Gdiplus 64-bit colors

I create a 64-bit raster map and wrap it with a Graphics object to draw it. The problem is that the Gdiplus Color class only has 32 bits (each component of the byte is only iemax 255), so how can I draw through a 64-bit image using gdiplus? eg.

Bitmap bmp(100, 100, PixelFormat64bppARGB);

Graphics g(&bmp);
//how do I draw a red line now, if i use Color(255,0,0) it comes as almost dark black red
+3
source share
3 answers

Gdiplus does not seem to support 64-bit operations. Some simple way to still use Gdiplus methods is to split the image into two 32-bit images and work with them separately.

ARGB AARR GGBB 32- ARGB.

, , :

// This is what you want to do (ARGB, 16 bit per channel)
// g.DrawLine(new Pen(Color(0, 65535, 1024, 31), 1, 0, 0, 100, 100);

// AARR GGBB variant
gAARR.DrawLine(new Pen(Color(0,0,255,255), 1, 0, 0, 100, 100);
gGGBB.DrawLine(new Pen(Color(4,0,0,31), 1, 0, 0, 100, 100);

// ARGBhigh ARGBlow variant
gHigh.DrawLine(new Pen(Color(0,255,4,0), 1, 0, 0, 100, 100);
gLow.DrawLine(new Pen(Color(0,255,0,31), 1, 0, 0, 100, 100);

, (A, R, G, B), . MSDN, Color (R, G, B, A). -, , (R, G, B).

, 2 .

+2

MSDN - :

PixelFormat48bppRGB PixelFormat64bppARGB PixelFormat64bppPARGB 16 (). Microsoft Windows GDI + 1.0 16- , 8 , .

+1

You can use this Bitmap constructor to set the pixel format:

public:
Bitmap(
    int width, 
    int height, 
    PixelFormat format
)

EDIT: you cannot use the Color class (I think) since it only supports 32-bit colors. However, you can call LockBits in a bitmap and skip it manually.

0
source

Source: https://habr.com/ru/post/1704377/


All Articles