You probably have to call IconControlA() with ICONCTRLA_GetImage2 just to generate the delayed image2 and the mask2, except for WB 3.0/3.1 where Blt(Mask)BitMapRastPort() is patched by icon.library to generate the true image just in time.
(On WB 3.5+ this is done automatically by a call to DrawIconState(). Or you could use my command NoDelayedImage2, but that would be a decision of the user, I think.)
@Akira
All clear signal:
Don't worry about the delayed image2 or mask2. The delay is only activated for the Workbench task, not for other programs.
My assembler code for converting an image structure in A0 into a 40 byte bitmap in A1, but this code may only work for color icons, because they always use real planes. For old-style images you also have to take PlanePick and PlaneOnOff into acount.
Code:
preparebitmap ADDQ.W #4,A0 ; image width etc
MOVEM.W (A0)+,D0-D1 ; width, height
ADDQ.L #8,D0
ADDQ.L #7,D0
LSR.L #4,D0
ADD.L D0,D0 ; plane bytes/row
MOVE.W D0,(A1)+ ; bytes/row
MOVE.W D1,(A1)+ ; row count
MULU.W D0,D1 ; total plane size
MOVE.W (A0)+,D0 ; depth
MOVEA.L (A0),A0 ; planar image data
CMPI.W #8,D0
BLS.S .depthok
MOVEQ #8,D0 ; limit to 8 planes
.depthok MOVE.W D0,(A1)+ ; flags, depth
CLR.W (A1) ; clear pad word !!
ADDA.W #30,A1
CLR.L (A1) ; plane 7
CLR.L -(A1) ; plane 6
CLR.L -(A1) ; plane 5
CLR.L -(A1) ; plane 4
CLR.L -(A1) ; plane 3
CLR.L -(A1) ; plane 2
CLR.L -(A1) ; plane 1
CLR.L -(A1) ; plane 0
BRA.S .countdowndepth
.nextpointer MOVE.L A0,(A1)+ ; image data offsets
ADDA.L D1,A0 ; add planesize
.countdowndepth DBRA D0,.nextpointer
RTS