Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixel color incorrect - appears cyan instead of white, possible red channel rendering issue #132

Open
San-tito opened this issue Feb 28, 2024 · 0 comments
Labels
Bug Something isn't working or should get fixed

Comments

@San-tito
Copy link

When attempting to draw pixels on the screen using the provided pixel_put function, pixels intended to be white are instead rendered as cyan. This discrepancy suggests a potential problem with how the red channel is being handled during the rendering process.

static void pixel_put(mlx_image_t *image, int x, int y, int color)
{
    int i;
    unsigned char *pixel;

    if ((unsigned)x < (*image).width && (unsigned)y < (*image).height)
    {
        pixel = (*image).pixels + (y * (*image).width + x) * sizeof(int);
        i = sizeof(int) * 6;
        while (i >= 0)
        {
            *pixel++ = (color >> i) & 0xFF;
            i -= sizeof(int) * 2;
        }
    }
}

``
The pixel_put function is responsible for placing a pixel of a specified color at the given coordinates on an image. It operates by manipulating the pixel's color values, byte by byte, to set the appropriate RGB components.

This issue has been observed across multiple platforms, including Arch Linux and macOS Catalina. 
@W2Wizard W2Wizard added the Bug Something isn't working or should get fixed label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working or should get fixed
Projects
None yet
Development

No branches or pull requests

2 participants