wip build_with_cmake macro
[AROS.git] / rom / graphics / getbitmapattr.c
blob5418c61068cd3c31c6531b986d00e8cb633bb5d6
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Get an attribute from a bitmap.
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include "gfxfuncsupport.h"
10 #include <graphics/rastport.h>
12 /*****************************************************************************
14 NAME */
15 #include <exec/types.h>
16 #include <graphics/gfx.h>
17 #include <proto/graphics.h>
18 #include <proto/oop.h>
20 AROS_LH2(IPTR, GetBitMapAttr,
22 /* SYNOPSIS */
23 AROS_LHA(struct BitMap *, bitmap, A0),
24 AROS_LHA(ULONG , attribute, D1),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 160, Graphics)
29 /* FUNCTION
30 Returns a specific information about a bitmap. Do not access the
31 bitmap directly!
33 INPUTS
34 bitmap - The BitMap structure to get information about.
35 attribute - Number of the attribute to get. See <graphics/gfx.h> for
36 possible values.
38 RESULT
39 The information you requested. If you asked for an unknown attribute,
40 0 or NULL is returned.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 AllocBitMap()
51 INTERNALS
53 HISTORY
54 29-10-95 digulla automatically created from
55 graphics_lib.fd and clib/graphics_protos.h
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 IPTR retval;
63 switch(attribute)
65 case BMA_HEIGHT:
66 retval = (IPTR)bitmap->Rows;
67 break;
69 case BMA_WIDTH:
70 /* must return width in pixel! */
71 retval = (IPTR)(bitmap->BytesPerRow * 8);
72 break;
74 case BMA_DEPTH:
75 if (IS_HIDD_BM(bitmap))
77 retval = (IPTR)HIDD_BM_REALDEPTH(bitmap);
79 else
81 retval = (IPTR)bitmap->Depth;
83 break;
85 case BMA_FLAGS:
86 retval = (IPTR)(bitmap->Flags & (BMF_DISPLAYABLE |
87 BMF_INTERLEAVED |
88 BMF_STANDARD));
89 break;
91 default:
92 retval = 0;
93 break;
96 return retval;
98 AROS_LIBFUNC_EXIT
100 } /* GetBitMapAttr */