Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int GzPutDisplay(GzDisplay *display, int i, int j, GzIntensity r, GzIntensity g, GzIntensity b, GzIntensity a, GzDepth z)
- {
- /* write pixel values into the display */
- GzPixel currPixel = {r, g, b, a, z};
- //Bound checking
- if(i < 0 || i >= display->xres || j < 0 || j >= display->yres) return GZ_FAILURE; //Ignore anything outside of the resolution
- display->fbuf[j * display->xres + i] = currPixel;
- return GZ_SUCCESS;
- }
- int GzGetDisplay(GzDisplay *display, int i, int j, GzIntensity *r, GzIntensity *g, GzIntensity *b, GzIntensity *a, GzDepth *z)
- {
- /* pass back pixel value in the display */
- /* check display class to see what vars are valid */
- //Bound checking
- if(i < 0 || i >= display->xres || j < 0 || j >= display->yres) return GZ_FAILURE;
- GzPixel currPixel = display->fbuf[j * display->xres + i];
- *r = currPixel.red;
- *g = currPixel.green;
- *b = currPixel.blue;
- *a = currPixel.alpha;
- *z = currPixel.z;
- return GZ_SUCCESS;
- }
Add Comment
Please, Sign In to add comment