Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-11

Duplicating palette of TFPCustomImage

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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

Reply by email

Unknown author
to Unknown author

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

Show quoted text 26 lines
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 - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email