Page 1 of 1
paste one DC on second DC
Posted: Wed Jun 05, 2024 1:40 pm
by Natter
Hi,
I need to paste one device context onto another at the specified coordinates. How can I do this?
Re: paste one DC on second DC
Posted: Wed Jun 05, 2024 2:30 pm
by Jimmy
you can use
StretchBlt API function
https://learn.microsoft.com/en-us/windo ... stretchblt
BOS Taurus of HMG have this :
Code: Select all | Expand
//*****************************************************************************************************************************
//* BT_DRAW_HDC_TO_HDC (hDC1, x1, y1, Width1, Height1, hDC2, x2, y2, Width2, Height2, Mode_Stretch, Action, Color_Transp)
//*****************************************************************************************************************************
// Action
#define BT_HDC_OPAQUE 0
#define BT_HDC_TRANSPARENT 1
HB_FUNC (BT_DRAW_HDC_TO_HDC)
{
HDC hDC1, hDC2;
INT x1, y1, Width1, Height1, x2, y2, Width2, Height2;
INT Mode_Stretch, Action;
COLORREF color_transp;
POINT Point;
hDC1 = (HDC) HMG_parnl (1);
x1 = (INT) hb_parni (2);
y1 = (INT) hb_parni (3);
Width1 = (INT) hb_parni (4);
Height1 = (INT) hb_parni (5);
hDC2 = (HDC) HMG_parnl (6);
x2 = (INT) hb_parni (7);
y2 = (INT) hb_parni (8);
Width2 = (INT) hb_parni (9);
Height2 = (INT) hb_parni (10);
Mode_Stretch = (INT) hb_parni (11);
Action = (INT) hb_parni (12);
color_transp = (COLORREF) hb_parnl (13);
bt_bmp_adjust_rect (&Width1, &Height1, &Width2, &Height2, Mode_Stretch);
//SetStretchBltMode (hDC1, COLORONCOLOR);
GetBrushOrgEx (hDC1, &Point);
SetStretchBltMode (hDC1, HALFTONE);
SetBrushOrgEx (hDC1, Point.x, Point.y, NULL);
switch (Action)
{ case BT_HDC_OPAQUE:
StretchBlt(hDC1, x1, y1, Width1, Height1, hDC2, x2, y2, Width2, Height2, SRCCOPY);
break;
case BT_HDC_TRANSPARENT:
TransparentBlt(hDC1, x1, y1, Width1, Height1, hDC2, x2, y2, Width2, Height2, color_transp);
break;
default:
hb_retl (FALSE);
return;
}
hb_retl (TRUE);
}
Re: paste one DC on second DC
Posted: Wed Jun 05, 2024 3:44 pm
by Natter
Thanks, Jimmy, I'll try.
Re: paste one DC on second DC
Posted: Thu Jun 06, 2024 10:24 am
by Natter
Jimmy, I compiled your example. References to bt_bmp_adjust_rect and HMG_parnl are not recognized
Re: paste one DC on second DC
Posted: Thu Jun 06, 2024 10:38 am
by Jimmy
hi,
Natter wrote:Jimmy, I compiled your example. References to bt_bmp_adjust_rect and HMG_parnl are not recognized
replace HMG_parnl() with hb_parnll()
you will find HB_FUNC(
STRETCHBLT ) in Fivewin \source\winapi\bmpdraw.c
Re: paste one DC on second DC
Posted: Thu Jun 06, 2024 10:45 am
by Natter
Thanks !