DescendingBear

Processing 1

Mar 1st, 2016
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. void setup()
  2. {
  3. size(800, 600);
  4. }
  5.  
  6. void flaga(int x, int y, int szer, int wys)
  7. {
  8. for (int i=x; i <szer; i++)
  9. {
  10. for (int j = y; j < wys/3; j++)
  11. {
  12. color c = color(0, 0, 0);
  13. set(i, j, c);
  14. }
  15. }
  16. for (int i=x; i <szer; i++)
  17. {
  18. for (int j= wys/3; j < 2*wys/3-y; j++)
  19. {
  20. color c = color(255, 0, 0);
  21. set(i, j, c);
  22. }
  23. }
  24. for (int i=x; i <szer; i++)
  25. {
  26. for (int j= 2*wys/3-y; j < wys-2*y; j++)
  27. {
  28. color c = color(255, 255, 0);
  29. set(i, j, c);
  30. }
  31. }
  32. }
  33.  
  34. void putPixel(int x, int y, int r, int g, int b)
  35. {
  36. r &=255;
  37. g &=255;
  38. b &=255;
  39. int a =y + width * x;
  40. int k=255000000 | (r<<16) | (g<<8) | (b) ;
  41. pixels[a] = k;
  42. }
  43.  
  44. void draw()
  45. {
  46. //flaga (10, 50, 500, 400);
  47. loadPixels();
  48. putPixel(10, 10, 255, 0, 0);
  49. }
Add Comment
Please, Sign In to add comment