git » fp-git.git » commit d1cd722

hooked a dummy pal importing

author ecalot
2006-02-26 08:30:43 UTC
committer ecalot
2006-02-26 08:30:43 UTC
parent 6f13df487937104c9a9599f26f973a1d14d433f5

hooked a dummy pal importing

PR/src/include/common.h +1 -0
PR/src/include/pal.h +1 -0
PR/src/include/palette.h +2 -0
PR/src/lib/formats/pal.c +13 -1

diff --git a/PR/src/include/common.h b/PR/src/include/common.h
index 5fdf449..f88dc8d 100644
--- a/PR/src/include/common.h
+++ b/PR/src/include/common.h
@@ -232,5 +232,6 @@ PARSING_OPTRAW\
 #define PR_RESULT_WAV_UNSUPPORTED_SAMPLERATE -29
 #define PR_RESULT_WAV_UNSUPPORTED_STEREO -30
 #define PR_RESULT_ERR_BMP_BITRATE_DIFFERS -31
+#define PR_WRONG_PALETTE_COLOR_COUNT -32 /*TODO: use RESULT_PAL_UNSUPPORTED */
 
 #endif
diff --git a/PR/src/include/pal.h b/PR/src/include/pal.h
index 7699a02..dadc428 100644
--- a/PR/src/include/pal.h
+++ b/PR/src/include/pal.h
@@ -53,5 +53,6 @@ int mFormatImportPal(tPalette* p,int* bits, const char* vFile);
 */
 
 int writePal(const char* file, int colors, const tColor* colorArray, int optionflag, const char* backupExtension);
+int readPal(const char* file,tColor** colorArray,int *colors);
 
 #endif
diff --git a/PR/src/include/palette.h b/PR/src/include/palette.h
index 6cd0cb1..541eaed 100644
--- a/PR/src/include/palette.h
+++ b/PR/src/include/palette.h
@@ -64,6 +64,8 @@ int applyPalette(tPalette* p,tImage *i);
 
 void* objPalette_pop1_4bitsCreate(tBinary c, int *error);
 int objPalette_pop1_4bitsWrite(void* o, const char* file, int optionflag, const char* backupExtension);
+void* objPop1Palette4bitsRead(const char* file,int *result);
+int objPop1Palette4bitsSet(void* o,tResource* res);
 
 tColor* objPalette_pop1_4bitsGetColors(void* o);
 tColor* paletteGetColorArrayForColors(int colors);
diff --git a/PR/src/lib/formats/pal.c b/PR/src/lib/formats/pal.c
index 178e0cf..a7523c2 100644
--- a/PR/src/lib/formats/pal.c
+++ b/PR/src/lib/formats/pal.c
@@ -68,7 +68,18 @@ int writePal(const char* file, int colors, const tColor* colorArray, int optionf
 	return PR_RESULT_SUCCESS; 
 }
 
-int mFormatImportPal(tPalette* p, int* bits, const char* vFile) {
+int readPal(const char* file,tColor** colorArray,int *colors) {
+	FILE* fd;
+	/*int ok;
+	char magic[4];*/
+
+	fd=fopen(file,"rb");
+	if (!fd) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; 
+	/* TODO: do the reading */
+	fclose(fd);
+	return PR_RESULT_SUCCESS;
+
+#if 0
 	/* declare variables */
 	unsigned char* pals;
 	unsigned char* pals1;
@@ -129,5 +140,6 @@ int mFormatImportPal(tPalette* p, int* bits, const char* vFile) {
 	mWriteFileInDatFile(res);
 */
 	return 1; /* true */
+#endif
 }