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

SetPixel for 16bpp #10

Open
GoogleCodeExporter opened this issue Aug 28, 2015 · 0 comments
Open

SetPixel for 16bpp #10

GoogleCodeExporter opened this issue Aug 28, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

This is not a defect but an enhancement request.

While using the library I realized that a function to set 16bpp grayscale 
pixels is not available and the existing SetPixel() functions in 
ImageLineHelper.cs are based on an RGB model. So it doesn't work to use these 
with the same values for r,g, and b.

So I wrote my own and would kindly ask to add this to the code stack after a 
review by the gurus of this library.

My code is:

public static void SetPixel16bppGray(ImageLine line, int col, int gray)
{
    int offset = col * line.channels;
    if (line.IsInt())
    {
        line.Scanline[offset] = gray;
    }
    else
    {
        line.ScanlineB[offset++] = (byte)gray;
        line.ScanlineB[offset] = (byte)(gray >> 8);
    }
}

I hope this contribution is valuable.
Keep up the good work!

kr
Michael

Original issue reported on code.google.com by MichaelD...@gmail.com on 5 May 2015 at 1:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant