-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
In case anyone else requires a 32bpp method for put_pixel:
void put_pixel_32bpp(int x, int y, int r, int g, int b)
{
unsigned int pix_offset;
unsigned int c;
// calculate the pixel's byte offset inside the buffer
pix_offset = x*4 + y * fix.line_length;
//some magic to work out the color
c = (r << 16) + (g << 8) + (b << 0);
// write 'four bytes at once'
*((unsigned int*)(fbp + pix_offset)) = c;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels