C (250/257)

From:
Date:27 Feb 2001 at 16:08:27
Subject:Picasso96 DrawImage() Problem

I'm writing a program which needs to copy an image using DrawImage()
to an offscreen bitmap whose format matches the screen bitmap (that
is, the offscreen bitmap is allocated by calling AllocBitMap() with
the screen's bitmap passed as the friend bitmap). To do this, a
temporary RastPort is constructed and the allocated bitmap attached
to it so that DrawImage() can be used.

Everything works fine when the screen is in a native screen mode
and when a Picasso96 8-bit screen is chosen, but fails when a
high or true color screen is in use. When I say that it fails,
it copies the image data correctly but the colors are wrong.
I've also tried replacing the DrawImage() call with a BltBitMap()
and, once again, the image data looks fine but the colors are
messed up on high/true color modes (the palette has been set
correctly using LoadRGB32() as it displays fine with other modes).

I am opening the screen myself by asking the user for a display
mode id (stored in aps->aps_ModeID). Just out of interest (since
Picasso96's SDK makes this quite unclear), does SA_DisplayID
override SA_Depth when the ID refers to a high/true color mode?
It appears that this is the case because the screen opens okay
but I thought I'd check this (I should really be replacing SA_Depth
with TAG_IGNORE for foreign modes but I haven't done this yet
because WinUAE's Picasso modes appear not to set the foreign bit
in their mode id's!)

The program only does 256 color rendering but needs to allow
the user to open on a high/true color screen btw.

A code snippet follows:

// Note: ih is a handle for some ILBM loading code I wrote.
// The image is 16 colors (TEMPLATEDEPTH = 4).

static UWORD defaultPens = 0xffff;

static struct Image tempImage =
{

};

After this setup, the template bitmap image is blitted to the
screen (actually, a window on the screen with BltBitMapRastPort()).
As I said, the image data shows up perfectly so all the ILBM
loading code is fine but the colors are wrong when the selected
screen is > 8-bit depth.

Any help greatly appreciated! Thanks.

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/