|
유영인.Chris 님이 쓰신 글 :
: ScanLine에서 얻어온 값은 포인터입니다. 그래서, 그 값에 바로써도 원래의 값에 영향을 미치지요.
:
: 아래 예제는 사진 인화처럼 Image1 그림의 컬러를 뒤집어서 폼에 쓰는 예제입니다.
:
:
: //---------------------------------------------------------------------------
:
: #include <vcl.h>
: #pragma hdrstop
:
: #include "Unit1.h"
: //---------------------------------------------------------------------------
: #pragma package(smart_init)
: #pragma resource "*.dfm"
: TForm1 *Form1;
: //---------------------------------------------------------------------------
: __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
: {
: }
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
:
: int itX, itY;
: RGBTRIPLE *rtColor;
:
: Image1->Picture->Bitmap->PixelFormat = pf24bit;
:
: for(itY = 0; itY < Image1->Picture->Bitmap->Height; itY ++) {
: rtColor = (RGBTRIPLE *)Image1->Picture->Bitmap->ScanLine[itY];
:
: for(itX = 0; itX < Image1->Picture->Bitmap->Width; itX ++) {
: rtColor[itX].rgbtRed = rtColor[itX].rgbtRed ^ 0xFF;
: rtColor[itX].rgbtGreen = rtColor[itX].rgbtGreen ^ 0xFF;
: rtColor[itX].rgbtBlue = rtColor[itX].rgbtBlue ^ 0xFF;
: }
: }
:
:
: Canvas->Draw(0, 0, Image1->Picture->Bitmap);
:
: }
: //---------------------------------------------------------------------------
:
:
: 박상용 님이 쓰신 글 :
: : bitmap을 읽어올때 scanline을 쓰면 한 픽셀씩 읽어오는것보다 빠릅니다..
: :
: : 그런데 bitmap에 저장할때는 scanline같은것을 못찾아서 한 픽셀씩 쓰려니까 상당히 느리더군요...
: :
: : 빠른 방법이 있는지 여부를 알고 싶습니다.
: :
: : 그럼 답변 부탁드리겠습니다...
|