Get the colours of each pixel of an image.
Posted: Fri Oct 21, 2005 11:18 am
I’m trying to draw the black line of a map above a TColorGridSeries. I’d like to convert a .bmp image into a ColorGridSeries but it doesn’t work. It only works if the image is .jpg. I use C++ Builder 6. The code that I use is:
Graphics::TBitmap *tmp = new Graphics::TBitmap();
try
{
tmp->Assign(Image1->Picture->Graphic);
Series2->Bitmap=tmp;
}
__finally
{
delete tmp;
}
When I do it, the image appears inverted. How could I correct it?
Moreover, I’d like to make transparent all the map but the black line. When I set the white colour to transparent some pixels in grey appear that I can’t delete. Can I index to every pixel to the image by ‘x’ and ‘z’ and know which colour it has? I tried GetXZValue(x,z) and ValueColor, in this case it doesn’t work.
How could I write in code this?
If (pixel[x,z] is different to colour black) set to transparent colour.
Thanks for everything,
Graphics::TBitmap *tmp = new Graphics::TBitmap();
try
{
tmp->Assign(Image1->Picture->Graphic);
Series2->Bitmap=tmp;
}
__finally
{
delete tmp;
}
When I do it, the image appears inverted. How could I correct it?
Moreover, I’d like to make transparent all the map but the black line. When I set the white colour to transparent some pixels in grey appear that I can’t delete. Can I index to every pixel to the image by ‘x’ and ‘z’ and know which colour it has? I tried GetXZValue(x,z) and ValueColor, in this case it doesn’t work.
How could I write in code this?
If (pixel[x,z] is different to colour black) set to transparent colour.
Thanks for everything,