2
# "$Id: image_array.py 247 2006-08-22 05:54:01Z andreasheld $"
4
# Image test program for pyFLTK the Python bindings
5
# for the Fast Light Tool Kit (FLTK).
7
# FLTK copyright 1998-1999 by Bill Spitzak and others.
8
# pyFLTK copyright 2003 by Andreas Held and others.
10
# This library is free software you can redistribute it and/or
11
# modify it under the terms of the GNU Library General Public
12
# License as published by the Free Software Foundation either
13
# version 2 of the License, or (at your option) any later version.
15
# This library is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
# Library General Public License for more details.
20
# You should have received a copy of the GNU Library General Public
21
# License along with this library if not, write to the Free Software
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25
# Please report all bugs and problems to "pyfltk-user@lists.sourceforge.net".
39
#image = new uchar[4*width*height];
46
dy = float(y)/(height-1)
49
dx = float(x)/(width-1)
50
#print 255*((1.0-dx)*(1.0-dy))
51
p.append(int(255*((1.0-dx)*(1.0-dy))))
53
p.append(int(255*((1.0-dx)*dy)))
55
p.append(int(255*(dx*dy)))
59
alpha = int(255*sqrt(dx*dx+dy*dy))
87
i = i + FL_ALIGN_RIGHT
91
i = i + FL_ALIGN_BOTTOM
93
i = i + FL_ALIGN_INSIDE
95
i = i + FL_ALIGN_TEXT_OVER_IMAGE
105
window = Fl_Window(400,400)
107
window.color(FL_WHITE)
108
b = Fl_Button(140,160,120,120,"Image w/Alpha")
114
rgb = Fl_RGB_Image(image, width, height,4)
121
leftb = Fl_Toggle_Button(25,50,50,25,"left")
122
leftb.callback(button_cb)
124
rightb = Fl_Toggle_Button(75,50,50,25,"right")
125
rightb.callback(button_cb)
127
topb = Fl_Toggle_Button(125,50,50,25,"top")
128
topb.callback(button_cb)
130
bottomb = Fl_Toggle_Button(175,50,50,25,"bottom");
131
bottomb.callback(button_cb)
133
insideb = Fl_Toggle_Button(225,50,50,25,"inside")
134
insideb.callback(button_cb)
136
overb = Fl_Toggle_Button(25,75,100,25,"text over")
137
overb.callback(button_cb)
139
inactb = Fl_Toggle_Button(125,75,100,25,"inactive")
140
inactb.callback(button_cb)
142
window.resizable(window)
144
window.show(len(sys.argv), sys.argv)