Page 1 of 2

[Solved] AllocBitMapTags(BMATags_PixelFormat) freeze 4.1.6 ?

PostPosted: Tue Sep 22, 2015 8:48 pm
by zzd10h
Hi,
when new FE SDK was published I changed all my Picasso functions to graphics ones.

Under FE, no problem, by changing :
Code: Select all
bitmap_vignette = p96AllocBitMap( bmh->bmh_Width, bmh->bmh_Height, 32, BMF_DISPLAYABLE, NULL, RGBFB_A8R8G8B8 );

to
Code: Select all
bitmap_vignette = AllocBitMapTags( bmh->bmh_Width, bmh->bmh_Height,32, BMATags_Displayable, TRUE, BMATags_PixelFormat,RGBFB_A8R8G8B8);


Works well, no gcc warning about obsolete picasso96 functions and overall, program runs well.

But under 4.1.6, the same program freezes the system.

As BMATags_PixelFormat is not known in the previous 4.1.6 SDK, I can't recompile the graphics AllocBitmap under 4.1.6.

By restoring Picasso96 functions and by compiling the program with the newest FE SDK, makes it work again under 4.1.6.

1) Therefore, is this AllocBitmapTags() works under 4.1.6 ?

2) Or is it a way to make the diferrence between OS level in the code ?
#ifdef __amigaos4.1.6__
or
#ifdef __amigaos4.1.8__

Thank you by advance.
Guillaume

Re: AllocBitMapTags(BMATags_PixelFormat) freeze 4.1.6 ?

PostPosted: Tue Sep 22, 2015 11:01 pm
by colinw
I think a TAG_END may help..

Re: AllocBitMapTags(BMATags_PixelFormat) freeze 4.1.6 ?

PostPosted: Tue Sep 22, 2015 11:40 pm
by zzd10h
Thank you Colin for your reply.

You are right, I added a TAG_END (shame on me :? )

Code: Select all
bitmap_vignette = AllocBitMapTags( bmh->bmh_Width, bmh->bmh_Height,32, BMATags_Displayable, TRUE, BMATags_PixelFormat,RGBFB_A8R8G8B8,TAG_END);


It still works under FE

Under 4.1.6, no more freeze but an ISI at this exact AllocBitmapTags instruction.

Thank you

Re: AllocBitMapTags(BMATags_PixelFormat) freeze 4.1.6 ?

PostPosted: Wed Sep 23, 2015 12:20 am
by colinw
zzd10h wrote:It still works under FE
Under 4.1.6, no more freeze but an ISI at this exact AllocBitmapTags instruction.
Thank you


According to the autodocs, AllocBitmapTags() only existed from graphics.library verion 53.7 (6.5.2013)
I don't remember what graphics version was included in 4.1.6

You should always employ a version check if it's likely your program depends on a specific mimimum
version of a component, especially when it's likely that earlier versions may still be in use somewhere.

See; include_h/exec/libraries.h -> LIB_IS_AT_LEAST() macro.

Re: AllocBitMapTags(BMATags_PixelFormat) freeze 4.1.6 ?

PostPosted: Wed Sep 23, 2015 12:25 am
by zzd10h
I didn't though (wrongly) that AllocBitMapTags() was a new function...

Thank you, too, for the tip about lib_at_least

Re: [Solved] AllocBitMapTags(BMATags_PixelFormat) freeze 4.1

PostPosted: Wed Sep 23, 2015 6:29 am
by broadblues
Works well, no gcc warning about obsolete picasso96 functions and overall, program runs well.

But under 4.1.6, the same program freezes the system.


The new gfx functions need FE or greater (gfxlib 54.148 giver or take a revision).

If you want to program to run pre FE you will have to use P96 still.

Re: [Solved] AllocBitMapTags(BMATags_PixelFormat) freeze 4.1

PostPosted: Wed Sep 23, 2015 5:56 pm
by salass00
@zzd10h

For older graphics.library versions where the AllocBitMapTags() function isn't available there's a kind of hack/cludge you can use with AllocBitMap() if you don't want to use Picasso96API.library.

I don't remember the exact details since I've never had to use it for anything but essentially what you have to do IIRC is set the flags parameter (and maybe some others as well?) to some magic value(s) and then you can set the friend bitmap parameter to a taglist with extra RTG parameters. The AllocBitMapTags() function is just a convenient way to bypass all this legacy crap.

Re: [Solved] AllocBitMapTags(BMATags_PixelFormat) freeze 4.1

PostPosted: Wed Sep 23, 2015 8:32 pm
by zzd10h
@Salass0
thank you for the advice but I don't succeed to find how to pass the Pixel format to this function.

@Broadblues
yes, you are right, I will still use P96 for 4.1.6 programs.

Re: [Solved] AllocBitMapTags(BMATags_PixelFormat) freeze 4.1

PostPosted: Wed Sep 23, 2015 10:40 pm
by salass00
zzd10h wrote:@Salass0
thank you for the advice but I don't succeed to find how to pass the Pixel format to this function.


The flags parameter should be set to BMF_CHECKVALUE (this is described in <graphics/gfx.h>).

For the tag list (specfied using the friend bitmap parameter) you should use the same tags as you would use for AllocBitMapTags().

Re: [Solved] AllocBitMapTags(BMATags_PixelFormat) freeze 4.1

PostPosted: Wed Sep 23, 2015 11:35 pm
by zzd10h
Sorry my ignorance, but I made that :

Code: Select all
                 struct TagItem tags[3] ;
            tags[0].ti_Tag = BMATags_Displayable ;
            tags[0].ti_Data = TRUE ;
            tags[1].ti_Tag = BMATags_PixelFormat ;
            tags[1].ti_Data = RGBFB_A8R8G8B8 ;
            tags[2].ti_Tag = TAG_DONE;                         
                               
            bitmap_vignette = AllocBitMap( bmh->bmh_Width, bmh->bmh_Height,32, BMF_CHECKVALUE, tags);    



but it complains about

warning: passing argument 6 of 'IGraphics->AllocBitMap' from incompatible pointer type


Thank you for your help.