Hello,  FPC developers' list.

CreateGrayScalePalette raises an exception. The problem is that palette is created with count = 0 and every color assigment increase color count. I dont know why it is done so but as result you cannot assign palette colors from highier indexes to lower. It is not a big problem but CreateGrayScalePalette doesnot follow this rule and raises an exception.

Attached patch fixes CreateGrayScalePalette.

--
Best regards,
Paul Ishenin.
Index: packages/fcl-image/src/fppalette.inc
===================================================================
--- packages/fcl-image/src/fppalette.inc        (revision 11286)
+++ packages/fcl-image/src/fppalette.inc        (working copy)
@@ -217,7 +217,7 @@
 begin
   fppal:=TFPPalette.Create(256);
   Col.Alpha:=AlphaOpaque;
-  for i:=$FF downto 0 do
+  for i:=0 to $FF do
   begin
     Col.Red:=i;
     Col.Red:=(Col.Red shl 8) + Col.Red;
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to