Update of /cvsroot/perl-win32-gui/Win32-GUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30145
Modified Files: CHANGELOG DC.xs Log Message: ExtCreateRgn and GetRgnData Index: DC.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/DC.xs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DC.xs 13 Apr 2006 22:17:07 -0000 1.13 --- DC.xs 24 Jun 2006 14:53:13 -0000 1.14 *************** *** 1697,1700 **** --- 1697,1758 ---- ########################################################################### + # (@)METHOD:ExtCreateRgn (RGNDATA) + # + # The ExtCreateRgn function creates a region from data held in memory. The + # data is a win32 RGNDATA structure (See MSDN) that can be created by packing + # the bytes by hand, or more easily by using the L<GetRgnData()|GetRgnData> + # method. + # + # my $rgn = Win32::GUI::Region->CreateRoundRectRgn(0,0,100,100,50,50); + # my $rgndata = $rgn->GetRgnData(); + # my $newrgn = Win32::GUI::Region->ExtCreateRgn($rgndata); + # + # Returns a Win32::GUI::Region object on success or undef on failure + void + ExtCreateRgn(Class="Win32::GUI::Region", svrgndata) + char *Class + SV *svrgndata + PREINIT: + HRGN hrgn; + LPRGNDATA rgndata; + STRLEN len; + PPCODE: + rgndata = (LPRGNDATA)SvPV(svrgndata, len); + /* TODO: XFORM transformation as first param? */ + hrgn = ExtCreateRegion(NULL, (DWORD)len, rgndata); + if (hrgn== NULL) XSRETURN_UNDEF; + XPUSHs(CreateObjectWithHandle(NOTXSCALL "Win32::GUI::Region", (HWND) hrgn)); + + ########################################################################### + # (@)METHOD:GetRgnData () + # + # The GetRgnData functions returns a representation of the region as a string + # of bytes that can be used to re-create an identical region using the + # L<ExtCreateRgn()|ExtCreateRgn> method. + # + # Returns a string of bytes on success or undef on failure + void + GetRgnData(handle) + HRGN handle + PREINIT: + SV *svrgndata; + STRLEN len1, len2; + PPCODE: + len1 = (STRLEN)GetRegionData(handle, 0, NULL); + svrgndata = sv_2mortal(newSV(len1)); + SvPOK_on(svrgndata); + SvCUR_set(svrgndata,len1); + len2 = (STRLEN)GetRegionData(handle, (DWORD)len1, (LPRGNDATA)SvPV_nolen(svrgndata)); + + if(len1 == len2) { /* success */ + XPUSHs(svrgndata); + XSRETURN(1); + } + else { /* failure */ + XSRETURN_UNDEF; + } + + + ########################################################################### # (@)METHOD:CombineRgn (source1,source2,CombineMode) # The CombineRgn method combines two regions. The two regions are combined according to the *************** *** 1714,1718 **** # COMPLEXREGION (3) The region is more than a single rectangle. # ERROR No (0) region is created. - int CombineRgn(destination,source1,source2,CombineMode) HRGN destination --- 1772,1775 ---- Index: CHANGELOG =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/CHANGELOG,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** CHANGELOG 23 Jun 2006 23:08:07 -0000 1.89 --- CHANGELOG 24 Jun 2006 14:53:12 -0000 1.90 *************** *** 6,9 **** --- 6,13 ---- Win32-GUI ChangeLog =================== + + [Robert May] : 24 June 2006 - ExtCreateRgn and GetRgnData + - DC.xs - added new region construction ExtCreateRgn and + new region method GetRgnData (Tracker: 1469648) + + [Robert May] : 23 June 2006 - -wantreturn and AnimateWindow - GUI.pm, Textfield.xs - add -wantreturn option to constructor