I have loaded an image with this
Now I am trying to make a copy of it to keep the original and do some modifying to the copy. Everything I have tried loses the alpha transparency and it shows up pink. The image body is fine.
What is happening to the transparency? The original image displays just fine, the copy does not (pink).
Object * LoadInternalImage(STRPTR Render) { return(IIntuition->NewObject(BitMapClass,NULL, BITMAP_SourceFile, Render, BITMAP_Screen, DefaultPubScreen, BITMAP_Precision, PRECISION_EXACT, BITMAP_Masking, TRUE, TAG_DONE)); }
Object * CopyImage(Object *SourceImg) { Object *Img; struct BitMap *SourceBM, *DestBM; uint32 Width, Height, Depth, PixelFormat; if (SourceImg==NULL) return(NULL); IIntuition->GetAttrs(SourceImg, BITMAP_BitMap, &SourceBM, TAG_DONE); Width=IGraphics->GetBitMapAttr(SourceBM,BMA_WIDTH); Height=IGraphics->GetBitMapAttr(SourceBM,BMA_HEIGHT); Depth=IGraphics->GetBitMapAttr(SourceBM,BMA_DEPTH); // Depth=IGraphics->GetBitMapAttr(SourceBM,BMA_BITSPERPIXEL); PixelFormat=IGraphics->GetBitMapAttr(SourceBM,BMA_PIXELFORMAT); // I am forcing it to this format. Either way has same result. if (!(DestBM=IGraphics->AllocBitMapTags(Width,Height,32,//Depth, BMATags_PixelFormat, PIXF_A8R8G8B8,//PixelFormat, BMATags_Clear, TRUE, BMATags_Displayable, TRUE, TAG_DONE))) { return(NULL); } // I have tried every combination, plus others. if (IGraphics->CompositeTags( COMPOSITE_Src, SourceBM, DestBM, // COMPOSITE_Src_Over_Dest, SourceBM, DestBM, // COMPTAG_Flags, COMPFLAG_IgnoreDestAlpha, // COMPTAG_Flags, COMPFLAG_SrcAlphaOverride | COMPFLAG_IgnoreDestAlpha, // COMPTAG_Flags, COMPFLAG_SrcAlphaOverride, TAG_DONE) != COMPERR_Success) { IGraphics->FreeBitMap(DestBM); return(NULL); } if (!(Img=IIntuition->NewObject(BitMapClass,NULL, BITMAP_BitMap, DestBM, BITMAP_Width, Width, BITMAP_Height, Height, BITMAP_HasAlpha, TRUE, BITMAP_Screen, DefaultPubScreen, BITMAP_Precision, PRECISION_EXACT, BITMAP_Masking, TRUE, TAG_DONE))) { IGraphics->FreeBitMap(DestBM); return(NULL); } return(Img); }