From 5cb32502b777eb0dec8ec2d8a8c9714ed487b86f Mon Sep 17 00:00:00 2001 From: scuri Date: Wed, 3 Dec 2008 15:45:33 +0000 Subject: *** empty log message *** --- html/en/history.html | 2625 +++++++++++++++++++++++++++++++++++++++------ include/im_file.h | 2 +- include/im_format.h | 52 +- include/im_format_raw.h | 2 +- mak.vc8/im.sln | 7 - mak.vc8/im_capture.vcproj | 3 +- mak.vc8/im_wmv.vcproj | 3 +- src/im_file.cpp | 82 +- src/im_fileraw.cpp | 6 +- src/im_format.cpp | 38 +- src/im_format_avi.cpp | 61 +- src/im_format_bmp.cpp | 52 +- src/im_format_ecw.cpp | 40 +- src/im_format_gif.cpp | 49 +- src/im_format_ico.cpp | 52 +- src/im_format_jp2.cpp | 48 +- src/im_format_jpeg.cpp | 49 +- src/im_format_krn.cpp | 45 +- src/im_format_led.cpp | 50 +- src/im_format_pcx.cpp | 56 +- src/im_format_png.cpp | 49 +- src/im_format_pnm.cpp | 48 +- src/im_format_ras.cpp | 52 +- src/im_format_raw.cpp | 54 +- src/im_format_sgi.cpp | 49 +- src/im_format_tga.cpp | 57 +- src/im_format_tiff.cpp | 47 +- src/im_format_wmv.cpp | 65 +- test/im_copy.cpp | 2 +- test/im_copy.vcproj | 160 ++- 30 files changed, 3041 insertions(+), 864 deletions(-) diff --git a/html/en/history.html b/html/en/history.html index 6030df2..46b7874 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -1,361 +1,2280 @@ - - + + + + + + History - - - + + + + + + + + + - - -

History of Changes

-

CVS (18/Nov/2008)

- -

Version 3.4 (14/Oct/2008)

- -

Version 3.3 (26/Nov/2007)

- -

Version 3.2 (24/Nov/2006)

- -

Version 3.1 (12/Dez/2005)

- -

Version 3.0.3 (14/Oct/2004)

- -

Version 3.0.2 (25/Aug/2004)

- -

- New: utility functions imPaletteHighContrast, - imImageLoadImage and - imImageLoadBitmap.
- - New: operation imProcessNormalizeComponents.
- - Changed: name imProcessGaussianConvolve to - imProcessGaussianConvolveRep. New: - operation imProcessGaussianConvolve that uses a float kernel. - New: utility functions - imGaussianStdDev2Repetitions and imGaussianStdDev2KernelSize.
- - Changed: name imProcessDiffOfGaussianConvolve to - imProcessDiffOfGaussianConvolveRep. - New: operation imProcessDiffOfGaussianConvolve that uses a float kernel.
- - Changed: IM_GAMUT_BRIGHTCONT - parameters to the interval [-100,100]. Fixed: - IM_GAMUT_EXPAND and IM_GAMUT_BRIGHTCONT normalization.
- - Changed: logical operations, flag IM_BIT_NOT - replaced by operation imProcessBitwiseNot.
- - Changed: imImageSetAttribute count can be -1 for zero terminated data.
- - Fixed: operations imProcessBitwiseNot and - imProcessNegative for IM_BINARY images.
- - Fixed: the color_mode_flags parameter interpretation by - imFileReadImageData. -
- - Fixed: imProcessEqualizeHistogram and - imProcessExpandHistogram for - color images.
- - Fixed: imProcessMultipleStdDev.
- - Fixed: imProcessDifusionErrThreshold for - IM_GRAY images.
- - Fixed: "KRN" format, internal format is topdown.
- - Fixed: initialization of TGA image_count.

- -

Version 3.0.1 (22/Apr/2004)

- -

- Improved compatibility with the old version, it was missing the load of Map images with - imLoadRGB.
- - The FFTW code was from version 2.1.3, not from 2.1.5 as suposed, it was updated. The FFT functions were condensed in - only one file with an "#ifdef" for FFTW version 2 and 3. The FFT functions also were renamed to remove the "W" that - belongs only to the FFTW library.
- - The SetAttribute functions now accept NULL in data to remove the attribute.
- - New: imProcessCrossCorrelation and imProcessAutoCorrelation functions.
- - The imCalcGrayHistogram function now can calculate the histogram of - IM_MAP - and IM_BINARY images.

- -

Version 3.0 (April 2004)

- -

A major rewrite of the library. Everything changed, check the manual, but backward compatibility is kept for old - applications. A new API more flexible, new formats, support for attributes and video, image capture and image - processing. New: color spaces and data types. The library now got a professional look for scientific applications.

- -

Version 2.6 (May 2002)

- -

Correction of bug in resolution reading and writing for format JPEG.

- -

Version 2.5 (August 2001)

- -

Correction of bug in the default GIF compression. Two new callbacks: transparency color index for GIF files and - image description for TIFF files.

- -

Version 2.4 (February 2000)

- -

Change in the treatment of LZW compression in formats TIFF and GIF. Now compression is no longer the default.

- -

Version 2.3 (June 1998)

- -

Close function of the access driver for files in memory corrected. JPEG library updated to 6b. Correction of a - problem with the reading of some JPEG files.

- -

Version 2.2 (November 1997)

- -

The definition of the counter callback was changed to inform, in a parameter, the type of access being performed, - either reading or writing. Type imCallback defined to make type casting easier when using function - imRegisterCallback. Correction of a problem with the makefile in UNIX, which was generating link - errors in some platforms.

- -

Version 2.1 (October 1997)

- -

Correction of a problem with internal memory liberation when reading Map images in TIFF files. Conversion RGB to - Map is now made using the algorithm implemented by LibJPEG. The algorithm of imResize was - improved for cases in which the size is being reduced instead of increased. Correction of a problem with functions - imImageInfo and imFileFormat: when the provided file was not in a format recognized - by IM, there was an error in format TGA which caused these functions to access an invalid memory area.

- -

Version 2.0 (September 1997)

- -

The library was virtually rewritten to implement a new structure which allowed greater flexibility, simplifying the - addition of new formats. Formats TGA, PCL, JPEG and LED - were added to the list of supported formats, and new functions were added: imMap2RGB, - imRGB2Gray, imMap2Gray, imResize, imStretch.

- -

Version 1.1 (June 1996)

- -

Small corrections to increase portability. Changes in return codes. Identifiers were created to return codes and - predefined parameters. Online manual concluded.

- -

Version 1.0 (October 1995)

+ + +
+ +

History of Changes

+ +
+ +

CVS (03/Dez/2008)

+ +
+ +

·         +Changed: function imColorHSI_Smax +removed from public, now it is used only internally. HSI space +now uses S already normalized between 0-Smax.

+ +

·         +Fixed: +imColorHSI2RGB conversion.

+ +

·         +Fixed: imConvertDataType when +converting a floating point to integer, there were rounding problems.

+ +

·         +Fixed: loading or saving two files of the same format at the same time.

+ +
+ +

Version +3.4 (14/Oct/2008)

+ +
+ +

·         +New: imlua_avi, imlua_wmv +and imlua_jp2 libraries so the respective formats can be dynamically loaded +using require.

+ +

·         +Changed: IMPORTANT +- the "imlua_cd" library moved from IM to +CD under the name "cdluaim".

+ +

·         +Changed: IMPORTANT +- the support services (Downloads, Mailing List and CVS) moved from LuaForge to SourceForge.

+ +

·         +Changed: All dll8 and dll9 DLLs now have a Manifest file that specifies the +correct MSVCR*.DLL.

+ +

·         +Changed: Makefiles for UNIX now uses a compact version +of Tecmake that does not need any installation, just +type "make".

+ +

·         +Changed: premake files are used now only internally +and were removed from the distribution.

+ +

·         +Changed: Copyright notice modified to reflect +the registration at INPI (National Institute of Intellectual Property in +Brazil). License continues +under the same terms.

+ +

·         +Fixed: reviewed and fixed the parameter checking of all IMLua +processing functions. Also reviewed all IMLua +parameter checking. Thanks to Lucas Lorensi.

+ +

·         +Fixed: loading of TIFF format with old JPEG compression.

+ +

·         +Fixed: loading and saving of PNM format when data in textual format and gray +values are greatter than 255.

+ +

·         +Fixed: Bicubic and Zero order interpolation for all +geometric operations for pixels near the image border when increasing image +size.

+ +

·         +Fixed: +Lua samples.

+ +

·         +Fixed: ICON format in 64 bits Linux.

+ +
+ +

Version +3.3 (26/Nov/2007)

+ +
+ +

·         +New: read support for ECW using the ERMapper ECW +JPEG 2000 SDK.

+ +

·         +Changed: libTIFF updated to version 3.8.2.

+ +

·         +Changed: libPNG updated to version 1.2.22.

+ +

·         +Changed: libJasper updated to libGeoJasper +1.4.0 (using Jasper version 1.900.1). Better support for counter progress, Geo +tags and several speed improvements. New GeoTIFFBox and XMLPacket attributes.

+ +

·         +Changed: renamed macro imPutImage to imcdCanvasPutImage, and added canvas as the first +parameter.

+ +

·         +Changed: renamed the imImage Lua methods to image:cdCanvasPutImageRect, image:wdCanvasPutImageRect +and image:cdCanvasGetImage, +and added canvas as the first parameter. Now imlua_cd +depends on cdlua from CD version 5.0.

+ +

·         +Changed: metatable names in Lua +are now the same as the C struct names.

+ +

·         +Changed: new read EXIF tags support in TIFF format (no write support yet). +Renamed attributes "GeoTransMatrix" and +"IntergraphMatrix", to "GeoTransformationMatrix" and "Intergraph TransformationMatrix" for libGeoTIFF +compatibility. Better support for known TIFF tags. New support for reading one +band of a multiband gray image in TIFF format. New support +for DNG files.

+ +

·         +Fixed: imConvertDataType gamma function when converting real to/from integer.

+ +

·         +Fixed: small error at the image border when resampling, rotating or other geometric operations.

+ +

·         +Fixed: imProcessCanny invalid division by zero when input image is all zero.

+ +

·         +Fixed: imFileReadImageInfo when loading MAP images with a scrambled gray palette. They were +incorrectly converted to +GREY.

+ +

·         +Fixed: support for IM_ALPHA and 32 bpp +in ICO format.

+ +

·         +Fixed: number of lines returned in imProcessHoughLinesDraw.

+ +
+ +

Version +3.2 (24/Nov/2006)

+ +
+ +

·         +New: imProcessRotateRef to rotate +relative to a reference point.

+ +

·         +New: geometric distortion +imProcessSwirl.

+ +

·         +New: imProcessInterlaceSplit.

+ +

·         +New: function imGaussianKernelSize2StdDev.

+ +

·         +New: convolutions imProcessBarlettConvolve, imProcessPrewittConvolve, imProcessSplineEdgeConvolve, imProcessConvolveDual and +imProcessConvolveSep.

+ +

·         +New: "im_kernel.h" module with simple functions to create know +pre-defined kernels like sobel, laplacian, +gaussian, etc.

+ +

·         +New: imVideoCaptureSetInOut to +control input and output in capture devices.

+ +

·         +New: function imBinMemoryRelease +to release internal memory allocated by the BinMemory +file when saving.

+ +

·         +New: functions for capture device information: imVideoCaptureDeviceExDesc, +imVideoCaptureDevicePath and imVideoCaptureDeviceVendorInfo.

+ +

·         +New: function imFileOpenAs +to open a file of a specific format.

+ +

·         +New: functions imFormatRegisterInternal +and imFormatRemoveAll to control +format registration.

+ +

·         +Changed: imProcessGaussianConvolve to +used separable convolution and now is stddev is +negative will use its magnitude as the kernel size. Removed Rep +functions imProcessGaussianConvolveRep, +imProcessDiffOfGaussianConvolveRep and imGaussianStdDev2Repetitions.

+ +

·         +Changed: imProcessBlend to use an +image instead of a constant. Old function renamed to imProcessBlendConst.

+ +

·         +Changed: imFileHandle prototype. Now +the function has an index parameter to specify which handle it should return. index=0 is always an imBinFile* +handle. Use index=1 or greater to return other internal handles that are format +dependent.

+ +

·         +Changed: the Removed the include "im.h" to +not include "im_lib.h". "im_lib.h" must be included +when necessary.

+ +

·         +Changed: imAnalyzeMeasureArea and imAnalyzeMeasurePerimeter prototypes to +include the number of regions as a parameter. Fixed: these functions to +internally initialize the results array to zero (this was necessary and not +documented).

+ +

·         +Changed: imProcessFlip and imProcessMirror so they can be done +in-place.

+ +

·         +Fixed: missing implementation of imVideoCaptureOneFrame +in Lua 5.

+ +

·         +Fixed: imAnalyzeFindRegions when +pixel is at the width-1 column.

+ +

·         +Fixed: file format identification when TIFF identification +failed was not closing the file.

+ +

·         +Fixed: imAnalyzeMeasurePerimeter +when perimeter line is at the first or last lines. Thanks to Takeshi +Mitsunaga.

+ +

·         +Fixed: invalid return value in imVideoCaptureConnect +in Lua 5.

+ +

·         +Fixed: imProcessRotate for IM_MAP +images.

+ +

·         +Fixed: Lua binding of imFileImageSave, wrong parameters order. +New: image:Save(filename, +format) alias for imImage objects.

+ +

·         +Fixed: BMP format implementation when reading and writing +RGBA 32 bits images.

+ +

·         +Fixed: imFileLoadImageFrame and imFileLoadBitmapFrame index parameter in Lua.

+ +

·         +Fixed: alpha channel allocation in imImage.

+ +
+ +

Version +3.1 (12/Dez/2005)

+ +
+ +

·         +New: Download, Discussion List, Submission of Bugs, Support Requests and +Feature Requests, are now available thanks to the LuaForge +site.

+ +

·         +New: Binding for Lua 5

+ +

·         +New: support for alpha in imImage.

+ +

·         +New: organization of the documentation.

+ +

·         +New: in ICON format the TransparencyIndex is used +to for IM_MAP images without an alpha channel.

+ +

·         +New: video capture functions: imVideoCaptureFormatCount, +imVideoCaptureGetFormat and imVideoCaptureSetFormat, to access the +available capture video formats.

+ +

·         +New: functions imFileLoadImageFrame +and imFileLoadBitmapFrame to reuse +the image data when loading.

+ +

·         +New: function imFileImageSave.

+ +

·         +New: function imImageCreateBased.

+ +

·         +New: imProcessInsert.

+ +

·         +New: compression functions imCompressDataLZF +and imCompressDataUnLZF, using libLZF.

+ +

·         +New: module for imBinFile, IM_FILEHANDLE +that allows to access an already opened file using the +system file handle as file name. Thanks to Frederico Abraham.

+ +

·         +Changed: in JPEG file format YcbCr are now +automatically converted to RGB when loaded. RGB images were already +automatically converted to YCbCr when saved. Now this +behavior can be controlled by the AutoYCbCr +attribute.

+ +

·         +Changed: the imAnalyzeFindRegions to +include an additional parameter that control if regions touching the border are +computed or not. The function imProcessPrune +now will only eliminate the regions in the selected size range.

+ +

·         +Changed: third party libraries, updated to newest versions: libExif, +libTIFF, libPNG and zlib. Added OLD JPEG support in libTIFF.

+ +

·         +Changed: optimization flags to ON when building the library in all platforms.

+ +

·         +Changed: imProcessPerimeterLine, imAnalyzeMeasurePerimeter, imAnalyzeMeasurePerimArea, imAnalyzeMeasureCentroid and imAnalyzeMeasurePrincipalAxis to consider +pixels that touch the borders.

+ +

·         +Changed: macro name cdPutBitmap to imPutBitmap.

+ +

·         +Changed: function names imImageLoad and imImageLoadBitmap, to imFileImageLoad +and imFileImageLoadBitmap.

+ +

·         +Fixed: overflow in imCalcImageStatistics +fo IM_INT and IM_USHORT +images.

+ +

·         +Fixed: error management in system file I/O in UNIX.

+ +

·         +Fixed: some small defines for 64-bits compatibility in libExif, +libPNG and libJPEG.

+ +

·         +Fixed: incorrect interpretation of 16 bit data from PNG +files.

+ +

·         +Fixed: imFileReadImageInfo can be +called many times with the same index that will return the correct result +without accessing the file again.

+ +

·         +Fixed: small bug in sample iupglcap.

+ +

·         +Fixed: TIFF format read for images with multiple bands in ExtraSamples.

+ +

·         +Fixed: ICON format can_sequence was +0.

+ +

·         +Fixed: imProcessMergeHSI and imProcessSplitHSI documentation, and implementation +for IM_BYTE images.

+ +

·         +Fixed: imProcessRangeContrastThreshold, +imProcessLocalMaxThreshold and imProcessRankClosestConvolve when +processing near the border.

+ +

·         +Fixed: invalid file permissions in UNIX when saving a new file.

+ +

·         +Fixed: +name for imProcessLocalMaxThresEstimate.

+ +

·         +Fixed: imProcessReduceBy4 for images with odd width and/or +height.

+ +

·         +Fixed: imAttribTableSet when +replacing an attribute (thanks to Takeshi Mitsunaga).

+ +

·         +Fixed: memory leaks in imConvertToBitmap +and imConvertDataType (thanks to +Takeshi Mitsunaga).

+ +

·         +Fixed: imProcessZeroCrossing for +the last pixel column (thanks to Takeshi Mitsunaga). Also fixed +for some crossings that were lost.

+ +

·         +Fixed: imProcessGrayMorphConvolve +for IM_FLOAT images with IM_FLOAT kernel +(thanks to Takeshi Mitsunaga).

+ +
+ +

Version +3.0.3 (14/Oct/2004)

+ +
+ +

·         +New: Image Transform +imProcessDistanceTransform.

+ +

·         +New: group of functions Image Analysis: imAnalyzeFindRegions, +imAnalyzeMeasureArea, imAnalyzeMeasurePerimArea, imAnalyzeMeasureCentroid, imAnalyzeMeasurePrincipalAxis, imAnalyzeMeasureHoles, imProcessPerimeterLine, +imAnalyzeMeasurePerimeter, imProcessPrune, imProcessFillHoles.

+ +

·         +New: imConvertMapToRGB to help +loading data as RGB.

+ +

·         +New: sample iupglcap.

+ +

·         +New: imProcessRenderChessboard +and imProcessRenderGrid.

+ +

·         +Changed: imProcessThreshold, imProcessRangeContrastThreshold and imProcessLocalMaxThreshold now also supports IM_USHORT and IM_INT +data types.

+ +

·         +Changed: the default color conversion to binary so it can be done for all color +spaces.

+ +

·         +Changed: im_process.h to split into 4 files: im_process_pont.h, im_process_loc.h, +im_process_glo.h, im_process_ana.h. +But it still exists and includes the new files for compatibility.

+ +

·         +Changed: the border extensions in several types of convolution. Rank convolution do not extend the borders. Binary morphology use zero extension. Gray morphology do +not extend the borders.

+ +

·         +Fixed: file read with bitmap conversion when original data changes only data +type.

+ +

·         +Fixed: rank convolution operations that did not accept even kernel sizes.

+ +

·         +Fixed: imProcessHoughLinesDraw that +was ignoring some lines.

+ +
+ +

Version 3.0.2 (25/Aug/2004)

+ +
+ +

- New: +utility functions imPaletteHighContrast, imImageLoadImage and imImageLoadBitmap. +
+- New: operation imProcessNormalizeComponents.
+- Changed: name imProcessGaussianConvolve +to imProcessGaussianConvolveRep. New: +operation imProcessGaussianConvolve that uses +a float kernel. New: utility functions imGaussianStdDev2Repetitions and imGaussianStdDev2KernelSize.
+- Changed: name imProcessDiffOfGaussianConvolve +to imProcessDiffOfGaussianConvolveRep. New: +operation imProcessDiffOfGaussianConvolve that +uses a float kernel.
+- Changed: IM_GAMUT_BRIGHTCONT +parameters to the interval [-100,100]. Fixed: IM_GAMUT_EXPAND +and IM_GAMUT_BRIGHTCONT normalization.
+- Changed: logical operations, flag IM_BIT_NOT +replaced by operation imProcessBitwiseNot.
+- Changed: imImageSetAttribute +count can be -1 for zero terminated data.
+- Fixed: operations imProcessBitwiseNot +and imProcessNegative for IM_BINARY +images.
+- Fixed: the color_mode_flags +parameter interpretation by imFileReadImageData. +
+- Fixed: imProcessEqualizeHistogram +and imProcessExpandHistogram for color images. +
+- Fixed: imProcessMultipleStdDev.
+- Fixed: imProcessDifusionErrThreshold +for IM_GRAY images.
+- Fixed: "KRN" format, internal +format is topdown.
+- Fixed: initialization of TGA image_count.

+ +
+ +

Version 3.0.1 (22/Apr/2004)

+ +
+ +

- Improved compatibility +with the old version, it was missing the load of Map images with imLoadRGB.
+- The FFTW code was from version 2.1.3, not from 2.1.5 as suposed, +it was updated. The FFT functions were condensed in only one file with an "#ifdef" for FFTW +version 2 and 3. The FFT functions also were renamed to remove the +"W" that belongs only to the FFTW library.
+- The SetAttribute functions now accept NULL +in data to remove the attribute.
+- New: imProcessCrossCorrelation and imProcessAutoCorrelation functions.
+- The imCalcGrayHistogram function now can +calculate the histogram of IM_MAP and IM_BINARY images.

+ +
+ +

Version 3.0 (April 2004)

+ +
+ +

A major +rewrite of the library. Everything changed, check the manual, but backward compatibility is +kept for old applications. A new API more flexible, new formats, support for +attributes and video, image capture and image processing. New: color spaces and +data types. The library now got a professional look for scientific +applications.

+ +
+ +

Version 2.6 (May 2002)

+ +
+ +

Correction +of bug in resolution reading and writing for format JPEG.

+ +
+ +

Version 2.5 (August 2001)

+ +
+ +

Correction +of bug in the default GIF compression. Two new callbacks: transparency color index +for GIF files and image description for TIFF files.

+ +
+ +

Version 2.4 (February 2000)

+ +
+ +

Change in the treatment of +LZW compression in formats TIFF and GIF. Now compression is no longer the +default.

+ +
+ +

Version 2.3 (June 1998)

+ +
+ +

Close function of the +access driver for files in memory corrected. JPEG library updated to 6b. +Correction of a problem with the reading of some JPEG files.

+ +
+ +

Version 2.2 (November 1997)

+ +
+ +

The definition of the +counter callback was changed to inform, in a parameter, the type of access +being performed, either reading or writing. Type imCallback +defined to make type casting easier when using function imRegisterCallback. +Correction of a problem with the makefile +in UNIX, which was generating link errors in some platforms.

+ +
+ +

Version 2.1 (October 1997)

+ +
+ +

Correction of a problem +with internal memory liberation when reading Map images in TIFF files. +Conversion RGB to Map is now made using the algorithm implemented by LibJPEG. The algorithm of imResize +was improved for cases in which the size is being reduced instead of increased. +Correction of a problem with functions imImageInfo +and imFileFormat: when the provided +file was not in a format recognized by IM, there was an error in format TGA +which caused these functions to access an invalid memory area.

+ +
+ +

Version 2.0 (September 1997)

+ +
+ +

The library was virtually +rewritten to implement a new structure which allowed greater flexibility, +simplifying the addition of new formats. Formats TGA, PCL, +JPEG and LED were added to the list of +supported formats, and new functions were added: imMap2RGB, imRGB2Gray, +imMap2Gray, imResize, +imStretch.

+ +
+ +

Version 1.1 (June 1996)

+ +
+ +

Small +corrections to increase portability. Changes in return codes. +Identifiers were created to return codes and predefined parameters. Online +manual concluded.

+ +
+ +

Version +1.0 (October 1995)

+ +
+ +
- \ No newline at end of file + diff --git a/include/im_file.h b/include/im_file.h index a35c82a..33ef12e 100644 --- a/include/im_file.h +++ b/include/im_file.h @@ -23,7 +23,7 @@ extern "C" { * \ingroup file */ -/** \brief Image File Format Base (SDK Use Only) +/** \brief Image File Format Base Class (SDK Use Only) * * \par * Base container to hold format independent state variables. diff --git a/include/im_format.h b/include/im_format.h index 9120676..6ee0473 100644 --- a/include/im_format.h +++ b/include/im_format.h @@ -11,27 +11,20 @@ #define __IM_FORMAT_H -/** \brief Image File Format Driver (SDK Use Only) +class imFormat; + +/** \brief Image File Format Virtual Class (SDK Use Only) * * \par * Virtual Base class for file formats. All file formats inherit from this class. * \ingroup filesdk */ -class imFormat: public _imFile +class imFileFormatBase: public _imFile { public: - const char* format; - const char* desc; - const char* ext; - const char** comp; - int comp_count, - can_sequence; + const imFormat* iformat; - imFormat(const char* _format, const char* _desc, const char* _ext, - const char** _comp, int _comp_count, int _can_sequence) - :format(_format), desc(_desc), ext(_ext), comp(_comp), - comp_count(_comp_count), can_sequence(_can_sequence) - {} - virtual ~imFormat() {} + imFileFormatBase(const imFormat* _iformat): iformat(_iformat) {} + virtual ~imFileFormatBase() {} imAttribTable* AttribTable() {return (imAttribTable*)this->attrib_table;} @@ -45,7 +38,32 @@ public: virtual int ReadImageData(void* data) = 0; virtual int WriteImageInfo() = 0; // Should update compression virtual int WriteImageData(void* data) = 0; // Must update image_count +}; + +/** \brief Image File Format Descriptor (SDK Use Only) + * + * \par + * All file formats must define these informations. They are stored by \ref imFormatRegister. + * \ingroup filesdk */ +class imFormat +{ +public: + const char* format; + const char* desc; + const char* ext; + const char** comp; + int comp_count, + can_sequence; + + virtual imFileFormatBase* Create() const = 0; virtual int CanWrite(const char* compression, int color_mode, int data_type) const = 0; + + imFormat(const char* _format, const char* _desc, const char* _ext, + const char** _comp, int _comp_count, int _can_sequence) + :format(_format), desc(_desc), ext(_ext), comp(_comp), + comp_count(_comp_count), can_sequence(_can_sequence) + {} + virtual ~imFormat() {} }; extern "C" @@ -56,15 +74,15 @@ extern "C" /* Opens a file with the respective format driver * Uses the file extension to speed up the search for the format driver. * Used by "im_file.cpp" only. */ -imFormat* imFormatOpen(const char* file_name, int *error); +imFileFormatBase* imFileFormatBaseOpen(const char* file_name, int *error); /* Opens a file with the given format * Used by "im_file.cpp" only. */ -imFormat* imFormatOpenAs(const char* file_name, const char* format, int *error); +imFileFormatBase* imFileFormatBaseOpenAs(const char* file_name, const char* format, int *error); /* Creates a file using the given format driver. * Used by "im_file.cpp" only. */ -imFormat* imFormatNew(const char* file_name, const char* format, int *error); +imFileFormatBase* imFileFormatBaseNew(const char* file_name, const char* format, int *error); /* File Format SDK */ diff --git a/include/im_format_raw.h b/include/im_format_raw.h index 8027f82..07cc81c 100644 --- a/include/im_format_raw.h +++ b/include/im_format_raw.h @@ -54,7 +54,7 @@ extern "C" { StartOffset, SwitchType, ByteOrder, Padding IM_INT (1) \endverbatim * \ingroup format */ -imFormat* imFormatInitRAW(void); +imFileFormatBase* imFormatInitRAW(void); #if defined(__cplusplus) diff --git a/mak.vc8/im.sln b/mak.vc8/im.sln index 27a3077..201b401 100644 --- a/mak.vc8/im.sln +++ b/mak.vc8/im.sln @@ -105,13 +105,6 @@ Global {CB86E507-6B6C-4FDF-9B6D-27AA123AE463}.Release|Win32.ActiveCfg = Debug|Win32 {CB86E507-6B6C-4FDF-9B6D-27AA123AE463}.Release|Win32.Build.0 = Debug|Win32 {CB86E507-6B6C-4FDF-9B6D-27AA123AE463}.Release|x64.ActiveCfg = Debug|Win32 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|Win32.ActiveCfg = Debug|Win32 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|Win32.Build.0 = Debug|Win32 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|x64.ActiveCfg = Debug|x64 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Debug|x64.Build.0 = Debug|x64 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Release|Win32.ActiveCfg = Debug|x64 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Release|x64.ActiveCfg = Debug|x64 - {909637FA-8229-45A9-9F42-53D8ED5F91C5}.Release|x64.Build.0 = Debug|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/mak.vc8/im_capture.vcproj b/mak.vc8/im_capture.vcproj index e7a8555..1e16bef 100644 --- a/mak.vc8/im_capture.vcproj +++ b/mak.vc8/im_capture.vcproj @@ -4,7 +4,6 @@ Version="8,00" Name="im_capture" ProjectGUID="{CB868607-6B6C-4CDF-9B6D-27AA925AE473}" - TargetFrameworkVersion="131072" > @@ -49,66 +49,66 @@ imFile* imFileOpen(const char* file_name, int *error) { assert(file_name); - imFormat* iformat = imFormatOpen(file_name, error); - if (!iformat) + imFileFormatBase* ifileformat = imFileFormatBaseOpen(file_name, error); + if (!ifileformat) return NULL; - imFileClear(iformat); + imFileClear(ifileformat); - iformat->attrib_table = new imAttribTable(599); + ifileformat->attrib_table = new imAttribTable(599); - iformat->counter = imCounterBegin(file_name); + ifileformat->counter = imCounterBegin(file_name); - return iformat; + return ifileformat; } imFile* imFileOpenAs(const char* file_name, const char* format, int *error) { assert(file_name); - imFormat* iformat = imFormatOpenAs(file_name, format, error); - if (!iformat) + imFileFormatBase* ifileformat = imFileFormatBaseOpenAs(file_name, format, error); + if (!ifileformat) return NULL; - imFileClear(iformat); + imFileClear(ifileformat); - iformat->attrib_table = new imAttribTable(599); + ifileformat->attrib_table = new imAttribTable(599); - iformat->counter = imCounterBegin(file_name); + ifileformat->counter = imCounterBegin(file_name); - return iformat; + return ifileformat; } imFile* imFileNew(const char* file_name, const char* format, int *error) { assert(file_name); - imFormat* iformat = imFormatNew(file_name, format, error); - if (!iformat) + imFileFormatBase* ifileformat = imFileFormatBaseNew(file_name, format, error); + if (!ifileformat) return NULL; - imFileClear(iformat); + imFileClear(ifileformat); - iformat->is_new = 1; - iformat->image_count = 0; - iformat->compression[0] = 0; + ifileformat->is_new = 1; + ifileformat->image_count = 0; + ifileformat->compression[0] = 0; - iformat->attrib_table = new imAttribTable(101); + ifileformat->attrib_table = new imAttribTable(101); - iformat->counter = imCounterBegin(file_name); + ifileformat->counter = imCounterBegin(file_name); - return iformat; + return ifileformat; } void imFileClose(imFile* ifile) { assert(ifile); - imFormat* iformat = (imFormat*)ifile; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; imAttribTable* attrib_table = (imAttribTable*)ifile->attrib_table; imCounterEnd(ifile->counter); - iformat->Close(); + ifileformat->Close(); if (ifile->line_buffer) free(ifile->line_buffer); @@ -118,16 +118,16 @@ void imFileClose(imFile* ifile) void* imFileHandle(imFile* ifile, int index) { assert(ifile); - imFormat* iformat = (imFormat*)ifile; - return iformat->Handle(index); + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; + return ifileformat->Handle(index); } void imFileSetAttribute(imFile* ifile, const char* attrib, int data_type, int count, const void* data) { assert(ifile); assert(attrib); - imFormat* iformat = (imFormat*)ifile; - imAttribTable* atable = (imAttribTable*)iformat->attrib_table; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; + imAttribTable* atable = (imAttribTable*)ifileformat->attrib_table; if (data) atable->Set(attrib, data_type, count, data); else @@ -138,8 +138,8 @@ const void* imFileGetAttribute(imFile* ifile, const char* attrib, int *data_type { assert(ifile); assert(attrib); - imFormat* iformat = (imFormat*)ifile; - imAttribTable* attrib_table = (imAttribTable*)iformat->attrib_table; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; + imAttribTable* attrib_table = (imAttribTable*)ifileformat->attrib_table; return attrib_table->Get(attrib, data_type, count); } @@ -167,10 +167,10 @@ void imFileGetAttributeList(imFile* ifile, char** attrib, int *attrib_count) void imFileGetInfo(imFile* ifile, char* format, char* compression, int *image_count) { assert(ifile); - imFormat* iformat = (imFormat*)ifile; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; if(compression) strcpy(compression, ifile->compression); - if(format) strcpy(format, iformat->format); + if(format) strcpy(format, ifileformat->iformat->format); if (image_count) *image_count = ifile->image_count; } @@ -214,7 +214,7 @@ int imFileReadImageInfo(imFile* ifile, int index, int *width, int *height, int * { assert(ifile); assert(!ifile->is_new); - imFormat* iformat = (imFormat*)ifile; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; if (index >= ifile->image_count) return IM_ERR_DATA; @@ -233,7 +233,7 @@ int imFileReadImageInfo(imFile* ifile, int index, int *width, int *height, int * ifile->convert_bpp = 0; ifile->switch_type = 0; - int error = iformat->ReadImageInfo(index); + int error = ifileformat->ReadImageInfo(index); if (error) return error; if (!imImageCheckFormat(ifile->file_color_mode, ifile->file_data_type)) @@ -322,7 +322,7 @@ int imFileReadImageData(imFile* ifile, void* data, int convert2bitmap, int color { assert(ifile); assert(!ifile->is_new); - imFormat* iformat = (imFormat*)ifile; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; if (ifile->image_index == -1) return IM_ERR_DATA; @@ -350,7 +350,7 @@ int imFileReadImageData(imFile* ifile, void* data, int convert2bitmap, int color imFileLineBufferInit(ifile); - int ret = iformat->ReadImageData(data); + int ret = ifileformat->ReadImageData(data); // here we can NOT change the file_color_mode we already returned to the user // so just check for gray and binary consistency @@ -389,12 +389,12 @@ int imFileWriteImageInfo(imFile* ifile, int width, int height, int user_color_mo { assert(ifile); assert(ifile->is_new); - imFormat* iformat = (imFormat*)ifile; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; if (!imImageCheckFormat(user_color_mode, user_data_type)) return IM_ERR_DATA; - int error = iformat->CanWrite(ifile->compression, user_color_mode, user_data_type); + int error = ifileformat->iformat->CanWrite(ifile->compression, user_color_mode, user_data_type); if (error) return error; ifile->width = width; @@ -409,7 +409,7 @@ int imFileWriteImageInfo(imFile* ifile, int width, int height, int user_color_mo ifile->palette[1] = imColorEncode(255, 255, 255); } - return iformat->WriteImageInfo(); + return ifileformat->WriteImageInfo(); } int imFileWriteImageData(imFile* ifile, void* data) @@ -417,12 +417,12 @@ int imFileWriteImageData(imFile* ifile, void* data) assert(ifile); assert(ifile->is_new); assert(data); - imFormat* iformat = (imFormat*)ifile; + imFileFormatBase* ifileformat = (imFileFormatBase*)ifile; if (!imFileCheckConversion(ifile)) return IM_ERR_DATA; imFileLineBufferInit(ifile); - return iformat->WriteImageData(data); + return ifileformat->WriteImageData(data); } diff --git a/src/im_fileraw.cpp b/src/im_fileraw.cpp index da7ef81..530b6c9 100644 --- a/src/im_fileraw.cpp +++ b/src/im_fileraw.cpp @@ -2,7 +2,7 @@ * \brief RAW File Format Open/New Functions * * See Copyright Notice in im_lib.h - * $Id: im_fileraw.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_fileraw.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im.h" @@ -21,7 +21,7 @@ imFile* imFileOpenRaw(const char* file_name, int *error) { assert(file_name); - imFormat* iformat = imFormatInitRAW(); + imFileFormatBase* iformat = imFormatInitRAW(); *error = iformat->Open(file_name); if (*error) { @@ -42,7 +42,7 @@ imFile* imFileNewRaw(const char* file_name, int *error) { assert(file_name); - imFormat* iformat = imFormatInitRAW(); + imFileFormatBase* iformat = imFormatInitRAW(); *error = iformat->New(file_name); if (*error) { diff --git a/src/im_format.cpp b/src/im_format.cpp index be9892c..d389743 100644 --- a/src/im_format.cpp +++ b/src/im_format.cpp @@ -2,7 +2,7 @@ * \brief File Format Access * * See Copyright Notice in im_lib.h - * $Id: im_format.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ @@ -163,7 +163,7 @@ static char* utlFileGetExt(const char *file_name) return file_ext; } -imFormat* imFormatOpen(const char* file_name, int *error) +imFileFormatBase* imFileFormatBaseOpen(const char* file_name, int *error) { int i; @@ -191,18 +191,20 @@ imFormat* imFormatOpen(const char* file_name, int *error) { ext_mark[i] = 1; // Mark this format to avoid testing it again in the next phase - *error = iformat->Open(file_name); + imFileFormatBase* ifileformat = iformat->Create(); + *error = ifileformat->Open(file_name); if (*error != IM_ERR_NONE && *error != IM_ERR_FORMAT) // Error situation that must abort { // Only IM_ERR_FORMAT is a valid error here free(extension); delete [] ext_mark; + delete ifileformat; return NULL; } else if (*error == IM_ERR_NONE) // Sucessfully oppened the file { free(extension); delete [] ext_mark; - return iformat; + return ifileformat; } } } @@ -218,17 +220,18 @@ imFormat* imFormatOpen(const char* file_name, int *error) if (!ext_mark[i]) { imFormat* iformat = iFormatList[i]; - - *error = iformat->Open(file_name); + imFileFormatBase* ifileformat = iformat->Create(); + *error = ifileformat->Open(file_name); if (*error != IM_ERR_NONE && *error != IM_ERR_FORMAT) // Error situation that must abort { // Only IM_ERR_FORMAT is a valid error here delete [] ext_mark; + delete ifileformat; return NULL; } else if (*error == IM_ERR_NONE) // Sucessfully oppened the file { delete [] ext_mark; - return iformat; + return ifileformat; } } } @@ -238,7 +241,7 @@ imFormat* imFormatOpen(const char* file_name, int *error) return NULL; } -imFormat* imFormatOpenAs(const char* file_name, const char* format, int *error) +imFileFormatBase* imFileFormatBaseOpenAs(const char* file_name, const char* format, int *error) { assert(file_name); assert(format); @@ -257,17 +260,21 @@ imFormat* imFormatOpenAs(const char* file_name, const char* format, int *error) return NULL; } - *error = iformat->Open(file_name); + imFileFormatBase* ifileformat = iformat->Create(); + *error = ifileformat->Open(file_name); if (*error != IM_ERR_NONE && *error != IM_ERR_FORMAT) // Error situation that must abort + { + delete ifileformat; return NULL; + } else if (*error == IM_ERR_NONE) // Sucessfully oppened the file - return iformat; + return ifileformat; *error = IM_ERR_FORMAT; return NULL; } -imFormat* imFormatNew(const char* file_name, const char* format, int *error) +imFileFormatBase* imFileFormatBaseNew(const char* file_name, const char* format, int *error) { assert(file_name); assert(format); @@ -280,10 +287,13 @@ imFormat* imFormatNew(const char* file_name, const char* format, int *error) return NULL; } - *error = iformat->New(file_name); + imFileFormatBase* ifileformat = iformat->Create(); + *error = ifileformat->New(file_name); if (*error) + { + delete ifileformat; return NULL; + } - return iformat; + return ifileformat; } - diff --git a/src/im_format_avi.cpp b/src/im_format_avi.cpp index 3de98d4..632e45b 100644 --- a/src/im_format_avi.cpp +++ b/src/im_format_avi.cpp @@ -2,7 +2,7 @@ * \brief AVI - Windows Audio-Video Interleaved RIFF * * See Copyright Notice in im_lib.h - * $Id: im_format_avi.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_avi.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -41,7 +41,7 @@ static const char* iAVICompTable[15] = "CUSTOM" // (show compression dialog) }; -class imFormatAVI: public imFormat +class imFileFormatAVI: public imFileFormatBase { PAVIFILE file; PAVISTREAM stream; @@ -63,15 +63,8 @@ class imFormatAVI: public imFormat void InitMasks(imDib* dib); public: - imFormatAVI() - :imFormat("AVI", - "Windows Audio-Video Interleaved RIFF", - "*.avi;", - iAVICompTable, - 15, - 1) - {} - ~imFormatAVI() {} + imFileFormatAVI(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatAVI() {} int Open(const char* file_name); int New(const char* file_name); @@ -81,6 +74,22 @@ public: int ReadImageData(void* data); int WriteImageInfo(); int WriteImageData(void* data); +}; + +class imFormatAVI: public imFormat +{ +public: + imFormatAVI() + :imFormat("AVI", + "Windows Audio-Video Interleaved RIFF", + "*.avi;", + iAVICompTable, + 15, + 1) + {} + ~imFormatAVI() {} + + imFileFormatBase* Create(void) const { return new imFileFormatAVI(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -89,9 +98,9 @@ void imFormatRegisterAVI(void) imFormatRegister(new imFormatAVI()); } -int imFormatAVI::Open(const char* file_name) +int imFileFormatAVI::Open(const char* file_name) { - /* initializes avi file library */ + /* initializes avi file library, can be called many times */ AVIFileInit(); /* open existing file */ @@ -152,9 +161,9 @@ int imFormatAVI::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatAVI::New(const char* file_name) +int imFileFormatAVI::New(const char* file_name) { - /* initializes avi file library */ + /* initializes avi file library, can be called many times */ AVIFileInit(); /* creates a new file */ @@ -179,7 +188,7 @@ int imFormatAVI::New(const char* file_name) return IM_ERR_NONE; } -void imFormatAVI::Close() +void imFileFormatAVI::Close() { if (this->dib) imDibDestroy(this->dib); @@ -193,10 +202,10 @@ void imFormatAVI::Close() if (this->stream) AVIStreamRelease(this->stream); AVIFileRelease(this->file); - AVIFileExit(); + AVIFileExit(); /* called one for each AVIFileInit */ } -void* imFormatAVI::Handle(int index) +void* imFileFormatAVI::Handle(int index) { if (index == 1) return (void*)this->file; @@ -206,7 +215,7 @@ void* imFormatAVI::Handle(int index) return NULL; } -int imFormatAVI::ReadImageInfo(int index) +int imFileFormatAVI::ReadImageInfo(int index) { this->current_frame = index; @@ -280,7 +289,7 @@ int imFormatAVI::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatAVI::WriteImageInfo() +int imFileFormatAVI::WriteImageInfo() { if (dib) { @@ -423,7 +432,7 @@ int imFormatAVI::WriteImageInfo() return IM_ERR_NONE; } -void imFormatAVI::ReadPalette(unsigned char* bmp_colors) +void imFileFormatAVI::ReadPalette(unsigned char* bmp_colors) { /* convert the color map to the IM format */ for (int c = 0; c < this->palette_count; c++) @@ -435,7 +444,7 @@ void imFormatAVI::ReadPalette(unsigned char* bmp_colors) } } -void imFormatAVI::WritePalette(unsigned char* bmp_colors) +void imFileFormatAVI::WritePalette(unsigned char* bmp_colors) { /* convert the color map to the IM format */ for (int c = 0; c < this->palette_count; c++) @@ -446,7 +455,7 @@ void imFormatAVI::WritePalette(unsigned char* bmp_colors) } } -void imFormatAVI::InitMasks(imDib* dib) +void imFileFormatAVI::InitMasks(imDib* dib) { if (dib->bmih->biCompression == BI_BITFIELDS) { @@ -495,7 +504,7 @@ void imFormatAVI::InitMasks(imDib* dib) } } -void imFormatAVI::FixRGB(int bpp) +void imFileFormatAVI::FixRGB(int bpp) { int x; @@ -552,7 +561,7 @@ void imFormatAVI::FixRGB(int bpp) } } -int imFormatAVI::ReadImageData(void* data) +int imFileFormatAVI::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading AVI Frame..."); @@ -596,7 +605,7 @@ int imFormatAVI::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatAVI::WriteImageData(void* data) +int imFileFormatAVI::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing AVI Frame..."); diff --git a/src/im_format_bmp.cpp b/src/im_format_bmp.cpp index 809169b..5ec4938 100644 --- a/src/im_format_bmp.cpp +++ b/src/im_format_bmp.cpp @@ -2,7 +2,7 @@ * \brief BMP - Windows Device Independent Bitmap * * See Copyright Notice in im_lib.h - * $Id: im_format_bmp.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_bmp.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -283,7 +283,7 @@ static const char* iBMPCompTable[2] = "RLE" }; -class imFormatBMP: public imFormat +class imFileFormatBMP: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ unsigned short bpp; /* number of bits per pixel */ @@ -298,6 +298,22 @@ class imFormatBMP: public imFormat int WritePalette(); void FixRGBOrder(); +public: + imFileFormatBMP(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatBMP() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatBMP: public imFormat +{ public: imFormatBMP() :imFormat("BMP", @@ -309,23 +325,17 @@ public: {} ~imFormatBMP() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatBMP(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; + void imFormatRegisterBMP(void) { imFormatRegister(new imFormatBMP()); } -int imFormatBMP::Open(const char* file_name) +int imFileFormatBMP::Open(const char* file_name) { unsigned short id; unsigned int dword; @@ -404,7 +414,7 @@ int imFormatBMP::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatBMP::New(const char* file_name) +int imFileFormatBMP::New(const char* file_name) { /* opens the binary file for writing with intel byte order */ handle = imBinFileNew(file_name); @@ -418,12 +428,12 @@ int imFormatBMP::New(const char* file_name) return IM_ERR_NONE; } -void imFormatBMP::Close() +void imFileFormatBMP::Close() { imBinFileClose(handle); } -void* imFormatBMP::Handle(int index) +void* imFileFormatBMP::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -431,7 +441,7 @@ void* imFormatBMP::Handle(int index) return NULL; } -int imFormatBMP::ReadImageInfo(int index) +int imFileFormatBMP::ReadImageInfo(int index) { (void)index; unsigned int dword; @@ -614,7 +624,7 @@ int imFormatBMP::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatBMP::WriteImageInfo() +int imFileFormatBMP::WriteImageInfo() { // force bottom up orientation this->file_data_type = IM_BYTE; @@ -735,7 +745,7 @@ int imFormatBMP::WriteImageInfo() return IM_ERR_NONE; } -int imFormatBMP::ReadPalette() +int imFileFormatBMP::ReadPalette() { int nc; if (this->is_os2) @@ -762,7 +772,7 @@ int imFormatBMP::ReadPalette() return IM_ERR_NONE; } -int imFormatBMP::WritePalette() +int imFileFormatBMP::WritePalette() { unsigned char bmp_colors[256 * 4]; @@ -783,7 +793,7 @@ int imFormatBMP::WritePalette() return IM_ERR_NONE; } -void imFormatBMP::FixRGBOrder() +void imFileFormatBMP::FixRGBOrder() { int x; @@ -844,7 +854,7 @@ void imFormatBMP::FixRGBOrder() } } -int imFormatBMP::ReadImageData(void* data) +int imFileFormatBMP::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading BMP..."); @@ -879,7 +889,7 @@ int imFormatBMP::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatBMP::WriteImageData(void* data) +int imFileFormatBMP::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing BMP..."); diff --git a/src/im_format_ecw.cpp b/src/im_format_ecw.cpp index 0b77b56..bba99b0 100644 --- a/src/im_format_ecw.cpp +++ b/src/im_format_ecw.cpp @@ -23,20 +23,14 @@ static const char* iECWCompTable[2] = "JPEG-2000", }; -class imFormatECW: public imFormat +class imFileFormatECW: public imFileFormatBase { NCSFileView *pNCSFileView; // NCSEcwCompressClient *pClient; public: - imFormatECW() - :imFormat("ECW", - "ECW JPEG-2000 File Format", - "*.ecw;*.jp2;*.j2k;*.jpc;*.j2c;", - iECWCompTable, - 2, - 0) - {} + imFileFormatECW(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatECW() {} int Open(const char* file_name); int New(const char* file_name); @@ -46,6 +40,22 @@ public: int ReadImageData(void* data); int WriteImageInfo(){return 0;} // do nothing for now; int WriteImageData(void* data){(void)data; return 0;} // do nothing for now; +}; + +class imFormatECW: public imFormat +{ +public: + imFormatECW() + :imFormat("ECW", + "ECW JPEG-2000 File Format", + "*.ecw;*.jp2;*.j2k;*.jpc;*.j2c;", + iECWCompTable, + 2, + 0) + {} + ~imFormatECW() {} + + imFileFormatBase* Create(void) const { return new imFileFormatECW(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -54,7 +64,7 @@ void imFormatRegisterECW(void) imFormatRegister(new imFormatECW()); } -int imFormatECW::Open(const char* file_name) +int imFileFormatECW::Open(const char* file_name) { NCSError eError = NCScbmOpenFileView((char*)file_name, &this->pNCSFileView, NULL); if (eError != NCS_SUCCESS) @@ -82,7 +92,7 @@ int imFormatECW::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatECW::New(const char* file_name) +int imFileFormatECW::New(const char* file_name) { strcpy(this->compression, "JPEG-2000"); this->image_count = 1; @@ -91,7 +101,7 @@ int imFormatECW::New(const char* file_name) return IM_ERR_FORMAT; } -void imFormatECW::Close() +void imFileFormatECW::Close() { if (this->is_new) ;// NCSEcwCompressClose(this->pClient); @@ -99,7 +109,7 @@ void imFormatECW::Close() NCScbmCloseFileView(this->pNCSFileView); } -void* imFormatECW::Handle(int index) +void* imFileFormatECW::Handle(int index) { (void)index; @@ -109,7 +119,7 @@ void* imFormatECW::Handle(int index) return (void*)this->pNCSFileView; } -int imFormatECW::ReadImageInfo(int index) +int imFileFormatECW::ReadImageInfo(int index) { NCSFileViewFileInfoEx *pNCSFileInfo; imAttribTable* attrib_table = AttribTable(); @@ -245,7 +255,7 @@ static void iCopyDataBuffer(UINT8 **ppOutputLine, imbyte* line_buffer, int nBand memcpy(line_buffer, ppOutputLine[0], nBands*type_size*view_width); } -int imFormatECW::ReadImageData(void* data) +int imFileFormatECW::ReadImageData(void* data) { imAttribTable* attrib_table = AttribTable(); int i, *attrib_data, view_width, view_height, diff --git a/src/im_format_gif.cpp b/src/im_format_gif.cpp index ce371ba..390271a 100644 --- a/src/im_format_gif.cpp +++ b/src/im_format_gif.cpp @@ -2,7 +2,7 @@ * \brief GIF - Graphics Interchange Format * * See Copyright Notice in im_lib.h - * $Id: im_format_gif.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_gif.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -932,7 +932,7 @@ static const char* iGIFCompTable[1] = "LZW" }; -class imFormatGIF: public imFormat +class imFileFormatGIF: public imFileFormatBase { imBinFile* handle; iGIFData gif_data; @@ -940,6 +940,22 @@ class imFormatGIF: public imFormat int GIFReadImageInfo(); int GIFWriteImageInfo(); +public: + imFileFormatGIF(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatGIF() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatGIF: public imFormat +{ public: imFormatGIF() :imFormat("GIF", @@ -951,14 +967,7 @@ public: {} ~imFormatGIF() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatGIF(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -967,7 +976,7 @@ void imFormatRegisterGIF(void) imFormatRegister(new imFormatGIF()); } -int imFormatGIF::Open(const char* file_name) +int imFileFormatGIF::Open(const char* file_name) { this->handle = imBinFileOpen(file_name); if (this->handle == NULL) @@ -1044,7 +1053,7 @@ int imFormatGIF::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatGIF::New(const char* file_name) +int imFileFormatGIF::New(const char* file_name) { this->handle = imBinFileNew(file_name); if (this->handle == NULL) @@ -1070,7 +1079,7 @@ int imFormatGIF::New(const char* file_name) return IM_ERR_NONE; } -void imFormatGIF::Close() +void imFileFormatGIF::Close() { if (this->is_new && !imBinFileError(this->handle)) imBinFileWrite(this->handle, (void*)";", 1, 1); @@ -1078,7 +1087,7 @@ void imFormatGIF::Close() imBinFileClose(this->handle); } -void* imFormatGIF::Handle(int index) +void* imFileFormatGIF::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -1086,7 +1095,7 @@ void* imFormatGIF::Handle(int index) return NULL; } -int imFormatGIF::GIFReadImageInfo() +int imFileFormatGIF::GIFReadImageInfo() { imbyte byte_value; imushort word_value; @@ -1165,7 +1174,7 @@ int imFormatGIF::GIFReadImageInfo() return IM_ERR_NONE; } -int imFormatGIF::GIFWriteImageInfo() +int imFileFormatGIF::GIFWriteImageInfo() { this->file_data_type = IM_BYTE; this->file_color_mode = imColorModeSpace(this->user_color_mode); @@ -1235,7 +1244,7 @@ int imFormatGIF::GIFWriteImageInfo() return IM_ERR_NONE; } -int imFormatGIF::ReadImageInfo(int index) +int imFileFormatGIF::ReadImageInfo(int index) { imAttribTable* attrib_table = AttribTable(); attrib_table->RemoveAll(); @@ -1316,7 +1325,7 @@ int imFormatGIF::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatGIF::WriteImageInfo() +int imFileFormatGIF::WriteImageInfo() { this->file_color_mode = imColorModeSpace(this->user_color_mode); this->file_color_mode |= IM_TOPDOWN; @@ -1396,7 +1405,7 @@ int imFormatGIF::WriteImageInfo() return iGIFCompressOutput(&gif_data, handle, gif_data.ClearCode); } -int imFormatGIF::ReadImageData(void* data) +int imFileFormatGIF::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading GIF..."); @@ -1433,7 +1442,7 @@ int imFormatGIF::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatGIF::WriteImageData(void* data) +int imFileFormatGIF::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing GIF..."); diff --git a/src/im_format_ico.cpp b/src/im_format_ico.cpp index d4d1884..b10f30e 100644 --- a/src/im_format_ico.cpp +++ b/src/im_format_ico.cpp @@ -2,7 +2,7 @@ * \brief ICO - Windows Icon * * See Copyright Notice in im_lib.h - * $Id: im_format_ico.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_ico.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -49,7 +49,7 @@ static const char* iICOCompTable[1] = "NONE" }; -class imFormatICO: public imFormat +class imFileFormatICO: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ unsigned short bpp; /* number of bits per pixel */ @@ -61,6 +61,22 @@ class imFormatICO: public imFormat int WritePalette(); void FixRGBOrder(); +public: + imFileFormatICO(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatICO() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatICO: public imFormat +{ public: imFormatICO() :imFormat("ICO", @@ -72,23 +88,17 @@ public: {} ~imFormatICO() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatICO(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; + void imFormatRegisterICO(void) { imFormatRegister(new imFormatICO()); } -int imFormatICO::Open(const char* file_name) +int imFileFormatICO::Open(const char* file_name) { unsigned short word; @@ -145,7 +155,7 @@ int imFormatICO::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatICO::New(const char* file_name) +int imFileFormatICO::New(const char* file_name) { /* opens the binary file for writing with intel byte order */ handle = imBinFileNew(file_name); @@ -165,7 +175,7 @@ int imFormatICO::New(const char* file_name) return IM_ERR_NONE; } -void imFormatICO::Close() +void imFileFormatICO::Close() { if (this->is_new) { @@ -180,7 +190,7 @@ void imFormatICO::Close() imBinFileClose(handle); } -void* imFormatICO::Handle(int index) +void* imFileFormatICO::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -188,7 +198,7 @@ void* imFormatICO::Handle(int index) return NULL; } -int imFormatICO::ReadImageInfo(int index) +int imFileFormatICO::ReadImageInfo(int index) { this->file_data_type = IM_BYTE; unsigned int dword_value; @@ -270,7 +280,7 @@ int imFormatICO::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatICO::WriteImageInfo() +int imFileFormatICO::WriteImageInfo() { this->file_data_type = IM_BYTE; this->file_color_mode = imColorModeSpace(this->user_color_mode); @@ -368,7 +378,7 @@ int imFormatICO::WriteImageInfo() return IM_ERR_NONE; } -int imFormatICO::ReadPalette() +int imFileFormatICO::ReadPalette() { /* reads the color palette */ unsigned char bmp_colors[256 * 4]; @@ -389,7 +399,7 @@ int imFormatICO::ReadPalette() return IM_ERR_NONE; } -int imFormatICO::WritePalette() +int imFileFormatICO::WritePalette() { unsigned char bmp_colors[256 * 4]; @@ -410,7 +420,7 @@ int imFormatICO::WritePalette() return IM_ERR_NONE; } -void imFormatICO::FixRGBOrder() +void imFileFormatICO::FixRGBOrder() { if (this->bpp == 24) { @@ -455,7 +465,7 @@ static inline int PixelOffset(int is_top_down, int is_packed, int width, int hei return plane*width*height + row*width + col; } -int imFormatICO::ReadImageData(void* data) +int imFileFormatICO::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading ICO..."); @@ -542,7 +552,7 @@ int imFormatICO::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatICO::WriteImageData(void* data) +int imFileFormatICO::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing ICO..."); diff --git a/src/im_format_jp2.cpp b/src/im_format_jp2.cpp index 16e2c60..de25e88 100644 --- a/src/im_format_jp2.cpp +++ b/src/im_format_jp2.cpp @@ -3,7 +3,7 @@ * * See Copyright Notice in im_lib.h * See libJaper Copyright Notice in jasper.h - * $Id: im_format_jp2.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_jp2.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -103,6 +103,26 @@ static const char* iJP2CompTable[1] = "JPEG-2000", }; +class imFileFormatJP2: public imFileFormatBase +{ + int fmtid; + jas_stream_t *stream; + jas_image_t *image; + +public: + imFileFormatJP2(const imFormat* _iformat): imFileFormatBase(_iformat), image(0) {} + ~imFileFormatJP2() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + class imFormatJP2: public imFormat { int fmtid; @@ -118,18 +138,10 @@ public: 1, 0) { - image = 0; } ~imFormatJP2() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatJP2(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -166,7 +178,7 @@ void imFormatRegisterJP2(void) imFormatRegister(new imFormatJP2()); } -int imFormatJP2::Open(const char* file_name) +int imFileFormatJP2::Open(const char* file_name) { this->stream = jas_binfile_open(file_name, 0); if (this->stream == NULL) @@ -185,7 +197,7 @@ int imFormatJP2::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatJP2::New(const char* file_name) +int imFileFormatJP2::New(const char* file_name) { this->stream = jas_binfile_open(file_name, 1); if (this->stream == NULL) @@ -197,7 +209,7 @@ int imFormatJP2::New(const char* file_name) return IM_ERR_NONE; } -void imFormatJP2::Close() +void imFileFormatJP2::Close() { if (this->image) jas_image_destroy(this->image); @@ -205,7 +217,7 @@ void imFormatJP2::Close() jas_stream_close(this->stream); } -void* imFormatJP2::Handle(int index) +void* imFileFormatJP2::Handle(int index) { if (index == 0) return (void*)this->stream->obj_; @@ -217,7 +229,7 @@ void* imFormatJP2::Handle(int index) return NULL; } -int imFormatJP2::ReadImageInfo(int index) +int imFileFormatJP2::ReadImageInfo(int index) { (void)index; @@ -290,7 +302,7 @@ int imFormatJP2::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatJP2::WriteImageInfo() +int imFileFormatJP2::WriteImageInfo() { this->file_data_type = this->user_data_type; this->file_color_mode = imColorModeSpace(this->user_color_mode); @@ -377,7 +389,7 @@ int imFormatJP2::WriteImageInfo() return IM_ERR_NONE; } -int imFormatJP2::ReadImageData(void* data) +int imFileFormatJP2::ReadImageData(void* data) { int count = imFileLineBufferCount(this); @@ -419,7 +431,7 @@ int imFormatJP2::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatJP2::WriteImageData(void* data) +int imFileFormatJP2::WriteImageData(void* data) { int count = imFileLineBufferCount(this); imCounterTotal(this->counter, count, "Writing JP2..."); /* first time count */ diff --git a/src/im_format_jpeg.cpp b/src/im_format_jpeg.cpp index 91d0ae9..487db0b 100644 --- a/src/im_format_jpeg.cpp +++ b/src/im_format_jpeg.cpp @@ -3,7 +3,7 @@ * * See Copyright Notice in im_lib.h * See libJPEG Copyright Notice in jpeglib.h - * $Id: im_format_jpeg.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_jpeg.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -69,7 +69,7 @@ static const char* iJPEGCompTable[1] = "JPEG" }; -class imFormatJPEG: public imFormat +class imFileFormatJPEG: public imFileFormatBase { jpeg_decompress_struct dinfo; jpeg_compress_struct cinfo; @@ -83,6 +83,22 @@ class imFormatJPEG: public imFormat void iWriteExifAttrib(imAttribTable* attrib_table); #endif +public: + imFileFormatJPEG(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatJPEG() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatJPEG: public imFormat +{ public: imFormatJPEG() :imFormat("JPEG", @@ -94,14 +110,7 @@ public: {} ~imFormatJPEG() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatJPEG(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -110,7 +119,7 @@ void imFormatRegisterJPEG(void) imFormatRegister(new imFormatJPEG()); } -int imFormatJPEG::Open(const char* file_name) +int imFileFormatJPEG::Open(const char* file_name) { this->handle = imBinFileOpen(file_name); if (this->handle == NULL) @@ -158,7 +167,7 @@ int imFormatJPEG::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatJPEG::New(const char* file_name) +int imFileFormatJPEG::New(const char* file_name) { this->handle = imBinFileNew(file_name); if (this->handle == NULL) @@ -190,7 +199,7 @@ int imFormatJPEG::New(const char* file_name) return IM_ERR_NONE; } -void imFormatJPEG::Close() +void imFileFormatJPEG::Close() { if (this->is_new) jpeg_destroy_compress(&this->cinfo); @@ -200,7 +209,7 @@ void imFormatJPEG::Close() imBinFileClose(this->handle); } -void* imFormatJPEG::Handle(int index) +void* imFileFormatJPEG::Handle(int index) { if (index == 0) return this->handle; @@ -216,7 +225,7 @@ void* imFormatJPEG::Handle(int index) } #ifdef USE_EXIF -void imFormatJPEG::iReadExifAttrib(unsigned char* data, int data_length, imAttribTable* attrib_table) +void imFileFormatJPEG::iReadExifAttrib(unsigned char* data, int data_length, imAttribTable* attrib_table) { ExifData* exif = exif_data_new_from_data(data, data_length); if (!exif) @@ -377,7 +386,7 @@ static void iGetRational(float fvalue, int *num, int *den, int sign) *num = sign * imRound(fvalue); } -void imFormatJPEG::iWriteExifAttrib(imAttribTable* attrib_table) +void imFileFormatJPEG::iWriteExifAttrib(imAttribTable* attrib_table) { ExifData* exif = exif_data_new(); @@ -525,7 +534,7 @@ void imFormatJPEG::iWriteExifAttrib(imAttribTable* attrib_table) } #endif -int imFormatJPEG::ReadImageInfo(int index) +int imFileFormatJPEG::ReadImageInfo(int index) { (void)index; this->fix_adobe = 0; @@ -635,7 +644,7 @@ int imFormatJPEG::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatJPEG::WriteImageInfo() +int imFileFormatJPEG::WriteImageInfo() { this->file_color_mode = imColorModeSpace(this->user_color_mode); this->file_color_mode |= IM_TOPDOWN; @@ -737,7 +746,7 @@ static void iFixAdobe(unsigned char* line_buffer, int width) } } -int imFormatJPEG::ReadImageData(void* data) +int imFileFormatJPEG::ReadImageData(void* data) { if (setjmp(this->jerr.setjmp_buffer)) return IM_ERR_ACCESS; @@ -769,7 +778,7 @@ int imFormatJPEG::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatJPEG::WriteImageData(void* data) +int imFileFormatJPEG::WriteImageData(void* data) { if (setjmp(this->jerr.setjmp_buffer)) return IM_ERR_ACCESS; diff --git a/src/im_format_krn.cpp b/src/im_format_krn.cpp index 41c9be7..21261a8 100644 --- a/src/im_format_krn.cpp +++ b/src/im_format_krn.cpp @@ -2,7 +2,7 @@ * \brief KRN - IM Kernel File Format * * See Copyright Notice in im_lib.h - * $Id: im_format_krn.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_krn.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -124,10 +124,26 @@ static const char* iKRNCompTable[1] = "NONE" }; -class imFormatKRN: public imFormat +class imFileFormatKRN: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ +public: + imFileFormatKRN(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatKRN() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatKRN: public imFormat +{ public: imFormatKRN() :imFormat("KRN", @@ -139,14 +155,7 @@ public: {} ~imFormatKRN() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatKRN(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -155,7 +164,7 @@ void imFormatRegisterKRN(void) imFormatRegister(new imFormatKRN()); } -int imFormatKRN::Open(const char* file_name) +int imFileFormatKRN::Open(const char* file_name) { char sig[9]; @@ -186,7 +195,7 @@ int imFormatKRN::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatKRN::New(const char* file_name) +int imFileFormatKRN::New(const char* file_name) { /* opens the binary file for writing */ handle = imBinFileNew(file_name); @@ -203,12 +212,12 @@ int imFormatKRN::New(const char* file_name) return IM_ERR_NONE; } -void imFormatKRN::Close() +void imFileFormatKRN::Close() { imBinFileClose(handle); } -void* imFormatKRN::Handle(int index) +void* imFileFormatKRN::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -216,7 +225,7 @@ void* imFormatKRN::Handle(int index) return NULL; } -int imFormatKRN::ReadImageInfo(int index) +int imFileFormatKRN::ReadImageInfo(int index) { (void)index; this->file_color_mode = IM_GRAY|IM_TOPDOWN; @@ -248,7 +257,7 @@ int imFormatKRN::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatKRN::WriteImageInfo() +int imFileFormatKRN::WriteImageInfo() { this->file_data_type = this->user_data_type; this->file_color_mode = IM_GRAY|IM_TOPDOWN; @@ -283,7 +292,7 @@ int imFormatKRN::WriteImageInfo() return IM_ERR_NONE; } -int imFormatKRN::ReadImageData(void* data) +int imFileFormatKRN::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading KRN..."); @@ -318,7 +327,7 @@ int imFormatKRN::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatKRN::WriteImageData(void* data) +int imFileFormatKRN::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing KRN..."); diff --git a/src/im_format_led.cpp b/src/im_format_led.cpp index d67ee8c..eb7173c 100644 --- a/src/im_format_led.cpp +++ b/src/im_format_led.cpp @@ -2,7 +2,7 @@ * \brief LED - IUP image in LED * * See Copyright Notice in im_lib.h - * $Id: im_format_led.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_led.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -81,7 +81,7 @@ static const char* iLEDCompTable[1] = "NONE" }; -class imFormatLED: public imFormat +class imFileFormatLED: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ int pal_count; @@ -89,6 +89,22 @@ class imFormatLED: public imFormat int ReadPalette(); int WritePalette(); +public: + imFileFormatLED(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatLED() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatLED: public imFormat +{ public: imFormatLED() :imFormat("LED", @@ -100,23 +116,17 @@ public: {} ~imFormatLED() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatLED(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; + void imFormatRegisterLED(void) { imFormatRegister(new imFormatLED()); } -int imFormatLED::Open(const char* file_name) +int imFileFormatLED::Open(const char* file_name) { char sig[4]; unsigned char byte_value; @@ -171,7 +181,7 @@ int imFormatLED::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatLED::New(const char* file_name) +int imFileFormatLED::New(const char* file_name) { /* opens the binary file for writing */ handle = imBinFileNew(file_name); @@ -190,12 +200,12 @@ int imFormatLED::New(const char* file_name) return IM_ERR_NONE; } -void imFormatLED::Close() +void imFileFormatLED::Close() { imBinFileClose(handle); } -void* imFormatLED::Handle(int index) +void* imFileFormatLED::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -203,7 +213,7 @@ void* imFormatLED::Handle(int index) return NULL; } -int imFormatLED::ReadImageInfo(int index) +int imFileFormatLED::ReadImageInfo(int index) { (void)index; @@ -225,7 +235,7 @@ int imFormatLED::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatLED::WriteImageInfo() +int imFileFormatLED::WriteImageInfo() { this->file_data_type = IM_BYTE; this->file_color_mode = imColorModeSpace(this->user_color_mode); @@ -239,7 +249,7 @@ int imFormatLED::WriteImageInfo() return IM_ERR_NONE; } -int imFormatLED::ReadPalette() +int imFileFormatLED::ReadPalette() { int c, r, g, b, i; @@ -260,7 +270,7 @@ int imFormatLED::ReadPalette() return IM_ERR_NONE; } -int imFormatLED::WritePalette() +int imFileFormatLED::WritePalette() { int c; unsigned char r, g, b; @@ -285,7 +295,7 @@ int imFormatLED::WritePalette() return IM_ERR_NONE; } -int imFormatLED::ReadImageData(void* data) +int imFileFormatLED::ReadImageData(void* data) { int value; @@ -310,7 +320,7 @@ int imFormatLED::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatLED::WriteImageData(void* data) +int imFileFormatLED::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing LED..."); diff --git a/src/im_format_pcx.cpp b/src/im_format_pcx.cpp index 32487bc..fd206ae 100644 --- a/src/im_format_pcx.cpp +++ b/src/im_format_pcx.cpp @@ -2,7 +2,7 @@ * \brief PCX - ZSoft Picture * * See Copyright Notice in im_lib.h - * $Id: im_format_pcx.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_pcx.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -145,7 +145,7 @@ static const char* iPCXCompTable[2] = "RLE" }; -class imFormatPCX: public imFormat +class imFileFormatPCX: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ int bpp; /* number of bits per pixel */ @@ -159,6 +159,22 @@ class imFormatPCX: public imFormat void Pack24bpp(); void Unpack24bpp(); +public: + imFileFormatPCX(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatPCX() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatPCX: public imFormat +{ public: imFormatPCX() :imFormat("PCX", @@ -170,23 +186,17 @@ public: {} ~imFormatPCX() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatPCX(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; + void imFormatRegisterPCX(void) { imFormatRegister(new imFormatPCX()); } -int imFormatPCX::Open(const char* file_name) +int imFileFormatPCX::Open(const char* file_name) { unsigned char id; @@ -226,7 +236,7 @@ int imFormatPCX::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatPCX::New(const char* file_name) +int imFileFormatPCX::New(const char* file_name) { /* opens the binary file for writing with intel byte order */ handle = imBinFileNew(file_name); @@ -238,12 +248,12 @@ int imFormatPCX::New(const char* file_name) return IM_ERR_NONE; } -void imFormatPCX::Close() +void imFileFormatPCX::Close() { imBinFileClose(handle); } -void* imFormatPCX::Handle(int index) +void* imFileFormatPCX::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -251,7 +261,7 @@ void* imFormatPCX::Handle(int index) return NULL; } -int imFormatPCX::ReadImageInfo(int index) +int imFileFormatPCX::ReadImageInfo(int index) { unsigned char bppp, planes; unsigned short xmin, xmax, ymax, ymin, word, bplp; @@ -339,7 +349,7 @@ int imFormatPCX::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatPCX::WriteImageInfo() +int imFileFormatPCX::WriteImageInfo() { unsigned short word_value, bplp; unsigned char byte_value, filler[54+3*2]; @@ -447,7 +457,7 @@ int imFormatPCX::WriteImageInfo() return IM_ERR_NONE; } -int imFormatPCX::ReadPalette() +int imFileFormatPCX::ReadPalette() { unsigned char pcx_colors[256 * 3]; @@ -498,7 +508,7 @@ int imFormatPCX::ReadPalette() return IM_ERR_NONE; } -int imFormatPCX::WritePalette() +int imFileFormatPCX::WritePalette() { unsigned char ExtPal = (unsigned char)12; unsigned char pcx_colors[256 * 3]; @@ -522,7 +532,7 @@ int imFormatPCX::WritePalette() return IM_ERR_NONE; } -void imFormatPCX::Expand4bpp() +void imFileFormatPCX::Expand4bpp() { int num_bits = 8, WidthDiv8 = (this->width + 7) / 8; @@ -559,7 +569,7 @@ void imFormatPCX::Expand4bpp() memcpy(this->line_buffer, in_data + this->line_buffer_size+2, this->width); } -void imFormatPCX::Pack24bpp() +void imFileFormatPCX::Pack24bpp() { imbyte *in_data = (unsigned char*)this->line_buffer; imbyte *out_data = in_data + this->line_buffer_size+2; @@ -580,7 +590,7 @@ void imFormatPCX::Pack24bpp() memcpy(in_data, in_data + this->line_buffer_size+2, this->line_raw_size); } -void imFormatPCX::Unpack24bpp() +void imFileFormatPCX::Unpack24bpp() { imbyte *in_data = (unsigned char*)this->line_buffer; imbyte *out_data = in_data + this->line_buffer_size+2; @@ -601,7 +611,7 @@ void imFormatPCX::Unpack24bpp() memcpy(out_data - (this->line_buffer_size+2), out_data, this->line_raw_size); } -int imFormatPCX::ReadImageData(void* data) +int imFileFormatPCX::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading PCX..."); @@ -637,7 +647,7 @@ int imFormatPCX::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatPCX::WriteImageData(void* data) +int imFileFormatPCX::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing PCX..."); diff --git a/src/im_format_png.cpp b/src/im_format_png.cpp index 1e7f8ba..314f07f 100644 --- a/src/im_format_png.cpp +++ b/src/im_format_png.cpp @@ -3,7 +3,7 @@ * * See Copyright Notice in im_lib.h * See libPNG Copyright Notice in png.h - * $Id: im_format_png.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_png.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -42,7 +42,7 @@ static const char* iPNGCompTable[1] = "DEFLATE" }; -class imFormatPNG: public imFormat +class imFileFormatPNG: public imFileFormatBase { png_structp png_ptr; png_infop info_ptr; @@ -53,6 +53,22 @@ class imFormatPNG: public imFormat void iReadAttrib(imAttribTable* attrib_table); void iWriteAttrib(imAttribTable* attrib_table); +public: + imFileFormatPNG(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatPNG() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatPNG: public imFormat +{ public: imFormatPNG() :imFormat("PNG", @@ -64,14 +80,7 @@ public: {} ~imFormatPNG() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatPNG(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -80,7 +89,7 @@ void imFormatRegisterPNG(void) imFormatRegister(new imFormatPNG()); } -int imFormatPNG::Open(const char* file_name) +int imFileFormatPNG::Open(const char* file_name) { this->handle = imBinFileOpen(file_name); if (this->handle == NULL) @@ -115,7 +124,7 @@ int imFormatPNG::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatPNG::New(const char* file_name) +int imFileFormatPNG::New(const char* file_name) { this->handle = imBinFileNew(file_name); if (this->handle == NULL) @@ -134,7 +143,7 @@ int imFormatPNG::New(const char* file_name) return IM_ERR_NONE; } -void imFormatPNG::Close() +void imFileFormatPNG::Close() { if (this->is_new) png_destroy_write_struct(&this->png_ptr, &this->info_ptr); @@ -144,7 +153,7 @@ void imFormatPNG::Close() imBinFileClose(this->handle); } -void* imFormatPNG::Handle(int index) +void* imFileFormatPNG::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -154,7 +163,7 @@ void* imFormatPNG::Handle(int index) return 0; } -void imFormatPNG::iReadAttrib(imAttribTable* attrib_table) +void imFileFormatPNG::iReadAttrib(imAttribTable* attrib_table) { double gamma; if (png_get_gAMA(png_ptr, info_ptr, &gamma)) @@ -377,7 +386,7 @@ static int iFindAttribString(void* user_data, int index, const char* name, int d return 1; } -void imFormatPNG::iWriteAttrib(imAttribTable* attrib_table) +void imFileFormatPNG::iWriteAttrib(imAttribTable* attrib_table) { const void* attrib_data = attrib_table->Get("Gamma"); if (attrib_data) @@ -563,7 +572,7 @@ void imFormatPNG::iWriteAttrib(imAttribTable* attrib_table) } } -int imFormatPNG::ReadImageInfo(int index) +int imFileFormatPNG::ReadImageInfo(int index) { (void)index; @@ -678,7 +687,7 @@ int imFormatPNG::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatPNG::WriteImageInfo() +int imFileFormatPNG::WriteImageInfo() { this->file_color_mode = imColorModeSpace(this->user_color_mode); this->file_color_mode |= IM_TOPDOWN; @@ -805,7 +814,7 @@ static int iInterlaceRowCheck(int row_step, int pass) return 0; } -int imFormatPNG::ReadImageData(void* data) +int imFileFormatPNG::ReadImageData(void* data) { if (setjmp(this->png_ptr->jmpbuf)) return IM_ERR_ACCESS; @@ -856,7 +865,7 @@ int imFormatPNG::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatPNG::WriteImageData(void* data) +int imFileFormatPNG::WriteImageData(void* data) { if (setjmp(this->png_ptr->jmpbuf)) return IM_ERR_ACCESS; diff --git a/src/im_format_pnm.cpp b/src/im_format_pnm.cpp index 1c7832a..bd034ad 100644 --- a/src/im_format_pnm.cpp +++ b/src/im_format_pnm.cpp @@ -2,7 +2,7 @@ * \brief PNM - Netpbm Portable Image Map * * See Copyright Notice in im_lib.h - * $Id: im_format_pnm.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_pnm.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -98,13 +98,29 @@ static const char* iPNMCompTable[2] = "ASCII" }; -class imFormatPNM: public imFormat +class imFileFormatPNM: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ unsigned char image_type; void FixBinary(); +public: + imFileFormatPNM(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatPNM() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatPNM: public imFormat +{ public: imFormatPNM() :imFormat("PNM", @@ -116,23 +132,17 @@ public: {} ~imFormatPNM() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatPNM(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; + void imFormatRegisterPNM(void) { imFormatRegister(new imFormatPNM()); } -int imFormatPNM::Open(const char* file_name) +int imFileFormatPNM::Open(const char* file_name) { unsigned char sig[2]; @@ -168,7 +178,7 @@ int imFormatPNM::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatPNM::New(const char* file_name) +int imFileFormatPNM::New(const char* file_name) { /* opens the binary file for writing */ handle = imBinFileNew(file_name); @@ -180,12 +190,12 @@ int imFormatPNM::New(const char* file_name) return IM_ERR_NONE; } -void imFormatPNM::Close() +void imFileFormatPNM::Close() { imBinFileClose(handle); } -void* imFormatPNM::Handle(int index) +void* imFileFormatPNM::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -193,7 +203,7 @@ void* imFormatPNM::Handle(int index) return NULL; } -int imFormatPNM::ReadImageInfo(int index) +int imFileFormatPNM::ReadImageInfo(int index) { (void)index; @@ -249,7 +259,7 @@ int imFormatPNM::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatPNM::WriteImageInfo() +int imFileFormatPNM::WriteImageInfo() { this->file_data_type = this->user_data_type; this->file_color_mode = imColorModeSpace(this->user_color_mode); @@ -328,7 +338,7 @@ int imFormatPNM::WriteImageInfo() return IM_ERR_NONE; } -void imFormatPNM::FixBinary() +void imFileFormatPNM::FixBinary() { unsigned char* buf = (unsigned char*)this->line_buffer; for (int b = 0; b < this->line_buffer_size; b++) @@ -338,7 +348,7 @@ void imFormatPNM::FixBinary() } } -int imFormatPNM::ReadImageData(void* data) +int imFileFormatPNM::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading PNM..."); @@ -414,7 +424,7 @@ int imFormatPNM::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatPNM::WriteImageData(void* data) +int imFileFormatPNM::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing PNM..."); diff --git a/src/im_format_ras.cpp b/src/im_format_ras.cpp index bab074a..1960c49 100644 --- a/src/im_format_ras.cpp +++ b/src/im_format_ras.cpp @@ -2,7 +2,7 @@ * \brief RAS - Sun Raster File * * See Copyright Notice in im_lib.h - * $Id: im_format_ras.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_ras.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -153,7 +153,7 @@ static const char* iRASCompTable[2] = "RLE" }; -class imFormatRAS: public imFormat +class imFileFormatRAS: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ unsigned int bpp, /* number of bits per pixel */ @@ -165,6 +165,22 @@ class imFormatRAS: public imFormat int WritePalette(); void FixRGB(); +public: + imFileFormatRAS(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatRAS() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatRAS: public imFormat +{ public: imFormatRAS() :imFormat("RAS", @@ -176,23 +192,17 @@ public: {} ~imFormatRAS() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatRAS(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; + void imFormatRegisterRAS(void) { imFormatRegister(new imFormatRAS()); } -int imFormatRAS::Open(const char* file_name) +int imFileFormatRAS::Open(const char* file_name) { unsigned int dword_value; @@ -238,7 +248,7 @@ int imFormatRAS::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatRAS::New(const char* file_name) +int imFileFormatRAS::New(const char* file_name) { /* opens the binary file for writing with motorola byte order */ handle = imBinFileNew(file_name); @@ -252,12 +262,12 @@ int imFormatRAS::New(const char* file_name) return IM_ERR_NONE; } -void imFormatRAS::Close() +void imFileFormatRAS::Close() { imBinFileClose(handle); } -void* imFormatRAS::Handle(int index) +void* imFileFormatRAS::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -265,7 +275,7 @@ void* imFormatRAS::Handle(int index) return NULL; } -int imFormatRAS::ReadImageInfo(int index) +int imFileFormatRAS::ReadImageInfo(int index) { (void)index; unsigned int dword_value; @@ -347,7 +357,7 @@ int imFormatRAS::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatRAS::WriteImageInfo() +int imFileFormatRAS::WriteImageInfo() { this->file_data_type = IM_BYTE; this->file_color_mode = imColorModeSpace(this->user_color_mode); @@ -420,7 +430,7 @@ int imFormatRAS::WriteImageInfo() return IM_ERR_NONE; } -int imFormatRAS::ReadPalette() +int imFileFormatRAS::ReadPalette() { unsigned char ras_colors[256 * 3]; @@ -451,7 +461,7 @@ int imFormatRAS::ReadPalette() return IM_ERR_NONE; } -int imFormatRAS::WritePalette() +int imFileFormatRAS::WritePalette() { int c; unsigned char ras_colors[256 * 3]; @@ -471,7 +481,7 @@ int imFormatRAS::WritePalette() return IM_ERR_NONE; } -void imFormatRAS::FixRGB() +void imFileFormatRAS::FixRGB() { int x; imbyte* byte_data = (imbyte*)this->line_buffer; @@ -509,7 +519,7 @@ void imFormatRAS::FixRGB() } } -int imFormatRAS::ReadImageData(void* data) +int imFileFormatRAS::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading RAS..."); @@ -541,7 +551,7 @@ int imFormatRAS::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatRAS::WriteImageData(void* data) +int imFileFormatRAS::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing RAS..."); diff --git a/src/im_format_raw.cpp b/src/im_format_raw.cpp index 83ffadb..a7b7934 100644 --- a/src/im_format_raw.cpp +++ b/src/im_format_raw.cpp @@ -2,7 +2,7 @@ * \brief RAW File Format * * See Copyright Notice in im_lib.h - * $Id: im_format_raw.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_raw.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -20,13 +20,29 @@ static const char* iRAWCompTable[1] = "NONE" }; -class imFormatRAW: public imFormat +class imFileFormatRAW: public imFileFormatBase { imBinFile* handle; int padding; int iRawUpdateParam(int index); +public: + imFileFormatRAW(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatRAW() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatRAW: public imFormat +{ public: imFormatRAW() :imFormat("RAW", @@ -38,23 +54,18 @@ public: {} ~imFormatRAW() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatRAW(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; -imFormat* imFormatInitRAW(void) + +imFileFormatBase* imFormatInitRAW(void) { - return new imFormatRAW(); + imFormatRAW iformat; + return iformat.Create(); } -int imFormatRAW::Open(const char* file_name) +int imFileFormatRAW::Open(const char* file_name) { this->handle = imBinFileOpen(file_name); if (this->handle == NULL) @@ -68,7 +79,7 @@ int imFormatRAW::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatRAW::New(const char* file_name) +int imFileFormatRAW::New(const char* file_name) { this->handle = imBinFileNew(file_name); if (this->handle == NULL) @@ -79,12 +90,12 @@ int imFormatRAW::New(const char* file_name) return IM_ERR_NONE; } -void imFormatRAW::Close() +void imFileFormatRAW::Close() { imBinFileClose(this->handle); } -void* imFormatRAW::Handle(int index) +void* imFileFormatRAW::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -106,7 +117,7 @@ static int iCalcPad(int padding, int line_size) } } -int imFormatRAW::iRawUpdateParam(int index) +int imFileFormatRAW::iRawUpdateParam(int index) { (void)index; @@ -156,12 +167,12 @@ int imFormatRAW::iRawUpdateParam(int index) return IM_ERR_NONE; } -int imFormatRAW::ReadImageInfo(int index) +int imFileFormatRAW::ReadImageInfo(int index) { return iRawUpdateParam(index); } -int imFormatRAW::WriteImageInfo() +int imFileFormatRAW::WriteImageInfo() { this->file_color_mode = this->user_color_mode; this->file_data_type = this->user_data_type; @@ -177,7 +188,7 @@ static int iFileDataTypeSize(int file_data_type, int switch_type) return type_size; } -int imFormatRAW::ReadImageData(void* data) +int imFileFormatRAW::ReadImageData(void* data) { int count = imFileLineBufferCount(this); int line_count = imImageLineCount(this->width, this->file_color_mode); @@ -214,7 +225,7 @@ int imFormatRAW::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatRAW::WriteImageData(void* data) +int imFileFormatRAW::WriteImageData(void* data) { int count = imFileLineBufferCount(this); int line_count = imImageLineCount(this->width, this->file_color_mode); @@ -267,4 +278,3 @@ int imFormatRAW::CanWrite(const char* compression, int color_mode, int data_type return IM_ERR_NONE; } - diff --git a/src/im_format_sgi.cpp b/src/im_format_sgi.cpp index 1b0ac0a..08bbf4d 100644 --- a/src/im_format_sgi.cpp +++ b/src/im_format_sgi.cpp @@ -2,7 +2,7 @@ * \brief SGI - Silicon Graphics Image File Format * * See Copyright Notice in im_lib.h - * $Id: im_format_sgi.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_sgi.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -133,14 +133,30 @@ static const char* iSGICompTable[2] = "RLE" }; -class imFormatSGI: public imFormat +class imFileFormatSGI: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ unsigned char comp_type, /* sgi compression information */ bpc; /* bytes per channels */ - unsigned int *starttab, /* compression control buffer */ - *lengthtab; /* compression control buffer */ + unsigned int *starttab, /* compression control buffer */ + *lengthtab; /* compression control buffer */ +public: + imFileFormatSGI(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatSGI() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatSGI: public imFormat +{ public: imFormatSGI() :imFormat("SGI", @@ -152,14 +168,7 @@ public: {} ~imFormatSGI() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatSGI(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -168,7 +177,7 @@ void imFormatRegisterSGI(void) imFormatRegister(new imFormatSGI()); } -int imFormatSGI::Open(const char* file_name) +int imFileFormatSGI::Open(const char* file_name) { unsigned short word_value; @@ -213,7 +222,7 @@ int imFormatSGI::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatSGI::New(const char* file_name) +int imFileFormatSGI::New(const char* file_name) { /* opens the binary file for writing with motorola byte order */ handle = imBinFileNew(file_name); @@ -230,14 +239,14 @@ int imFormatSGI::New(const char* file_name) return IM_ERR_NONE; } -void imFormatSGI::Close() +void imFileFormatSGI::Close() { if (this->starttab) free(this->starttab); if (this->lengthtab) free(this->lengthtab); imBinFileClose(handle); } -void* imFormatSGI::Handle(int index) +void* imFileFormatSGI::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -245,7 +254,7 @@ void* imFormatSGI::Handle(int index) return NULL; } -int imFormatSGI::ReadImageInfo(int index) +int imFileFormatSGI::ReadImageInfo(int index) { (void)index; unsigned short word_value, dimension, depth; @@ -378,7 +387,7 @@ int imFormatSGI::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatSGI::WriteImageInfo() +int imFileFormatSGI::WriteImageInfo() { unsigned int dword_value; unsigned short word_value; @@ -487,7 +496,7 @@ int imFormatSGI::WriteImageInfo() return IM_ERR_NONE; } -int imFormatSGI::ReadImageData(void* data) +int imFileFormatSGI::ReadImageData(void* data) { int count = imFileLineBufferCount(this); @@ -533,7 +542,7 @@ int imFormatSGI::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatSGI::WriteImageData(void* data) +int imFileFormatSGI::WriteImageData(void* data) { int count = imFileLineBufferCount(this); diff --git a/src/im_format_tga.cpp b/src/im_format_tga.cpp index 8e8e176..86e968a 100644 --- a/src/im_format_tga.cpp +++ b/src/im_format_tga.cpp @@ -2,7 +2,7 @@ * \brief TGA - Truevision Graphics Adapter File * * See Copyright Notice in im_lib.h - * $Id: im_format_tga.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_tga.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -207,7 +207,7 @@ static const char* iTGACompTable[2] = "RLE" }; -class imFormatTGA: public imFormat +class imFileFormatTGA: public imFileFormatBase { imBinFile* handle; /* the binary file handle */ unsigned char id_lenght; @@ -219,6 +219,22 @@ class imFormatTGA: public imFormat int LoadExtensionArea(); int SaveExtensionArea(); +public: + imFileFormatTGA(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatTGA() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatTGA: public imFormat +{ public: imFormatTGA() :imFormat("TGA", @@ -230,14 +246,7 @@ public: {} ~imFormatTGA() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatTGA(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -246,7 +255,7 @@ void imFormatRegisterTGA(void) imFormatRegister(new imFormatTGA()); } -int imFormatTGA::Open(const char* file_name) +int imFileFormatTGA::Open(const char* file_name) { /* opens the binary file for reading with intel byte order */ handle = imBinFileOpen(file_name); @@ -294,7 +303,7 @@ int imFormatTGA::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatTGA::New(const char* file_name) +int imFileFormatTGA::New(const char* file_name) { /* opens the binary file for writing with intel byte order */ handle = imBinFileNew(file_name); @@ -306,12 +315,12 @@ int imFormatTGA::New(const char* file_name) return IM_ERR_NONE; } -void imFormatTGA::Close() +void imFileFormatTGA::Close() { imBinFileClose(handle); } -void* imFormatTGA::Handle(int index) +void* imFileFormatTGA::Handle(int index) { if (index == 0) return (void*)this->handle; @@ -319,7 +328,7 @@ void* imFormatTGA::Handle(int index) return NULL; } -int imFormatTGA::ReadImageInfo(int index) +int imFileFormatTGA::ReadImageInfo(int index) { (void)index; unsigned char byte_value; @@ -436,7 +445,7 @@ int imFormatTGA::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatTGA::WriteImageInfo() +int imFileFormatTGA::WriteImageInfo() { unsigned char byte_value; unsigned short word_value; @@ -487,7 +496,7 @@ int imFormatTGA::WriteImageInfo() int length = 0; const char* desc_attrib = (const char*)attrib_table->Get("Title", NULL, &length); - if (desc) + if (desc_attrib) { if (length > 255) this->id_lenght = 255; @@ -600,7 +609,7 @@ static long iTGARGB2Color(int c, unsigned char *colors, int map_bpp) return imColorEncode(r, g, b); } -int imFormatTGA::ReadPalette() +int imFileFormatTGA::ReadPalette() { int map_size = imFileLineSizeAligned(this->palette_count, this->map_bpp, 1); unsigned char* tga_colors = (unsigned char*) malloc(map_size); @@ -622,7 +631,7 @@ int imFormatTGA::ReadPalette() return 1; } -int imFormatTGA::WritePalette() +int imFileFormatTGA::WritePalette() { unsigned char tga_color[256*3]; @@ -642,7 +651,7 @@ int imFormatTGA::WritePalette() return 1; } -int imFormatTGA::LoadExtensionArea() +int imFileFormatTGA::LoadExtensionArea() { unsigned int dword_value; imBinFileSeekFrom(handle, -26); @@ -807,7 +816,7 @@ static void iGetRational(float fvalue, int *num, int *den) *num = imRound(fvalue); } -int imFormatTGA::SaveExtensionArea() +int imFileFormatTGA::SaveExtensionArea() { unsigned int dword_value; unsigned short word_value; @@ -971,7 +980,7 @@ int imFormatTGA::SaveExtensionArea() return 1; } -void imFormatTGA::FixRGB() +void imFileFormatTGA::FixRGB() { int x; imbyte* byte_data = (imbyte*)this->line_buffer; @@ -1010,7 +1019,7 @@ void imFormatTGA::FixRGB() } } -int imFormatTGA::ReadImageData(void* data) +int imFileFormatTGA::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading TGA..."); @@ -1044,7 +1053,7 @@ int imFormatTGA::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatTGA::WriteImageData(void* data) +int imFileFormatTGA::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing TGA..."); diff --git a/src/im_format_tiff.cpp b/src/im_format_tiff.cpp index 98467f9..1c55a55 100644 --- a/src/im_format_tiff.cpp +++ b/src/im_format_tiff.cpp @@ -3,7 +3,7 @@ * * See Copyright Notice in im_lib.h * See libTIFF Copyright Notice in tiff.h - * $Id: im_format_tiff.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_tiff.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -590,7 +590,7 @@ static void iTIFFWriteAttributes(TIFF* tiff, imAttribTable* attrib_table) iTIFFWriteCustomTags(tiff, attrib_table); } -class imFormatTIFF: public imFormat +class imFileFormatTIFF: public imFileFormatBase { TIFF* tiff; int invert, // must invert black and white reference @@ -605,6 +605,22 @@ class imFormatTIFF: public imFormat int ReadTileline(void* line_buffer, int row, int plane); +public: + imFileFormatTIFF(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatTIFF() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatTIFF: public imFormat +{ public: imFormatTIFF() :imFormat("TIFF", @@ -616,14 +632,7 @@ public: {} ~imFormatTIFF() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatTIFF(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -639,7 +648,7 @@ void imFormatRegisterTIFF(void) imFormatRegister(new imFormatTIFF()); } -int imFormatTIFF::Open(const char* file_name) +int imFileFormatTIFF::Open(const char* file_name) { this->tiff = TIFFOpen(file_name, "r"); if (this->tiff == NULL) @@ -659,7 +668,7 @@ int imFormatTIFF::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatTIFF::New(const char* file_name) +int imFileFormatTIFF::New(const char* file_name) { this->tiff = TIFFOpen(file_name, "w"); if (this->tiff == NULL) @@ -670,7 +679,7 @@ int imFormatTIFF::New(const char* file_name) return IM_ERR_NONE; } -void imFormatTIFF::Close() +void imFileFormatTIFF::Close() { if (this->tile_buf) { @@ -682,7 +691,7 @@ void imFormatTIFF::Close() TIFFClose(this->tiff); } -void* imFormatTIFF::Handle(int index) +void* imFileFormatTIFF::Handle(int index) { if (index == 0) return (void*)this->tiff->tif_fd; @@ -692,7 +701,7 @@ void* imFormatTIFF::Handle(int index) return NULL; } -int imFormatTIFF::ReadImageInfo(int index) +int imFileFormatTIFF::ReadImageInfo(int index) { this->cpx_int = 0; this->invert = 0; @@ -1011,7 +1020,7 @@ int imFormatTIFF::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatTIFF::WriteImageInfo() +int imFileFormatTIFF::WriteImageInfo() { this->file_color_mode = this->user_color_mode; this->file_data_type = this->user_data_type; @@ -1254,7 +1263,7 @@ static void iTIFFLabFix(void* line_buffer, int width, int data_type, int is_new) // Do NOT know how it is encoded for other data types. } -int imFormatTIFF::ReadTileline(void* line_buffer, int row, int plane) +int imFileFormatTIFF::ReadTileline(void* line_buffer, int row, int plane) { int t; @@ -1295,7 +1304,7 @@ int imFormatTIFF::ReadTileline(void* line_buffer, int row, int plane) return 1; } -int imFormatTIFF::ReadImageData(void* data) +int imFileFormatTIFF::ReadImageData(void* data) { int count = imFileLineBufferCount(this); @@ -1348,7 +1357,7 @@ int imFormatTIFF::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatTIFF::WriteImageData(void* data) +int imFileFormatTIFF::WriteImageData(void* data) { int count = imFileLineBufferCount(this); diff --git a/src/im_format_wmv.cpp b/src/im_format_wmv.cpp index 3b411c3..a4733a5 100644 --- a/src/im_format_wmv.cpp +++ b/src/im_format_wmv.cpp @@ -2,7 +2,7 @@ * \brief WMV - Windows Media Video Format * * See Copyright Notice in im_lib.h - * $Id: im_format_wmv.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $ + * $Id: im_format_wmv.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ */ #include "im_format.h" @@ -494,7 +494,7 @@ static GUID iWMFCompFindSubType(const char* compression) return WMMEDIASUBTYPE_Base; } -class imFormatWMV: public imFormat +class imFileFormatWMV: public imFileFormatBase { IWMSyncReader* Reader; // When reading WM_MEDIA_TYPE* MediaType; @@ -525,6 +525,22 @@ class imFormatWMV: public imFormat int SetInputProps(); int SetProfile(); +public: + imFileFormatWMV(const imFormat* _iformat): imFileFormatBase(_iformat) {} + ~imFileFormatWMV() {} + + int Open(const char* file_name); + int New(const char* file_name); + void Close(); + void* Handle(int index); + int ReadImageInfo(int index); + int ReadImageData(void* data); + int WriteImageInfo(); + int WriteImageData(void* data); +}; + +class imFormatWMV: public imFormat +{ public: imFormatWMV() :imFormat("WMV", @@ -536,14 +552,7 @@ public: {} ~imFormatWMV() {} - int Open(const char* file_name); - int New(const char* file_name); - void Close(); - void* Handle(int index); - int ReadImageInfo(int index); - int ReadImageData(void* data); - int WriteImageInfo(); - int WriteImageData(void* data); + imFileFormatBase* Create(void) const { return new imFileFormatWMV(this); } int CanWrite(const char* compression, int color_mode, int data_type) const; }; @@ -552,7 +561,7 @@ void imFormatRegisterWMV(void) imFormatRegister(new imFormatWMV()); } -int imFormatWMV::Open(const char* file_name) +int imFileFormatWMV::Open(const char* file_name) { /* initializes COM */ CoInitialize(NULL); @@ -675,7 +684,7 @@ int imFormatWMV::Open(const char* file_name) return IM_ERR_NONE; } -int imFormatWMV::New(const char* file_name) +int imFileFormatWMV::New(const char* file_name) { /* initializes COM */ CoInitialize(NULL); @@ -698,7 +707,7 @@ int imFormatWMV::New(const char* file_name) return IM_ERR_NONE; } -void imFormatWMV::Close() +void imFileFormatWMV::Close() { HeaderInfo->Release(); @@ -720,7 +729,7 @@ void imFormatWMV::Close() CoUninitialize(); } -void* imFormatWMV::Handle(int index) +void* imFileFormatWMV::Handle(int index) { if (index == 1) { @@ -733,7 +742,7 @@ void* imFormatWMV::Handle(int index) return NULL; } -void imFormatWMV::iReadAttrib(imAttribTable* attrib_table) +void imFileFormatWMV::iReadAttrib(imAttribTable* attrib_table) { WORD StreamNumber = 0; WORD attrib_list_count = 0; @@ -916,12 +925,12 @@ static int iAttribSet(void* user_data, int index, const char* name, int data_typ return 1; } -void imFormatWMV::iWriteAttrib(imAttribTable* attrib_table) +void imFileFormatWMV::iWriteAttrib(imAttribTable* attrib_table) { attrib_table->ForEach((void*)HeaderInfo, iAttribSet); } -void imFormatWMV::CalcFPS() +void imFileFormatWMV::CalcFPS() { LONGLONG AvgTimePerFrame = 0; @@ -970,7 +979,7 @@ void imFormatWMV::CalcFPS() } } -void imFormatWMV::SetOutputProps() +void imFileFormatWMV::SetOutputProps() { DWORD output_number; Reader->GetOutputNumberForStream(stream_number, &output_number); @@ -1002,7 +1011,7 @@ void imFormatWMV::SetOutputProps() } } -int imFormatWMV::SetInputProps() +int imFileFormatWMV::SetInputProps() { DWORD input_count; Writer->GetInputCount(&input_count); @@ -1078,7 +1087,7 @@ int imFormatWMV::SetInputProps() return 1; } -int imFormatWMV::SetProfile() +int imFileFormatWMV::SetProfile() { HRESULT hr; @@ -1144,7 +1153,7 @@ int imFormatWMV::SetProfile() return 1; } -int imFormatWMV::ReadImageInfo(int index) +int imFileFormatWMV::ReadImageInfo(int index) { if (this->seekable && this->current_frame != index) { @@ -1268,7 +1277,7 @@ int imFormatWMV::ReadImageInfo(int index) return IM_ERR_NONE; } -int imFormatWMV::WriteImageInfo() +int imFileFormatWMV::WriteImageInfo() { if (this->bmiHeader) { @@ -1357,7 +1366,7 @@ int imFormatWMV::WriteImageInfo() return IM_ERR_NONE; } -void imFormatWMV::ReadPalette(unsigned char* bmp_colors) +void imFileFormatWMV::ReadPalette(unsigned char* bmp_colors) { /* convert the color map to the IM format */ for (int c = 0; c < this->palette_count; c++) @@ -1369,7 +1378,7 @@ void imFormatWMV::ReadPalette(unsigned char* bmp_colors) } } -void imFormatWMV::WritePalette(unsigned char* bmp_colors) +void imFileFormatWMV::WritePalette(unsigned char* bmp_colors) { /* convert the color map to the IM format */ for (int c = 0; c < this->palette_count; c++) @@ -1380,7 +1389,7 @@ void imFormatWMV::WritePalette(unsigned char* bmp_colors) } } -void imFormatWMV::InitMasks(imDib* dib) +void imFileFormatWMV::InitMasks(imDib* dib) { if (dib->bmih->biCompression == BI_BITFIELDS) { @@ -1429,7 +1438,7 @@ void imFormatWMV::InitMasks(imDib* dib) } } -void imFormatWMV::FixRGB(int bpp) +void imFileFormatWMV::FixRGB(int bpp) { int x; @@ -1486,7 +1495,7 @@ void imFormatWMV::FixRGB(int bpp) } } -int imFormatWMV::ReadImageData(void* data) +int imFileFormatWMV::ReadImageData(void* data) { imCounterTotal(this->counter, this->height, "Reading WMV Frame..."); @@ -1552,7 +1561,7 @@ int imFormatWMV::ReadImageData(void* data) return IM_ERR_NONE; } -int imFormatWMV::WriteImageData(void* data) +int imFileFormatWMV::WriteImageData(void* data) { imCounterTotal(this->counter, this->height, "Writing WMV Frame..."); diff --git a/test/im_copy.cpp b/test/im_copy.cpp index dd0b82e..6663a32 100644 --- a/test/im_copy.cpp +++ b/test/im_copy.cpp @@ -54,7 +54,7 @@ int main(int argc, char* argv[]) } imFormatRegisterAVI(); - imFormatRegisterWMV(); +// imFormatRegisterWMV(); void* data = NULL; imFile* ifile = NULL; diff --git a/test/im_copy.vcproj b/test/im_copy.vcproj index 051b110..c2e9102 100644 --- a/test/im_copy.vcproj +++ b/test/im_copy.vcproj @@ -1,111 +1,175 @@ + Keyword="Win32Proj" + > + Name="Win32" + /> + + + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + + + + + + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + Name="VCManagedResourceCompilerTool" + /> + + - - + TargetMachine="1" + /> + Name="VCALinkTool" + /> + Name="VCManifestTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> + Name="VCAppVerifierTool" + /> + Name="VCWebDeploymentTool" + /> + Name="VCPostBuildEventTool" + /> + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + + + + + + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + Name="VCManagedResourceCompilerTool" + /> + + - - + TargetMachine="1" + /> + Name="VCALinkTool" + /> + Name="VCManifestTool" + /> + Name="VCXDCMakeTool" + /> + Name="VCBscMakeTool" + /> + Name="VCFxCopTool" + /> + Name="VCAppVerifierTool" + /> + Name="VCWebDeploymentTool" + /> + Name="VCPostBuildEventTool" + /> @@ -114,9 +178,11 @@ + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + RelativePath=".\im_copy.cpp" + > -- cgit v1.2.3