13,825
社区成员
发帖
与我相关
我的任务
分享
typedef struct
{
unsigned char B;
unsigned char G;
unsigned char R;
// unsigned char Unused;
}typeColor;
//---------------------------------------------------------------------------
void __fastcall TForm1::Background(Graphics::TBitmap &bmp)
{
bmp.PixelFormat = pf24bit;
typeColor *pix;
// int r,g,b;
// r = GetRValue(bmp.Canvas->Pixels[2][2]);
// g = GetGValue(bmp.Canvas->Pixels[2][2]);
// b = GetBValue(bmp.Canvas->Pixels[2][2]);
unsigned char gray;
for (int i = 0; i < bmp.Height; i++)
{
pix = (typeColor*) bmp.ScanLine[i];
for (int j = 0; j < bmp.Width; j++)
{
if (pix->B >= 220 && pix->B <= 223) {
if (pix->G >= 220 && pix->G <= 223) {
if (pix->R >= 220 && pix->R <= 223) {
pix->B = 222;
pix->G = 222;
pix->R = 222;
}
}
}
/*
if (i < 2 || i > 29) {
pix->B = r;
pix->G = g;
pix->R = b;
}
else if (j<2 || j>29) {
pix->B = r;
pix->G = g;
pix->R = b;
} */
pix ++;
}
}
}