Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 65 lines (57 sloc) 2.162 kb
45cf7d8 Lyle Johnson initial checkin of r2610 from trunk
authored
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec Lyle Johnson Updated copyright notice for all SWIG interface files
authored
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 Lyle Johnson initial checkin of r2610 from trunk
authored
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 Lyle Johnson Replaced e-mail address "lyle@users.sourceforge.net" with
authored
20 * at "lyle@lylejohnson.name".
45cf7d8 Lyle Johnson initial checkin of r2610 from trunk
authored
21 ***********************************************************************/
22
23 /***********************************************************************
24 * $Id: FXMemoryBuffer.i 2062 2005-01-29 16:54:34Z lyle $
25 ***********************************************************************/
26
27 class FXMemoryBuffer {
28 public:
29 // Create an memory buffer object
30 FXMemoryBuffer(FXColor *data,FXuint size);
31
32 // Returns the size (in bytes)
33 FXuint getSize() const;
34
35 %extend {
36 // Returns the data as an array of Bignums
37 VALUE getData() const {
38 FXColor* data = self->getData();
39 if (data) {
40 FXuint size = self->getSize();
41 VALUE ary = rb_ary_new2(size);
42 for (int i = 0; i < size; i++)
43 rb_ary_store(ary, i, UINT2NUM(data[i]));
44 return ary;
45 }
46 else {
47 return Qnil;
48 }
49 }
50
51 // Indexed access
52 FXColor __getitem__(FXuint i) const {
53 return self->getData()[i];
54 }
55
56 FXColor __setitem__(FXuint i,FXColor value){
57 self->getData()[i] = value;
58 return value;
59 }
60 }
61
62 // Destructor
63 ~FXMemoryBuffer();
64 };
Something went wrong with that request. Please try again.