ruby-iup 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +97 -0
- data/doc/README +10 -0
- data/doc/build_install.txt +77 -0
- data/examples/README +16 -0
- data/examples/ctrl/cbox.rb +221 -0
- data/examples/ctrl/checkboard.rb +33 -0
- data/examples/ctrl/degrade.rb +73 -0
- data/examples/ctrl/example1.rb +53 -0
- data/examples/ctrl/example2.rb +39 -0
- data/examples/ctrl/iupcolorbar.rb +95 -0
- data/examples/ctrl/iupcolorbrowser.rb +45 -0
- data/examples/ctrl/iupdial.rb +117 -0
- data/examples/ctrl/iupgauge.rb +242 -0
- data/examples/ctrl/iupgetcolor.rb +8 -0
- data/examples/ctrl/iupgetparam.rb +62 -0
- data/examples/ctrl/iupglcanvas.rb +172 -0
- data/examples/ctrl/iupmask.rb +15 -0
- data/examples/ctrl/iupmatrix.rb +39 -0
- data/examples/ctrl/iupplot2.rb +603 -0
- data/examples/ctrl/iuptabs.rb +22 -0
- data/examples/ctrl/iuptree.rb +190 -0
- data/examples/ctrl/iupval.rb +71 -0
- data/examples/ctrl/numbering.rb +46 -0
- data/examples/ctrl/sample.rb +166 -0
- data/examples/dlg/iupalarm.rb +14 -0
- data/examples/dlg/iupfiledlg.rb +19 -0
- data/examples/dlg/iupgetfile.rb +19 -0
- data/examples/dlg/iuplistdialog.rb +26 -0
- data/examples/dlg/iupmessage.rb +5 -0
- data/examples/dlg/iupscanf.rb +17 -0
- data/examples/elem/iupbutton.rb +197 -0
- data/examples/elem/iupcanvas.rb +27 -0
- data/examples/elem/iupcanvas2.rb +113 -0
- data/examples/elem/iupcanvas3.rb +62 -0
- data/examples/elem/iupdialog.rb +71 -0
- data/examples/elem/iupdialog2.rb +25 -0
- data/examples/elem/iupfill.rb +51 -0
- data/examples/elem/iupframe.rb +25 -0
- data/examples/elem/iuphbox.rb +68 -0
- data/examples/elem/iupimage.rb +113 -0
- data/examples/elem/iupitem.rb +60 -0
- data/examples/elem/iuplabel.rb +57 -0
- data/examples/elem/iuplist.rb +41 -0
- data/examples/elem/iuplist2.rb +125 -0
- data/examples/elem/iupmenu.rb +32 -0
- data/examples/elem/iupmultiline.rb +24 -0
- data/examples/elem/iupmultiline2.rb +156 -0
- data/examples/elem/iupradio.rb +32 -0
- data/examples/elem/iupseparator.rb +81 -0
- data/examples/elem/iupsubmenu.rb +85 -0
- data/examples/elem/iuptext.rb +61 -0
- data/examples/elem/iuptimer.rb +36 -0
- data/examples/elem/iuptoggle.rb +110 -0
- data/examples/elem/iupvbox.rb +87 -0
- data/examples/elem/iupzbox.rb +60 -0
- data/examples/elem/mdisample.rb +376 -0
- data/examples/elem/progressbar.rb +294 -0
- data/examples/elem/scrollbar.rb +66 -0
- data/examples/elem/tray.rb +90 -0
- data/examples/func/iupgetattribute.rb +32 -0
- data/examples/func/iupidle.rb +48 -0
- data/ext/extconf.rb +27 -0
- data/ext/iup-linux/include/cd.h +494 -0
- data/ext/iup-linux/include/cd_canvas.hpp +358 -0
- data/ext/iup-linux/include/cd_old.h +158 -0
- data/ext/iup-linux/include/cd_private.h +362 -0
- data/ext/iup-linux/include/cdcgm.h +34 -0
- data/ext/iup-linux/include/cdclipbd.h +22 -0
- data/ext/iup-linux/include/cddbuf.h +23 -0
- data/ext/iup-linux/include/cddebug.h +24 -0
- data/ext/iup-linux/include/cddgn.h +23 -0
- data/ext/iup-linux/include/cddxf.h +22 -0
- data/ext/iup-linux/include/cdemf.h +22 -0
- data/ext/iup-linux/include/cdgdiplus.h +29 -0
- data/ext/iup-linux/include/cdimage.h +23 -0
- data/ext/iup-linux/include/cdirgb.h +30 -0
- data/ext/iup-linux/include/cdiup.h +22 -0
- data/ext/iup-linux/include/cdlua.h +39 -0
- data/ext/iup-linux/include/cdlua3_private.h +120 -0
- data/ext/iup-linux/include/cdlua5_private.h +141 -0
- data/ext/iup-linux/include/cdluaim.h +24 -0
- data/ext/iup-linux/include/cdluaiup.h +27 -0
- data/ext/iup-linux/include/cdluapdf.h +27 -0
- data/ext/iup-linux/include/cdmf.h +24 -0
- data/ext/iup-linux/include/cdmf_private.h +32 -0
- data/ext/iup-linux/include/cdnative.h +26 -0
- data/ext/iup-linux/include/cdpdf.h +38 -0
- data/ext/iup-linux/include/cdpicture.h +22 -0
- data/ext/iup-linux/include/cdprint.h +23 -0
- data/ext/iup-linux/include/cdps.h +37 -0
- data/ext/iup-linux/include/cdwmf.h +22 -0
- data/ext/iup-linux/include/im.h +282 -0
- data/ext/iup-linux/include/im_attrib.h +116 -0
- data/ext/iup-linux/include/im_attrib_flat.h +39 -0
- data/ext/iup-linux/include/im_binfile.h +214 -0
- data/ext/iup-linux/include/im_capture.h +365 -0
- data/ext/iup-linux/include/im_color.h +465 -0
- data/ext/iup-linux/include/im_colorhsi.h +61 -0
- data/ext/iup-linux/include/im_complex.h +160 -0
- data/ext/iup-linux/include/im_convert.h +127 -0
- data/ext/iup-linux/include/im_counter.h +69 -0
- data/ext/iup-linux/include/im_dib.h +195 -0
- data/ext/iup-linux/include/im_file.h +111 -0
- data/ext/iup-linux/include/im_format.h +79 -0
- data/ext/iup-linux/include/im_format_all.h +576 -0
- data/ext/iup-linux/include/im_format_avi.h +87 -0
- data/ext/iup-linux/include/im_format_ecw.h +93 -0
- data/ext/iup-linux/include/im_format_jp2.h +78 -0
- data/ext/iup-linux/include/im_format_raw.h +64 -0
- data/ext/iup-linux/include/im_format_wmv.h +100 -0
- data/ext/iup-linux/include/im_image.h +403 -0
- data/ext/iup-linux/include/im_kernel.h +315 -0
- data/ext/iup-linux/include/im_lib.h +191 -0
- data/ext/iup-linux/include/im_math.h +368 -0
- data/ext/iup-linux/include/im_math_op.h +219 -0
- data/ext/iup-linux/include/im_palette.h +172 -0
- data/ext/iup-linux/include/im_plus.h +73 -0
- data/ext/iup-linux/include/im_process.h +35 -0
- data/ext/iup-linux/include/im_process_ana.h +221 -0
- data/ext/iup-linux/include/im_process_glo.h +170 -0
- data/ext/iup-linux/include/im_process_loc.h +577 -0
- data/ext/iup-linux/include/im_process_pon.h +712 -0
- data/ext/iup-linux/include/im_raw.h +34 -0
- data/ext/iup-linux/include/im_util.h +277 -0
- data/ext/iup-linux/include/imlua.h +83 -0
- data/ext/iup-linux/include/iup.h +255 -0
- data/ext/iup-linux/include/iup_pplot.h +40 -0
- data/ext/iup-linux/include/iupcb.h +25 -0
- data/ext/iup-linux/include/iupcbox.h +23 -0
- data/ext/iup-linux/include/iupcbs.h +42 -0
- data/ext/iup-linux/include/iupcells.h +130 -0
- data/ext/iup-linux/include/iupcolorbar.h +126 -0
- data/ext/iup-linux/include/iupcompat.h +62 -0
- data/ext/iup-linux/include/iupcontrols.h +40 -0
- data/ext/iup-linux/include/iupcpi.h +76 -0
- data/ext/iup-linux/include/iupdef.h +520 -0
- data/ext/iup-linux/include/iupdial.h +64 -0
- data/ext/iup-linux/include/iupgauge.h +57 -0
- data/ext/iup-linux/include/iupgc.h +20 -0
- data/ext/iup-linux/include/iupgetparam.h +27 -0
- data/ext/iup-linux/include/iupgl.h +101 -0
- data/ext/iup-linux/include/iupim.h +21 -0
- data/ext/iup-linux/include/iupkey.h +290 -0
- data/ext/iup-linux/include/iuplua.h +41 -0
- data/ext/iup-linux/include/iuplua_pplot.h +26 -0
- data/ext/iup-linux/include/iupluacontrols.h +27 -0
- data/ext/iup-linux/include/iupluagl.h +26 -0
- data/ext/iup-linux/include/iupluaim.h +26 -0
- data/ext/iup-linux/include/iupluaole.h +26 -0
- data/ext/iup-linux/include/iupmask.h +52 -0
- data/ext/iup-linux/include/iupmatrix.h +69 -0
- data/ext/iup-linux/include/iupole.h +24 -0
- data/ext/iup-linux/include/iupsbox.h +20 -0
- data/ext/iup-linux/include/iupspeech.h +23 -0
- data/ext/iup-linux/include/iupspin.h +21 -0
- data/ext/iup-linux/include/iuptabs.h +79 -0
- data/ext/iup-linux/include/iuptree.h +93 -0
- data/ext/iup-linux/include/iupval.h +46 -0
- data/ext/iup-linux/include/lauxlib.h +174 -0
- data/ext/iup-linux/include/lua.h +388 -0
- data/ext/iup-linux/include/lua.hpp +9 -0
- data/ext/iup-linux/include/luaconf.h +763 -0
- data/ext/iup-linux/include/lualib.h +53 -0
- data/ext/iup-linux/include/old_im.h +59 -0
- data/ext/iup-linux/include/wd.h +78 -0
- data/ext/iup-linux/include/wd_old.h +85 -0
- data/ext/iup-linux/libcd.so +0 -0
- data/ext/iup-linux/libcdcontextplus.so +0 -0
- data/ext/iup-linux/libcdluacontextplus51.so +0 -0
- data/ext/iup-linux/libcdpdf.so +0 -0
- data/ext/iup-linux/libfreetype.so +0 -0
- data/ext/iup-linux/libim.so +0 -0
- data/ext/iup-linux/libim_fftw.so +0 -0
- data/ext/iup-linux/libim_jp2.so +0 -0
- data/ext/iup-linux/libim_process.so +0 -0
- data/ext/iup-linux/libiup.so +0 -0
- data/ext/iup-linux/libiup_pplot.so +0 -0
- data/ext/iup-linux/libiupcd.so +0 -0
- data/ext/iup-linux/libiupcontrols.so +0 -0
- data/ext/iup-linux/libiupgl.so +0 -0
- data/ext/iup-linux/libiupim.so +0 -0
- data/ext/iup-linux/libiupimglib.so +0 -0
- data/ext/iup-linux/libpdflib.so +0 -0
- data/ext/iup-win32/cd.dll +0 -0
- data/ext/iup-win32/cd.lib +0 -0
- data/ext/iup-win32/cdcontextplus.dll +0 -0
- data/ext/iup-win32/cdcontextplus.lib +0 -0
- data/ext/iup-win32/cdlua51.lib +0 -0
- data/ext/iup-win32/cdluacontextplus51.lib +0 -0
- data/ext/iup-win32/cdluaim51.lib +0 -0
- data/ext/iup-win32/cdluapdf51.lib +0 -0
- data/ext/iup-win32/cdpdf.dll +0 -0
- data/ext/iup-win32/cdpdf.lib +0 -0
- data/ext/iup-win32/freetype6.dll +0 -0
- data/ext/iup-win32/freetype6.lib +0 -0
- data/ext/iup-win32/im.dll +0 -0
- data/ext/iup-win32/im_avi.dll +0 -0
- data/ext/iup-win32/im_capture.dll +0 -0
- data/ext/iup-win32/im_ecw.dll +0 -0
- data/ext/iup-win32/im_fftw.dll +0 -0
- data/ext/iup-win32/im_jp2.dll +0 -0
- data/ext/iup-win32/im_process.dll +0 -0
- data/ext/iup-win32/im_wmv.dll +0 -0
- data/ext/iup-win32/include/cd.h +494 -0
- data/ext/iup-win32/include/cd_canvas.hpp +358 -0
- data/ext/iup-win32/include/cd_old.h +158 -0
- data/ext/iup-win32/include/cd_private.h +362 -0
- data/ext/iup-win32/include/cdcgm.h +34 -0
- data/ext/iup-win32/include/cdclipbd.h +22 -0
- data/ext/iup-win32/include/cddbuf.h +23 -0
- data/ext/iup-win32/include/cddebug.h +24 -0
- data/ext/iup-win32/include/cddgn.h +23 -0
- data/ext/iup-win32/include/cddxf.h +22 -0
- data/ext/iup-win32/include/cdemf.h +22 -0
- data/ext/iup-win32/include/cdgdiplus.h +29 -0
- data/ext/iup-win32/include/cdimage.h +23 -0
- data/ext/iup-win32/include/cdirgb.h +30 -0
- data/ext/iup-win32/include/cdiup.h +22 -0
- data/ext/iup-win32/include/cdlua.h +39 -0
- data/ext/iup-win32/include/cdlua3_private.h +120 -0
- data/ext/iup-win32/include/cdlua5_private.h +141 -0
- data/ext/iup-win32/include/cdluaim.h +24 -0
- data/ext/iup-win32/include/cdluaiup.h +27 -0
- data/ext/iup-win32/include/cdluapdf.h +27 -0
- data/ext/iup-win32/include/cdmf.h +24 -0
- data/ext/iup-win32/include/cdmf_private.h +32 -0
- data/ext/iup-win32/include/cdnative.h +26 -0
- data/ext/iup-win32/include/cdpdf.h +38 -0
- data/ext/iup-win32/include/cdpicture.h +22 -0
- data/ext/iup-win32/include/cdprint.h +23 -0
- data/ext/iup-win32/include/cdps.h +37 -0
- data/ext/iup-win32/include/cdwmf.h +22 -0
- data/ext/iup-win32/include/iup.h +255 -0
- data/ext/iup-win32/include/iup_pplot.h +40 -0
- data/ext/iup-win32/include/iupcb.h +25 -0
- data/ext/iup-win32/include/iupcbox.h +23 -0
- data/ext/iup-win32/include/iupcbs.h +42 -0
- data/ext/iup-win32/include/iupcells.h +130 -0
- data/ext/iup-win32/include/iupcolorbar.h +126 -0
- data/ext/iup-win32/include/iupcompat.h +62 -0
- data/ext/iup-win32/include/iupcontrols.h +40 -0
- data/ext/iup-win32/include/iupcpi.h +76 -0
- data/ext/iup-win32/include/iupdef.h +520 -0
- data/ext/iup-win32/include/iupdial.h +64 -0
- data/ext/iup-win32/include/iupgauge.h +57 -0
- data/ext/iup-win32/include/iupgc.h +20 -0
- data/ext/iup-win32/include/iupgetparam.h +27 -0
- data/ext/iup-win32/include/iupgl.h +101 -0
- data/ext/iup-win32/include/iupim.h +21 -0
- data/ext/iup-win32/include/iupkey.h +290 -0
- data/ext/iup-win32/include/iuplua.h +41 -0
- data/ext/iup-win32/include/iuplua_pplot.h +26 -0
- data/ext/iup-win32/include/iupluacontrols.h +27 -0
- data/ext/iup-win32/include/iupluagl.h +26 -0
- data/ext/iup-win32/include/iupluaim.h +26 -0
- data/ext/iup-win32/include/iupluaole.h +26 -0
- data/ext/iup-win32/include/iupmask.h +52 -0
- data/ext/iup-win32/include/iupmatrix.h +69 -0
- data/ext/iup-win32/include/iupole.h +24 -0
- data/ext/iup-win32/include/iupsbox.h +20 -0
- data/ext/iup-win32/include/iupspeech.h +23 -0
- data/ext/iup-win32/include/iupspin.h +21 -0
- data/ext/iup-win32/include/iuptabs.h +79 -0
- data/ext/iup-win32/include/iuptree.h +93 -0
- data/ext/iup-win32/include/iupval.h +46 -0
- data/ext/iup-win32/include/wd.h +78 -0
- data/ext/iup-win32/include/wd_old.h +85 -0
- data/ext/iup-win32/iup.dll +0 -0
- data/ext/iup-win32/iup.lib +0 -0
- data/ext/iup-win32/iup_pplot.dll +0 -0
- data/ext/iup-win32/iup_pplot.lib +0 -0
- data/ext/iup-win32/iupcd.dll +0 -0
- data/ext/iup-win32/iupcd.lib +0 -0
- data/ext/iup-win32/iupcontrols.dll +0 -0
- data/ext/iup-win32/iupcontrols.lib +0 -0
- data/ext/iup-win32/iupgl.dll +0 -0
- data/ext/iup-win32/iupgl.lib +0 -0
- data/ext/iup-win32/iupim.dll +0 -0
- data/ext/iup-win32/iupim.lib +0 -0
- data/ext/iup-win32/iupimglib.dll +0 -0
- data/ext/iup-win32/iupimglib.lib +0 -0
- data/ext/iup-win32/iuplua51.lib +0 -0
- data/ext/iup-win32/iuplua_pplot51.lib +0 -0
- data/ext/iup-win32/iupluacd51.lib +0 -0
- data/ext/iup-win32/iupluacontrols51.lib +0 -0
- data/ext/iup-win32/iupluagl51.lib +0 -0
- data/ext/iup-win32/iupluaim51.lib +0 -0
- data/ext/iup-win32/iupluaimglib51.lib +0 -0
- data/ext/iup-win32/iupluaole51.lib +0 -0
- data/ext/iup-win32/iupole.dll +0 -0
- data/ext/iup-win32/iupole.lib +0 -0
- data/ext/iup-win32/iupstub.lib +0 -0
- data/ext/iup-win32/pdflib.dll +0 -0
- data/ext/iup-win32/pdflib.lib +0 -0
- data/ext/iup.c +1261 -0
- data/ext/mkrf_conf.rb +72 -0
- data/ext/rb_cd.h +1525 -0
- data/ext/rb_iup.h +2446 -0
- data/ext/rb_iup_pplot.h +129 -0
- data/ext/rb_iupcb.h +13 -0
- data/ext/rb_iupcbox.h +40 -0
- data/ext/rb_iupcells.h +15 -0
- data/ext/rb_iupcolorbar.h +17 -0
- data/ext/rb_iupcompat.h +237 -0
- data/ext/rb_iupcontrols.h +28 -0
- data/ext/rb_iupdef.h +3 -0
- data/ext/rb_iupdial.h +24 -0
- data/ext/rb_iupgauge.h +15 -0
- data/ext/rb_iupgc.h +18 -0
- data/ext/rb_iupgetparam.h +72 -0
- data/ext/rb_iupgl.h +58 -0
- data/ext/rb_iupim.h +25 -0
- data/ext/rb_iupmask.h +189 -0
- data/ext/rb_iupmatrix.h +80 -0
- data/ext/rb_iupole.h +24 -0
- data/ext/rb_iupsbox.h +23 -0
- data/ext/rb_iupspeech.h +25 -0
- data/ext/rb_iupspin.h +29 -0
- data/ext/rb_iuptabs.h +29 -0
- data/ext/rb_iuptree.h +94 -0
- data/ext/rb_iupval.h +24 -0
- data/lib/README +1 -0
- metadata +391 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'iup'
|
3
|
+
|
4
|
+
|
5
|
+
cdcanvas = nil
|
6
|
+
|
7
|
+
action = lambda do |ih, posx, posy|
|
8
|
+
|
9
|
+
iposx = posx.to_i
|
10
|
+
iposy = posy.to_i
|
11
|
+
# invert scroll reference (YMAX - DY - POSY)
|
12
|
+
iposy = 399 - ih.dy.to_i - iposy
|
13
|
+
|
14
|
+
cdcanvas.CanvasClear()
|
15
|
+
|
16
|
+
cdcanvas.CanvasForeground(Cd::RED)
|
17
|
+
cdcanvas.CanvasLine(0-iposx, 0-iposy, 599-iposx, 399-iposy)
|
18
|
+
cdcanvas.CanvasLine(0-iposx, 399-iposy, 599-iposx, 0-iposy)
|
19
|
+
|
20
|
+
Iup::DEFAULT
|
21
|
+
end
|
22
|
+
|
23
|
+
scroll_cb = lambda do |ih, op, posx, posy|
|
24
|
+
action.call(ih, posx, posy)
|
25
|
+
Iup::DEFAULT
|
26
|
+
end
|
27
|
+
|
28
|
+
resize_cb = lambda do |ih, w, h|
|
29
|
+
return Iup::DEFAULT if cdcanvas==nil
|
30
|
+
# update CD canvas size
|
31
|
+
cdcanvas.CanvasActivate()
|
32
|
+
|
33
|
+
# update page size, it is always the client size of the canvas
|
34
|
+
ih.dx = w
|
35
|
+
ih.dy = h
|
36
|
+
|
37
|
+
# refresh scroolbar in IUP 2.x
|
38
|
+
ih.posx = ih.posx
|
39
|
+
ih.posy = ih.posy
|
40
|
+
return Iup::DEFAULT
|
41
|
+
end
|
42
|
+
|
43
|
+
canvas = Iup.Canvas()
|
44
|
+
canvas.rastersize = "300x200" # initial size
|
45
|
+
canvas.scrollbar = "YES"
|
46
|
+
canvas.xmax = 599
|
47
|
+
canvas.ymax = 399
|
48
|
+
|
49
|
+
canvas.scroll_cb = scroll_cb
|
50
|
+
canvas.resize_cb = resize_cb
|
51
|
+
canvas.action = action
|
52
|
+
|
53
|
+
dialog = Iup.Dialog(canvas)
|
54
|
+
dialog.title = "Scrollbar Test"
|
55
|
+
|
56
|
+
dialog.Map()
|
57
|
+
cdcanvas = Cd.CreateCanvas(Cd.CD_IUP, canvas)
|
58
|
+
canvas.rastersize = nil # release the minimum limitation
|
59
|
+
|
60
|
+
dialog.ShowXY(Iup::CENTER,Iup::CENTER)
|
61
|
+
|
62
|
+
Iup.MainLoop()
|
63
|
+
|
64
|
+
cdcanvas.KillCanvas()
|
65
|
+
dialog.Destroy()
|
66
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'iup'
|
3
|
+
|
4
|
+
img = [
|
5
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
6
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
7
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
8
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,11, 5, 5, 5, 5,12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
9
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,10, 6, 5, 3, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
10
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 5, 1, 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
11
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 5, 1, 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
12
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 9, 9, 1, 1, 3, 7, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
13
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 6, 1, 1, 1, 1, 2, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
14
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 6, 1, 1, 1, 1, 4, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
15
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 6, 1, 1, 1, 1, 4, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
16
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,11, 2, 7, 5, 4, 4, 4, 4, 4, 4,11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
17
|
+
1, 1, 1, 1, 1, 1, 7, 4, 4, 4, 6, 3, 3, 7, 5, 5, 7, 7, 4, 4, 4, 4,10,10,10,10,10, 1, 1, 1, 1, 1,
|
18
|
+
1, 1, 1, 1, 4, 4, 4, 9, 9, 6, 5, 4, 8, 7, 5, 1, 1, 1, 1, 7, 5, 6, 3, 3, 3, 3, 4,10, 7, 9, 1, 1,
|
19
|
+
1, 1, 1, 4, 4, 6, 6, 8, 1, 1, 1, 1, 1,10, 5, 1, 1, 1, 1,10, 6, 1, 1, 1, 1, 1, 3, 3, 7, 7, 7, 1,
|
20
|
+
1, 1, 2, 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 1, 7, 9, 1, 1, 1, 1, 1, 1, 1, 7, 7, 5, 1,
|
21
|
+
1, 1, 1, 3, 4, 4, 4, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 1, 7, 6, 1, 1, 1, 1, 1, 7, 7, 7, 9, 7, 1,
|
22
|
+
1, 1, 1, 1, 3, 3, 3, 4,10,10,10,11, 1, 4, 5, 1, 1, 1, 1, 5, 6,15, 5, 7, 7, 7, 9, 6, 5, 5, 1, 1,
|
23
|
+
1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 2, 4, 7, 5, 5, 5, 5, 6, 9,14,14, 6, 5, 5, 5, 7,12, 1, 1, 1, 1,
|
24
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 3, 3, 2, 2, 2, 4, 4, 2, 2,10,16, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
25
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
26
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
27
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 1, 1, 1, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
28
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 9, 1, 1, 4, 9, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
29
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12, 3, 5, 1, 1, 5, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
30
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 1, 1, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
31
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 5, 4, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
32
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 3, 5, 7, 7,13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
33
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
34
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
35
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
36
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
tecgraf = Iup.Image(32,32,img)
|
42
|
+
tecgraf["1"] = "BGCOLOR"
|
43
|
+
tecgraf["2"] = "079 086 099"
|
44
|
+
tecgraf["3"] = "040 045 053"
|
45
|
+
tecgraf["4"] = "104 113 129"
|
46
|
+
tecgraf["5"] = "136 147 170"
|
47
|
+
tecgraf["6"] = "155 164 179"
|
48
|
+
tecgraf["7"] = "121 136 167"
|
49
|
+
tecgraf["8"] = "239 239 243"
|
50
|
+
tecgraf["9"] = "176 190 214"
|
51
|
+
tecgraf["10"] = "127 133 143"
|
52
|
+
tecgraf["11"] = "207 209 214"
|
53
|
+
tecgraf["12"] = "247 255 255"
|
54
|
+
tecgraf["13"] = "244 247 249"
|
55
|
+
tecgraf["14"] = "212 217 225"
|
56
|
+
tecgraf["15"] = "215 226 241"
|
57
|
+
tecgraf["16"] = "231 237 245"
|
58
|
+
|
59
|
+
dg = Iup.Dialog(Iup.Label("Tray example"))
|
60
|
+
dg.title = "Tray"
|
61
|
+
dg.tray = "YES"
|
62
|
+
dg.traytip = "This is a tip at tray"
|
63
|
+
dg.trayimage = tecgraf
|
64
|
+
dg.Show()
|
65
|
+
|
66
|
+
action1 = lambda do |ih|
|
67
|
+
dg.Show()
|
68
|
+
end
|
69
|
+
|
70
|
+
action2 = lambda do |ih|
|
71
|
+
dg.tray = "NO"
|
72
|
+
dg.Hide()
|
73
|
+
Iup::CLOSE
|
74
|
+
end
|
75
|
+
|
76
|
+
trayclick_cb = lambda do |ih, b, press, dclick|
|
77
|
+
if b == 1 && press!=0
|
78
|
+
item_show = Iup.Item(:title=>"Show",:action=>action1)
|
79
|
+
item_exit = Iup.Item(:title=>"Exit",:action=>action2)
|
80
|
+
menu = Iup.Menu([item_show, item_exit])
|
81
|
+
menu.Popup(Iup::MOUSEPOS, Iup::MOUSEPOS)
|
82
|
+
end
|
83
|
+
Iup::DEFAULT
|
84
|
+
end
|
85
|
+
|
86
|
+
dg.hidetaskbar = "YES"
|
87
|
+
dg.trayclick_cb = trayclick_cb
|
88
|
+
|
89
|
+
Iup.MainLoop()
|
90
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'iup'
|
3
|
+
|
4
|
+
acao_numero = lambda do |ih, c, new_value|
|
5
|
+
valid_character = "0123456789.+-Ee"
|
6
|
+
|
7
|
+
if(c == Iup::K_CR) # replaces TAB for ENTER */
|
8
|
+
return Iup::K_TAB
|
9
|
+
elsif(c<256 && valid_character[c.chr]) # c is a valid character */
|
10
|
+
return Iup::DEFAULT
|
11
|
+
elsif(c<20 || c>=256) # c is a control character(TAB, BACKSPACE, ...) */
|
12
|
+
return Iup::DEFAULT
|
13
|
+
end
|
14
|
+
return Iup::IGNORE
|
15
|
+
end
|
16
|
+
|
17
|
+
campo = Iup.Text("acao_numero") # creates TEXT field */
|
18
|
+
campo.action = acao_numero # registers callback */
|
19
|
+
campo.value = 1.0 # defines initial value */
|
20
|
+
|
21
|
+
mensagem = Iup.Label("Entre a Number: ") # creates message */
|
22
|
+
prompt = Iup.Hbox([mensagem, campo]) # creates prompt */
|
23
|
+
|
24
|
+
dlg = Iup.Dialog(prompt)
|
25
|
+
dlg.Show() # displays and creates dialog */
|
26
|
+
Iup.MainLoop() # interacts with user */
|
27
|
+
|
28
|
+
puts("Integer Number: %d" % campo.GetInt("VALUE")) # prints the integer number entered by the user */
|
29
|
+
puts("Real Number: %g" % campo.GetFloat("VALUE")) # prints the real number entered by the user */
|
30
|
+
puts("Text: %s" % campo.value) # prints the text entered by the user */
|
31
|
+
|
32
|
+
dlg.Destroy()
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require 'iup'
|
4
|
+
|
5
|
+
calc = {}
|
6
|
+
|
7
|
+
|
8
|
+
text = Iup.Text(:size=>"100x20")
|
9
|
+
|
10
|
+
calc_end = lambda do
|
11
|
+
Iup.SetIdle(nil)
|
12
|
+
Iup::DEFAULT
|
13
|
+
end
|
14
|
+
|
15
|
+
idle_function = lambda do
|
16
|
+
# Iup::TITLE value for IUP */
|
17
|
+
sleep 0.01
|
18
|
+
calc[:passo]+= 1 # next iteration step */
|
19
|
+
calc[:fatorial] *= calc[:passo] # executes one computation step */
|
20
|
+
|
21
|
+
# feedback to the user on the current step and the last computed value */
|
22
|
+
str = "%d -> %10.4g" % [calc[:passo],calc[:fatorial]]
|
23
|
+
text.value = str
|
24
|
+
|
25
|
+
if(calc[:passo] == 100) # computation ends when step = 100 */
|
26
|
+
calc_end.call
|
27
|
+
end
|
28
|
+
Iup::DEFAULT
|
29
|
+
end
|
30
|
+
|
31
|
+
calc_begin = lambda do |ih|
|
32
|
+
calc[:passo] = 0
|
33
|
+
calc[:fatorial] = 1.0
|
34
|
+
Iup.SetIdle(idle_function)
|
35
|
+
text.value = "Computing..."
|
36
|
+
Iup::DEFAULT
|
37
|
+
end
|
38
|
+
|
39
|
+
bt = Iup.Button(:title=>"Calcular",:action=>calc_begin)
|
40
|
+
|
41
|
+
dg = Iup.Dialog(Iup.Vbox([text, bt]))
|
42
|
+
|
43
|
+
dg.ShowXY(Iup::CENTER, Iup::CENTER)
|
44
|
+
|
45
|
+
Iup.MainLoop()
|
46
|
+
dg.Destroy()
|
47
|
+
|
48
|
+
|
data/ext/extconf.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# extconf.rb for ruby-iup extension module.
|
2
|
+
#
|
3
|
+
# Copyright (C) 2008 Park Heesob <jmg3000@gmail.com>
|
4
|
+
#
|
5
|
+
# This program is distributed under the terms of the MIT license.
|
6
|
+
# See the included COPYRIGHT file for the terms of this license.
|
7
|
+
#
|
8
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
9
|
+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
10
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
11
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
12
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
13
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
14
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
|
16
|
+
require 'ftools'
|
17
|
+
|
18
|
+
if RUBY_PLATFORM =~ /win32/
|
19
|
+
ldir = "./iup-win32"
|
20
|
+
Dir[ldir+"/*.dll"].each do |f|
|
21
|
+
File.install(f,Config::CONFIG['bindir'],0644,true)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
File.open("nmake.bat","w")
|
25
|
+
File.open("Makefile","w") {|f|
|
26
|
+
f.puts("install:")
|
27
|
+
}
|
@@ -0,0 +1,494 @@
|
|
1
|
+
/** \file
|
2
|
+
* \brief User API
|
3
|
+
* CD - Canvas Draw
|
4
|
+
* Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
5
|
+
* http://www.tecgraf.puc-rio.br/cd
|
6
|
+
* mailto:cd@tecgraf.puc-rio.br
|
7
|
+
*
|
8
|
+
* See Copyright Notice at the end of this file
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef __CD_H
|
12
|
+
#define __CD_H
|
13
|
+
|
14
|
+
#ifdef __cplusplus
|
15
|
+
extern "C" {
|
16
|
+
#endif
|
17
|
+
|
18
|
+
|
19
|
+
#define CD_NAME "CD - Canvas Draw"
|
20
|
+
#define CD_DESCRIPTION "A 2D Graphics Library"
|
21
|
+
#define CD_COPYRIGHT "Copyright (C) 1994-2008 Tecgraf, PUC-Rio."
|
22
|
+
#define CD_VERSION "5.1.0"
|
23
|
+
#define CD_VERSION_DATE "2008/10/14"
|
24
|
+
#define CD_VERSION_NUMBER 501000
|
25
|
+
|
26
|
+
typedef struct _cdContext cdContext;
|
27
|
+
typedef struct _cdCanvas cdCanvas;
|
28
|
+
typedef struct _cdCanvas cdState;
|
29
|
+
typedef struct _cdImage cdImage;
|
30
|
+
|
31
|
+
/* client images using bitmap structure */
|
32
|
+
typedef struct _cdBitmap {
|
33
|
+
int w;
|
34
|
+
int h;
|
35
|
+
int type;
|
36
|
+
void *data;
|
37
|
+
} cdBitmap;
|
38
|
+
|
39
|
+
|
40
|
+
/* library */
|
41
|
+
char* cdVersion(void);
|
42
|
+
char* cdVersionDate(void);
|
43
|
+
int cdVersionNumber(void);
|
44
|
+
|
45
|
+
/* canvas init */
|
46
|
+
cdCanvas* cdCreateCanvas(cdContext *context, void *data);
|
47
|
+
cdCanvas* cdCreateCanvasf(cdContext *context, const char* format, ...);
|
48
|
+
void cdKillCanvas(cdCanvas* canvas);
|
49
|
+
|
50
|
+
cdContext* cdCanvasGetContext(cdCanvas* canvas);
|
51
|
+
int cdCanvasActivate(cdCanvas* canvas);
|
52
|
+
void cdCanvasDeactivate(cdCanvas* canvas);
|
53
|
+
int cdUseContextPlus(int use);
|
54
|
+
void cdInitContextPlus(void); /* need an external library */
|
55
|
+
|
56
|
+
/* context */
|
57
|
+
typedef int (*cdCallback)(cdCanvas* canvas, ...);
|
58
|
+
int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
|
59
|
+
unsigned long cdContextCaps(cdContext *context);
|
60
|
+
|
61
|
+
/* control */
|
62
|
+
int cdCanvasSimulate(cdCanvas* canvas, int mode);
|
63
|
+
void cdCanvasFlush(cdCanvas* canvas);
|
64
|
+
void cdCanvasClear(cdCanvas* canvas);
|
65
|
+
cdState* cdCanvasSaveState(cdCanvas* canvas);
|
66
|
+
void cdCanvasRestoreState(cdCanvas* canvas, cdState* state);
|
67
|
+
void cdReleaseState(cdState* state);
|
68
|
+
void cdCanvasSetAttribute(cdCanvas* canvas, const char* name, char* data);
|
69
|
+
void cdCanvasSetfAttribute(cdCanvas* canvas, const char* name, const char* format, ...);
|
70
|
+
char* cdCanvasGetAttribute(cdCanvas* canvas, const char* name);
|
71
|
+
|
72
|
+
/* interpretation */
|
73
|
+
int cdCanvasPlay(cdCanvas* canvas, cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data);
|
74
|
+
|
75
|
+
/* coordinate transformation */
|
76
|
+
void cdCanvasGetSize(cdCanvas* canvas, int *width, int *height, double *width_mm, double *height_mm);
|
77
|
+
int cdCanvasUpdateYAxis(cdCanvas* canvas, int* y);
|
78
|
+
double cdfCanvasUpdateYAxis(cdCanvas* canvas, double* y);
|
79
|
+
int cdCanvasInvertYAxis(cdCanvas* canvas, int y);
|
80
|
+
double cdfCanvasInvertYAxis(cdCanvas* canvas, double y);
|
81
|
+
void cdCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, int *dx, int *dy);
|
82
|
+
void cdCanvasPixel2MM(cdCanvas* canvas, int dx, int dy, double *mm_dx, double *mm_dy);
|
83
|
+
void cdfCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, double *dx, double *dy);
|
84
|
+
void cdfCanvasPixel2MM(cdCanvas* canvas, double dx, double dy, double *mm_dx, double *mm_dy);
|
85
|
+
void cdCanvasOrigin(cdCanvas* canvas, int x, int y);
|
86
|
+
void cdfCanvasOrigin(cdCanvas* canvas, double x, double y);
|
87
|
+
void cdCanvasGetOrigin(cdCanvas* canvas, int *x, int *y);
|
88
|
+
void cdfCanvasGetOrigin(cdCanvas* canvas, double *x, double *y);
|
89
|
+
void cdCanvasTransform(cdCanvas* canvas, const double* matrix);
|
90
|
+
double* cdCanvasGetTransform(cdCanvas* canvas);
|
91
|
+
void cdCanvasTransformMultiply(cdCanvas* canvas, const double* matrix);
|
92
|
+
void cdCanvasTransformRotate(cdCanvas* canvas, double angle);
|
93
|
+
void cdCanvasTransformScale(cdCanvas* canvas, double sx, double sy);
|
94
|
+
void cdCanvasTransformTranslate(cdCanvas* canvas, double dx, double dy);
|
95
|
+
void cdCanvasTransformPoint(cdCanvas* canvas, int x, int y, int *tx, int *ty);
|
96
|
+
void cdfCanvasTransformPoint(cdCanvas* canvas, double x, double y, double *tx, double *ty);
|
97
|
+
|
98
|
+
/* clipping */
|
99
|
+
int cdCanvasClip(cdCanvas* canvas, int mode);
|
100
|
+
void cdCanvasClipArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
|
101
|
+
int cdCanvasGetClipArea(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
|
102
|
+
void cdfCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
|
103
|
+
int cdfCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
|
104
|
+
|
105
|
+
/* clipping region */
|
106
|
+
int cdCanvasIsPointInRegion(cdCanvas* canvas, int x, int y);
|
107
|
+
void cdCanvasOffsetRegion(cdCanvas* canvas, int x, int y);
|
108
|
+
void cdCanvasGetRegionBox(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
|
109
|
+
int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode);
|
110
|
+
|
111
|
+
/* primitives */
|
112
|
+
void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color);
|
113
|
+
void cdCanvasMark(cdCanvas* canvas, int x, int y);
|
114
|
+
|
115
|
+
void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2);
|
116
|
+
void cdCanvasBegin(cdCanvas* canvas, int mode);
|
117
|
+
void cdCanvasVertex(cdCanvas* canvas, int x, int y);
|
118
|
+
void cdCanvasEnd(cdCanvas* canvas);
|
119
|
+
void cdCanvasRect(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
|
120
|
+
void cdCanvasBox(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
|
121
|
+
void cdCanvasArc(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
|
122
|
+
void cdCanvasSector(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
|
123
|
+
void cdCanvasChord(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
|
124
|
+
void cdCanvasText(cdCanvas* canvas, int x, int y, const char* s);
|
125
|
+
|
126
|
+
void cdfCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
|
127
|
+
void cdfCanvasVertex(cdCanvas* canvas, double x, double y);
|
128
|
+
void cdfCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
|
129
|
+
void cdfCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
|
130
|
+
void cdfCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
|
131
|
+
void cdfCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
|
132
|
+
void cdfCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
|
133
|
+
void cdfCanvasText(cdCanvas* canvas, double x, double y, const char* s);
|
134
|
+
|
135
|
+
/* attributes */
|
136
|
+
void cdCanvasSetBackground(cdCanvas* canvas, long color);
|
137
|
+
void cdCanvasSetForeground(cdCanvas* canvas, long color);
|
138
|
+
long cdCanvasBackground(cdCanvas* canvas, long color);
|
139
|
+
long cdCanvasForeground(cdCanvas* canvas, long color);
|
140
|
+
int cdCanvasBackOpacity(cdCanvas* canvas, int opacity);
|
141
|
+
int cdCanvasWriteMode(cdCanvas* canvas, int mode);
|
142
|
+
int cdCanvasLineStyle(cdCanvas* canvas, int style);
|
143
|
+
void cdCanvasLineStyleDashes(cdCanvas* canvas, const int* dashes, int count);
|
144
|
+
int cdCanvasLineWidth(cdCanvas* canvas, int width);
|
145
|
+
int cdCanvasLineJoin(cdCanvas* canvas, int join);
|
146
|
+
int cdCanvasLineCap(cdCanvas* canvas, int cap);
|
147
|
+
int cdCanvasInteriorStyle(cdCanvas* canvas, int style);
|
148
|
+
int cdCanvasHatch(cdCanvas* canvas, int style);
|
149
|
+
void cdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char* stipple);
|
150
|
+
unsigned char* cdCanvasGetStipple(cdCanvas* canvas, int *n, int *m);
|
151
|
+
void cdCanvasPattern(cdCanvas* canvas, int w, int h, long const int *pattern);
|
152
|
+
long* cdCanvasGetPattern(cdCanvas* canvas, int* n, int* m);
|
153
|
+
int cdCanvasFillMode(cdCanvas* canvas, int mode);
|
154
|
+
int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size);
|
155
|
+
void cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size);
|
156
|
+
char* cdCanvasNativeFont(cdCanvas* canvas, const char* font);
|
157
|
+
int cdCanvasTextAlignment(cdCanvas* canvas, int alignment);
|
158
|
+
double cdCanvasTextOrientation(cdCanvas* canvas, double angle);
|
159
|
+
int cdCanvasMarkType(cdCanvas* canvas, int type);
|
160
|
+
int cdCanvasMarkSize(cdCanvas* canvas, int size);
|
161
|
+
|
162
|
+
/* vector text */
|
163
|
+
void cdCanvasVectorText(cdCanvas* canvas, int x, int y, const char* s);
|
164
|
+
void cdCanvasMultiLineVectorText(cdCanvas* canvas, int x, int y, const char* s);
|
165
|
+
|
166
|
+
/* vector text attributes */
|
167
|
+
char *cdCanvasVectorFont(cdCanvas* canvas, const char *filename);
|
168
|
+
void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2);
|
169
|
+
double* cdCanvasVectorTextTransform(cdCanvas* canvas, const double* matrix);
|
170
|
+
void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s);
|
171
|
+
int cdCanvasVectorCharSize(cdCanvas* canvas, int size);
|
172
|
+
|
173
|
+
/* vector text properties */
|
174
|
+
void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y);
|
175
|
+
void cdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, int x, int y, int *rect);
|
176
|
+
|
177
|
+
/* properties */
|
178
|
+
void cdCanvasGetFontDim(cdCanvas* canvas, int *max_width, int *height, int *ascent, int *descent);
|
179
|
+
void cdCanvasGetTextSize(cdCanvas* canvas, const char* s, int *width, int *height);
|
180
|
+
void cdCanvasGetTextBox(cdCanvas* canvas, int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax);
|
181
|
+
void cdCanvasGetTextBounds(cdCanvas* canvas, int x, int y, const char* s, int *rect);
|
182
|
+
int cdCanvasGetColorPlanes(cdCanvas* canvas);
|
183
|
+
|
184
|
+
/* color */
|
185
|
+
void cdCanvasPalette(cdCanvas* canvas, int n, const long *palette, int mode);
|
186
|
+
|
187
|
+
/* client images */
|
188
|
+
void cdCanvasGetImageRGB(cdCanvas* canvas, unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int w, int h);
|
189
|
+
void cdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
|
190
|
+
void cdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
|
191
|
+
void cdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
|
192
|
+
|
193
|
+
/* server images */
|
194
|
+
cdImage* cdCanvasCreateImage(cdCanvas* canvas, int w, int h);
|
195
|
+
void cdKillImage(cdImage* image);
|
196
|
+
void cdCanvasGetImage(cdCanvas* canvas, cdImage* image, int x, int y);
|
197
|
+
void cdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax);
|
198
|
+
void cdCanvasScrollArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);
|
199
|
+
|
200
|
+
/* bitmap */
|
201
|
+
cdBitmap* cdCreateBitmap(int w, int h, int type);
|
202
|
+
cdBitmap* cdInitBitmap(int w, int h, int type, ...);
|
203
|
+
void cdKillBitmap(cdBitmap* bitmap);
|
204
|
+
unsigned char* cdBitmapGetData(cdBitmap* bitmap, int dataptr);
|
205
|
+
void cdBitmapSetRect(cdBitmap* bitmap, int xmin, int xmax, int ymin, int ymax);
|
206
|
+
void cdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y, int w, int h);
|
207
|
+
void cdCanvasGetBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y);
|
208
|
+
void cdBitmapRGB2Map(cdBitmap* bitmap_rgb, cdBitmap* bitmap_map);
|
209
|
+
|
210
|
+
/* color */
|
211
|
+
long cdEncodeColor(unsigned char red, unsigned char green, unsigned char blue);
|
212
|
+
void cdDecodeColor(long color, unsigned char* red, unsigned char* green, unsigned char* blue);
|
213
|
+
unsigned char cdDecodeAlpha(long color);
|
214
|
+
long cdEncodeAlpha(long color, unsigned char alpha);
|
215
|
+
|
216
|
+
#define cdAlpha(_) (unsigned char)(~(((_) >> 24) & 0xFF))
|
217
|
+
#define cdReserved(_) (unsigned char)(((_) >> 24) & 0xFF)
|
218
|
+
#define cdRed(_) (unsigned char)(((_) >> 16) & 0xFF)
|
219
|
+
#define cdGreen(_) (unsigned char)(((_) >> 8) & 0xFF)
|
220
|
+
#define cdBlue(_) (unsigned char)(((_) >> 0) & 0xFF)
|
221
|
+
|
222
|
+
/* client image color convertion */
|
223
|
+
void cdRGB2Map(int width, int height, const unsigned char* red, const unsigned char* green, const unsigned char* blue, unsigned char* index, int pal_size, long *color);
|
224
|
+
|
225
|
+
|
226
|
+
/* CD Values */
|
227
|
+
|
228
|
+
#define CD_QUERY -1 /* query value */
|
229
|
+
|
230
|
+
enum { /* bitmap type */
|
231
|
+
CD_RGB, /* these definitions are compatible with the IM library */
|
232
|
+
CD_MAP,
|
233
|
+
CD_RGBA = 0x100
|
234
|
+
};
|
235
|
+
|
236
|
+
enum { /* bitmap data */
|
237
|
+
CD_IRED,
|
238
|
+
CD_IGREEN,
|
239
|
+
CD_IBLUE,
|
240
|
+
CD_IALPHA,
|
241
|
+
CD_INDEX,
|
242
|
+
CD_COLORS
|
243
|
+
};
|
244
|
+
|
245
|
+
enum { /* status report */
|
246
|
+
CD_ERROR = -1,
|
247
|
+
CD_OK = 0
|
248
|
+
};
|
249
|
+
|
250
|
+
enum { /* clip mode */
|
251
|
+
CD_CLIPOFF,
|
252
|
+
CD_CLIPAREA,
|
253
|
+
CD_CLIPPOLYGON,
|
254
|
+
CD_CLIPREGION
|
255
|
+
};
|
256
|
+
|
257
|
+
enum { /* region combine mode */
|
258
|
+
CD_UNION,
|
259
|
+
CD_INTERSECT,
|
260
|
+
CD_DIFFERENCE,
|
261
|
+
CD_NOTINTERSECT
|
262
|
+
};
|
263
|
+
|
264
|
+
enum { /* polygon mode (begin...end) */
|
265
|
+
CD_FILL,
|
266
|
+
CD_OPEN_LINES,
|
267
|
+
CD_CLOSED_LINES,
|
268
|
+
CD_CLIP,
|
269
|
+
CD_BEZIER,
|
270
|
+
CD_REGION
|
271
|
+
};
|
272
|
+
|
273
|
+
#define CD_POLYCUSTOM 10
|
274
|
+
|
275
|
+
enum { /* fill mode */
|
276
|
+
CD_EVENODD,
|
277
|
+
CD_WINDING
|
278
|
+
};
|
279
|
+
|
280
|
+
enum { /* line join */
|
281
|
+
CD_MITER,
|
282
|
+
CD_BEVEL,
|
283
|
+
CD_ROUND
|
284
|
+
};
|
285
|
+
|
286
|
+
enum { /* line cap */
|
287
|
+
CD_CAPFLAT,
|
288
|
+
CD_CAPSQUARE,
|
289
|
+
CD_CAPROUND
|
290
|
+
};
|
291
|
+
|
292
|
+
enum { /* background opacity mode */
|
293
|
+
CD_OPAQUE,
|
294
|
+
CD_TRANSPARENT
|
295
|
+
};
|
296
|
+
|
297
|
+
enum { /* write mode */
|
298
|
+
CD_REPLACE,
|
299
|
+
CD_XOR,
|
300
|
+
CD_NOT_XOR
|
301
|
+
};
|
302
|
+
|
303
|
+
enum { /* color allocation mode (palette) */
|
304
|
+
CD_POLITE,
|
305
|
+
CD_FORCE
|
306
|
+
};
|
307
|
+
|
308
|
+
enum { /* line style */
|
309
|
+
CD_CONTINUOUS,
|
310
|
+
CD_DASHED,
|
311
|
+
CD_DOTTED,
|
312
|
+
CD_DASH_DOT,
|
313
|
+
CD_DASH_DOT_DOT,
|
314
|
+
CD_CUSTOM
|
315
|
+
};
|
316
|
+
|
317
|
+
enum { /* marker type */
|
318
|
+
CD_PLUS,
|
319
|
+
CD_STAR,
|
320
|
+
CD_CIRCLE,
|
321
|
+
CD_X,
|
322
|
+
CD_BOX,
|
323
|
+
CD_DIAMOND,
|
324
|
+
CD_HOLLOW_CIRCLE,
|
325
|
+
CD_HOLLOW_BOX,
|
326
|
+
CD_HOLLOW_DIAMOND
|
327
|
+
};
|
328
|
+
|
329
|
+
enum { /* hatch type */
|
330
|
+
CD_HORIZONTAL,
|
331
|
+
CD_VERTICAL,
|
332
|
+
CD_FDIAGONAL,
|
333
|
+
CD_BDIAGONAL,
|
334
|
+
CD_CROSS,
|
335
|
+
CD_DIAGCROSS
|
336
|
+
};
|
337
|
+
|
338
|
+
enum { /* interior style */
|
339
|
+
CD_SOLID,
|
340
|
+
CD_HATCH,
|
341
|
+
CD_STIPPLE,
|
342
|
+
CD_PATTERN,
|
343
|
+
CD_HOLLOW
|
344
|
+
};
|
345
|
+
|
346
|
+
enum { /* text alignment */
|
347
|
+
CD_NORTH,
|
348
|
+
CD_SOUTH,
|
349
|
+
CD_EAST,
|
350
|
+
CD_WEST,
|
351
|
+
CD_NORTH_EAST,
|
352
|
+
CD_NORTH_WEST,
|
353
|
+
CD_SOUTH_EAST,
|
354
|
+
CD_SOUTH_WEST,
|
355
|
+
CD_CENTER,
|
356
|
+
CD_BASE_LEFT,
|
357
|
+
CD_BASE_CENTER,
|
358
|
+
CD_BASE_RIGHT
|
359
|
+
};
|
360
|
+
|
361
|
+
enum { /* style */
|
362
|
+
CD_PLAIN = 0,
|
363
|
+
CD_BOLD = 1,
|
364
|
+
CD_ITALIC = 2,
|
365
|
+
CD_UNDERLINE = 4,
|
366
|
+
CD_STRIKEOUT = 8
|
367
|
+
};
|
368
|
+
|
369
|
+
#define CD_BOLD_ITALIC (CD_BOLD|CD_ITALIC) /* compatibility name */
|
370
|
+
|
371
|
+
enum { /* some font sizes */
|
372
|
+
CD_SMALL = 8,
|
373
|
+
CD_STANDARD = 12,
|
374
|
+
CD_LARGE = 18
|
375
|
+
};
|
376
|
+
|
377
|
+
/* Canvas Capabilities */
|
378
|
+
#define CD_CAP_NONE 0x00000000
|
379
|
+
#define CD_CAP_FLUSH 0x00000001
|
380
|
+
#define CD_CAP_CLEAR 0x00000002
|
381
|
+
#define CD_CAP_PLAY 0x00000004
|
382
|
+
#define CD_CAP_YAXIS 0x00000008
|
383
|
+
#define CD_CAP_CLIPAREA 0x00000010
|
384
|
+
#define CD_CAP_CLIPPOLY 0x00000020
|
385
|
+
#define CD_CAP_REGION 0x00000040
|
386
|
+
#define CD_CAP_RECT 0x00000080
|
387
|
+
#define CD_CAP_CHORD 0x00000100
|
388
|
+
#define CD_CAP_IMAGERGB 0x00000200
|
389
|
+
#define CD_CAP_IMAGERGBA 0x00000400
|
390
|
+
#define CD_CAP_IMAGEMAP 0x00000800
|
391
|
+
#define CD_CAP_GETIMAGERGB 0x00001000
|
392
|
+
#define CD_CAP_IMAGESRV 0x00002000
|
393
|
+
#define CD_CAP_BACKGROUND 0x00004000
|
394
|
+
#define CD_CAP_BACKOPACITY 0x00008000
|
395
|
+
#define CD_CAP_WRITEMODE 0x00010000
|
396
|
+
#define CD_CAP_LINESTYLE 0x00020000
|
397
|
+
#define CD_CAP_LINEWITH 0x00040000
|
398
|
+
#define CD_CAP_FPRIMTIVES 0x00080000
|
399
|
+
#define CD_CAP_HATCH 0x00100000
|
400
|
+
#define CD_CAP_STIPPLE 0x00200000
|
401
|
+
#define CD_CAP_PATTERN 0x00400000
|
402
|
+
#define CD_CAP_FONT 0x00800000
|
403
|
+
#define CD_CAP_FONTDIM 0x01000000
|
404
|
+
#define CD_CAP_TEXTSIZE 0x02000000
|
405
|
+
#define CD_CAP_TEXTORIENTATION 0x04000000
|
406
|
+
#define CD_CAP_PALETTE 0x08000000
|
407
|
+
#define CD_CAP_LINECAP 0x10000000
|
408
|
+
#define CD_CAP_LINEJOIN 0x20000000
|
409
|
+
#define CD_CAP_ALL 0xFFFFFFFF
|
410
|
+
|
411
|
+
/* cdPlay definitions */
|
412
|
+
#define CD_SIZECB 0 /* size callback */
|
413
|
+
typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm);
|
414
|
+
#define CD_ABORT 1
|
415
|
+
#define CD_CONTINUE 0
|
416
|
+
|
417
|
+
/* simulation flags */
|
418
|
+
#define CD_SIM_NONE 0x0000
|
419
|
+
#define CD_SIM_LINE 0x0001
|
420
|
+
#define CD_SIM_RECT 0x0002
|
421
|
+
#define CD_SIM_BOX 0x0004
|
422
|
+
#define CD_SIM_ARC 0x0008
|
423
|
+
#define CD_SIM_SECTOR 0x0010
|
424
|
+
#define CD_SIM_CHORD 0x0020
|
425
|
+
#define CD_SIM_POLYLINE 0x0040
|
426
|
+
#define CD_SIM_POLYGON 0x0080
|
427
|
+
#define CD_SIM_TEXT 0x0100
|
428
|
+
#define CD_SIM_ALL 0xFFFF
|
429
|
+
|
430
|
+
#define CD_SIM_LINES (CD_SIM_LINE | CD_SIM_RECT | CD_SIM_ARC | CD_SIM_POLYLINE)
|
431
|
+
#define CD_SIM_FILLS (CD_SIM_BOX | CD_SIM_SECTOR | CD_SIM_CHORD | CD_SIM_POLYGON)
|
432
|
+
|
433
|
+
/* some predefined colors for convenience */
|
434
|
+
#define CD_RED 0xFF0000L /* 255, 0, 0 */
|
435
|
+
#define CD_DARK_RED 0x800000L /* 128, 0, 0 */
|
436
|
+
#define CD_GREEN 0x00FF00L /* 0,255, 0 */
|
437
|
+
#define CD_DARK_GREEN 0x008000L /* 0,128, 0 */
|
438
|
+
#define CD_BLUE 0x0000FFL /* 0, 0,255 */
|
439
|
+
#define CD_DARK_BLUE 0x000080L /* 0, 0,128 */
|
440
|
+
|
441
|
+
#define CD_YELLOW 0xFFFF00L /* 255,255, 0 */
|
442
|
+
#define CD_DARK_YELLOW 0x808000L /* 128,128, 0 */
|
443
|
+
#define CD_MAGENTA 0xFF00FFL /* 255, 0,255 */
|
444
|
+
#define CD_DARK_MAGENTA 0x800080L /* 128, 0,128 */
|
445
|
+
#define CD_CYAN 0x00FFFFL /* 0,255,255 */
|
446
|
+
#define CD_DARK_CYAN 0x008080L /* 0,128,128 */
|
447
|
+
|
448
|
+
#define CD_WHITE 0xFFFFFFL /* 255,255,255 */
|
449
|
+
#define CD_BLACK 0x000000L /* 0, 0, 0 */
|
450
|
+
|
451
|
+
#define CD_DARK_GRAY 0x808080L /* 128,128,128 */
|
452
|
+
#define CD_GRAY 0xC0C0C0L /* 192,192,192 */
|
453
|
+
|
454
|
+
/* some usefull conversion factors */
|
455
|
+
#define CD_MM2PT 2.834645669 /* milimeters to points (pt = CD_MM2PT * mm) */
|
456
|
+
#define CD_RAD2DEG 57.295779513 /* radians to degrees (deg = CD_RAD2DEG * rad) */
|
457
|
+
#define CD_DEG2RAD 0.01745329252 /* degrees to radians (rad = CD_DEG2RAD * deg) */
|
458
|
+
|
459
|
+
|
460
|
+
#ifdef __cplusplus
|
461
|
+
}
|
462
|
+
#endif
|
463
|
+
|
464
|
+
|
465
|
+
#ifndef CD_NO_OLD_INTERFACE
|
466
|
+
#include "cd_old.h"
|
467
|
+
#endif
|
468
|
+
|
469
|
+
|
470
|
+
/******************************************************************************
|
471
|
+
Copyright (C) 1994-2008 Tecgraf, PUC-Rio.
|
472
|
+
|
473
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
474
|
+
a copy of this software and associated documentation files (the
|
475
|
+
"Software"), to deal in the Software without restriction, including
|
476
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
477
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
478
|
+
permit persons to whom the Software is furnished to do so, subject to
|
479
|
+
the following conditions:
|
480
|
+
|
481
|
+
The above copyright notice and this permission notice shall be
|
482
|
+
included in all copies or substantial portions of the Software.
|
483
|
+
|
484
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
485
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
486
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
487
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
488
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
489
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
490
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
491
|
+
******************************************************************************/
|
492
|
+
|
493
|
+
#endif /* ifndef CD_H */
|
494
|
+
|