2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Pixelformat class
9 /****************************************************************************************/
11 #include <proto/oop.h>
12 #include <proto/utility.h>
14 #include <utility/tagitem.h>
15 #include <hidd/graphics.h>
18 #include <aros/debug.h>
20 #include "graphics_intern.h"
22 /****************************************************************************************/
24 OOP_Object
*PF__Root__New(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
26 DECLARE_ATTRCHECK(pixfmt
);
31 /* If no attrs are supplied, just create an empty pixfmt object */
33 EnterFunc(bug("PixFmt::New()\n"));
35 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
37 ReturnPtr("PixFmt::New(Failed from superclass", OOP_Object
*, NULL
);
39 if (NULL
== msg
->attrList
)
40 ReturnPtr("PixFmt::New(empty)", OOP_Object
*, o
);
42 if (!parse_pixfmt_tags(msg
->attrList
, &pf
, ATTRCHECK(pixfmt
), CSD(cl
) ))
44 D(bug("!!! ERROR PARSINF ATTRS IN PixFmt::New() !!!\n"));
53 OOP_MethodID dispose_mid
;
55 dispose_mid
= OOP_GetMethodID(IID_Root
, moRoot_Dispose
);
56 OOP_CoerceMethod(cl
, o
, (OOP_Msg
)&dispose_mid
);
61 ReturnPtr("PixFmt::New(Success)", OOP_Object
*, o
);
65 /****************************************************************************************/
67 VOID
PF__Root__Get(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_Get
*msg
)
69 HIDDT_PixelFormat
*pf
;
70 struct pixfmt_data
*data
;
73 data
= OOP_INST_DATA(cl
, o
);
76 if (IS_PIXFMT_ATTR(msg
->attrID
, idx
))
80 case aoHidd_PixFmt_RedShift
:
81 *msg
->storage
= pf
->red_shift
;
84 case aoHidd_PixFmt_GreenShift
:
85 *msg
->storage
= pf
->green_shift
;
88 case aoHidd_PixFmt_BlueShift
:
89 *msg
->storage
= pf
->blue_shift
;
92 case aoHidd_PixFmt_AlphaShift
:
93 *msg
->storage
= pf
->alpha_shift
;
96 case aoHidd_PixFmt_RedMask
:
97 *msg
->storage
= pf
->red_mask
;
100 case aoHidd_PixFmt_GreenMask
:
101 *msg
->storage
= pf
->green_mask
;
104 case aoHidd_PixFmt_BlueMask
:
105 *msg
->storage
= pf
->blue_mask
;
108 case aoHidd_PixFmt_AlphaMask
:
109 *msg
->storage
= pf
->alpha_mask
;
112 case aoHidd_PixFmt_CLUTShift
:
113 *msg
->storage
= pf
->clut_shift
;
116 case aoHidd_PixFmt_CLUTMask
:
117 *msg
->storage
= pf
->clut_mask
;
120 case aoHidd_PixFmt_Depth
:
121 *msg
->storage
= pf
->depth
;
124 case aoHidd_PixFmt_BitsPerPixel
:
125 *msg
->storage
= pf
->size
;
128 case aoHidd_PixFmt_BytesPerPixel
:
129 *msg
->storage
= pf
->bytes_per_pixel
;
132 case aoHidd_PixFmt_StdPixFmt
:
133 *msg
->storage
= pf
->stdpixfmt
;
136 case aoHidd_PixFmt_ColorModel
:
137 *msg
->storage
= HIDD_PF_COLMODEL(pf
);
140 case aoHidd_PixFmt_BitMapType
:
141 *msg
->storage
= HIDD_PF_BITMAPTYPE(pf
);
144 case aoHidd_PixFmt_SwapPixelBytes
:
145 *msg
->storage
= HIDD_PF_SWAPPIXELBYTES(pf
);
149 D(bug("TRYING TO GET UNKNOWN PIXFMT ATTR\n"));
150 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
157 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
163 /****************************************************************************************/