home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!marketgraph!rvg
- From: rvg@marketgraph.xs4all.nl (Ruud van Gaal)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: LoadRGB32()
- Message-ID: <360flah60.alamito@marketgraph.xs4all.nl>
- Date: Mon, 8 Jan 96 11:15:54 CET
- References: <4cguvt$aa2@serveur.cribx1.u-bordeaux.fr>
- Reply-To: rvg@marketgraph.xs4all.nl
- X-Newsreader: Alamito Mail and News Manager (V2.0.4 for Waffle) registered to MARKETGRAPH VISUAL AUTOMATION
-
- In <4cguvt$aa2@serveur.cribx1.u-bordeaux.fr>
- skoruppa@athena.ceremab.u-bordeaux.fr (Nils Skoruppa) wrote:
-
- >So I changed the program to use LoadRGB32()
- >instead of LoadRGB4() (and ULONGs and so forth).
- >Unfortunately, now AGA IFF-ILBM files are no longer
- >loaded correctly, garbage is displayed instead
- >(not only wrong colours, but a completely wrong
- >bitmap). On the other hand, I did not at all touch the
- >routine which (finds and) decodes the BODY to a BitMap.
-
- LoadRGB32() doesn't work AT ALL like LoadRGB4() does (it really works very
- strange, and you would probably NEVER find the solution by hand). Here's an
- extract from a ViewPort wrapper function I use daily in my programs (i.e.
- it's tested). It's C++, but you'll get the idea.
-
- void QViewPort::SetPalette(QPalette *qpal)
- /** Set palette from QPalette **/
- { ulong ctable[256*3+2]; // System needs longs; stacksize!
- ubyte *sct; // Source ct
- ulong c;
- /** Create ULONG table for faster LoadRGB32() **/
- sct=(ubyte*)qpal->CT24();
- ctable[0]=(((ulong)qpal->Colors())<<16); // Upper word=count, lwr=offset
- into colormap
- for(int i=0;i<qpal->Colors();i++)
- { c=(ulong)sct[i*3+0]; c=(c<<24)|(c<<16)|(c<<8)|c;
- ctable[i*3+1]=c;
- c=(ulong)sct[i*3+1]; c=(c<<24)|(c<<16)|(c<<8)|c;
- ctable[i*3+2]=c;
- c=(ulong)sct[i*3+2]; c=(c<<24)|(c<<16)|(c<<8)|c;
- ctable[i*3+3]=c;
- }
- ctable[i*3+1]=0; // Close table
- LoadRGB32(vp,ctable);
- }
-
- Yes, note the strange copying of the color values; It is actually a 96-bit
- color value you're using.
- Don't know why they did this, but I had to ask this to another Amiga
- programmer, since I too didn't have the autodocs. I hope AT gets its Web page
- up real soon.
- Note that I use offset 0 in the above example.
-
- --
- Ruud van Gaal
- MarketGraph Visual Automation
- E-Mail: rvg@marketgraph.xs4all.nl
- "...Works fascinates me. I could sit and watch it for hours..."
-
-