New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / graphics / getbitmapattr.c
blob6e737563fe2b9750f11c852495041f21412338c6
1 /*
2 Copyright © 1995-2001, 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>
19 AROS_LH2(IPTR, GetBitMapAttr,
21 /* SYNOPSIS */
22 AROS_LHA(struct BitMap *, bitmap, A0),
23 AROS_LHA(ULONG , attribute, D1),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 160, Graphics)
28 /* FUNCTION
29 Returns a specific information about a bitmap. Do not access the
30 bitmap directly!
32 INPUTS
33 bitmap - The BitMap structure to get information about.
34 attribute - Number of the attribute to get. See <graphics/gfx.h> for
35 possible values.
37 RESULT
38 The information you requested. If you asked for an unknown attribute,
39 0 or NULL is returned.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 AllocBitMap()
50 INTERNALS
52 HISTORY
53 29-10-95 digulla automatically created from
54 graphics_lib.fd and clib/graphics_protos.h
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
59 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
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 */