2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
10 #include <cybergraphx/cybergraphics.h>
11 #include <hidd/graphics.h>
12 #include <proto/oop.h>
13 #include <proto/utility.h>
15 #include "cybergraphics_intern.h"
16 #include "gfxfuncsupport.h"
18 /*****************************************************************************
21 #include <proto/cybergraphics.h>
23 AROS_LH2(ULONG
, GetCyberMapAttr
,
26 AROS_LHA(struct BitMap
*, bitMap
, A0
),
27 AROS_LHA(ULONG
, attribute
, D0
),
30 struct Library
*, CyberGfxBase
, 16, Cybergraphics
)
33 Provides information about an RTG bitmap. If you are unsure whether
34 the bitmap is an RTG one, you must retrieve and check
35 CYBRMATTR_ISCYBERGFX first, as all other attributes are only allowed
36 to be retrieved for RTG bitmaps.
39 bitMap - an RTG bitmap.
40 attribute - one of the following bitmap attributes:
41 CYBRMATTR_PIXFMT - the bitmap's pixel format. See
42 LockBitMapTagList() for possible values.
43 CYBRMATTR_WIDTH - the bitmap's width (in pixels).
44 CYBRMATTR_HEIGHT - the bitmap's height (in pixels).
45 CYBRMATTR_DEPTH - the number of bits per pixel.
46 CYBRMATTR_BPPIX - the number of bytes per pixel.
47 CYBRMATTR_XMOD - the number of bytes per row.
48 CYBRMATTR_ISCYBERGFX - TRUE only if the bitmap is an RTG one.
49 CYBRMATTR_ISLINEARMEM - TRUE only if the bitmap's display buffer
51 CYBRMATTR_COLORMAP - the bitmap's color map.
54 value - the value associated with the requested attribute.
57 If an unknown attribute is requested, -1 is returned.
62 CYBRMATTR_COLORMAP is unimplemented.
68 *****************************************************************************/
72 OOP_Object
*bm_obj
= NULL
;
73 OOP_Object
*pf
= NULL
;
77 if (IS_HIDD_BM(bitMap
))
79 bm_obj
= HIDD_BM_OBJ(bitMap
);
80 OOP_GetAttr(bm_obj
, aHidd_BitMap_PixFmt
, (IPTR
*)&pf
);
86 OOP_GetAttr(bm_obj
, aHidd_BitMap_BytesPerRow
, &retval
);
88 retval
= bitMap
->BytesPerRow
;
93 OOP_GetAttr(pf
, aHidd_PixFmt_BytesPerPixel
, &retval
);
98 case CYBRMATTR_PIXFMT
:
99 case CYBRMATTR_PIXFMT_ALPHA
:
102 OOP_GetAttr(pf
, aHidd_PixFmt_CgxPixFmt
, &retval
);
104 /* Backwards compatibility kludge. To be removed.
105 Used only by Cairo, do not use CYBRMATTR_PIXFMT_ALPHA
107 if (attribute
== CYBRMATTR_PIXFMT_ALPHA
)
111 OOP_GetAttr(pf
, aHidd_PixFmt_StdPixFmt
, &stdpf
);
112 if ((stdpf
>= vHidd_StdPixFmt_0RGB32
) && (stdpf
>= vHidd_StdPixFmt_0BGR32
))
116 D(bug("[GetCyberMapAttr] Pixel format is %d\n", retval
));
122 case CYBRMATTR_WIDTH
:
123 retval
= GetBitMapAttr(bitMap
, BMA_WIDTH
);
126 case CYBRMATTR_HEIGHT
:
127 retval
= GetBitMapAttr(bitMap
, BMA_HEIGHT
);
130 case CYBRMATTR_DEPTH
:
131 retval
= GetBitMapAttr(bitMap
, BMA_DEPTH
);
134 case CYBRMATTR_ISCYBERGFX
:
135 retval
= bm_obj
? TRUE
: FALSE
;
138 case CYBRMATTR_ISLINEARMEM
:
140 OOP_GetAttr(bm_obj
, aHidd_BitMap_IsLinearMem
, &retval
);
146 D(bug("!!! UNKNOWN ATTRIBUTE PASSED TO GetCyberMapAttr()\n"));
148 } /* switch (attribute) */
153 } /* GetCyberMapAttr */