grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / muimaster / mui_obtainpen.c
blob4a8fcd58e3a12b39d43adba401e03cefb3427d95
1 /*
2 Copyright © 2002-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <proto/graphics.h>
8 #include <proto/muimaster.h>
10 #include <string.h>
11 #include <stdlib.h>
13 #include "mui.h"
14 #include "penspec.h"
15 #include "muimaster_intern.h"
17 /*****************************************************************************
19 NAME */
20 AROS_LH3(LONG, MUI_ObtainPen,
22 /* SYNOPSIS */
23 AROS_LHA(struct MUI_RenderInfo *, mri, A0),
24 AROS_LHA(struct MUI_PenSpec *, spec, A1),
25 AROS_LHA(ULONG, flags, D0),
27 /* LOCATION */
28 struct Library *, MUIMasterBase, 26, MUIMaster)
30 /* FUNCTION
31 Turns struct MUI_PenSpec (the result of a Poppen object) into
32 a pen for SetAPen().
34 INPUTS
36 RESULT
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 MUI_ReleasePen()
47 INTERNALS
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 LONG retval = -1;
54 struct MUI_PenSpec_intern intern;
56 if (!spec || !mri || !mri->mri_Colormap) return -1;
58 if (!zune_pen_spec_to_intern(spec, &intern))
59 return -1;
60 if (!zune_penspec_setup(&intern, mri))
61 return -1;
62 retval = intern.p_pen;
63 if ((retval != -1) && (intern.p_is_allocated))
65 /* flag to indicate that ReleasePen() needs to be called
66 in MUI_ReleasePen() */
68 retval |= 0x10000;
71 return retval;
73 AROS_LIBFUNC_EXIT
75 } /* MUIA_ObtainPen */