Yes, half transparent is what I want. I am having trouble still. All of the error handling has been removed to shorten things up.
Load image
Code: Select all
if (!(DTO=IDataTypes->NewDTObject(Path,
DTA_GroupID, GID_PICTURE,
PDTA_Screen, DefaultPubScreen,
// PDTA_Remap, FALSE,
// PDTA_AlphaChannel, TRUE,
PDTA_PromoteMask, TRUE,
PDTA_DestMode, PMODE_V43,
// PDTA_WhichPicture, WhichPicture,
TAG_END)))
{
}
Allocate bitmap and set it up
Code: Select all
if (!(OrigBM=IP96->p96AllocBitMap(bmhd->bmh_Width,bmhd->bmh_Height,32,BMF_DISPLAYABLE,NULL,RGBFB_A8R8G8B8)))
{
}
Lock=IP96->p96LockBitMap(OrigBM,(uint8 *)&RenderInfoBuffer,sizeof RenderInfoBuffer);
pdtBlitPixelArrayBuffer.MethodID=PDTM_READPIXELARRAY;
pdtBlitPixelArrayBuffer.pbpa_PixelData=RenderInfoBuffer.Memory;
pdtBlitPixelArrayBuffer.pbpa_PixelFormat=PBPAFMT_ARGB;
pdtBlitPixelArrayBuffer.pbpa_PixelArrayMod=RenderInfoBuffer.BytesPerRow;
pdtBlitPixelArrayBuffer.pbpa_Left=0;
pdtBlitPixelArrayBuffer.pbpa_Top=0;
pdtBlitPixelArrayBuffer.pbpa_Width=bmhd->bmh_Width;
pdtBlitPixelArrayBuffer.pbpa_Height=bmhd->bmh_Height;
IIntuition->IDoMethodA(DTO,(Msg)&pdtBlitPixelArrayBuffer);
IP96->p96UnlockBitMap(OrigBM,Lock);
IDataTypes->DisposeDTObject(DTO);
DTO=NULL;
Create ScaleBM
Code: Select all
if (!(ScaleBM=IP96->p96AllocBitMap(ScaleWidth,ScaleHeight,32,BMF_CLEAR | BMF_DISPLAYABLE,NULL,RGBFB_A8R8G8B8)))
{
}
Scale it and try to make it transparent
Code: Select all
if (IGraphics->CompositeTags(
COMPOSITE_Src, OrigBM, ScaleBM,
COMPTAG_ScaleX, COMP_FLOAT_TO_FIX(ScaleFactorX),
COMPTAG_ScaleY, COMP_FLOAT_TO_FIX(ScaleFactorY),
!Ghost ? TAG_IGNORE : COMPTAG_SrcAlpha, COMP_FLOAT_TO_FIX(0.75),
// !Ghost ? TAG_IGNORE : COMPTAG_SrcAlpha, COMP_FLOAT_TO_FIX(0.5),
TAG_DONE) != COMPERR_Success)
{
}
Now, if I don't do use the COMPTAG_SrcAlpha tag and use your suggestion to BltBitMapTags(), it locks up. I know the BLIT_Alpha value is not correct, it was just for test and copied from autodoc.
Code: Select all
if (Ghost)
{
if (!(GhostBM=IP96->p96AllocBitMap(ScaleWidth,ScaleHeight,32,BMF_CLEAR | BMF_DISPLAYABLE,NULL,RGBFB_A8R8G8B8)))
{
}
}
IGraphics->BltBitMapTags(
BLITA_DestX, 0,
BLITA_DestY, 0,
BLITA_Width, ScaleWidth,
BLITA_Height, ScaleHeight,
BLITA_SrcType, BLITT_BITMAP,
BLITA_Source, ScaleBM,
BLITA_DestType, BLITT_BITMAP,
BLITA_Dest, GhostBM,
BLITA_Alpha, 0xfffffff,
// BLITA_UseSrcAlpha, TRUE,
TAG_END);
Then put it in a BitMapObject since only showing the images in a listbrowser or button gadget.
Code: Select all
if (!(Img=BitMapObject,
BITMAP_Screen, DefaultPubScreen,
BITMAP_Precision, PRECISION_EXACT,
BITMAP_BitMap, Ghost ? GhostBM : ScaleBM,
BITMAP_Width, ScaleWidth,
BITMAP_Height, ScaleHeight,
BITMAP_HasAlpha, TRUE,
BITMAP_Masking, TRUE,
BITMAP_Transparent, TRUE, // optional
TAG_DONE)))
{
}
I would prefer to do the scaling and transparency all at once with CompositeTags() and not have to use BltBitMapTags() so don't have to use 2 bitmaps (Scale and Ghost).
What would be the correct BLITA_Alpha value if I have to use it? 0x7fffffff or 0x7f7f7f7f maybe?