From: Sean H. <jal...@ho...> - 2007-01-26 04:08:14
|
On Thu, 25 Jan 2007 09:44:59 -0700, alexander Serechenko Alexander = <sk...@gm...> wrote: > Is there any way to copy some transparent image over another? > Only way I found is to use AlphaCopyToDC to some virtual DC, but i > can't find any way to get Win32::GUI::DC not associated with any > device. > Is any one can help me? Win32::GUI::DC::CreateCompatibleDC() Creates a memory device context (DC) compatible with the specified devic= e. That's all the documentation there is. According to the source (DC.xs), = it = returns a Win32::GUI::DC object, not just a handle. Of course, if it is = = just a handle, it's easy enough to do: my $dc =3D bless { -handle =3D> Win32::GUI::CreateCompatibleDC(), }, 'Win32::GUI::DC'; And according to Microsoft, calling it with no handle should give you a = DC = compatible with the current screen. Here's an excerpt: The CreateCompatibleDC function creates a memory device context (DC) = compatible with the specified device. HDC CreateCompatibleDC( HDC hdc // handle to DC ); Parameters hdc [in] Handle to an existing DC. If this handle is NULL, the function = creates a memory DC compatible with the application's current screen. Return Values If the function succeeds, the return value is the handle to a memory DC.= If the function fails, the return value is NULL. Remarks A memory DC exists only in memory. When the memory DC is created, its = display surface is exactly one monochrome pixel wide and one monochrome = = pixel high. Before an application can use a memory DC for drawing = operations, it must select a bitmap of the correct width and height into= = the DC. To select a bitmap into a DC, use the CreateCompatibleBitmap = function, specifying the height, width, and color organization required.= When a memory DC is created, all attributes are set to normal default = values. The memory DC can be used as a normal DC. You can set the = attributes; obtain the current settings of its attributes; and select = pens, brushes, and regions. |