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

Last change on this file since 47 was 35, checked in by Eugene Romanenko, 16 years ago

added licence block to source files

File size: 5.0 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: CDDL 1.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the COMMON DEVELOPMENT AND
5 * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6 * this file except in compliance with the License. You may obtain a copy of
7 * the License at http://www.sun.com/cddl/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Initial Developer of the Original Code is
15 * Eugene Romanenko, netlabs.org.
16 * Portions created by the Initial Developer are Copyright (C) 2006
17 * the Initial Developer. All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * Alternatively, the contents of this file may be used under the terms of
22 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
23 * in which case the provisions of the LGPL are applicable instead of those
24 * above. If you wish to allow use of your version of this file only under the
25 * terms of the LGPL, and not to allow others to use your version of this file
26 * under the terms of the CDDL, indicate your decision by deleting the
27 * provisions above and replace them with the notice and other provisions
28 * required by the LGPL. If you do not delete the provisions above, a recipient
29 * may use your version of this file under the terms of any one of the CDDL
30 * or the LGPL.
31 *
32 * ***** END LICENSE BLOCK ***** */
33
34
35
36/*
37 *  This file was generated by the SOM Compiler.
38 *  Generated using:
39 *     SOM incremental update: 2.24
40 */
41
42
43/*
44 *  This file was generated by the SOM Compiler and Emitter Framework.
45 *  Generated using template emitter:
46 *      SOM Emitter emitxtm: 2.23.1.9
47 */
48
49#ifndef SOM_Module_lupixbuf_Source
50#define SOM_Module_lupixbuf_Source
51#endif
52#define LuPixbuf_Class_Source
53
54#include "lupixbuf.xih"
55
56
57
58/*
59 * SOM_Scope void SOMLINK LuPixbufInit(LuPixbuf *somSelf,  Environment *ev,
60 *                                     somInitCtrl* ctrl, long w, long h)
61 */
62
63/*
64 * The prototype for LuPixbufInit was replaced by the following prototype:
65 */
66SOM_Scope void SOMLINK LuPixbufInit(LuPixbuf *somSelf,  Environment *ev, 
67                                    somInitCtrl* ctrl, long w, 
68                                    long h, short bpp)
69{
70    LuPixbufData *somThis;
71    somInitCtrl globalCtrl;
72    somBooleanVector myMask;
73    LuPixbuf_BeginInitializer_LuPixbufInit;
74    LuPixbuf_Init_SOMObject_somDefaultInit(somSelf, ctrl);
75
76    // local LuPixbuf initialization code
77    somThis->width = w;
78    somThis->height = h;
79    somThis->bpp = bpp;
80    somThis->rowsize = ( somThis->width * somThis->bpp );
81    if ( bpp != 4 ) {
82            somThis->rowsize = (somThis->rowsize + 3) &~3;
83        }
84    somThis->dlen = somThis->rowsize * somThis->height;
85    somThis->data = new char[ somThis->dlen ];
86    memset( somThis->data, 0xff, somThis->dlen );
87}
88
89
90SOM_Scope long  SOMLINK getWidth(LuPixbuf *somSelf,  Environment *ev)
91{
92    LuPixbufData *somThis = LuPixbufGetData(somSelf);
93    return somThis->width;
94}
95
96SOM_Scope long  SOMLINK getHeight(LuPixbuf *somSelf,  Environment *ev)
97{
98    LuPixbufData *somThis = LuPixbufGetData(somSelf);
99    return somThis->height;
100}
101
102SOM_Scope short  SOMLINK getBpp(LuPixbuf *somSelf,  Environment *ev)
103{
104    LuPixbufData *somThis = LuPixbufGetData(somSelf);
105    return somThis->bpp;
106}
107
108SOM_Scope long  SOMLINK getRowSize(LuPixbuf *somSelf,  Environment *ev)
109{
110    LuPixbufData *somThis = LuPixbufGetData(somSelf);
111    return somThis->rowsize;
112}
113
114SOM_Scope long  SOMLINK getDataLen(LuPixbuf *somSelf,  Environment *ev)
115{
116    LuPixbufData *somThis = LuPixbufGetData(somSelf);
117    return somThis->dlen;
118}
119
120SOM_Scope void*  SOMLINK getDataPtr(LuPixbuf *somSelf,  Environment *ev)
121{
122    LuPixbufData *somThis = LuPixbufGetData(somSelf);
123    return somThis->data;
124}
125
126SOM_Scope void  SOMLINK putAt(LuPixbuf *somSelf,  Environment *ev,
127                              LuPixbuf* p, long x, long y)
128{
129    LuPixbufData *somThis = LuPixbufGetData(somSelf);
130    int xlen = __min( somThis->width - x, p->getWidth( ev ) ) * somThis->bpp;
131    int ylen = __min( somThis->height - y, p->getHeight( ev ) );
132    int rowstribe = p->getRowSize( ev );
133    char *fromdt = (char *)p->getDataPtr( ev );
134    char *todt = (char *)somThis->data + ( somThis->rowsize * y );
135    for ( int i = 0; i < ylen; i++ )
136    {
137        char *from = fromdt + ( i * rowstribe );
138        char *to = todt + ( i * somThis->rowsize ) + ( x * somThis->bpp );
139        memcpy( to, from, xlen );
140    }
141}
142
143SOM_Scope void SOMLINK somDestruct(LuPixbuf *somSelf, octet doFree,
144                                   som3DestructCtrl* ctrl)
145{
146    LuPixbufData *somThis;
147    somDestructCtrl globalCtrl;
148    somBooleanVector myMask;
149    LuPixbuf_BeginDestructor;
150
151    // local LuPixbuf deinitialization code
152    delete somThis->data;
153    // local LuPixbuf deinitialization code end
154
155    LuPixbuf_EndDestructor;
156}
157
158
Note: See TracBrowser for help on using the repository browser.