Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » A5 colour depth and colours in general

This thread is locked; no one can reply to it. rss feed Print
A5 colour depth and colours in general
Neil Walker
Member #210
April 2000
avatar

Hello,
Sorry I'm late to the A5 party. A few questions on colours and depth:

1. How do you specify what depth you want (i.e. the old set_color_depth)?
2. Where are the colour conversion functions (i.e. set_color_conversion), such as converting 32bit to 16bit?
3. I take it paletted bitmaps and 8bit is not supported. How do you read 8bpp images?
4. What about seeing what we've got (e.g. stuff like gfx_capabilities to check for hardware acceleration, the current bitmap depth, etc)

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Trent Gamblin
Member #261
April 2000
avatar

1. How do you specify what depth you want (i.e. the old set_color_depth)?

al_set_new_display_option

Specifically ALLEGRO_COLOR_SIZE, ALLEGRO_RED_SIZE, GREEN_SIZE, BLUE_SIZE.

Generally you don't have to worry about RED/GREEN/BLUE size, or even color size, but if you just want a 16 bit backbuffer use ALLEGRO_COLOR_SIZE.

Quote:

2. Where are the colour conversion functions (i.e. set_color_conversion), such as converting 32bit to 16bit?

Loaded bitmaps are automatically converted to the current format set by al_set_new_bitmap_format.

Quote:

3. I take it paletted bitmaps and 8bit is not supported. How do you read 8bpp images?

You can load 8bpp images, they will be converted to the format set by al_set_new_bitmap_format as above. There are no 8bpp ALLEGRO_BITMAPs or ALLEGRO_DISPLAYs.

Neil Walker
Member #210
April 2000
avatar

Thanks. That was easy :)

So, looking at the bitmap methods, when you create bitmaps, etc without specifying flags do they get set to the display depth (e.g. ALLEGRO_COLOR_SIZE) or some other default?

btw, I'm converting a library that relied on allegro being initialised and configured and used 'screen' to see if allegro was configured. What's the best way in A5, now it has no globals? Just call a display option (e.g. get backbuffer) and see if it returns NULL

One more thing, what's the easiest way of checking a colour matches, I used to do something like:

if(get_pixel(....)==makecol(1,2,3)

but colours now work with structs. I'm sure I could write a function but am asking anyway.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Evert
Member #794
November 2000
avatar

I'm converting a library that relied on allegro being initialised and configured and used 'screen' to see if allegro was configured. What's the best way in A5, now it has no globals? Just call a display option (e.g. get backbuffer) and see if it returns NULL

I doubt that'd work. Fortunately, there is al_is_system_installed() ;)

Quote:

but colours now work with structs. I'm sure I could write a function but am asking anyway.

Writing a function is probably the way to go.

Neil Walker
Member #210
April 2000
avatar

Thanks again. I never spotted that :)

One thing I'm trying to achieve and I hope this is my last question, is the equivalent of:

blit (source, dest, sx, sy, dx, dy, w, h);

i.e. al_draw_bitmap seems to only copy full width and height. I take it you have to create a sub-bitmap first in order to blit only part of a bitmap onto another? If so, wouldn't it be more useful to just have a function to do this as I assume it's a very common thing to do?

It's getting quite lengthy my code. I'm doing some parallax stuff and assuming you have to first create sub-bitmaps, it's doubling the code. Then I want to draw the bitmap onto itself which it seems you cannot do in A5 now, so that's yet more code to create temporary bitmaps, etc.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Matthew Leverton
Supreme Loser
January 1999
avatar

Neil Walker
Member #210
April 2000
avatar

Crikey, I've got the eyesight of a donkey.

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Go to: