Guest User

Untitled

a guest
Jan 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. (*
  2. Fonction level
  3. *)
  4. let level (r, g, b) = (0.3 *. r +. 0.59 *. g +. 0.11 *. b) / 255
  5.  
  6. (*
  7. Fonction color2grey
  8. *)
  9. let color2grey (r, g, b) =
  10. let gr = (int)(level(r, g, b) *. 255.) in
  11. (gr, gr, gr)
  12.  
  13. (*
  14. Fonction image2grey src dst
  15. *)
  16. let image2grey scr dst =
  17. let (w,h) = get_dims img in
  18. for y = 0 to h do
  19. for x = 0 to w do
  20. Sdlvideo.put_pixel_color scr x y color2grey (Sdlvideo.get_pixel_color img x y)
Add Comment
Please, Sign In to add comment