32 bit to 16 bit

5 posts / 0 new
Last post
alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
32 bit to 16 bit

Is it possible to blit from a 32 bit bitmap to a 16 bit screen? So far I have been absolutely unsuccessfull in trying to...

The case is this: I try and allocate a bitmap with p96AllocBitMap, specifying depth = 32 and format = RGBF_A8R8G8B8. When I supply NULL as friend, the blit fails and locks up the entire machine (this is both with 32 and 16 bit workbench). When I supply the workbench window bitmap as friend, the resulting bitmap is 16 bit and format is RGBF_R5G6B5.

The reason: I need to render to an ARGB bitmap to have the alpha channel, but I want the software (Qt) to work on 16 bit screens.

thomas
thomas's picture
Offline
Last seen: 1 week 6 days ago
Joined: 2011-05-16 14:23
Did you use RGBFF_A8R8G8B8 or

Did you use RGBFF_A8R8G8B8 or RGBFB_A8R8G8B8 to specify pixel format? RGBFB_#? is right for p96AllocBitMap.

hypex
hypex's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2011-09-09 16:20
What blitting function are

What blitting function are you using? In any case for using the graphics.library routines it is recommended to keep to the graphics.library and leave the system to use P96 itself as required. BlitBitMapTags() looks resourceful.

Also, how are you loading in the graphics? Datatypes can help you here. You can use the bitmap.class to setup a a bitmap for you.

Unless you only render once the best method is to pre-render all the bitmaps into the format of the destination to allow quick blitting.

alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
@thomas I am using RGBFB.

@thomas

I am using RGBFB. When supplying a friend bitmap, the format arg is completely ignored. When not supplying a friend, I get a complete lockup when trying to blit (using BltRastPortBitMap()).

alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
Haha, it turns out, that I am

Haha, it turns out, that I am a dumbass (once again). The bitmap allocation and blitting functions just fine. The problem was, that I would allocate a Layer for the bitmap (because I need clipping), and I would specify it like this:

struct Layer *layer = ILayers->CreateLayer(layer_info,
LAYA_BitMap, bm,
LAYA_MinX, 0,
LAYA_MinY, 0,
LAYA_MaxX, w,
LAYA_MaxY, h,
TAG_DONE);

Now, this is obviously glaringly wrong. MaxX should be w-1 and MaxY h-1. For some reason, this works with friend bitmaps (no hang), but fails otherwise when trying to draw stuff that exceeds the limits of the rastport. Doh!

Log in or register to post comments