git » fp-git.git » commit 0acac5b

Prepeared the skeletton abstraction layer for bitmap to support .png files

author ecalot
2006-06-13 13:59:39 UTC
committer ecalot
2006-06-13 13:59:39 UTC
parent 16fc6904a7c7af8a14ae453fcc90013b15b35919

Prepeared the skeletton abstraction layer for bitmap to support .png files

PR/doc/changelog.txt +1 -1
PR/src/include/bitmap.h +32 -13
PR/src/include/bmp.h +1 -4
PR/src/include/png.h +8 -11
PR/src/lib/actions/export.c +0 -6
PR/src/lib/actions/import.c +0 -6
PR/src/lib/object/image/image16.c +1 -1
PR/src/lib/object/image/image2.c +1 -1
PR/src/lib/object/image/image256.c +1 -1
PR/src/lib/object/image/image_common.c +1 -1

diff --git a/PR/doc/changelog.txt b/PR/doc/changelog.txt
index f293871..4ac6c07 100644
--- a/PR/doc/changelog.txt
+++ b/PR/doc/changelog.txt
@@ -198,7 +198,7 @@ Versions:
   - Moved tResource* from reslist to types.h
   - Renamed "uncompress" to "decomporess"
   x Transform flags from the hex form to the [a-y]* form (a is 1, b is 2, c is 4...)
-  x Prepeare the skeletton abstraction layer for bitmap to support .png files
+  - Prepeare the skeletton abstraction layer for bitmap to support .png files
  * PR v1.4 (future plans)
   x Added full POP2 RLEV compression algorithm
   x Code a palette adapting feature
diff --git a/PR/src/include/bitmap.h b/PR/src/include/bitmap.h
index ff27040..a219920 100644
--- a/PR/src/include/bitmap.h
+++ b/PR/src/include/bitmap.h
@@ -19,33 +19,52 @@
 */
 
 /*
-bmp.h: Princed Resources : BMP file support headers
-\xaf\xaf\xaf\xaf\xaf
+bitmap.h: Princed Resources : BMP/PNG support common headers
+\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf
  Copyright 2003 Princed Development Team
   Created: 24 Aug 2003
 
   Author: Enrique Calot <ecalot.cod@princed.com.ar>
   Version: 1.01 (2003-Oct-23)
   Version: 1.10 (2004-Feb-17)
+  Version: 2.00 (2006-Jun-13)
 
  Note:
   DO NOT remove this copyright notice
 */
 
-#ifndef _PR_BMP_H_
-#define _PR_BMP_H_
+#ifndef _PR_BITMAP_H_
+#define _PR_BITMAP_H_
 
-#include "types.h" /* tResource */
-#include "image.h" /* tImage */
+#ifdef _PR_USE_PNG_
 
-#define FORMATS_BMP_PALETTE_BW "\x00\x00\x00\0\xFF\xFF\xFF"
+#define mFormatExportBitmap(data,vFileext,size,image,optionflag,backupExtension) \
+        mFormatExportPng(data,vFileext,size,image,optionflag,backupExtension)
+#define mFormatImportBitmap(res) \
+        mFormatImportPng(res)
 
-int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag,const char* backupExtension);
-int mFormatImportBmp(tResource *res);
-int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupExtension);
-int mReadBitMap(tImage* img,unsigned char* data, int size); /* Note: this will ignore the palette */
+#define mWriteBitmap(file,data,w,h,bits,colors,colorArray,lineWidth,optionflag,backupExtension) \
+        mWritePng(file,data,w,h,bits,colors,colorArray,lineWidth,optionflag,backupExtension)
+#define readBitmap(file,data,ph,pw,pbits,pcolors,colorArray,plineWidth) \
+        readPng(file,data,ph,pw,pbits,pcolors,colorArray,plineWidth)
 
-int mWriteBmp(const char* file,const unsigned char* data, int w, int h, int bits, int colors, tColor* colorArray, int lineWidth, int optionflag, const char* backupExtension);
-int readBmp(const char* file, unsigned char** data, int *ph, int *pw,  int *pbits, int *pcolors, tColor** colorArray, int *plineWidth);
+#include "png.h"
+
+#else
+
+#define mFormatExportBitmap(data,vFileext,size,image,optionflag,backupExtension) \
+        mFormatExportBmp(data,vFileext,size,image,optionflag,backupExtension)
+#define mFormatImportBitmap(res) \
+        mFormatImportBmp(res)
+
+#define mWriteBitmap(file,data,w,h,bits,colors,colorArray,lineWidth,optionflag,backupExtension) \
+        mWriteBmp(file,data,w,h,bits,colors,colorArray,lineWidth,optionflag,backupExtension)
+#define readBitmap(file,data,ph,pw,pbits,pcolors,colorArray,plineWidth) \
+        readBmp(file,data,ph,pw,pbits,pcolors,colorArray,plineWidth)
+
+#include "bmp.h"
 
 #endif
+
+#endif
+
diff --git a/PR/src/include/bmp.h b/PR/src/include/bmp.h
index ff27040..6d58211 100644
--- a/PR/src/include/bmp.h
+++ b/PR/src/include/bmp.h
@@ -38,14 +38,11 @@ bmp.h: Princed Resources : BMP file support headers
 #include "types.h" /* tResource */
 #include "image.h" /* tImage */
 
-#define FORMATS_BMP_PALETTE_BW "\x00\x00\x00\0\xFF\xFF\xFF"
-
 int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag,const char* backupExtension);
 int mFormatImportBmp(tResource *res);
-int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupExtension);
-int mReadBitMap(tImage* img,unsigned char* data, int size); /* Note: this will ignore the palette */
 
 int mWriteBmp(const char* file,const unsigned char* data, int w, int h, int bits, int colors, tColor* colorArray, int lineWidth, int optionflag, const char* backupExtension);
 int readBmp(const char* file, unsigned char** data, int *ph, int *pw,  int *pbits, int *pcolors, tColor** colorArray, int *plineWidth);
 
 #endif
+
diff --git a/PR/src/include/png.h b/PR/src/include/png.h
index ff27040..0a9a35f 100644
--- a/PR/src/include/png.h
+++ b/PR/src/include/png.h
@@ -19,7 +19,7 @@
 */
 
 /*
-bmp.h: Princed Resources : BMP file support headers
+png.h: Princed Resources : PNG file support headers
 \xaf\xaf\xaf\xaf\xaf
  Copyright 2003 Princed Development Team
   Created: 24 Aug 2003
@@ -32,20 +32,17 @@ bmp.h: Princed Resources : BMP file support headers
   DO NOT remove this copyright notice
 */
 
-#ifndef _PR_BMP_H_
-#define _PR_BMP_H_
+#ifndef _PR_PNG_H_
+#define _PR_PNG_H_
 
 #include "types.h" /* tResource */
 #include "image.h" /* tImage */
 
-#define FORMATS_BMP_PALETTE_BW "\x00\x00\x00\0\xFF\xFF\xFF"
+int mFormatExportPng(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag,const char* backupExtension);
+int mFormatImportPng(tResource *res);
 
-int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag,const char* backupExtension);
-int mFormatImportBmp(tResource *res);
-int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupExtension);
-int mReadBitMap(tImage* img,unsigned char* data, int size); /* Note: this will ignore the palette */
-
-int mWriteBmp(const char* file,const unsigned char* data, int w, int h, int bits, int colors, tColor* colorArray, int lineWidth, int optionflag, const char* backupExtension);
-int readBmp(const char* file, unsigned char** data, int *ph, int *pw,  int *pbits, int *pcolors, tColor** colorArray, int *plineWidth);
+int mWritePng(const char* file,const unsigned char* data, int w, int h, int bits, int colors, tColor* colorArray, int lineWidth, int optionflag, const char* backupExtension);
+int readPng(const char* file, unsigned char** data, int *ph, int *pw,  int *pbits, int *pcolors, tColor** colorArray, int *plineWidth);
 
 #endif
+
diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c
index d2e245f..b9bc0f5 100644
--- a/PR/src/lib/actions/export.c
+++ b/PR/src/lib/actions/export.c
@@ -49,12 +49,6 @@ export.c: Princed Resources : DAT Extractor
 #include "pallist.h" 
 #include "unknown.h"
 
-#include "bmp.h"
-#include "mid.h"
-#include "pal.h"
-#include "plv.h"
-#include "wav.h"
-
 extern FILE* outputStream;
 
 /***************************************************************\
diff --git a/PR/src/lib/actions/import.c b/PR/src/lib/actions/import.c
index b6c5b61..de3b51b 100644
--- a/PR/src/lib/actions/import.c
+++ b/PR/src/lib/actions/import.c
@@ -47,12 +47,6 @@ import.c: Princed Resources : DAT Importer
 #include "unknown.h"
 #include "object.h"
 
-#include "bmp.h"
-#include "mid.h"
-#include "wav.h"
-#include "pal.h"
-#include "plv.h"
-
 extern FILE* outputStream;
 
 /***************************************************************\
diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c
index b6cf94a..539d608 100644
--- a/PR/src/lib/object/image/image16.c
+++ b/PR/src/lib/object/image/image16.c
@@ -44,7 +44,7 @@ image.c: Princed Resources : Image Compression Library
 
 #include "palette.h" /* getColorArrayByColors */
 
-#include "bmp.h"
+#include "bitmap.h"
 
 /* Compression level explanation:
  *
diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c
index 9d324ed..1cd7cc6 100644
--- a/PR/src/lib/object/image/image2.c
+++ b/PR/src/lib/object/image/image2.c
@@ -44,7 +44,7 @@ image.c: Princed Resources : Image Compression Library
 
 #include "palette.h" /* getColorArrayByColors */
 
-#include "bmp.h"
+#include "bitmap.h"
 
 /* Compression level explanation:
  *
diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c
index 28fb86b..9bcf118 100644
--- a/PR/src/lib/object/image/image256.c
+++ b/PR/src/lib/object/image/image256.c
@@ -44,7 +44,7 @@ image.c: Princed Resources : Image Compression Library
 
 #include "palette.h" /* getColorArrayByColors */
 
-#include "bmp.h"
+#include "bitmap.h"
 
 /* Compression level explanation:
  *
diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c
index b6cf94a..539d608 100644
--- a/PR/src/lib/object/image/image_common.c
+++ b/PR/src/lib/object/image/image_common.c
@@ -44,7 +44,7 @@ image.c: Princed Resources : Image Compression Library
 
 #include "palette.h" /* getColorArrayByColors */
 
-#include "bmp.h"
+#include "bitmap.h"
 
 /* Compression level explanation:
  *