Advertisement
Guest User

Image Code Exercises

a guest
Mar 31st, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Write code to set the pixel at (0, 0) to blue (i.e. blue value is 255, red and green are left at 0)
  2.  
  3. image = new SimpleImage("x.png");
  4. image.setZoom(20);
  5. pixel = image.getPixel(0, 0);
  6. pixel.setBlue(255);
  7. print(image);
  8.  
  9. --------------------------------------------------------------------------------------------------
  10. Write code to set the pixel at (0, 0) to be violet (i.e. red and blue both 255, green left at 0).
  11.  
  12. image = new SimpleImage("x.png");
  13. image.setZoom(20);
  14. pixel = image.getPixel(0, 0);
  15. pixel.setRed(255);
  16. pixel.setBlue(255);
  17. print(image);
  18.  
  19. --------------------------------------------------------------------------------------------------
  20.  
  21. Write code to set the pixel at (1, 0) to be red
  22.  
  23. image = new SimpleImage("x.png");
  24. image.setZoom(20);
  25. pixel = image.getPixel(1, 0);
  26. pixel.setRed(255);
  27. print(image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement