Guest User

Untitled

a guest
May 27th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. void Plot( int x, int y, Pixel color, Surface* surf )
  2. {
  3. // get a pointer to the screen pixels
  4. Pixel* buffer = surf->GetBuffer();
  5. // plot the pixel
  6. int pixelnr = x + y * surf->GetWidth();
  7. buffer[pixelnr] = color;
  8. }
  9.  
  10. // get a pixel at a location
  11. Pixel Get( int x, int y, Surface* surf )
  12. {
  13. // get a pointer to the screen pixels
  14. Pixel* buffer = surf->GetBuffer();
  15. // get the pixel
  16. int pixelnr = x + y * surf->GetWidth();
  17. return buffer[pixelnr];
  18. }
Add Comment
Please, Sign In to add comment