New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / graphics / allocscreenbitmap.c
blobb5f8465512be52429815b7f38938679fea416755
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Private graphics function for allocating screen bitmaps
6 Lang: english
7 */
8 #include "graphics_intern.h"
9 #include <exec/memory.h>
10 #include <graphics/rastport.h>
11 #include <proto/exec.h>
12 #include <proto/oop.h>
13 #include <oop/oop.h>
14 #include "gfxfuncsupport.h"
15 #include "dispinfo.h"
17 /*****************************************************************************
19 NAME */
20 #include <graphics/rastport.h>
21 #include <proto/graphics.h>
23 AROS_LH1(struct BitMap * , AllocScreenBitMap,
25 /* SYNOPSIS */
26 AROS_LHA(ULONG, modeid, D0),
28 /* LOCATION */
29 struct GfxBase *, GfxBase, 182, Graphics)
31 /* FUNCTION
32 Allocates a bitmap for use with a screen opened by OpenScreen()
34 INPUTS
35 modeid - the DisplayID of the screen to create
37 RESULT
38 bitmap - pointer to the newly created bitmap.
40 NOTES
41 This function is private and AROS specific.
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 HISTORY
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
56 AROS_LIBBASE_EXT_DECL(struct GfxBase *,GfxBase)
58 struct BitMap *nbm = NULL;
59 HIDDT_ModeID hiddmode;
61 /* First get the the gfxmode for this modeid */
62 hiddmode = get_hiddmode_for_amigamodeid(modeid, GfxBase);
64 if (vHidd_ModeID_Invalid != hiddmode)
66 /* Create the bitmap from the hidd mode */
67 OOP_Object *sync, *pf;
69 if (HIDD_Gfx_GetMode(SDD(GfxBase)->gfxhidd, hiddmode, &sync, &pf))
71 ULONG width, height, depth;
73 OOP_GetAttr(sync, aHidd_Sync_HDisp, &width);
74 OOP_GetAttr(sync, aHidd_Sync_VDisp, &height);
75 OOP_GetAttr(pf, aHidd_PixFmt_Depth, &depth);
77 /* Hack: a negative depth indicates to AllocBitMap, that
78 the friend bitmap param actually is the hiddmode */
80 nbm = AllocBitMap(width, height, -((LONG)depth), BMF_DISPLAYABLE, (struct BitMap *)hiddmode);
84 return nbm;
86 AROS_LIBFUNC_EXIT
88 } /* AllocScreenBitMap */