git » fp-git.git » commit 9cdc755

bugfixes.

author ecalot
2006-02-18 05:52:46 UTC
committer ecalot
2006-02-18 05:52:46 UTC
parent 85ee233ad93ad88132321a4e776656847eaa81b6

bugfixes.

PR/src/include/palette.h +2 -0
PR/src/lib/object/image/image16.c +1 -0
PR/src/lib/object/image/image2.c +1 -0
PR/src/lib/object/image/image256.c +1 -0
PR/src/lib/object/image/image_common.c +1 -0
PR/src/lib/object/object.c +12 -1
PR/src/lib/object/palette/pop1_16c.c +4 -0
PR/src/lib/object/palette/pop2_256c.c +4 -0
PR/src/lib/object/palette/pop2_4bit.c +4 -0

diff --git a/PR/src/include/palette.h b/PR/src/include/palette.h
index ea3b31c..e43f362 100644
--- a/PR/src/include/palette.h
+++ b/PR/src/include/palette.h
@@ -64,4 +64,6 @@ int applyPalette(tPalette* p,tImage *i);
 void* objPalette_pop1_4bitsCreate(unsigned char* data, int size, int *error);
 int objPalette_pop1_4bitsWrite(void* o, const char* file, int optionflag, const char* backupExtension);
 
+tColor* objPalette_pop1_4bitsGetColors(void* o);
+
 #endif
diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c
index 3052c53..390a10a 100644
--- a/PR/src/lib/object/image/image16.c
+++ b/PR/src/lib/object/image/image16.c
@@ -413,6 +413,7 @@ void* objImageCreate(unsigned char* data, int size, tObject palette, int *error)
 		return NULL;
 	}
 
+	image->pal=palette;
 	bits=paletteGetBits(image->pal);
 	if (bits!=getCarry(image->type)) printf("error, palette mismatch\n");
 	
diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c
index 3052c53..390a10a 100644
--- a/PR/src/lib/object/image/image2.c
+++ b/PR/src/lib/object/image/image2.c
@@ -413,6 +413,7 @@ void* objImageCreate(unsigned char* data, int size, tObject palette, int *error)
 		return NULL;
 	}
 
+	image->pal=palette;
 	bits=paletteGetBits(image->pal);
 	if (bits!=getCarry(image->type)) printf("error, palette mismatch\n");
 	
diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c
index 3052c53..390a10a 100644
--- a/PR/src/lib/object/image/image256.c
+++ b/PR/src/lib/object/image/image256.c
@@ -413,6 +413,7 @@ void* objImageCreate(unsigned char* data, int size, tObject palette, int *error)
 		return NULL;
 	}
 
+	image->pal=palette;
 	bits=paletteGetBits(image->pal);
 	if (bits!=getCarry(image->type)) printf("error, palette mismatch\n");
 	
diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c
index 3052c53..390a10a 100644
--- a/PR/src/lib/object/image/image_common.c
+++ b/PR/src/lib/object/image/image_common.c
@@ -413,6 +413,7 @@ void* objImageCreate(unsigned char* data, int size, tObject palette, int *error)
 		return NULL;
 	}
 
+	image->pal=palette;
 	bits=paletteGetBits(image->pal);
 	if (bits!=getCarry(image->type)) printf("error, palette mismatch\n");
 	
diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c
index 7bcfee8..3758503 100644
--- a/PR/src/lib/object/object.c
+++ b/PR/src/lib/object/object.c
@@ -110,4 +110,15 @@ int writeObject(tObject o, const char* file, int optionflag, const char* backupE
 
 int paletteGetBits(tObject pal) { return 4; }
 int paletteGetColors(tObject pal) { return 16; }
-tColor* paletteGetColorArray(tObject pal) { return NULL; }
+tColor* paletteGetColorArray(tObject pal) {
+	switch (pal.type) {
+	case eResTypePop1Palette4bits: /* save and remember palette file */
+		return objPalette_pop1_4bitsGetColors(pal.obj);
+		break;
+	default:
+		return NULL;
+	}
+}
+
+
+
diff --git a/PR/src/lib/object/palette/pop1_16c.c b/PR/src/lib/object/palette/pop1_16c.c
index 133baf9..cf111bf 100644
--- a/PR/src/lib/object/palette/pop1_16c.c
+++ b/PR/src/lib/object/palette/pop1_16c.c
@@ -204,3 +204,7 @@ int objPalette_pop1_4bitsWrite(void* o, const char* file, int optionflag, const
 	return writePal(file,16,pal->c,optionflag,backupExtension);
 }
 
+tColor* objPalette_pop1_4bitsGetColors(void* o) {
+	tPop1_4bitsPalette* pal=o;
+	return pal->c;
+}
diff --git a/PR/src/lib/object/palette/pop2_256c.c b/PR/src/lib/object/palette/pop2_256c.c
index 133baf9..cf111bf 100644
--- a/PR/src/lib/object/palette/pop2_256c.c
+++ b/PR/src/lib/object/palette/pop2_256c.c
@@ -204,3 +204,7 @@ int objPalette_pop1_4bitsWrite(void* o, const char* file, int optionflag, const
 	return writePal(file,16,pal->c,optionflag,backupExtension);
 }
 
+tColor* objPalette_pop1_4bitsGetColors(void* o) {
+	tPop1_4bitsPalette* pal=o;
+	return pal->c;
+}
diff --git a/PR/src/lib/object/palette/pop2_4bit.c b/PR/src/lib/object/palette/pop2_4bit.c
index 133baf9..cf111bf 100644
--- a/PR/src/lib/object/palette/pop2_4bit.c
+++ b/PR/src/lib/object/palette/pop2_4bit.c
@@ -204,3 +204,7 @@ int objPalette_pop1_4bitsWrite(void* o, const char* file, int optionflag, const
 	return writePal(file,16,pal->c,optionflag,backupExtension);
 }
 
+tColor* objPalette_pop1_4bitsGetColors(void* o) {
+	tPop1_4bitsPalette* pal=o;
+	return pal->c;
+}