W tematcie o Gradieńcie dostałem bardzo dobrą pomoc odnośnie sposobu jego rysowania co mi się udało.
Kolejne moje pytanie dotyczy kopiowania rysunku o to kod :
- Kod: Zaznacz cały
HDC hdc = GetDC(Form1->Handle);
Label1->Caption = 255<<8;
if(BeginPath(hdc)) {
POINT pkt[4] = {{100,300},{200,100},{300,400},{200,250}};
Polygon(hdc,pkt,4);
if(EndPath(hdc) && SelectClipPath(hdc,RGN_COPY)) {
TRIVERTEX trivert[2];
GRADIENT_RECT grad_rect;
grad_rect.UpperLeft = 0;
grad_rect.LowerRight = 1;
trivert [0] .x = 100;
trivert [0] .y = 100;
trivert [0] .Red = 255<<8;
trivert [0] .Green = 0;
trivert [0] .Blue = 0;
trivert [1] .x = 500;
trivert [1] .y = 250;
trivert [1] .Red = 0;
trivert [1] .Green = 255<<8;
trivert [1] .Blue = 0;
GradientFill(hdc, trivert,2,&grad_rect,1,GRADIENT_FILL_RECT_V);
trivert [0] .x = 100;
trivert [0] .y = 250;
trivert [0] .Red = 0;
trivert [0] .Green = 255<<8;
trivert [0] .Blue = 0;
trivert [0] .Alpha = 0;
trivert [1] .x = 500;
trivert [1] .y = 400;
trivert [1] .Red = 0;
trivert [1] .Green = 0;
trivert [1] .Blue = 255<<8;
GradientFill(hdc, trivert,2,&grad_rect,1,GRADIENT_FILL_RECT_V);
Graphics::TBitmap* bmp = new Graphics::TBitmap;
Graphics::TCanvas* cnvs = new Graphics::TCanvas;
cnvs->Handle = hdc;
TRect rect = cnvs->ClipRect;
rect.Right = rect.Right - rect.Left;
rect.Bottom = rect.Bottom - rect.Top;
rect.Top = 0;
rect.Left = 0;
bmp->Width = rect.Right;
bmp->Height= rect.Bottom;
bmp->Canvas->CopyRect(rect, cnvs,cnvs->ClipRect);
Image1->Picture->Bitmap = bmp;
delete bmp;
delete cnvs;
}
}
Chodzi o to, że muszę skopiować teraz ten gradient na jaks bmp ALE pojawa się problem bo muszę skopiować sam rysunek bez jego obszaru obok jeżeli kopjuje go tak jak w kodzie którym podałem otrzymuje efekty jak na załącznikach.
Ma ktoś może jakiś pomysł jak to przekopiować bez tych śmieci ???
Pozdrawiam i z góry dzięki za wyrozumiałość