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 struct Library
*OOPBase
= CSD(cl
)->cs_OOPBase
;
27 DECLARE_ATTRCHECK(pixfmt
);
32 /* If no attrs are supplied, just create an empty pixfmt object */
34 EnterFunc(bug("PixFmt::New()\n"));
36 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
38 ReturnPtr("PixFmt::New(Failed from superclass", OOP_Object
*, NULL
);
40 if (NULL
== msg
->attrList
)
41 ReturnPtr("PixFmt::New(empty)", OOP_Object
*, o
);
43 if (!parse_pixfmt_tags(msg
->attrList
, &pf
, ATTRCHECK(pixfmt
), CSD(cl
) ))
45 D(bug("!!! ERROR PARSINF ATTRS IN PixFmt::New() !!!\n"));
54 OOP_MethodID dispose_mid
;
56 dispose_mid
= OOP_GetMethodID(IID_Root
, moRoot_Dispose
);
57 OOP_CoerceMethod(cl
, o
, (OOP_Msg
)&dispose_mid
);
62 ReturnPtr("PixFmt::New(Success)", OOP_Object
*, o
);
66 /****************************************************************************************/
68 VOID
PF__Root__Get(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_Get
*msg
)
70 HIDDT_PixelFormat
*pf
;
71 struct pixfmt_data
*data
;
74 data
= OOP_INST_DATA(cl
, o
);
77 if (IS_PIXFMT_ATTR(msg
->attrID
, idx
))
81 case aoHidd_PixFmt_RedShift
:
82 *msg
->storage
= pf
->red_shift
;
85 case aoHidd_PixFmt_GreenShift
:
86 *msg
->storage
= pf
->green_shift
;
89 case aoHidd_PixFmt_BlueShift
:
90 *msg
->storage
= pf
->blue_shift
;
93 case aoHidd_PixFmt_AlphaShift
:
94 *msg
->storage
= pf
->alpha_shift
;
97 case aoHidd_PixFmt_RedMask
:
98 *msg
->storage
= pf
->red_mask
;
101 case aoHidd_PixFmt_GreenMask
:
102 *msg
->storage
= pf
->green_mask
;
105 case aoHidd_PixFmt_BlueMask
:
106 *msg
->storage
= pf
->blue_mask
;
109 case aoHidd_PixFmt_AlphaMask
:
110 *msg
->storage
= pf
->alpha_mask
;
113 case aoHidd_PixFmt_CLUTShift
:
114 *msg
->storage
= pf
->clut_shift
;
117 case aoHidd_PixFmt_CLUTMask
:
118 *msg
->storage
= pf
->clut_mask
;
121 case aoHidd_PixFmt_Depth
:
122 *msg
->storage
= pf
->depth
;
125 case aoHidd_PixFmt_BitsPerPixel
:
126 *msg
->storage
= pf
->size
;
129 case aoHidd_PixFmt_BytesPerPixel
:
130 *msg
->storage
= pf
->bytes_per_pixel
;
133 case aoHidd_PixFmt_StdPixFmt
:
134 *msg
->storage
= pf
->stdpixfmt
;
137 case aoHidd_PixFmt_ColorModel
:
138 *msg
->storage
= HIDD_PF_COLMODEL(pf
);
141 case aoHidd_PixFmt_BitMapType
:
142 *msg
->storage
= HIDD_PF_BITMAPTYPE(pf
);
145 case aoHidd_PixFmt_SwapPixelBytes
:
146 *msg
->storage
= HIDD_PF_SWAPPIXELBYTES(pf
);
150 D(bug("TRYING TO GET UNKNOWN PIXFMT ATTR\n"));
151 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
158 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
164 /****************************************************************************************/