Update of /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-DIBitmap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15562
Modified Files: Changes DIBitmap.pm DIBitmap.xs Makefile.PL TYPEMAP Added Files: DIBitmapRC.PL TODO Removed Files: DIBitmap.html MANIFEST Readme Log Message: Merge DIBitmap into core distribution Index: Makefile.PL =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-DIBitmap/Makefile.PL,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.PL 2 Nov 2005 08:41:17 -0000 1.1 --- Makefile.PL 11 Jun 2006 16:34:33 -0000 1.2 *************** *** 1,32 **** use ExtUtils::MakeMaker; ! # See lib/ExtUtils/MakeMaker.pm for details of how to influence ! # the contents of the Makefile that is written. ! WriteMakefile( ! 'NAME' => 'Win32::GUI::DIBitmap', ! 'VERSION_FROM' => 'DIBitmap.pm', ! 'XS' => { 'DIBitmap.xs' => 'DIBitmap.cpp' }, ! 'LIBS' => ['Msvcprt.lib'], # e.g., '-lm' ! 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' ! 'INC' => '', # e.g., '-I/usr/include/other' ! 'MYEXTLIB' => 'extlib/FreeImage.lib', ! ($] ge '5.005') ! ? ( ! 'AUTHOR' => 'ROCHER Laurent ([EMAIL PROTECTED])', ! 'ABSTRACT' => 'Add new load/save image format and some image manipulation', ! ) ! : (), ); ! sub MY::xs_c { ! ' ! .xs.c: ! $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c ! .xs.cpp: ! $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp ! '; } --- 1,85 ---- + #!perl -w + use strict; + use warnings; + + # Makefile.PL for Win32::GUI::DIBitmap + # $Id$ + + use 5.006; + use Config; use ExtUtils::MakeMaker; ! use File::Find(); ! my @demos; ! File::Find::find(sub { push @demos, $File::Find::name if $File::Find::name =~ /\.(pl|zip|bmp|png|tga|jpg)$/ }, 'demos'); ! ! my %config = ( ! NAME => 'Win32::GUI::DIBitmap', ! VERSION_FROM => 'DIBitmap.pm', ! ABSTRACT_FROM => 'DIBitmap.pm', ! AUTHOR => 'ROCHER Laurent ([EMAIL PROTECTED])', ! PL_FILES => {'DIBitmapRC.PL' => '$(BASEEXT).rc', }, ! OBJECT => '$(BASEEXT)$(OBJ_EXT) $(BASEEXT).res', ! LIBS => ['-lmsvcprt'], ! MYEXTLIB => 'extlib/FreeImage.lib', ! macro => {RC => 'rc.exe', ! RCFLAGS => '', ! INST_DEMODIR => '$(INST_LIB)/Win32/GUI/demos/$(BASEEXT)', ! DEMOS => "@demos", }, ! clean => {FILES => '*.rc *.res', }, ); + # if building using gcc (MinGW or cygwin) use windres + # as the resource compiler + # and the MinGW C++ standard library + if($Config{cc} =~ /gcc/i) { + $config{macro}->{RC} = 'windres'; + $config{macro}->{RCFLAGS} = '-O coff -o $*.res'; + $config{LIBS} = [':nosearch -lstdc++']; + $config{MYEXTLIB} = 'extlib/libFreeImage-mingw.a'; + if( $^O =~ /cygwin/i ) { + $config{MYEXTLIB} = 'extlib/libFreeImage-cygwin.a'; + } + } ! # Can't build with MinGW (yet). ! if($Config{cc} =~ /gcc/i and $^O !~ /cygwin/i ) { ! print <<__EXPLAIN; ! At this time Win32::GUI::DIBitmap cannot be build using MinGW. ! Win32::GUI::DIBitmap will be skipped during the current build process. ! __EXPLAIN ! ExtUtils::MakeMaker::WriteEmptyMakefile(NAME => 'Win32::GUI::DIBitmap'); ! } ! else { ! WriteMakefile(%config); ! } ! package MY; ! ! # Add rule for .rc to .res conversion ! # Add rules to install demo scripts ! sub postamble { ! return <<'__POSTAMBLE'; ! ! # Win32::GUI::DIBitmap RC section ! ! .rc.res: ! $(RC) $(RCFLAGS) $< ! ! # Win32::GUI::DIBitmap demo script section ! ! pure_all :: demo_to_blib ! $(NOECHO) $(NOOP) ! ! demo_to_blib: $(DEMOS) ! $(NOECHO) $(MKPATH) $(INST_DEMODIR) ! $(CP) $? $(INST_DEMODIR) ! $(NOECHO) $(TOUCH) demo_to_blib ! ! clean :: ! -$(RM_F) demo_to_blib ! ! __POSTAMBLE } --- DIBitmap.html DELETED --- Index: DIBitmap.pm =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-DIBitmap/DIBitmap.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DIBitmap.pm 2 Nov 2005 08:41:17 -0000 1.1 --- DIBitmap.pm 11 Jun 2006 16:34:32 -0000 1.2 *************** *** 1,149 **** package Win32::GUI::DIBitmap; use strict; ! use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); use Carp 'croak','carp'; require Exporter; require DynaLoader; - require AutoLoader; [...1662 lines suppressed...] ! =item L<Win32::GUI|Win32::GUI> ! ! =item L<http://freeimage.sourceforge.net/> ! ! =back =head1 AUTHOR ! Laurent Rocher ([EMAIL PROTECTED]) ! =head1 COPYRIGHT AND LICENCE ! Copyright 2003 by Laurent Rocher ([EMAIL PROTECTED]). ! ! This program is free software; you can redistribute it and/or modify it ! under the same terms as Perl itself. ! ! See L<http://www.perl.com/perl/misc/Artistic.html> =cut --- MANIFEST DELETED --- --- NEW FILE: DIBitmapRC.PL --- #!perl -w use strict; use warnings; use ExtUtils::MakeMaker; # $Id: DIBitmapRC.PL,v 1.1 2006/06/11 16:34:32 robertemay Exp $ # perl script to produce the RC file for # Win32::GUI::DIBitmap create Resource # file with a VERSIONINFO section # The variables: my %info = ( Version => MM->parse_version('DIBitmap.pm'), Dllname => 'DIBitmap.dll', Years => '2003..2006', Win32GUIVersion => MM->parse_version('../GUI.pm'), ); # Open the target file if ( @ARGV > 0 ) { my $file = $ARGV[0]; open(my $fh, '>', $file) or die qq(Failed to open '$file': $!); select $fh; } { my $fileVersion = $info{Version}; $fileVersion .= "_00" unless $fileVersion =~ m/_/; $info{FileVersion} = sprintf("%02d,%02d,%02d,00", $fileVersion =~ m/^(.*)\.([^_]*)_?(.*)$/); my $prodVersion = $info{Win32GUIVersion}; $prodVersion .= "_00" unless $prodVersion =~ m/_/; $info{ProductVersion} = sprintf("%02d,%02d,%02d,00", $prodVersion =~ m/^(.*)\.([^_]*)_?(.*)$/); } print <<"__RC"; #include "Winver.h" 1 VERSIONINFO FILEVERSION $info{FileVersion} PRODUCTVERSION $info{ProductVersion} FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL { BLOCK "StringFileInfo" { BLOCK "040904E4" { VALUE "Comments" , "Win32::GUI::DIBitmap, part of the perl Win32::GUI module. Includes code from the freeimage project http://freeimage.sourceforge.net/" VALUE "CompanyName" , "perl-win32-gui.sourceforge.net" VALUE "FileDescription" , "Win32::GUI::DIBitmap perl extension" VALUE "FileVersion" , "$info{Version}" VALUE "InternalName" , "$info{Dllname}" VALUE "LegalCopyright" , "Copyright © Laurent Rocher $info{Years}" VALUE "LegalTrademarks" , "GNU and Artistic licences" VALUE "OriginalFilename" , "$info{Dllname}" VALUE "ProductName" , "Win32::GUI perl extension" VALUE "ProductVersion" , "$info{Win32GUIVersion}" } } BLOCK "VarFileInfo" { VALUE "Translation", 0x0409, 0x04E4 } } __RC exit(0); __END__ Index: Changes =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-DIBitmap/Changes,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Changes 2 Nov 2005 08:41:17 -0000 1.1 --- Changes 11 Jun 2006 16:34:32 -0000 1.2 *************** *** 1,90 **** Revision history for Perl extension FreeImage. ! 0.15 28 / 11 / 2004 ! - Use FreeImage 3.5.1 (GIF support and LZW compression, improvements, bug fix, ...) ! - New Win32::GUI::DIBitmap method ! -> GetFIFMimeType ! -> ConvertTo4Bits ! 0.14 21 / 02 / 2004 ! - Use FreeImage 3.2.0 ! - New Win32::GUI::DIBitmap method ! -> Image internal format ! -> Pixel and and Background methods ! + SetPixel ! + GetPixel ! + HasBackgroundColor ! + GetBackgroundColor ! + SetBackgroundColor ! -> Conversion with new internal type ! -> Chanel processing ! + GetComplexChannel ! + SetComplexChannel ! 0.13 08 / 12 / 2003 ! - Correct memory leak in NewFromWindow, newFromDC [Thank to Steve Pick] ! 0.12 17 / 11 / 2003 ! - Use FreeImage 3.0.4 ! 0.11 11 / 11 / 2003 ! - Use FreeImage 3.0.3 ! 0.10 28 / 10 / 2003 ! - Use FreeImage 3.0.2 ! 0.09 24 / 10 / 2003 ! - Use FreeImage 3.0.1 ! 0.08 28 / 09 / 2003 ! - Use FreeImage 3.0.0 ! - New format : XBM, XPM ! - New Win32::GUI::DIBitmap method ! -> Conversion ! + Threshold : Convert to 1 bit ! + Dither : Convert to 1 bit ! -> Color manipulation ! + AdjustGamma ! + AdjustBrightness ! + AdjustContrast ! + Invert : Invert effect ! + GetHistogram : Get Color histogram ! -> Chanel processing ! + GetChannel ! + SetChannel ! -> Copy/Paste ! + Copy ! + Paste ! -> Rotation / flipping ! + Rotate : Create a rotated Bitmap (>= 8 bits only) ! + RotateEx : Create a rotated/translated Bitmap (>= 8 bits only) ! + FlipVerticaly : Flip Verticaly effect ! + FlipHorizontaly : Flip Horizontaly effect ! -> UpSampling / DownSampling ! + Rescale : Create a rescaled Bitmap (32 bits only) ! - New TIFF save format option. ! - New sample : read image from zipfile. ! 0.07 24 / 04 / 2003 ! - New Win32::GUI::DIBitmap method ! + newFromGD ! + CopyFromGD, CopyToGD : Must have Same Size and BPP. ! - UPDATE 1 : Add switch for old GD version ! - UPDATE 2 : Correct upside down bitmap bug ! 0.06 28 / 05 / 2002 ! - Use FreeImage 2.5.3 ! - Add FreeImage Multipaging interface ! 0.05 14 / 01 / 2002 ! - Use FreeImage 2.5.0 ! - Add FreeImage Multipaging interface (experimental in this release) ! - New Win32::GUI::DIBitmap method ! + Clone ! + AlphaCopyToDC ! + AlphaStrechToDC ! 0.04 29 / 10 / 2001 ! - Use FreeImage 2.4.2 ! - Fix bug in jpeg plug-in ! 0.03 18 / 08 / 2001 ! - Correct Bug when capture screen if display isn't in 32 bits ! - Add new function GetColorType ! - ColorQuantize work if image isn't in 24 bits ! - Add more Documentation ! 0.02 15 / 08 / 2001 ! - Use FreeImage 2.4.1 ! - Some little change ! 0.01 21 / 03 / 2001 ! - original version; created by h2xs 1.19 ! - First build Win32::GUI::DIBitmap --- 1,112 ---- Revision history for Perl extension FreeImage. ! 0.16 25/05/2006 [Robert May] ! - merge into Win32::GUI core distribution ! - new build process ! - fixed to build with C compiler (rather than requiring C++) ! - added basic tests ! 0.15 28/11/2004 ! - Use FreeImage 3.5.1 ! -> GIF support ! -> LZW compression ! -> other improvements, bug fix, ... ! - New Win32::GUI::DIBitmap method ! -> GetFIFMimeType ! -> ConvertTo4Bits ! ! 0.14 21/02/2004 ! - Use FreeImage 3.2.0 ! - New Win32::GUI::DIBitmap method ! -> Image internal format ! -> Pixel and and Background methods ! + SetPixel ! + GetPixel ! + HasBackgroundColor ! + GetBackgroundColor ! + SetBackgroundColor ! -> Conversion with new internal type ! -> Chanel processing ! + GetComplexChannel ! + SetComplexChannel ! ! 0.13 08/12/2003 ! - Correct memory leak in NewFromWindow, newFromDC [Thank to Steve Pick] ! ! 0.12 17/11/2003 ! - Use FreeImage 3.0.4 ! ! 0.11 11/11/2003 ! - Use FreeImage 3.0.3 ! ! 0.10 28/10/2003 ! - Use FreeImage 3.0.2 ! ! 0.09 24/10/2003 ! - Use FreeImage 3.0.1 ! ! 0.08 28/09/2003 ! - Use FreeImage 3.0.0 ! - New format : XBM, XPM ! - New Win32::GUI::DIBitmap method ! -> Conversion ! + Threshold : Convert to 1 bit ! + Dither : Convert to 1 bit ! -> Color manipulation ! + AdjustGamma ! + AdjustBrightness ! + AdjustContrast ! + Invert : Invert effect ! + GetHistogram : Get Color histogram ! -> Chanel processing ! + GetChannel ! + SetChannel ! -> Copy/Paste ! + Copy ! + Paste ! -> Rotation / flipping ! + Rotate : Create a rotated Bitmap (>= 8 bits only) ! + RotateEx : Create a rotated/translated Bitmap (>= 8 bits only) ! + FlipVerticaly : Flip Verticaly effect ! + FlipHorizontaly : Flip Horizontaly effect ! -> UpSampling / DownSampling ! + Rescale : Create a rescaled Bitmap (32 bits only) ! - New TIFF save format option. ! - New sample : read image from zipfile. ! ! 0.07 24/04/2003 ! - New Win32::GUI::DIBitmap method ! + newFromGD ! + CopyFromGD, CopyToGD : Must have Same Size and BPP. ! - UPDATE 1 : Add switch for old GD version ! - UPDATE 2 : Correct upside down bitmap bug ! ! 0.06 28/05/2002 ! - Use FreeImage 2.5.3 ! - Add FreeImage Multipaging interface ! ! 0.05 14/01/2002 ! - Use FreeImage 2.5.0 ! - Add FreeImage Multipaging interface (experimental in this release) ! - New Win32::GUI::DIBitmap method ! + Clone ! + AlphaCopyToDC ! + AlphaStrechToDC ! ! 0.04 29/10/2001 ! - Use FreeImage 2.4.2 ! - Fix bug in jpeg plug-in ! ! 0.03 18/08/2001 ! - Correct Bug when capture screen if display isn't in 32 bits ! - Add new function GetColorType ! - ColorQuantize work if image isn't in 24 bits ! - Add more Documentation ! ! 0.02 15/08/2001 ! - Use FreeImage 2.4.1 ! - Some little change ! ! 0.01 21/03/2001 ! - original version; created by h2xs 1.19 ! - First build Win32::GUI::DIBitmap --- Readme DELETED --- Index: DIBitmap.xs =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-DIBitmap/DIBitmap.xs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DIBitmap.xs 2 Nov 2005 08:41:17 -0000 1.1 --- DIBitmap.xs 11 Jun 2006 16:34:32 -0000 1.2 *************** *** 3,6 **** --- 3,8 ---- /**********************************************************************/ + /* $Id$ */ + #include "EXTERN.h" #include "perl.h" *************** *** 236,239 **** --- 238,242 ---- int constant (char * name, int arg) { + errno = 0; switch(*name) { *************** *** 386,389 **** --- 389,393 ---- CONSTANT(XPM_DEFAULT); } + errno = EINVAL; return 0; } *************** *** 395,398 **** --- 399,404 ---- MODULE = Win32::GUI::DIBitmap PACKAGE = Win32::GUI::DIBitmap + PROTOTYPES: ENABLE + ################################################################## # # *************** *** 865,869 **** cClrBits = 24; ! dib = FreeImage_Allocate (bmp.bmWidth, bmp.bmHeight, cClrBits ); if (dib == NULL) XSRETURN_EMPTY; --- 871,875 ---- cClrBits = 24; ! dib = FreeImage_Allocate (bmp.bmWidth, bmp.bmHeight, cClrBits, 0, 0, 0 ); if (dib == NULL) XSRETURN_EMPTY; *************** *** 938,942 **** cClrBits = 24; ! dib = FreeImage_Allocate (bmp.bmWidth, bmp.bmHeight, cClrBits ); if (dib == NULL) { --- 944,948 ---- cClrBits = 24; ! dib = FreeImage_Allocate (bmp.bmWidth, bmp.bmHeight, cClrBits, 0, 0, 0 ); if (dib == NULL) { *************** *** 1024,1028 **** cClrBits = 24; ! dib = FreeImage_Allocate (bmp.bmWidth, bmp.bmHeight, cClrBits ); if (dib == NULL) { --- 1030,1034 ---- cClrBits = 24; ! dib = FreeImage_Allocate (bmp.bmWidth, bmp.bmHeight, cClrBits, 0, 0, 0 ); if (dib == NULL) { *************** *** 1835,1838 **** --- 1841,1845 ---- { + UINT i, j; BITMAPINFOHEADER BMI; BYTE * pBits; *************** *** 1876,1880 **** // Modify background image ! for (UINT j = 0; j < h; j++) { --- 1883,1887 ---- // Modify background image ! for (j = 0; j < h; j++) { *************** *** 1882,1886 **** BYTE * pDest = &pBits [j * w * 4]; ! for (UINT i = 0; i < w; i++) { --- 1889,1893 ---- BYTE * pDest = &pBits [j * w * 4]; ! for (i = 0; i < w; i++) { *************** *** 2038,2047 **** if (ret != GDI_ERROR) { ! for (UINT j = 0; j < hd; ++j) { LPBYTE pbDestRGB = (LPBYTE)&((DWORD*)pDestBits)[j * wd]; LPBYTE pbSrcRGB = (LPBYTE)&((DWORD*)pSrcBits) [j * wd]; ! for (UINT i = 0; i < wd; ++i) { pbDestRGB[0] = (pbDestRGB[0] * (255-pbSrcRGB[3]) + pbSrcRGB[0] * pbSrcRGB[3])>>8; --- 2045,2056 ---- if (ret != GDI_ERROR) { ! UINT j; ! for (j = 0; j < hd; ++j) { + UINT i; LPBYTE pbDestRGB = (LPBYTE)&((DWORD*)pDestBits)[j * wd]; LPBYTE pbSrcRGB = (LPBYTE)&((DWORD*)pSrcBits) [j * wd]; ! for (i = 0; i < wd; ++i) { pbDestRGB[0] = (pbDestRGB[0] * (255-pbSrcRGB[3]) + pbSrcRGB[0] * pbSrcRGB[3])>>8; *************** *** 2843,2847 **** Win32::GUI::MDIBitmap mdib CODE: ! FreeImage_CloseMultiBitmap(mdib); # --- 2852,2856 ---- Win32::GUI::MDIBitmap mdib CODE: ! FreeImage_CloseMultiBitmap(mdib, 0); # --- NEW FILE: TODO --- - Upgrade to FreeImage 3.8.0 - Build and include static gcc lib (LibFreeImage.a?) so that we can build with MinGW/cygwin - more tests - test12.pl crashes during LockPage. Find out why. Index: TYPEMAP =================================================================== RCS file: /cvsroot/perl-win32-gui/Win32-GUI/Win32-GUI-DIBitmap/TYPEMAP,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TYPEMAP 2 Nov 2005 08:41:17 -0000 1.1 --- TYPEMAP 11 Jun 2006 16:34:33 -0000 1.2 *************** *** 1,12 **** TYPEMAP LPCTSTR T_PV - LPCSTR T_PV - LPTSTR T_PV - DWORD T_IV UINT T_IV BOOL T_IV FREE_IMAGE_FORMAT T_IV FREE_IMAGE_QUANTIZE T_IV - FREE_IMAGE_COLOR_TYPE T_IV FREE_IMAGE_DITHER T_IV FREE_IMAGE_FILTER T_IV --- 1,10 ---- + # Typemap for Win32::GUI::DIBitmap + # $Id$ TYPEMAP LPCTSTR T_PV UINT T_IV BOOL T_IV FREE_IMAGE_FORMAT T_IV FREE_IMAGE_QUANTIZE T_IV FREE_IMAGE_DITHER T_IV FREE_IMAGE_FILTER T_IV *************** *** 25,38 **** T_HANDLE if(SvROK($arg)) { ! if(hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0) != NULL) ! $var = ($type) SvIV(*(hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0))); else $var = NULL; } else ! $var = ($type) SvIV($arg); ################################################################################ OUTPUT T_HANDLE ! sv_setiv($arg, (IV) $var); ! --- 23,36 ---- T_HANDLE if(SvROK($arg)) { ! SV** out=hv_fetch((HV*)SvRV($arg), \"-handle\", 7, 0); ! if(out != NULL) ! $var = INT2PTR($type,SvIV(*out)); else $var = NULL; } else ! $var = INT2PTR($type,SvIV($arg)); ################################################################################ OUTPUT T_HANDLE ! sv_setiv($arg, PTR2IV($var));