DIBs, Palettes, D4, what's the right approach

DIBs, Palettes, D4, what's the right approach

Post by Keith Doy » Sun, 08 Jul 2001 15:22:35



Hi,

I've been digging through deja/google for days trying to figure out what
the best approach to this Delphi programming problem is...  Here's what
I want to do in D4:

1. In some display mode > 8 bits (16 or 24 bits/pixel).
1. Load a GIF
2. Display the GIF, and a second pane of some sort with the (up to) 256
   colors of the GIF palette.
3. Provide for editing/mods of the GIF palette, individual colors, or
   palette operations (reverse colors, generate a spread from one color
   to a second, etc), such that when the mods are performed, the effect on
   the image is displayed.
4. Save the GIF out as a Gif with the newly modifed palette.

I've got TGIFImage, which seems to load and display the image fine, but
from there things are just confusing.  It looks like every version of
Delphi may operate different in that regard, and there is an assortment of
badly documented component libraries none of which are obviously the right
ones to use for this sort of thing.

I gather I'll need to load the image to a DIB, and somehow connect that
to an actual display component to cause a DIB to DDB translation to occur
for the display.  Then perhaps I can get the colortable in the DIB and
modify it for subsequent re-display and GIF saving.

Is this the right approach?  If it is, then how do I accomplish the
following:

1. Load a GIF into a DIB.  Anyone know if TGIFImage can be used or do I have
   to resort to something else?  Or maybe I can use TGIFImage as is and
   somehow get at an internal DIB it may be maintaining?  TGIFImage just
   seems to extend the Image component so that you can load GIF images just
   like BMPs or JPGs-- there is no TGIFImage component, it just extends the
   Image component.

2. Get the ColorTable from the DIB.

3. Update the displayable component (map to the DDB and then update the
   screen)?

4. Save the GIF from a DIB with the new ColorTable.

Any ideas, pointers, sample code, special components, or cautions anyone
may be willing to offer would be appreciated.  The Web/dejagoogle has been
a morass of hundreds of independent, incomplete, somewhat conflicting or
related to other Delphi versions that don't seem quite on target.  It
seems like a rather simple program on the surface...

Thanks,

--

Keith Doyle      <http://www.syncopator.com/carousel>
(to send me an E-letter, remove underbars in reply address)

"Complexity is easy; simplicity is hard." --Edmund Kean(?)

 
 
 

1. DIBs and packed DIBs

When you receive a LPBITMAPINFO from a ActiveX component (ActiveMIL),
how can you get the full DIB, and convert it to a displayable DDB format,
preferrably to get it into a Delphi TBitmap.
Would the bits follow immediately after the BitmapInfoHeader (and eventually
the pallette info)? Or could the bits be somewhere else?
Would I have to use the DIB API commands to create a new bitmap from this?

-- Bj?rn

2. Blend mode summary and uses

3. Custom palettes: an easy approach?

4. Transparency

5. bitblt'ing dibs

6. BSP Trees at Warwick?

7. Delphi 2 : How to use DIBS's ?

8. LW5.0 Plugin problem

9. VL'97 deadline approaching

10. Graphics Interface '91 - Deadline approaches

11. Adobe's approach to raw