Board index » cppbuilder » How do Fastest pixels change on bitmap?

How do Fastest pixels change on bitmap?


2003-10-20 11:30:21 AM
cppbuilder114
Hi
I make a very slow code for change pixels on Bitmap.
how do the progress faster?
Thank
----------------------------------
// RGBQUAD.
typedef union {
struct {
BYTE blue, green, red, zero;
} rgb;
long color;
TColor pixel;
} DEPTH;
DEPTH DepthMask( DEPTH iColor, DEPTH iDiff )
{
iColor.rgb.red += iDiff.rgb.red;
iColor.rgb.blue += iDiff.rgb.blue;
iColor.rgb.green += iDiff.rgb.green;
return iColor;
}
----------------------------------
void ColorChange( TPoint Limit, DEPTH differ )
{
TCanvas *iCanvas = Image->Picture->Bitmap->Canvas;
long iY = Limit.y;
while ( iY-- ) {
long iX = Limit.x;
while ( iX-- ) {
DEPTH iColor;
iColor.pixel = iCanvas->Pixels[iX][iY];
iCanvas->Pixels[iX][iY] = DepthMask(iColor, differ).pixel;
}
}
}
 
 

Re:How do Fastest pixels change on bitmap?

Cactus wrote:
Quote
I make a very slow code for change pixels on Bitmap.
how do the progress faster?
iColor.pixel = iCanvas->Pixels[iX][iY];
iCanvas->Pixels[iX][iY] = DepthMask(iColor, differ).pixel;
Don't use the Pixels property. Use ScanLine instead or convert your
bitmap to a DIB. Do a search with google, lots of samples were posted here.
Michel
--
----------------------------------------
Michel Leunen
mailto: XXXX@XXXXX.COM
www.leunen.com/cbuilder/
----------------------------------------
 

Re:How do Fastest pixels change on bitmap?

Quote
Michel
Thanks.
 

{smallsort}