source: trunk/Lucide/SOURCE/plugins/ludoc/lupixbuf.cpp @ 2

Last change on this file since 2 was 2, checked in by Eugene Romanenko, 15 years ago

First import

File size: 3.0 KB
Line 
1
2/*
3 *  This file was generated by the SOM Compiler.
4 *  Generated using:
5 *     SOM incremental update: 2.24
6 */
7
8/*
9 *  This file was generated by the SOM Compiler and Emitter Framework.
10 *  Generated using template emitter:
11 *      SOM Emitter emitxtm: 2.23.1.9
12 */
13
14#ifndef SOM_Module_lupixbuf_Source
15#define SOM_Module_lupixbuf_Source
16#endif
17#define LuPixbuf_Class_Source
18
19#include "lupixbuf.xih"
20
21
22SOM_Scope void SOMLINK LuPixbufInit(LuPixbuf *somSelf,  Environment *ev,
23                                    somInitCtrl* ctrl, long w, long h)
24{
25    LuPixbufData *somThis;
26    somInitCtrl globalCtrl;
27    somBooleanVector myMask;
28    LuPixbuf_BeginInitializer_LuPixbufInit;
29    LuPixbuf_Init_SOMObject_somDefaultInit(somSelf, ctrl);
30
31    // local LuPixbuf initialization code
32    somThis->width = w;
33    somThis->height = h;
34    somThis->bpp = 3;
35    somThis->rowsize = ( somThis->width * somThis->bpp );
36    somThis->rowsize = (somThis->rowsize + 3) &~3;
37    somThis->dlen = somThis->rowsize * somThis->height;
38    somThis->data = new char[ somThis->dlen ];
39    memset( somThis->data, 0xff, somThis->dlen );
40}
41
42
43SOM_Scope long  SOMLINK getWidth(LuPixbuf *somSelf,  Environment *ev)
44{
45    LuPixbufData *somThis = LuPixbufGetData(somSelf);
46    return somThis->width;
47}
48
49SOM_Scope long  SOMLINK getHeight(LuPixbuf *somSelf,  Environment *ev)
50{
51    LuPixbufData *somThis = LuPixbufGetData(somSelf);
52    return somThis->height;
53}
54
55SOM_Scope long  SOMLINK getRowSize(LuPixbuf *somSelf,  Environment *ev)
56{
57    LuPixbufData *somThis = LuPixbufGetData(somSelf);
58    return somThis->rowsize;
59}
60
61SOM_Scope long  SOMLINK getDataLen(LuPixbuf *somSelf,  Environment *ev)
62{
63    LuPixbufData *somThis = LuPixbufGetData(somSelf);
64    return somThis->dlen;
65}
66
67SOM_Scope void*  SOMLINK getDataPtr(LuPixbuf *somSelf,  Environment *ev)
68{
69    LuPixbufData *somThis = LuPixbufGetData(somSelf);
70    return somThis->data;
71}
72
73SOM_Scope void  SOMLINK putAt(LuPixbuf *somSelf,  Environment *ev,
74                              LuPixbuf* p, long x, long y)
75{
76    LuPixbufData *somThis = LuPixbufGetData(somSelf);
77    int xlen = __min( somThis->width - x, p->getWidth( ev ) ) * somThis->bpp;
78    int ylen = __min( somThis->height - y, p->getHeight( ev ) );
79    int rowstribe = p->getRowSize( ev );
80    char *fromdt = (char *)p->getDataPtr( ev );
81    char *todt = (char *)somThis->data + ( somThis->rowsize * y );
82    for ( int i = 0; i < ylen; i++ )
83    {
84        char *from = fromdt + ( i * rowstribe );
85        char *to = todt + ( i * somThis->rowsize ) + ( x * somThis->bpp );
86        memcpy( to, from, xlen );
87    }
88}
89
90SOM_Scope void SOMLINK somDestruct(LuPixbuf *somSelf, octet doFree,
91                                   som3DestructCtrl* ctrl)
92{
93    LuPixbufData *somThis;
94    somDestructCtrl globalCtrl;
95    somBooleanVector myMask;
96    LuPixbuf_BeginDestructor;
97
98    // local LuPixbuf deinitialization code
99    delete somThis->data;
100    // local LuPixbuf deinitialization code end
101
102    LuPixbuf_EndDestructor;
103}
104
105
Note: See TracBrowser for help on using the repository browser.