글씨를 써서 테두리를 만든뒤 그걸 파일로 저장한뒤 불러오는 머 그런 프로그램입니다
글씨의 폰트를 바꿔서 캡쳐한 파일을 저장하기전에 그 전에 썼던 글씨를 지우려하는데
아래와 같이
for(int iy=0 ; iyHeight + ImgClearH ; iy++)
for (int ix = 0; ixWidth + ImgClearW; ix++) {
0 부터 지우는데 맨윗줄에 글씨 테두리 잔상이 지워지지 않고 남아있네요... ㅜ.ㅜ
혹시 아시는분 계신지요? ㅡ.ㅡ 제가 어디 실수한 곳이 있나요? ㅡ.ㅡ 답답하네요
===============================================================
Canvas->Font->Size=Edit1->Font->Size;
Canvas->Font->Name=Edit1->Font->Name;
SetBkMode(Canvas->Handle,TRANSPARENT);
int x=Bevel1->Left;
int y=Bevel1->Top;
AnsiString str=Edit1->Text;
Canvas->Font->Color=clBlack;
Canvas->TextOut(x,y-1,str);
Canvas->TextOut(x-1,y,str);
Canvas->TextOut(x+1,y,str);
Canvas->TextOut(x,y+1,str);
Canvas->Font->Color=clBlue;
Canvas->TextOut(x,y,str); // TLabel *Label21 = new TLabel(this);
int cW = Canvas->TextWidth(str);
int cH = Canvas->TextHeight(str);
// 이미지 읽을때
Graphics::TBitmap *p = new Graphics::TBitmap;
p->Width = cW+1;//Bevel1->Width;
p->Height = cH+1;//Bevel1->Height;
p->PixelFormat = pf24bit;
int length = StrLen(Edit1->Text.c_str());
AnsiString FileName = ExtractFilePath(Application->ExeName) + "dat\\Capture.bmp";
BitBlt(p->Canvas->Handle,0,0,cW+1,cH+1, GetDC(0),Bevel1->Left+8 , Bevel1->Top+33,cmSrcCopy);
p->SaveToFile(FileName);
Graphics::TBitmap * pOpenBmp = new Graphics::TBitmap(); // 이거 나중에 delete해야 함.
pOpenBmp->LoadFromFile(FileName);
int ImgClearW = 12 - (pOpenBmp->Width % 12);
int ImgClearH = 18 - (pOpenBmp->Height % 18);
int PosX, PosY;
PosX = CSpinEditX->Value*12;
PosY = CSpinEditY->Value*18;
//== 화면 잔상 지우기
for(int iy=0 ; iyHeight + ImgClearH ; iy++)
for (int ix = 0; ixWidth + ImgClearW; ix++) {
StringGrid->Canvas->Brush->Color = clWhite;
StringGrid->Canvas->FillRect(StringGrid->CellRect(ix+PosX,iy+PosY)); // Graphics::TBitmap *p=GetFormImage();
ViewImage->Canvas->Pixels[ix][iy]= 16777215;
}
//== 화면 잔상 지우기
TRect ImgRect = TRect(0, 0, pOpenBmp->Width, pOpenBmp->Height);
ViewImage->Width = pOpenBmp->Width;
ViewImage->Height = pOpenBmp->Height;
ViewImage->Canvas->StretchDraw(ImgRect, pOpenBmp);
ViewImage->Left = PosX;
ViewImage->Top = PosY;
for(int iy=0; iyHeight; iy++)
{
for (int ix = 0; ixWidth; ix++)
{
if ((ViewImage->Canvas->Pixels[ix][iy]==0)) {
StringGrid->Canvas->Brush->Color = clRed;
StringGrid->Canvas->FillRect(StringGrid->CellRect(ix+PosX,iy+PosY)); // Graphics::TBitmap *p=GetFormImage();
}
if (ViewImage->Canvas->Pixels[ix][iy]==16711680) {
StringGrid->Canvas->Brush->Color = clBlue;
StringGrid->Canvas->FillRect(StringGrid->CellRect(ix+PosX,iy+PosY)); // Graphics::TBitmap *p=GetFormImage();
}
}
}
delete pOpenBmp;
delete p;