I have a problem with adjusting a contrast and a brightness of any image. I read a MSDN Library GDI+ Reference. I found an article called "Using a Color Matrix to Transform a Single Color" (Platform SDK/Graphics & Multimedia/GDI+/Using GDI+/Recoloring). There is a color matrix for adjusting colors of an image. I thing, that the first three values on the diagonal of the matrix adjust the contrast of image and the first three values on the last row of the matrix adjust the brightness.
My problem is, that if I want multiply color by factor greater than one, then I get an image with corrupted colors. There is a WWW page to demonstrate this behaviour:
I just wrote two small function to compare the draw speed of gdi and gdi+. not include the complex functions, just draw lines.
The result is the gdi+ is more than ten times slower than gdi. Does this mean gdi+ is not useful in simple usage?
Hi this is a slow (well only about 3 milliseconds for a medium image), very recursive, way of doing it
Posted by Knabbers
on 08/01/2009 10:46am
in_bitmap() is only to check whether the coordinate is inside the dimensions of the bitmap (flood fill() crashes otherwise) NOTE: go to this adress for more options:
bool in_bitmap(int x, int y)
if ( x >= 0 && x < bWidth && y >= 0 && y < bHeight)
else return false;
void flood_fill(HDC dc, int x, int y, COLORREF bColor, COLORREF aColor)
if (GetPixel(dc,x,y) != bColor) return;
if ( GetPixel(dc,x,y+1) == bColor && in_bitmap(x,y+1))
if ( GetPixel(dc,x,y-1) == bColor && in_bitmap(x,y-1))
if ( GetPixel(dc,x+1,y) == bColor && in_bitmap(x+1,y))
if ( GetPixel(dc,x-1,y) == bColor && in_bitmap(x-1,y))
it sometimes overflows the stack lol :) however, it is still used because it is easy to read
does anybody have an experience with GDI+ with C++Builder. I have MS SDK from latest MSDN subscription (November 2001?). I download a distributable GDI+'s DLL (which one is not included into SDK). There is first example on the WWW page
I try the example using VC++ and C++Builder. I create two simple applications. Problem is, that I get two images running a VC++'s application, but I get only one image running a C++Builder application.
I debug the C++Builder appl and I found, that method ImageAttributes::SetColorMatrix() fails. Value of property
how do you resize an image? - i want to open an image resize it then save the resized image - but using scaletransform doesnt seem to work cause i just end up with the image being the same size as when i started.