|
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Image1 -> Picture -> Bitmap = new Graphics::TBitmap ;
Image1 -> Picture -> Bitmap->PixelFormat = pf32bit ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Image1 -> Picture -> Bitmap -> Height = Image1 -> Height ;
Image1 -> Picture -> Bitmap -> Width = Image1 -> Width ;
unsigned int color ;
unsigned int *pixel ;
int width = Image1 -> Picture -> Bitmap -> Width ;
int height = Image1 -> Picture -> Bitmap -> Height ;
double r ;
double g ;
double b ;
r = GetRValue((DWORD)ColorToRGB(clBlue)) ;
g = GetGValue((DWORD)ColorToRGB(clBlue)) ;
b = GetBValue((DWORD)ColorToRGB(clBlue)) ;
pixel = (unsigned int*)Image1 -> Picture -> Bitmap->ScanLine[0];
color = RGB(b,g,r );
for(int x=0 ; x<width ;x++,pixel++)
*pixel = color ;
pixel = (unsigned int*)Image1 -> Picture -> Bitmap->ScanLine[0];
for(int y=1 ; y<height ;y++ )
memcpy(Image1 -> Picture -> Bitmap->ScanLine[y],pixel,sizeof(unsigned int)*width);
}
폼에 이미지 하나 올리고 위와 같이 작성을 했는데요...
도움말에 보면 RGB함수는 인자 순서가 (r,g,b)라고 되어 있는데 이상하게 원하는 색깔이 표현 될려면(b,g,r)로 넣어야 파란색이 나오더라구요;;
혹시 이거 뭘 잘못한건지 아시는분 있으신가요?
미리 감사드립니다.
|