I found the problem. When using Merge the new palette colors are appended and with Build the new palette colors are in order of appearance in the image, which is total nonsense imho. Anyway I've implemented a Copy function, that makes an exact copy of a supplied palette. Will submit a patch for it later this evening.
Darius > Hi, > > I'm entering unknown territories with TFPCustomImage. What I would like to > do is, to duplicate the palette of a loaded image to a newly created image > in memory. Something like: > > NewImg := TFPMemoryImage.Create(OrgImg.Width, OrgImg.Height); > NewImg.Palette.Build(OrgImg); > > I also tried > > NewImg.Palette.Merge(OrgImg.Palette); > > But both yield image distortions when copying the pixels one by one. > > What is the correct way of doing this? > > Darius > > > > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal