git » fp-git.git » commit 3e917ee

moved all image material to the image object file

author ecalot
2006-02-17 14:56:50 UTC
committer ecalot
2006-02-17 14:56:50 UTC
parent 1f35a8e20d5a423935c686ea57833c9e532b212e

moved all image material to the image object file

PR/src/Makefile +5 -5
PR/src/lib/formats/bmp.c +0 -39
PR/src/lib/object/image/image16.c +43 -0
PR/src/lib/object/image/image2.c +43 -0
PR/src/lib/object/image/image256.c +43 -0
PR/src/lib/object/image/image_common.c +43 -0

diff --git a/PR/src/Makefile b/PR/src/Makefile
index 60b63d3..30fd5b4 100644
--- a/PR/src/Makefile
+++ b/PR/src/Makefile
@@ -53,10 +53,10 @@ endif
 
 ACTIONS  = .import.o .export.o .classify.o
 XML      = .parse.o .search.o .unknown.o .translate.o .tree.o
-COMPRESS = .compress.o .lzg_compress.o .lzg_uncompress.o .rle_compress.o .rle_uncompress.o .rlec_uncompress.o 
+COMPRESS = .lzg_compress.o .lzg_uncompress.o .rle_compress.o .rle_uncompress.o .rlec_uncompress.o 
 LAYERS   = .dat.o .memory.o .list.o .reslist.o .pallist.o .disk.o .idlist.o .autodetect.o .stringformat.o .resourcematch.o
 FORMAT   = .bmp.o .mid.o .pal.o .wav.o .plv.o
-OBJECT   = .object.o .pop1_4bit.o
+OBJECT   = .object.o .pop1_4bit.o .image.o
 CONSOLE  = .main.o .filedir.o
 MAIN     = .pr.o
 
@@ -162,9 +162,9 @@ $(XMLFILE): xml/resources.xml
 	$(INFO) Compiling main item class...
 	$(CC) $(OPTIONS) -c lib/object/main.c -o $@
 
-.compress.o: lib/compression/main.c include/compress.h include/disk.h include/memory.h
-	$(INFO) Compiling main compression library...
-	$(CC) $(OPTIONS) -c lib/compression/main.c -o $@
+.image.o: lib/object/image/image.c include/image.h include/compress.h include/disk.h include/memory.h
+	$(INFO) Compiling image type class...
+	$(CC) $(OPTIONS) -c lib/object/image/image.c -o $@
 
 .lzg_compress.o: lib/compression/lzg_compress.c include/compress.h
 	$(INFO) Compiling LZG compression module...
diff --git a/PR/src/lib/formats/bmp.c b/PR/src/lib/formats/bmp.c
index 6fce1ab..2169db6 100644
--- a/PR/src/lib/formats/bmp.c
+++ b/PR/src/lib/formats/bmp.c
@@ -43,45 +43,6 @@ bmp.c: Princed Resources : BMP file support
 #include <stdlib.h>
 #include <string.h>
 
-extern FILE* outputStream;
-
-int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag, const char* backupExtension) {
-	/*
-	 * This function will expand the data into an image structure,
-	 * then the bitmap structure will be saved to disk
-	 *
-	 * Note: The old structure is passed by parameters in order to
-	 *       keep the right palette.
-	 */
-
-	int result;
-
-	/* Expand graphic and check results */
-	result=mExpandGraphic(data,&image,size);
-	if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag))
-		fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);
-	if (result==COMPRESS_RESULT_FATAL) return 0; /* false */
-
-	/* Write bitmap */
-	mWriteBitMap(image,vFileext,optionflag,backupExtension);
-
-	/* free bitmap */
-	free(image.pix);
-	return 1; /* true */
-}
-
-int mFormatImportBmp(tResource *res) {
-	tImage img;
-
-	if (!mReadBitMap(&img,res->data,res->size)) return 0; /* false */
-	free(res->data);
-	mCompressGraphic(&(res->data),&img,(int*)&(res->size));
-	mWriteFileInDatFile(res);
-	free(img.pix);
-
-	return 1; /* true */
-}
-
 int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupExtension) {
 
 	/* declare variables */
diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c
index 7cec2ba..dd2c7e6 100644
--- a/PR/src/lib/object/image/image16.c
+++ b/PR/src/lib/object/image/image16.c
@@ -35,9 +35,13 @@ compress.c: Princed Resources : Image Compression Library
 #include <stdio.h>
 #include <string.h>
 #include "compress.h"
+#include "common.h"
 #include "image.h"
 #include "memory.h"
 #include "disk.h" /* array2short */
+#include "dat.h"
+
+#include "bmp.h"
 
 /* Compression level explanation:
  *
@@ -384,3 +388,42 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 	return COMPRESS_RESULT_SUCCESS;
 }
 
+extern FILE* outputStream;
+
+int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag, const char* backupExtension) {
+	/*
+	 * This function will expand the data into an image structure,
+	 * then the bitmap structure will be saved to disk
+	 *
+	 * Note: The old structure is passed by parameters in order to
+	 *       keep the right palette.
+	 */
+
+	int result;
+
+	/* Expand graphic and check results */
+	result=mExpandGraphic(data,&image,size);
+	if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag))
+		fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);
+	if (result==COMPRESS_RESULT_FATAL) return 0; /* false */
+
+	/* Write bitmap */
+	mWriteBitMap(image,vFileext,optionflag,backupExtension);
+
+	/* free bitmap */
+	free(image.pix);
+	return 1; /* true */
+}
+
+int mFormatImportBmp(tResource *res) {
+	tImage img;
+
+	if (!mReadBitMap(&img,res->data,res->size)) return 0; /* false */
+	free(res->data);
+	mCompressGraphic(&(res->data),&img,(int*)&(res->size));
+	mWriteFileInDatFile(res);
+	free(img.pix);
+
+	return 1; /* true */
+}
+
diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c
index 7cec2ba..dd2c7e6 100644
--- a/PR/src/lib/object/image/image2.c
+++ b/PR/src/lib/object/image/image2.c
@@ -35,9 +35,13 @@ compress.c: Princed Resources : Image Compression Library
 #include <stdio.h>
 #include <string.h>
 #include "compress.h"
+#include "common.h"
 #include "image.h"
 #include "memory.h"
 #include "disk.h" /* array2short */
+#include "dat.h"
+
+#include "bmp.h"
 
 /* Compression level explanation:
  *
@@ -384,3 +388,42 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 	return COMPRESS_RESULT_SUCCESS;
 }
 
+extern FILE* outputStream;
+
+int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag, const char* backupExtension) {
+	/*
+	 * This function will expand the data into an image structure,
+	 * then the bitmap structure will be saved to disk
+	 *
+	 * Note: The old structure is passed by parameters in order to
+	 *       keep the right palette.
+	 */
+
+	int result;
+
+	/* Expand graphic and check results */
+	result=mExpandGraphic(data,&image,size);
+	if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag))
+		fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);
+	if (result==COMPRESS_RESULT_FATAL) return 0; /* false */
+
+	/* Write bitmap */
+	mWriteBitMap(image,vFileext,optionflag,backupExtension);
+
+	/* free bitmap */
+	free(image.pix);
+	return 1; /* true */
+}
+
+int mFormatImportBmp(tResource *res) {
+	tImage img;
+
+	if (!mReadBitMap(&img,res->data,res->size)) return 0; /* false */
+	free(res->data);
+	mCompressGraphic(&(res->data),&img,(int*)&(res->size));
+	mWriteFileInDatFile(res);
+	free(img.pix);
+
+	return 1; /* true */
+}
+
diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c
index 7cec2ba..dd2c7e6 100644
--- a/PR/src/lib/object/image/image256.c
+++ b/PR/src/lib/object/image/image256.c
@@ -35,9 +35,13 @@ compress.c: Princed Resources : Image Compression Library
 #include <stdio.h>
 #include <string.h>
 #include "compress.h"
+#include "common.h"
 #include "image.h"
 #include "memory.h"
 #include "disk.h" /* array2short */
+#include "dat.h"
+
+#include "bmp.h"
 
 /* Compression level explanation:
  *
@@ -384,3 +388,42 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 	return COMPRESS_RESULT_SUCCESS;
 }
 
+extern FILE* outputStream;
+
+int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag, const char* backupExtension) {
+	/*
+	 * This function will expand the data into an image structure,
+	 * then the bitmap structure will be saved to disk
+	 *
+	 * Note: The old structure is passed by parameters in order to
+	 *       keep the right palette.
+	 */
+
+	int result;
+
+	/* Expand graphic and check results */
+	result=mExpandGraphic(data,&image,size);
+	if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag))
+		fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);
+	if (result==COMPRESS_RESULT_FATAL) return 0; /* false */
+
+	/* Write bitmap */
+	mWriteBitMap(image,vFileext,optionflag,backupExtension);
+
+	/* free bitmap */
+	free(image.pix);
+	return 1; /* true */
+}
+
+int mFormatImportBmp(tResource *res) {
+	tImage img;
+
+	if (!mReadBitMap(&img,res->data,res->size)) return 0; /* false */
+	free(res->data);
+	mCompressGraphic(&(res->data),&img,(int*)&(res->size));
+	mWriteFileInDatFile(res);
+	free(img.pix);
+
+	return 1; /* true */
+}
+
diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c
index 7cec2ba..dd2c7e6 100644
--- a/PR/src/lib/object/image/image_common.c
+++ b/PR/src/lib/object/image/image_common.c
@@ -35,9 +35,13 @@ compress.c: Princed Resources : Image Compression Library
 #include <stdio.h>
 #include <string.h>
 #include "compress.h"
+#include "common.h"
 #include "image.h"
 #include "memory.h"
 #include "disk.h" /* array2short */
+#include "dat.h"
+
+#include "bmp.h"
 
 /* Compression level explanation:
  *
@@ -384,3 +388,42 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 	return COMPRESS_RESULT_SUCCESS;
 }
 
+extern FILE* outputStream;
+
+int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag, const char* backupExtension) {
+	/*
+	 * This function will expand the data into an image structure,
+	 * then the bitmap structure will be saved to disk
+	 *
+	 * Note: The old structure is passed by parameters in order to
+	 *       keep the right palette.
+	 */
+
+	int result;
+
+	/* Expand graphic and check results */
+	result=mExpandGraphic(data,&image,size);
+	if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag))
+		fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);
+	if (result==COMPRESS_RESULT_FATAL) return 0; /* false */
+
+	/* Write bitmap */
+	mWriteBitMap(image,vFileext,optionflag,backupExtension);
+
+	/* free bitmap */
+	free(image.pix);
+	return 1; /* true */
+}
+
+int mFormatImportBmp(tResource *res) {
+	tImage img;
+
+	if (!mReadBitMap(&img,res->data,res->size)) return 0; /* false */
+	free(res->data);
+	mCompressGraphic(&(res->data),&img,(int*)&(res->size));
+	mWriteFileInDatFile(res);
+	free(img.pix);
+
+	return 1; /* true */
+}
+