Skip to content

32bpp #3

@kzd76

Description

@kzd76

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions