2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
6 #include <workbench/icon.h>
7 #include <intuition/imageclass.h>
8 #include "icon_intern.h"
10 /*****************************************************************************
13 #include <proto/icon.h>
15 AROS_LH7(void, DrawIconStateA
,
18 AROS_LHA(struct RastPort
*, rp
, A0
),
19 AROS_LHA(struct DiskObject
*, icon
, A1
),
20 AROS_LHA(STRPTR
, label
, A2
),
21 AROS_LHA(LONG
, leftEdge
, D0
),
22 AROS_LHA(LONG
, topEdge
, D1
),
23 AROS_LHA(ULONG
, state
, D2
),
24 AROS_LHA(struct TagItem
*, tags
, A3
),
27 struct Library
*, IconBase
, 27, Icon
)
30 Draw an icon like an image.
33 rp - rastport to draw into
37 topEdge - drawing position
38 state - drawing state, see intuition/imageclass.h
43 Only very limited implemented.
50 intuition/imageclass.h
56 *****************************************************************************/
60 struct NativeIcon
*nativeicon
;
62 nativeicon
= GetNativeIcon(icon
, LB(IconBase
));
63 if (nativeicon
&& GfxBase
&& CyberGfxBase
)
67 bmdepth
= GetBitMapAttr(rp
->BitMap
, BMA_DEPTH
);
69 if (nativeicon
->iconPNG
.img1
&& CyberGfxBase
&& (bmdepth
>= 15))
73 if ((state
== IDS_SELECTED
) && nativeicon
->iconPNG
.img2
)
75 img
= nativeicon
->iconPNG
.img2
;
79 img
= nativeicon
->iconPNG
.img1
;
87 nativeicon
->iconPNG
.width
* sizeof(ULONG
),
91 nativeicon
->iconPNG
.width
,
92 nativeicon
->iconPNG
.height
,
97 else if (nativeicon
->icon35
.img1
.imagedata
)
104 if (state
== IDS_SELECTED
&& nativeicon
->icon35
.img2
.imagedata
)
106 img
= &nativeicon
->icon35
.img2
;
110 img
= &nativeicon
->icon35
.img1
;
113 if ((cgfxcoltab
= AllocVecPooled(POOL
, img
->numcolors
* sizeof(ULONG
))))
115 struct ColorRegister
*cr
;
118 cr
= (struct ColorRegister
*)img
->palette
;
119 for(i
= 0; i
< img
->numcolors
; i
++)
121 struct ColorRegister color
= *cr
;
123 if (state
== IDS_SELECTED
)
125 ChangeToSelectedIconColor(&color
);
128 cgfxcoltab
[i
] = (color
.red
<< 16) | (color
.green
<< 8) | color
.blue
;
138 nativeicon
->icon35
.width
,
139 nativeicon
->icon35
.height
,
145 struct RastPort bmrp
;
154 nativeicon
->icon35
.width
,
157 nativeicon
->icon35
.width
,
158 nativeicon
->icon35
.height
,
162 BltMaskBitMapRastPort
164 bm
, 0, 0, rp
, leftEdge
, topEdge
,
165 nativeicon
->icon35
.width
,
166 nativeicon
->icon35
.height
,
170 DeinitRastPort(&bmrp
);
173 FreeVecPooled(POOL
, cgfxcoltab
);
177 } /* if (img->mask) */
181 img
->imagedata
, 0, 0, nativeicon
->icon35
.width
,
182 rp
, cgfxcoltab
, leftEdge
, topEdge
,
183 nativeicon
->icon35
.width
,
184 nativeicon
->icon35
.height
,
188 FreeVecPooled(POOL
, cgfxcoltab
);
192 } /* if (cgfxcoltab != NULL) */
194 } /* if (bmdepth >= 15) */
196 } /* if (nativeicon->icon35.img1.imagedata) */
198 } /* if (nativeicon && GfxBase && CyberGfxBase) */
200 if (state
== IDS_SELECTED
&& icon
->do_Gadget
.SelectRender
)
204 rp
, (struct Image
*) icon
->do_Gadget
.SelectRender
,
208 else if (icon
->do_Gadget
.GadgetRender
)
210 if (icon
->do_Gadget
.Flags
& GFLG_GADGIMAGE
)
214 rp
, (struct Image
*) icon
->do_Gadget
.GadgetRender
,
220 #warning DrawIconStateA() is only very limited implemented
223 } /* DrawIconStateA() */