C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[28060] Re:Re:Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무)
유영인 Cuperido [cuperido] 1399 읽음    2003-12-02 14:50
그런데, 근본적으로 박스까지 변하는 문제는 못고쳤네요.
이리저리 고칠려고 하다보니까 여기 계신것 같아서.. :)
같이 풀면 도움이 더 되지 않을까 하구 그냥 올려봅니다..

저도 나중에 꼭 필요한 루틴 같아서 다시 또 만들어보러..  =3=3=3

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"

TForm1 *Form1;
int    START_X, START_Y;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner): TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormActivate(TObject *Sender)
{

// 아무 이미지나 로드. 테스트용
Image1->Picture->LoadFromFile("C:\\Windows\\바람부는 들판.bmp");
Image1->Picture->Bitmap->PixelFormat = pf24bit;

// 깜빡거림 방지
DoubleBuffered = true;

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Image1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{

PrintText(Image1->Canvas, X, Y, "CLICK");
START_X = X;
START_Y = Y;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image1MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y)
{

PrintText(Image1->Canvas, START_X, START_Y, "CLICK");

}
//---------------------------------------------------------------------------
void __fastcall TForm1::PrintText(TCanvas *tcCanvas, int itX, int itY, String stText)
{

Graphics::TBitmap *btBitmap = new Graphics::TBitmap;
TCanvas           *tcTempCanvas = btBitmap->Canvas;
TRect             trSourceRect, trTargetRect;


// 비트맵 초기화
btBitmap->Width            = tcCanvas->TextWidth(stText);
btBitmap->Height           = tcCanvas->TextHeight(stText);
tcTempCanvas->Font         = tcCanvas->Font;
tcTempCanvas->Brush->Color = clBlack;
tcTempCanvas->Brush->Style = bsClear;

trSourceRect = Rect(0, 0, btBitmap->Width, btBitmap->Height);
trTargetRect = Rect(itX, itY, itX + btBitmap->Width, itY + btBitmap->Height);

tcTempCanvas->FillRect(trSourceRect);
tcTempCanvas->TextOut(0, 0, stText);

tcCanvas->CopyMode = cmSrcInvert;
tcCanvas->CopyRect(trTargetRect, tcTempCanvas, trSourceRect);

delete btBitmap;

}
//---------------------------------------------------------------------------


유영인  Cuperido 님이 쓰신 글 :
: Canvas->Brush->Style, Canvas->Brush->Color, Canvas->Font->Color 등을 이리저리 조작해서 원하시는 값을 맞추시면 될것 같습니다.
:
: cuperido
:
: 이운국 님이 쓰신 글 :
: : .

+ -

관련 글 리스트
28044 Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무) 이운국 1028 2003/12/02
28059     Re:Re:답변에 감사드리며... 이제 길이 보이네요. (냉무) 이운국 1126 2003/12/02
28061         Re:Re:Re:답변에 감사드리며... 이제 길이 보이네요. (냉무) 유영인 Cuperido 1555 2003/12/02
28057     Re:Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무) 투명 1819 2003/12/02
34101         Re:Re:Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무) 이운국 1173 2003/12/02
28048     Re:Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무) 유영인 Cuperido 1666 2003/12/02
34100         Re:Re:Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무) 이운국 1085 2003/12/02
28060         Re:Re:Canvas->TextOut 시 문자를 XOR 로 찍을려면 어케 하나요.(냉무) 유영인 Cuperido 1399 2003/12/02
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.