summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorscuri <scuri>2008-10-17 06:10:33 +0000
committerscuri <scuri>2008-10-17 06:10:33 +0000
commit7b52cc13af4e85f1ca2deb6b6c77de9c95ea0dcf (patch)
treed0857278bde2eff784227c57dcaf930346ceb7ac /test
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'test')
-rw-r--r--test/cdtest/.cvsignore16
-rw-r--r--test/cdtest/cdtest.bat3
-rw-r--r--test/cdtest/cdtest.c2662
-rw-r--r--test/cdtest/cdtest.dsp107
-rw-r--r--test/cdtest/cdtest.h415
-rw-r--r--test/cdtest/cdtest.icobin0 -> 766 bytes
-rw-r--r--test/cdtest/cdtest.led1508
-rw-r--r--test/cdtest/cdtest.rc1
-rw-r--r--test/cdtest/cdtest.sln16
-rw-r--r--test/cdtest/cdtest.vcproj161
-rw-r--r--test/cdtest/cdtest_led.c1590
-rw-r--r--test/cdtest/colobar.h7
-rw-r--r--test/cdtest/colorbar.c565
-rw-r--r--test/cdtest/config.mak24
-rw-r--r--test/cdtest/drivers.c457
-rw-r--r--test/cdtest/list.c278
-rw-r--r--test/cdtest/rubber.c387
-rw-r--r--test/lua/cdalign.wlua67
-rw-r--r--test/lua/cdtext.wlua59
-rw-r--r--test/lua/imagergb.wlua35
-rw-r--r--test/lua/iupcdaux.lua45
-rw-r--r--test/lua/iuplua_cdlua.wlua58
-rw-r--r--test/lua/rubberband.wlua54
-rw-r--r--test/metafile.c107
-rw-r--r--test/mf/align.mf45
-rw-r--r--test/mf/alignorient.mf44
-rw-r--r--test/mf/alignxor.mf44
-rw-r--r--test/mf/arc.mf25
-rw-r--r--test/mf/circles.mf47
-rw-r--r--test/mf/cliparea.mf80
-rw-r--r--test/mf/fill.mf48
-rw-r--r--test/mf/fill_x_hollow.mf170
-rw-r--r--test/mf/font.mf49
-rw-r--r--test/mf/grays.mf59
-rw-r--r--test/mf/hatch.mf47
-rw-r--r--test/mf/lines.mf44
-rw-r--r--test/mf/marks.mf33
-rw-r--r--test/mf/natal.mf1933
-rw-r--r--test/mf/poly.mf88
-rw-r--r--test/mf/poly2.mf88
-rw-r--r--test/mf/poly3.mf136
-rw-r--r--test/mf/poly4.mf136
-rw-r--r--test/mf/poly5.mf89
-rw-r--r--test/mf/sector.mf22
-rw-r--r--test/screencapture.c36
-rw-r--r--test/screencapture.mak8
-rw-r--r--test/simple/.cvsignore21
-rw-r--r--test/simple/config.mak25
-rw-r--r--test/simple/gdiplustest.cpp116
-rw-r--r--test/simple/iupmain.c83
-rw-r--r--test/simple/makefile.linux18
-rw-r--r--test/simple/makefile.mingw320
-rw-r--r--test/simple/simple.bat3
-rw-r--r--test/simple/simple.c1312
-rw-r--r--test/simple/simple.dsp83
-rw-r--r--test/simple/simple.h54
-rw-r--r--test/simple/simple.led93
-rw-r--r--test/simple/simple.sln20
-rw-r--r--test/simple/simple.vcproj131
-rw-r--r--test/simple/simple_led.c125
-rw-r--r--test/simple/teste.cpp219
61 files changed, 14216 insertions, 0 deletions
diff --git a/test/cdtest/.cvsignore b/test/cdtest/.cvsignore
new file mode 100644
index 0000000..1da6c19
--- /dev/null
+++ b/test/cdtest/.cvsignore
@@ -0,0 +1,16 @@
+obj
+bin
+william
+so_locations
+*.dep
+*.wdep
+*.loh
+.plan
+.project
+*.err
+Makefile
+*.make
+*.suo
+*.ncb
+*.opt
+*.user
diff --git a/test/cdtest/cdtest.bat b/test/cdtest/cdtest.bat
new file mode 100644
index 0000000..3249300
--- /dev/null
+++ b/test/cdtest/cdtest.bat
@@ -0,0 +1,3 @@
+@echo off
+REM Script generated automatically by tecmake v3.10
+..\bin\Win32\cdtest.exe %*
diff --git a/test/cdtest/cdtest.c b/test/cdtest/cdtest.c
new file mode 100644
index 0000000..bf701b9
--- /dev/null
+++ b/test/cdtest/cdtest.c
@@ -0,0 +1,2662 @@
+/*=========================================================================*/
+/* CDTEST.C - 09/12/95 */
+/* Canvas Draw Test. */
+/*=========================================================================*/
+
+/*- Convenccoes Usadas: ---------------------------------------------------*/
+/* - Identificadores de funccoes associadas a um callback comeccam por f. */
+/* Ex: fResize, fRepaint. */
+/* - Identificadores de constantes sao escritos em maiusculas. */
+/* Ex: LINE, ARC, NEWPOINT. */
+/* - Identificadores de funcoes internas do programa sao escritas em */
+/* minusculas. */
+/* Ex: newpolypoint, dellist. */
+/*-------------------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <iup.h>
+#include <cd.h>
+#include <wd.h>
+#include <cdiup.h>
+#include <cdpicture.h>
+#include <cddbuf.h>
+#include <cdirgb.h>
+#include <cdgdiplus.h>
+#include <iupkey.h>
+
+#include "cdtest.h"
+
+/*- Contexto do CD Test: --------------------------------------------------*/
+tCTC ctgc;
+
+/*- Parametros geometricos da primitiva sendo desenhada: ------------------*/
+tLinePos line_pos;
+tBoxPos box_pos;
+tPixelPos pixel_pos;
+tMarkPos mark_pos;
+tArcPos arc_pos;
+
+//#define USE_GDIPLUS
+
+#ifdef USE_GDIPLUS
+static const int use_gdiplus = 1;
+#else
+static const int use_gdiplus = 0;
+#endif
+
+static const int antialias = 1;
+
+
+/*-------------------------------------------------------------------------*/
+/* Associa os call-backs do IUP. */
+/*-------------------------------------------------------------------------*/
+void setcallbacks(void)
+{
+ IupSetFunction("cmdFileExit", (Icallback) fFileExit);
+
+ IupSetFunction("cmdEditClear", (Icallback) fEditClear);
+ IupSetFunction("cmdEditUndo", (Icallback) fEditUndo);
+
+ IupSetFunction("cmdHelpAbout", (Icallback) fHelpAbout);
+ IupSetFunction("cmdCloseAbout", (Icallback) fCloseAbout);
+
+ IupSetFunction("cmdWDCanvas", (Icallback) fWDCanvas);
+ IupSetFunction("cmdCloseWD", (Icallback) fCloseWD);
+ IupSetFunction("cmdPICCanvas", (Icallback) fPICCanvas);
+ IupSetFunction("cmdClosePIC", (Icallback) fClosePIC);
+
+ IupSetFunction("cmdShowDialog", (Icallback) fShowDialog);
+ IupSetFunction("cmdLine", (Icallback) fLine);
+ IupSetFunction("cmdRect", (Icallback) fRect);
+ IupSetFunction("cmdBox", (Icallback) fBox);
+ IupSetFunction("cmdArc", (Icallback) fArc);
+ IupSetFunction("cmdSector", (Icallback) fSector);
+ IupSetFunction("cmdChord", (Icallback) fChord);
+ IupSetFunction("cmdPixel", (Icallback) fPixel);
+ IupSetFunction("cmdMark", (Icallback) fMark);
+ IupSetFunction("cmdText", (Icallback) fText);
+ IupSetFunction("cmdPoly", (Icallback) fPoly);
+
+ IupSetFunction("cmdOptions", (Icallback) fOptions);
+ IupSetFunction("cmdOptionsHide", (Icallback) fOptionsHide);
+ IupSetFunction("cmdAttributes", (Icallback) fAttributes);
+ IupSetFunction("cmdAttributesHide", (Icallback) fAttributesHide);
+ IupSetFunction("cmdMsgHide", (Icallback) fMsgHide);
+ IupSetFunction("cmdSimulate", (Icallback) fSimulate);
+ IupSetFunction("cmdStretchPlay", (Icallback) fStretchPlay);
+
+ IupSetFunction("cmdWriteMode", (Icallback) fWriteMode);
+ IupSetFunction("cmdLineStyle", (Icallback) fLineStyle);
+ IupSetFunction("cmdLineCap", (Icallback) fLineCap);
+ IupSetFunction("cmdLineJoin", (Icallback) fLineJoin);
+ IupSetFunction("cmdFillMode", (Icallback) fFillMode);
+ IupSetFunction("cmdFontStyle", (Icallback) fFontStyle);
+ IupSetFunction("cmdFontTypeFace", (Icallback) fFontTypeFace);
+ IupSetFunction("cmdMarkType", (Icallback) fMarkType);
+ IupSetFunction("cmdTextAlignment", (Icallback) fTextAlignment);
+ IupSetFunction("cmdHatchStyle", (Icallback) fHatchStyle);
+ IupSetFunction("cmdOpacity", (Icallback) fOpacity);
+
+ IupSetFunction("cmdNoBuffering", (Icallback) fNoBuffering);
+ IupSetFunction("cmdImageBuffer", (Icallback) fImageBuffer);
+ IupSetFunction("cmdRGBBuffer", (Icallback) fRGBBuffer);
+
+ IupSetFunction("cmdInteger", (Icallback) fInteger);
+ IupSetFunction("cmdReal", (Icallback) fReal);
+ IupSetFunction("cmdDraw", (Icallback) fDraw);
+
+ IupSetFunction("cmdSolid", (Icallback) fSolid);
+ IupSetFunction("cmdHatch", (Icallback) fHatch);
+ IupSetFunction("cmdStipple", (Icallback) fStipple);
+ IupSetFunction("cmdPattern", (Icallback) fPattern);
+
+ IupSetFunction("cmdOpenLines", (Icallback) fOpenLines);
+ IupSetFunction("cmdClosedLines", (Icallback) fClosedLines);
+ IupSetFunction("cmdFill", (Icallback) fFill);
+ IupSetFunction("cmdPolyClip", (Icallback) fPolyClip);
+ IupSetFunction("cmdPolyBezier", (Icallback) fPolyBezier);
+
+ IupSetFunction("cmdClip", (Icallback) fClip);
+ IupSetFunction("cmdClipArea", (Icallback) fClipArea);
+ IupSetFunction("cmdClipOff", (Icallback) fClipOff);
+ IupSetFunction("cmdClipPoly", (Icallback) fClipPoly);
+
+ IupSetFunction("cmdImage", (Icallback) fImage);
+ IupSetFunction("cmdImagePut", (Icallback) fImagePut);
+ IupSetFunction("cmdImageGet", (Icallback) fImageGet);
+
+ IupSetFunction("cmdImageRGB", (Icallback) fImageRGB);
+ IupSetFunction("cmdImageRGBPut", (Icallback) fImageRGBPut);
+ IupSetFunction("cmdImageRGBGet", (Icallback) fImageRGBGet);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa o stipple e o pattern exemplo. */
+/*-------------------------------------------------------------------------*/
+void initsamples(void)
+{
+ int i;
+
+ /* zera os vetores */
+ for (i=0; i<100; i++) {
+ ctgc.stipple[i] = 0;
+ ctgc.pattern[i] = 0xffffffl;
+ }
+
+ /* especificaccao do stipple */
+ ctgc.stipple[11] = 1; /*------------*/
+ ctgc.stipple[21] = 1; /* 0123456789*/
+ ctgc.stipple[31] = 1; /* */
+ ctgc.stipple[41] = 1; /*9 0000000000*/
+ ctgc.stipple[51] = 1; /*8 0000111110*/
+ /*7 0001000110*/
+ ctgc.stipple[12] = 1; /*6 0010001010*/
+ ctgc.stipple[52] = 1; /*5 0111110010*/
+ ctgc.stipple[62] = 1; /*4 0100010010*/
+ /*3 0100010100*/
+ ctgc.stipple[13] = 1; /*2 0100011000*/
+ ctgc.stipple[53] = 1; /*1 0111110000*/
+ ctgc.stipple[73] = 1; /*0 0000000000*/
+ /*------------*/
+ ctgc.stipple[14] = 1;
+ ctgc.stipple[54] = 1;
+ ctgc.stipple[84] = 1;
+
+ ctgc.stipple[15] = 1; ctgc.stipple[26] = 1;
+ ctgc.stipple[25] = 1; ctgc.stipple[66] = 1;
+ ctgc.stipple[35] = 1; ctgc.stipple[86] = 1;
+ ctgc.stipple[45] = 1;
+ ctgc.stipple[55] = 1; ctgc.stipple[48] = 1;
+ ctgc.stipple[85] = 1; ctgc.stipple[58] = 1;
+ ctgc.stipple[68] = 1;
+ ctgc.stipple[37] = 1; ctgc.stipple[78] = 1;
+ ctgc.stipple[77] = 1; ctgc.stipple[88] = 1;
+ ctgc.stipple[87] = 1;
+
+
+ /* especificaccao do stipple */
+ ctgc.pattern[11] = CD_RED; /*------------*/
+ ctgc.pattern[21] = CD_RED; /* 0123456789*/
+ ctgc.pattern[31] = CD_RED; /* */
+ ctgc.pattern[41] = CD_RED; /*9 WWWWWWWWWW*/
+ ctgc.pattern[51] = CD_RED; /*8 WWWWGGGGGW*/
+ ctgc.pattern[12] = CD_RED; /*7 WWWGGGGGBW*/
+ ctgc.pattern[22] = CD_RED; /*6 WWGGGGGBBW*/
+ ctgc.pattern[32] = CD_RED; /*5 WrrrrrBBBW*/
+ ctgc.pattern[42] = CD_RED; /*4 WrrrrrBBBW*/
+ ctgc.pattern[52] = CD_RED; /*3 WrrrrrBBWW*/
+ ctgc.pattern[13] = CD_RED; /*2 WrrrrrBWWW*/
+ ctgc.pattern[23] = CD_RED; /*1 WrrrrrWWWW*/
+ ctgc.pattern[33] = CD_RED; /*0 WWWWWWWWWW*/
+ ctgc.pattern[43] = CD_RED; /*------------*/
+ ctgc.pattern[53] = CD_RED;
+ ctgc.pattern[14] = CD_RED; ctgc.pattern[15] = CD_RED;
+ ctgc.pattern[24] = CD_RED; ctgc.pattern[25] = CD_RED;
+ ctgc.pattern[34] = CD_RED; ctgc.pattern[35] = CD_RED;
+ ctgc.pattern[44] = CD_RED; ctgc.pattern[45] = CD_RED;
+ ctgc.pattern[54] = CD_RED; ctgc.pattern[55] = CD_RED;
+
+ ctgc.pattern[26] = CD_BLUE; ctgc.pattern[37] = CD_BLUE;
+ ctgc.pattern[36] = CD_BLUE; ctgc.pattern[47] = CD_BLUE;
+ ctgc.pattern[46] = CD_BLUE; ctgc.pattern[57] = CD_BLUE;
+ ctgc.pattern[56] = CD_BLUE; ctgc.pattern[67] = CD_BLUE;
+
+ ctgc.pattern[48] = CD_BLUE; ctgc.pattern[62] = CD_GREEN;
+ ctgc.pattern[58] = CD_BLUE; ctgc.pattern[63] = CD_GREEN;
+ ctgc.pattern[68] = CD_BLUE; ctgc.pattern[64] = CD_GREEN;
+ ctgc.pattern[78] = CD_BLUE; ctgc.pattern[65] = CD_GREEN;
+ ctgc.pattern[66] = CD_GREEN;
+
+ ctgc.pattern[73] = CD_GREEN; ctgc.pattern[84] = CD_GREEN;
+ ctgc.pattern[74] = CD_GREEN; ctgc.pattern[85] = CD_GREEN;
+ ctgc.pattern[75] = CD_GREEN; ctgc.pattern[86] = CD_GREEN;
+ ctgc.pattern[76] = CD_GREEN; ctgc.pattern[87] = CD_GREEN;
+ ctgc.pattern[77] = CD_GREEN; ctgc.pattern[88] = CD_GREEN;
+
+ ctgc.dashes[0] = 10;
+ ctgc.dashes[1] = 2;
+ ctgc.dashes[2] = 5;
+ ctgc.dashes[3] = 2;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa o CD Test. */
+/*-------------------------------------------------------------------------*/
+void CDTestInit(void)
+{
+ memset(&ctgc, 0, sizeof(ctgc));
+
+ if (use_gdiplus)
+ {
+#ifdef USE_GDIPLUS
+ cdInitGdiPlus();
+#endif
+ }
+
+ /* inicializaccao dos drivers */
+ DriversInit();
+
+ /* mostra o dialogo principal */
+ IupShow(IupGetHandle("dlgMain"));
+
+ /* inicializaccao da barra de cores */
+ ColorBarInit(IupGetHandle("dlgMain"), IupGetHandle("cnvColorBar"), &ctgc.foreground, &ctgc.background);
+
+ /* cria o canvas do CD associado ao canvas do IUP */
+ if (use_gdiplus) cdUseContextPlus(1);
+ ctgc.iup_canvas = cdCreateCanvas(CD_IUP, IupGetHandle("cnvMain"));
+ if (!antialias) cdCanvasSetAttribute(ctgc.iup_canvas, "ANTIALIAS", "0");
+ cdActivate(ctgc.iup_canvas);
+ if (use_gdiplus) cdUseContextPlus(0);
+
+ /* associa os call-backs */
+ setcallbacks();
+
+ /* os call-backs do canvas devem ser associados depois de sua criacao */
+ IupSetFunction("cmdRepaint", (Icallback) fRepaint);
+ IupSetFunction("cmdMotionCB", (Icallback) fMotionCB);
+ IupSetFunction("cmdButtonCB", (Icallback) fButtonCB);
+ IupSetFunction("cmdResizeCB", (Icallback) fResizeCB);
+ IupSetFunction("cmdGetFocusCB", (Icallback) fGetFocusCB);
+
+ /* inicializaccao do contexto */
+ ctgc.write_mode = CD_REPLACE;
+ ctgc.line_style = CD_CONTINUOUS;
+ ctgc.line_cap = CD_CAPFLAT;
+ ctgc.line_join = CD_MITER;
+ ctgc.fill_mode = CD_EVENODD;
+ ctgc.line_width = 1;
+ ctgc.font_style = CD_PLAIN;
+ ctgc.font_typeface = CD_SYSTEM;
+ ctgc.font_size = CD_STANDARD;
+ ctgc.text_alignment = CD_BASE_LEFT;
+ ctgc.text_orientation = 0;
+ ctgc.back_opacity = CD_TRANSPARENT;
+ ctgc.mark_type = CD_STAR;
+ ctgc.poly_mode = CD_OPEN_LINES;
+ ctgc.interior_style = CD_SOLID;
+ ctgc.hatch = CD_HORIZONTAL;
+ ctgc.following = FALSE;
+ ctgc.foreground = CD_BLACK;
+ ctgc.background = CD_WHITE;
+ ctgc.head = NULL;
+ ctgc.test_image = NULL;
+ ctgc.sim = 0;
+ ctgc.stretch_play = 0;
+ ctgc.dlg_x = IUP_CENTER;
+ ctgc.dlg_y = IUP_CENTER;
+ ctgc.visible = 0;
+
+ /* inicializa os vetores stipple e pattern */
+ initsamples();
+
+ /* inicializa o CDTest com a primitiva LINE */
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ ctgc.bt_cur_prim = IupGetHandle("btCurPrim");
+ ctgc.cur_prim = LINE;
+
+ /* inicializaccao do Canvas do IUP */
+ cdActivate(ctgc.iup_canvas);
+ cdFont(ctgc.font_typeface,ctgc.font_style,ctgc.font_size);
+ cdBackground(ctgc.background);
+ cdClear();
+ cdGetCanvasSize(&(ctgc.w),&(ctgc.h),NULL,NULL);
+ ctgc.bpp = cdGetColorPlanes();
+
+ {
+ double mm, xres;
+ cdPixel2MM(1, 0, &mm, NULL);
+ xres = 1.0/mm;
+ ctgc.res = xres;
+ }
+
+ /* inicializa o canvas off-screen de double-bufering */
+ ctgc.buffering = NO_BUFFER;
+ ctgc.buffer_canvas = NULL;
+
+ /* inicializa o clipping */
+ ctgc.clip_mode = CD_CLIPOFF;
+ cdGetClipArea(&(ctgc.clip_xmin), &(ctgc.clip_xmax),
+ &(ctgc.clip_ymin), &(ctgc.clip_ymax));
+
+ /* zera o buffer temporario de pontos */
+ ctgc.num_points = 0;
+
+ /* a lista de primitivas jah estah vazia, nao hah o que apagar */
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_NO);
+
+ /* atualiza o tamanho do canvas em pixels na barra de titulo */
+ sprintf(ctgc.title, "CDTest 5.3 (%dx%d - %dbpp)", ctgc.w, ctgc.h, ctgc.bpp);
+ IupSetAttribute(IupGetHandle("dlgMain"), IUP_TITLE, ctgc.title);
+
+ /* inicializa a barra de status */
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+
+ /* inicializa a posiccao do mouse */
+ mouse_pos(0, 0);
+
+ /* constroi os dialogos do CDTest sem mostra-los */
+ IupMap(IupGetHandle("dlgLB"));
+ IupMap(IupGetHandle("dlgAS"));
+ IupMap(IupGetHandle("dlgPixel"));
+ IupMap(IupGetHandle("dlgImage"));
+ IupMap(IupGetHandle("dlgImageRGB"));
+ IupMap(IupGetHandle("dlgMark"));
+ IupMap(IupGetHandle("dlgText"));
+ IupMap(IupGetHandle("dlgClip"));
+ IupMap(IupGetHandle("dlgAttributes"));
+ IupMap(IupGetHandle("dlgWDCanvas"));
+ IupMap(IupGetHandle("dlgPICCanvas"));
+
+ /* cria o canvas WD */
+ if (use_gdiplus) cdUseContextPlus(1);
+ ctgc.wd_canvas = cdCreateCanvas(CD_IUP, IupGetHandle("cnvWDCanvas"));
+ ctgc.pic_canvas = cdCreateCanvas(CD_IUP, IupGetHandle("cnvPICCanvas"));
+ ctgc.picture = cdCreateCanvas(CD_PICTURE, "");
+ if (use_gdiplus) cdUseContextPlus(0);
+
+ /* CDTEST default values */
+ cdActivate(ctgc.picture);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+
+ cdActivate(ctgc.wd_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+
+ /* reativa o canvas IUP */
+ cdActivate(ctgc.iup_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+}
+
+static void CDTestClose(void)
+{
+ dellist();
+
+ ColorBarClose();
+
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ if (ctgc.test_image) cdKillImage(ctgc.test_image);
+ cdKillCanvas(ctgc.picture);
+ cdKillCanvas(ctgc.pic_canvas);
+ cdKillCanvas(ctgc.wd_canvas);
+ cdKillCanvas(ctgc.iup_canvas);
+
+ IupDestroy(IupGetHandle("dlgLB"));
+ IupDestroy(IupGetHandle("dlgAS"));
+ IupDestroy(IupGetHandle("dlgPixel"));
+ IupDestroy(IupGetHandle("dlgImage"));
+ IupDestroy(IupGetHandle("dlgImageRGB"));
+ IupDestroy(IupGetHandle("dlgMark"));
+ IupDestroy(IupGetHandle("dlgText"));
+ IupDestroy(IupGetHandle("dlgClip"));
+ IupDestroy(IupGetHandle("dlgAttributes"));
+ IupDestroy(IupGetHandle("dlgWDCanvas"));
+ IupDestroy(IupGetHandle("dlgPICCanvas"));
+
+ IupDestroy(IupGetHandle("dlgMain"));
+}
+
+static int iscurvisible(void)
+{
+ char* vis = IupGetAttribute(ctgc.dlg_cur_prim, IUP_VISIBLE);
+ if (!vis)
+ return 0;
+ return strcmp(vis, IUP_YES) == 0? 1: 0;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo da lista de primitivas para o dispositivo ativo. */
+/*-------------------------------------------------------------------------*/
+void putlist(cdCanvas *target)
+{
+ tList *temp;
+ int wdc_w, wdc_h, wd = 0;
+
+ /* ativa o canvas destino */
+ cdActivate(target);
+
+ if (target == ctgc.wd_canvas)
+ {
+ cdGetCanvasSize(&wdc_w, &wdc_h, NULL, NULL);
+ wdWindow(0, ctgc.w, 0, ctgc.h);
+ wdViewport(0, wdc_w, 0, wdc_h);
+ wd = 1;
+ }
+
+ /* limpa o canvas com a cor de fundo */
+ cdBackground(ctgc.background);
+ cdClear();
+ cdClipArea(ctgc.clip_xmin, ctgc.clip_xmax, ctgc.clip_ymin, ctgc.clip_ymax);
+ cdClip(ctgc.clip_mode);
+
+ /* coloca a lista de primitivas no canvas */
+ for (temp = ctgc.head; temp; temp = (tList *) temp->next)
+ {
+ switch (temp->type) {
+ case LINE:
+ cdWriteMode(temp->par.lineboxpar.write_mode);
+ cdLineCap(temp->par.lineboxpar.line_cap);
+ cdLineJoin(temp->par.lineboxpar.line_join);
+ cdLineStyle(temp->par.lineboxpar.line_style);
+ cdLineWidth(temp->par.lineboxpar.line_width);
+ cdForeground(temp->par.lineboxpar.foreground);
+ if (wd)
+ wdLine(temp->par.lineboxpar.x1, temp->par.lineboxpar.y1,
+ temp->par.lineboxpar.x2, temp->par.lineboxpar.y2);
+ else
+ cdLine(temp->par.lineboxpar.x1, temp->par.lineboxpar.y1,
+ temp->par.lineboxpar.x2, temp->par.lineboxpar.y2);
+ break;
+ case RECT:
+ cdWriteMode(temp->par.lineboxpar.write_mode);
+ cdLineCap(temp->par.lineboxpar.line_cap);
+ cdLineJoin(temp->par.lineboxpar.line_join);
+ cdLineStyle(temp->par.lineboxpar.line_style);
+ cdLineWidth(temp->par.lineboxpar.line_width);
+ cdForeground(temp->par.lineboxpar.foreground);
+ if (wd)
+ wdRect(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ else
+ cdRect(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ break;
+ case BOX:
+ cdWriteMode(temp->par.lineboxpar.write_mode);
+ cdLineCap(temp->par.lineboxpar.line_cap);
+ cdLineJoin(temp->par.lineboxpar.line_join);
+ cdLineStyle(temp->par.lineboxpar.line_style);
+ cdLineWidth(temp->par.lineboxpar.line_width);
+ cdForeground(temp->par.lineboxpar.foreground);
+ cdBackground(temp->par.lineboxpar.background);
+ cdBackOpacity(temp->par.lineboxpar.back_opacity);
+ cdHatch(temp->par.lineboxpar.hatch);
+ cdInteriorStyle(temp->par.lineboxpar.interior_style);
+ if (wd)
+ wdBox(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ else
+ cdBox(temp->par.lineboxpar.x1, temp->par.lineboxpar.x2,
+ temp->par.lineboxpar.y1, temp->par.lineboxpar.y2);
+ break;
+ case ARC:
+ cdWriteMode(temp->par.arcsectorpar.write_mode);
+ cdLineCap(temp->par.arcsectorpar.line_cap);
+ cdLineJoin(temp->par.arcsectorpar.line_join);
+ cdLineStyle(temp->par.arcsectorpar.line_style);
+ cdLineWidth(temp->par.arcsectorpar.line_width);
+ cdForeground(temp->par.arcsectorpar.foreground);
+ if (wd)
+ wdArc(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ else
+ cdArc(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ break;
+ case CHORD:
+ cdWriteMode(temp->par.arcsectorpar.write_mode);
+ cdLineCap(temp->par.arcsectorpar.line_cap);
+ cdLineJoin(temp->par.arcsectorpar.line_join);
+ cdLineStyle(temp->par.arcsectorpar.line_style);
+ cdLineWidth(temp->par.arcsectorpar.line_width);
+ cdForeground(temp->par.arcsectorpar.foreground);
+ cdBackground(temp->par.arcsectorpar.background);
+ cdBackOpacity(temp->par.arcsectorpar.back_opacity);
+ cdHatch(temp->par.arcsectorpar.hatch);
+ cdInteriorStyle(temp->par.arcsectorpar.interior_style);
+ if (wd)
+ wdChord(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ else
+ cdChord(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ break;
+ case SECTOR:
+ cdWriteMode(temp->par.arcsectorpar.write_mode);
+ cdLineCap(temp->par.arcsectorpar.line_cap);
+ cdLineJoin(temp->par.arcsectorpar.line_join);
+ cdLineStyle(temp->par.arcsectorpar.line_style);
+ cdLineWidth(temp->par.arcsectorpar.line_width);
+ cdForeground(temp->par.arcsectorpar.foreground);
+ cdBackground(temp->par.arcsectorpar.background);
+ cdBackOpacity(temp->par.arcsectorpar.back_opacity);
+ cdHatch(temp->par.arcsectorpar.hatch);
+ cdInteriorStyle(temp->par.arcsectorpar.interior_style);
+ if (wd)
+ wdSector(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ else
+ cdSector(temp->par.arcsectorpar.xc, temp->par.arcsectorpar.yc,
+ temp->par.arcsectorpar.w, temp->par.arcsectorpar.h,
+ temp->par.arcsectorpar.angle1, temp->par.arcsectorpar.angle2);
+ break;
+ case PIXEL:
+ cdWriteMode(temp->par.pixelpar.write_mode);
+ cdPixel(temp->par.pixelpar.x, temp->par.pixelpar.y,
+ temp->par.pixelpar.foreground);
+ break;
+ case MARK:
+ cdWriteMode(temp->par.markpar.write_mode);
+ cdMarkSize(temp->par.markpar.mark_size);
+ cdMarkType(temp->par.markpar.mark_type);
+ cdForeground(temp->par.markpar.foreground);
+ if (wd)
+ wdMark(temp->par.markpar.x, temp->par.markpar.y);
+ else
+ cdMark(temp->par.markpar.x, temp->par.markpar.y);
+ break;
+ case TEXT:
+ cdWriteMode(temp->par.textpar.write_mode);
+ cdForeground(temp->par.textpar.foreground);
+ cdBackground(temp->par.textpar.background);
+ cdBackOpacity(temp->par.textpar.back_opacity);
+ cdTextAlignment(temp->par.textpar.text_alignment);
+ cdTextOrientation(temp->par.textpar.text_orientation);
+ cdFont(temp->par.textpar.font_typeface,
+ temp->par.textpar.font_style,
+ temp->par.textpar.font_size);
+ if (wd)
+ wdText(temp->par.textpar.x, temp->par.textpar.y,
+ temp->par.textpar.s);
+ else
+ cdText(temp->par.textpar.x, temp->par.textpar.y,
+ temp->par.textpar.s);
+ break;
+ case POLY: {
+ int i;
+ cdForeground(temp->par.polypar.foreground);
+ cdBackground(temp->par.polypar.background);
+ cdWriteMode(temp->par.polypar.write_mode);
+ cdLineCap(temp->par.polypar.line_cap);
+ cdLineJoin(temp->par.polypar.line_join);
+ cdLineStyle(temp->par.polypar.line_style);
+ cdLineWidth(temp->par.polypar.line_width);
+ cdFillMode(temp->par.polypar.fill_mode);
+ cdBackOpacity(temp->par.polypar.back_opacity);
+ cdHatch(temp->par.polypar.hatch);
+ cdInteriorStyle(temp->par.polypar.interior_style);
+ cdBegin(temp->par.polypar.poly_mode);
+ if (wd)
+ for (i=0; (i<temp->par.polypar.num_points); i++) {
+ wdVertex(temp->par.polypar.points[i].x,
+ temp->par.polypar.points[i].y);
+ }
+ else
+ for (i=0; (i<temp->par.polypar.num_points); i++) {
+ cdVertex(temp->par.polypar.points[i].x,
+ temp->par.polypar.points[i].y);
+ }
+ cdEnd();
+ break;
+ case META:
+ cdWriteMode(CD_REPLACE);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackground(CD_WHITE);
+ cdBackOpacity(CD_TRANSPARENT);
+ cdForeground(CD_BLACK);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.stretch_play)
+ {
+ if (wd)
+ cdPlay(temp->par.metapar.ctx, 0, wdc_w-1, 0, wdc_h-1, temp->par.metapar.filename);
+ else
+ cdPlay(temp->par.metapar.ctx, 0, ctgc.w-1, 0, ctgc.h-1, temp->par.metapar.filename);
+ }
+ else
+ cdPlay(temp->par.metapar.ctx, 0, 0, 0, 0, temp->par.metapar.filename);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /* volta o clip-mode para o corrente */
+ cdClip(ctgc.clip_mode);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo da lista de primitivas no canvas WD. */
+/*-------------------------------------------------------------------------*/
+int fWDRepaint(void)
+{
+ putlist(ctgc.wd_canvas);
+
+ /* reativa o canvas iup */
+ cdActivate(ctgc.iup_canvas);
+
+ return IUP_DEFAULT;
+}
+
+int fPICRepaint(void)
+{
+ int w, h;
+ putlist(ctgc.picture);
+
+ cdActivate(ctgc.pic_canvas);
+ cdGetCanvasSize(&w, &h, NULL, NULL);
+ cdClear();
+ if (ctgc.stretch_play)
+ cdPlay(CD_PICTURE, 0, w-1, 0, h-1, ctgc.picture);
+ else
+ cdPlay(CD_PICTURE, 0, 0, 0, 0, ctgc.picture);
+
+ /* reativa o canvas iup */
+ cdActivate(ctgc.iup_canvas);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Redesenha o canvas. */
+/*-------------------------------------------------------------------------*/
+void updatecanvas(void)
+{
+ if (ctgc.buffering == NO_BUFFER)
+ putlist(ctgc.iup_canvas);
+ else
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ putlist(ctgc.buffer_canvas);
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+
+ if (ctgc.wd_dialog)
+ fWDRepaint();
+
+ if (ctgc.pic_dialog)
+ fPICRepaint();
+}
+
+/*-------------------------------------------------------------------------*/
+/* Redesenha o canvas. */
+/*-------------------------------------------------------------------------*/
+int fRepaint(void)
+{
+ int i;
+
+ /* ativa o canvas na tela */
+ cdActivate(ctgc.iup_canvas);
+ wdViewport(0, ctgc.w, 0, ctgc.h);
+
+ /* desliga o clipping durante o evento Repaint */
+ cdClip(CD_CLIPOFF);
+
+ /* double-buffering? */
+ cdWriteMode(CD_REPLACE);
+ updatecanvas();
+
+ /* se o evento repaint for gerado durante o rubber band...*/
+ /* ...eh preciso restaurar o estado anterior */
+ if (ctgc.following) {
+ cdWriteMode(CD_NOT_XOR);
+ cdForeground(CD_BLACK);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ switch (ctgc.cur_prim) {
+ case POLY:
+ for (i=0; (i<ctgc.num_points-1); i++) {
+ cdLine(ctgc.points[i].x, ctgc.points[i].y,
+ ctgc.points[i+1].x, ctgc.points[i+1].y);
+ }
+ polygon(REPAINT, 0, 0);
+ break;
+ case LINE:
+ line(REPAINT, 0, 0);
+ break;
+ case ARC:
+ case CHORD:
+ case SECTOR:
+ arc(REPAINT, 0, 0);
+ break;
+ case RECT:
+ case BOX:
+ box(REPAINT, 0, 0);
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* restaura o estado de clipping anterior ao evento Repaint */
+ cdClip(ctgc.clip_mode);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Ativa o canvas WD. */
+/*-------------------------------------------------------------------------*/
+int fWDCanvas(void)
+{
+ IupShow(IupGetHandle("dlgWDCanvas"));
+ ctgc.wd_dialog = TRUE;
+ IupSetFunction("cmdWDRepaint", (Icallback)fWDRepaint);
+ fWDRepaint();
+ return IUP_DEFAULT;
+}
+
+int fPICCanvas(void)
+{
+ IupShow(IupGetHandle("dlgPICCanvas"));
+ ctgc.pic_dialog = TRUE;
+ IupSetFunction("cmdPICRepaint", (Icallback)fPICRepaint);
+ fPICRepaint();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desativa o canvas WD. */
+/*-------------------------------------------------------------------------*/
+int fCloseWD(void)
+{
+ ctgc.wd_dialog = FALSE;
+ return IUP_DEFAULT;
+}
+
+int fClosePIC(void)
+{
+ ctgc.pic_dialog = FALSE;
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Apaga a ultima primitiva desenhada. */
+/*-------------------------------------------------------------------------*/
+int fEditUndo(void)
+{
+ /* apaga a ultima primitiva da fila */
+ dellast();
+ /* se nao ha mais primitivas na fila, desabilita o undo */
+ if (ctgc.head == NULL)
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_NO);
+
+ updatecanvas();
+
+ return IUP_DEFAULT;
+}
+
+int fSimulate(Ihandle *self, int v)
+{
+ ignore(self);
+
+ cdActivate(ctgc.iup_canvas);
+
+ if (v == 1)
+ {
+ if (ctgc.sim == 1)
+ return IUP_DEFAULT;
+
+ ctgc.sim = 1;
+ cdSimulate(CD_SIM_ALL);
+ sprintf(ctgc.status_line, "cdSimulate(CD_SIM_ALL)");
+ }
+ else
+ {
+ if (ctgc.sim == 0)
+ return IUP_DEFAULT;
+
+ ctgc.sim = 0;
+ cdSimulate(CD_SIM_NONE);
+ sprintf(ctgc.status_line, "cdSimulate(CD_SIM_NONE)");
+ }
+
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+int fStretchPlay(Ihandle *self, int v)
+{
+ ignore(self);
+ ctgc.stretch_play = v;
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Tchau. */
+/*-------------------------------------------------------------------------*/
+int fFileExit(void)
+{
+ IupHide(ctgc.dlg_cur_prim);
+ return IUP_CLOSE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle OpenLines. */
+/*-------------------------------------------------------------------------*/
+int fOpenLines(void)
+{
+ ctgc.poly_mode = CD_OPEN_LINES;
+ sprintf(ctgc.status_line, "cdBegin(CD_OPEN_LINES)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle ClosedLines. */
+/*-------------------------------------------------------------------------*/
+int fClosedLines(void)
+{
+ ctgc.poly_mode = CD_CLOSED_LINES;
+ sprintf(ctgc.status_line, "cdBegin(CD_CLOSED_LINES)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fPolyBezier(void)
+{
+ ctgc.poly_mode = CD_BEZIER;
+ sprintf(ctgc.status_line, "cdBegin(CD_BEZIER)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Fill. */
+/*-------------------------------------------------------------------------*/
+int fFill(void)
+{
+ ctgc.poly_mode = CD_FILL;
+ sprintf(ctgc.status_line, "cdBegin(CD_FILL)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Clip. */
+/*-------------------------------------------------------------------------*/
+int fPolyClip(void)
+{
+ ctgc.poly_mode = CD_CLIP;
+ sprintf(ctgc.status_line, "cdBegin(CD_CLIP)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Solid. */
+/*-------------------------------------------------------------------------*/
+int fSolid(void)
+{
+ ctgc.interior_style = CD_SOLID;
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_SOLID)");
+ set_status();
+ cdInteriorStyle(CD_SOLID);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Hatch. */
+/*-------------------------------------------------------------------------*/
+int fHatch(void)
+{
+ ctgc.interior_style = CD_HATCH;
+ cdInteriorStyle(CD_HATCH);
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_HATCH)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Stipple. */
+/*-------------------------------------------------------------------------*/
+int fStipple(void)
+{
+ ctgc.interior_style = CD_STIPPLE;
+ cdInteriorStyle(CD_STIPPLE);
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_STIPPLE)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao toggle Pattern. */
+/*-------------------------------------------------------------------------*/
+int fPattern(void)
+{
+ ctgc.interior_style = CD_PATTERN;
+ cdInteriorStyle(CD_PATTERN);
+ sprintf(ctgc.status_line, "cdInteriorStyle(CD_PATTERN)");
+ set_status();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o a opacidade do fundo. */
+/*-------------------------------------------------------------------------*/
+int fOpacity(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.back_opacity = CD_OPAQUE;
+ sprintf(ctgc.status_line, "cdBackOpacity(CD_OPAQUE)");
+ break;
+ case 2:
+ ctgc.back_opacity = CD_TRANSPARENT;
+ sprintf(ctgc.status_line, "cdBackOpacity(CD_TRANSPARENT)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o modo de repaint para imagem do servidor. */
+/*-------------------------------------------------------------------------*/
+int fImageBuffer(Ihandle *self, int v)
+{
+ ignore(self);
+
+ /* se o toggle foi para o estado ligado... */
+ if (v) {
+ switch (ctgc.buffering) {
+ case IMAGE_BUFFER:
+ break;
+ case IMAGERGB_BUFFER:
+ /* mata o canvas do buffer anterior */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* prosegue como se nao houvesse o buffer anterior */
+ case NO_BUFFER:
+ /* cria o canvas do buffer */
+ if (use_gdiplus) cdUseContextPlus(1);
+ ctgc.buffer_canvas = cdCreateCanvas(CD_DBUFFER, ctgc.iup_canvas);
+ if (!antialias) cdCanvasSetAttribute(ctgc.buffer_canvas, "ANTIALIAS", "0");
+ if (use_gdiplus) cdUseContextPlus(0);
+ /* se nao consegui criar o canvas... */
+ if (!ctgc.buffer_canvas) {
+ /* desabilita o double-buffering */
+ ctgc.buffering = NO_BUFFER;
+ sprintf(ctgc.status_line, "Error creating CD_DBUFFER canvas.");
+ set_status();
+ }
+ else {
+ /* seta o modo de escrita para double-buffering em imagem do servidor */
+ ctgc.buffering = IMAGE_BUFFER;
+ /* reconstroe o stipple e o pattern no canvas do buffer */
+ cdActivate(ctgc.buffer_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.sim == 1)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+ /* atualiza o buffer */
+ updatecanvas();
+ /* muda a linha de status */
+ sprintf(ctgc.status_line, "CD_DBUFFER buffer active.");
+ set_status();
+ }
+
+ break;
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o modo de repaint para imagem RGB. */
+/*-------------------------------------------------------------------------*/
+int fRGBBuffer(Ihandle *self, int v)
+{
+ ignore(self);
+
+ if (v) {
+ switch (ctgc.buffering) {
+ case IMAGERGB_BUFFER:
+ break;
+ case IMAGE_BUFFER:
+ /* mata o canvas do buffer anterior */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* prossegue como se nao houvesse o buffer anterior */
+ case NO_BUFFER:
+ /* cria o canvas do buffer */
+ ctgc.buffer_canvas = cdCreateCanvas(CD_DBUFFERRGB, ctgc.iup_canvas);
+ if (!antialias) cdCanvasSetAttribute(ctgc.buffer_canvas, "ANTIALIAS", "0");
+ /* se nao consegui criar o canvas... */
+ if (!ctgc.buffer_canvas) {
+ /* mata a imagem alocada */
+ /* desabilita o double-buffering */
+ ctgc.buffering = NO_BUFFER;
+ sprintf(ctgc.status_line, "Error creating CD_DBUFFERRGB canvas.");
+ set_status();
+ }
+ else {
+ /* seta o modo de escrita para double-buffering em imagem RGB */
+ ctgc.buffering = IMAGERGB_BUFFER;
+ /* reconstroe o stipple e o pattern no canvas do buffer */
+ cdActivate(ctgc.buffer_canvas);
+ cdLineStyleDashes(ctgc.dashes, 4);
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.sim == 1)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+ /* atualiza o buffer */
+ updatecanvas();
+ /* muda a linha de status */
+ sprintf(ctgc.status_line, "CD_DBUFFERRGB buffer active.");
+ set_status();
+ }
+ break;
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Seleciona o modo de repaint para escrita diretamente na tela. */
+/*-------------------------------------------------------------------------*/
+int fNoBuffering(Ihandle *self, int v)
+{
+ ignore(self);
+
+ /* se foi para double-buffering, atualiza o buffer off-screen */
+ if (v) {
+ switch (ctgc.buffering) {
+ case IMAGERGB_BUFFER:
+ /* mata o canvas */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* passa a desenhar diretamente na tela */
+ ctgc.buffering = NO_BUFFER;
+ /* atualiza o buffer */
+ updatecanvas();
+ break;
+ case IMAGE_BUFFER:
+ /* mata o canvas */
+ if (ctgc.buffer_canvas) cdKillCanvas(ctgc.buffer_canvas);
+ ctgc.buffer_canvas = NULL;
+ /* passa a desenhar diretamente na tela */
+ ctgc.buffering = NO_BUFFER;
+ /* atualiza o buffer */
+ updatecanvas();
+ break;
+ case NO_BUFFER:
+ break;
+ }
+ }
+ /* muda a linha de status */
+ sprintf(ctgc.status_line, "Now drawing on-screen.");
+ set_status();
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcoes da barra de estilos.. */
+/*-------------------------------------------------------------------------*/
+int fMarkType(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.mark_type = CD_PLUS;
+ sprintf(ctgc.status_line, "cdMarkType(CD_PLUS)");
+ break;
+ case 2:
+ ctgc.mark_type = CD_STAR;
+ sprintf(ctgc.status_line, "cdMarkType(CD_STAR)");
+ break;
+ case 3:
+ ctgc.mark_type = CD_CIRCLE;
+ sprintf(ctgc.status_line, "cdMarkType(CD_CIRCLE)");
+ break;
+ case 4:
+ ctgc.mark_type = CD_X;
+ sprintf(ctgc.status_line, "cdMarkType(CD_X)");
+ break;
+ case 5:
+ ctgc.mark_type = CD_BOX;
+ sprintf(ctgc.status_line, "cdMarkType(CD_BOX)");
+ break;
+ case 6:
+ ctgc.mark_type = CD_DIAMOND;
+ sprintf(ctgc.status_line, "cdMarkType(CD_DIAMOND)");
+ break;
+ case 7:
+ ctgc.mark_type = CD_HOLLOW_CIRCLE;
+ sprintf(ctgc.status_line, "cdMarkType(CD_HOLLOW_CIRCLE)");
+ break;
+ case 8:
+ ctgc.mark_type = CD_HOLLOW_BOX;
+ sprintf(ctgc.status_line, "cdMarkType(CD_HOLLOW_BOX)");
+ break;
+ case 9:
+ ctgc.mark_type = CD_HOLLOW_DIAMOND;
+ sprintf(ctgc.status_line, "cdMarkType(CD_HOLLOW_DIAMOND)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fWriteMode(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.write_mode = CD_REPLACE;
+ sprintf(ctgc.status_line, "cdWriteMode(CD_REPLACE)");
+ break;
+ case 2:
+ ctgc.write_mode = CD_XOR;
+ sprintf(ctgc.status_line, "cdWriteMode(CD_XOR)");
+ break;
+ case 3:
+ ctgc.write_mode = CD_NOT_XOR;
+ sprintf(ctgc.status_line, "cdWriteMode(CD_NOT_XOR)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fLineStyle(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.line_style = CD_CONTINUOUS;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_CONTINUOUS)");
+ break;
+ case 2:
+ ctgc.line_style = CD_DASHED;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DASHED)");
+ break;
+ case 3:
+ ctgc.line_style = CD_DOTTED;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DOTTED)");
+ break;
+ case 4:
+ ctgc.line_style = CD_DASH_DOT;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DASH_DOT)");
+ break;
+ case 5:
+ ctgc.line_style = CD_DASH_DOT_DOT;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_DASH_DOT_DOT)");
+ break;
+ case 6:
+ ctgc.line_style = CD_CUSTOM;
+ sprintf(ctgc.status_line, "cdLineStyle(CD_CUSTOM)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fLineCap(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.line_cap = CD_CAPFLAT;
+ sprintf(ctgc.status_line, "cdLineCap(CD_CAPFLAT)");
+ break;
+ case 2:
+ ctgc.line_cap = CD_CAPSQUARE;
+ sprintf(ctgc.status_line, "cdLineCap(CD_CAPSQUARE)");
+ break;
+ case 3:
+ ctgc.line_cap = CD_CAPROUND;
+ sprintf(ctgc.status_line, "cdLineCap(CD_CAPROUND)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fLineJoin(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.line_join = CD_MITER;
+ sprintf(ctgc.status_line, "cdLineJoin(CD_MITER)");
+ break;
+ case 2:
+ ctgc.line_join = CD_BEVEL;
+ sprintf(ctgc.status_line, "cdLineJoin(CD_BEVEL)");
+ break;
+ case 3:
+ ctgc.line_join = CD_ROUND;
+ sprintf(ctgc.status_line, "cdLineJoin(CD_ROUND)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fFillMode(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.fill_mode = CD_EVENODD;
+ sprintf(ctgc.status_line, "cdFillMode(CD_EVENODD)");
+ break;
+ case 2:
+ ctgc.fill_mode = CD_WINDING;
+ sprintf(ctgc.status_line, "cdFillMode(CD_WINDING)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+char* font_style[4] = {"CD_PLAIN", "CD_BOLD", "CD_ITALIC", "CD_BOLD_ITALIC"};
+char* font_face[4] = {"CD_SYSTEM", "CD_COURIER", "CD_TIMES_ROMAN", "CD_HELVETICA"};
+
+int fFontStyle(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.font_style = CD_PLAIN;
+ break;
+ case 2:
+ ctgc.font_style = CD_BOLD;
+ break;
+ case 3:
+ ctgc.font_style = CD_ITALIC;
+ break;
+ case 4:
+ ctgc.font_style = CD_BOLD_ITALIC;
+ break;
+ }
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+ sprintf(ctgc.status_line, "cdFont(%s, %s, %d)", font_face[ctgc.font_typeface], font_style[ctgc.font_style], ctgc.font_size);
+ set_status();
+ return IUP_DEFAULT;
+}
+
+
+int fFontTypeFace(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.font_typeface = CD_SYSTEM;
+ break;
+ case 2:
+ ctgc.font_typeface = CD_COURIER;
+ break;
+ case 3:
+ ctgc.font_typeface = CD_TIMES_ROMAN;
+ break;
+ case 4:
+ ctgc.font_typeface = CD_HELVETICA;
+ break;
+ }
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+ sprintf(ctgc.status_line, "cdFont(%s, %s, %d)", font_face[ctgc.font_typeface], font_style[ctgc.font_style], ctgc.font_size);
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fTextAlignment(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.text_alignment = CD_NORTH;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_NORTH)");
+ break;
+ case 2 :
+ ctgc.text_alignment = CD_SOUTH;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_SOUTH)");
+ break;
+ case 3:
+ ctgc.text_alignment = CD_EAST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_EAST)");
+ break;
+ case 4:
+ ctgc.text_alignment = CD_WEST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_WEST)");
+ break;
+ case 5:
+ ctgc.text_alignment = CD_NORTH_EAST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_NORTH_EAST)");
+ break;
+ case 6:
+ ctgc.text_alignment = CD_NORTH_WEST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_NORTH_WEST)");
+ break;
+ case 7:
+ ctgc.text_alignment = CD_SOUTH_EAST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_SOUTH_EAST)");
+ break;
+ case 8:
+ ctgc.text_alignment = CD_SOUTH_WEST;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_SOUTH_WEST)");
+ break;
+ case 9:
+ ctgc.text_alignment = CD_CENTER;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_CENTER)");
+ break;
+ case 10:
+ ctgc.text_alignment = CD_BASE_LEFT;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_BASE_LEFT)");
+ break;
+ case 11:
+ ctgc.text_alignment = CD_BASE_CENTER;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_BASE_CENTER)");
+ break;
+ case 12:
+ ctgc.text_alignment = CD_BASE_RIGHT;
+ sprintf(ctgc.status_line, "cdTextAlignment(CD_BASE_RIGHT)");
+ break;
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+int fHatchStyle(Ihandle *self, char *t, int o, int v)
+{
+ ignore(t);
+ ignore(self);
+ if (v == 0) return IUP_DEFAULT;
+ switch (o) {
+ case 1:
+ ctgc.hatch = CD_HORIZONTAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_HORIZONTAL)");
+ break;
+ case 2 :
+ ctgc.hatch = CD_VERTICAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_VERTICAL)");
+ break;
+ case 3:
+ ctgc.hatch = CD_FDIAGONAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_FDIAGONAL)");
+ break;
+ case 4:
+ ctgc.hatch = CD_BDIAGONAL;
+ sprintf(ctgc.status_line, "cdHatch(CD_BDIAGONAL)");
+ break;
+ case 5:
+ ctgc.hatch = CD_CROSS;
+ sprintf(ctgc.status_line, "cdHatch(CD_CROSS)");
+ break;
+ case 6:
+ ctgc.hatch = CD_DIAGCROSS;
+ sprintf(ctgc.status_line, "cdHatch(CD_DIAGCROSS)");
+ break;
+ }
+ set_status();
+ cdHatch(ctgc.hatch);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza a linha de estatus do CDTest. */
+/*-------------------------------------------------------------------------*/
+void set_status(void)
+{
+ IupSetAttribute(IupGetHandle("lbStatusLine"), IUP_TITLE, ctgc.status_line);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza a posiccao do mouse no dialogo principal. */
+/*-------------------------------------------------------------------------*/
+void mouse_pos(int x, int y)
+{
+ /* salva a posiccao do mouse no contexto */
+ ctgc.x = x;
+ ctgc.y = y;
+
+ /* atualiza a posiccao do mouse no feedback para o usuario */
+ sprintf(ctgc.mouse_pos, "(%4d,%4d)", x, y);
+ IupSetAttribute(IupGetHandle("lbMousePos"), IUP_TITLE, ctgc.mouse_pos);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a caixa de dialogo corrente. */
+/*-------------------------------------------------------------------------*/
+int fShowDialog(void)
+{
+ if (ctgc.dlg_cur_prim != NULL) {
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Ativa a seleccao de area de clip. */
+/*-------------------------------------------------------------------------*/
+int fClip(Ihandle* self)
+{
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgClip");
+ ctgc.following = FALSE;
+ ctgc.cur_prim = CLIP;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgClip");
+ sprintf(ctgc.status_line, "LEFT click and drag to set. RIGHT clip to disable.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza a area de clipping. */
+/*-------------------------------------------------------------------------*/
+int fClipArea(void)
+{
+ ctgc.clip_mode = CD_CLIPAREA;
+ ctgc.clip_xmin = IupGetInt(IupGetHandle("txtClipXmin"), IUP_VALUE);
+ ctgc.clip_xmax = IupGetInt(IupGetHandle("txtClipXmax"), IUP_VALUE);
+ ctgc.clip_ymin = IupGetInt(IupGetHandle("txtClipYmin"), IUP_VALUE);
+ ctgc.clip_ymax = IupGetInt(IupGetHandle("txtClipYmax"), IUP_VALUE);
+ cdClipArea(ctgc.clip_xmin,ctgc.clip_xmax,ctgc.clip_ymin,ctgc.clip_ymax);
+ cdClip(CD_CLIPAREA);
+ sprintf(ctgc.status_line, "cdClipArea( %d, %d, %d, %d)",
+ ctgc.clip_xmin,ctgc.clip_xmax,ctgc.clip_ymin,ctgc.clip_ymax);
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Atualiza poligono de clipping. */
+/*-------------------------------------------------------------------------*/
+int fClipPoly(void)
+{
+ ctgc.clip_mode=CD_CLIPPOLYGON;
+ cdClip(CD_CLIPPOLYGON);
+ sprintf(ctgc.status_line, "cdClip(CD_CLIPPOLYGON)");
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desativa o Clipping. */
+/*-------------------------------------------------------------------------*/
+int fClipOff(void)
+{
+ ctgc.clip_mode = CD_CLIPOFF;
+ cdClip(CD_CLIPOFF);
+ sprintf(ctgc.status_line, "cdClip(CD_CLIPOFF)");
+ set_status();
+ updatecanvas();
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Prepara a seleccao de imagens. */
+/*-------------------------------------------------------------------------*/
+int fImage(Ihandle* self)
+{
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgImage");
+ ctgc.cur_prim = IMAGE;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgImage");
+ sprintf(ctgc.status_line, "LEFT click and drag to get. RIGHT click to put.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Pega a imagem. */
+/*-------------------------------------------------------------------------*/
+int fImageGet(void)
+{
+ int x, y, width, height;
+
+ /* mata a image */
+ if (ctgc.test_image != NULL) {
+ cdKillImage(ctgc.test_image);
+ }
+
+ x = IupGetInt(IupGetHandle("txtImageX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageY"), IUP_VALUE);
+
+ width = IupGetInt(IupGetHandle("txtImageW"), IUP_VALUE);
+ height = IupGetInt(IupGetHandle("txtImageH"), IUP_VALUE);
+
+ if (width*height != 0)
+ {
+ if (ctgc.buffering)
+ cdActivate(ctgc.buffer_canvas);
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ ctgc.test_image = cdCreateImage(width, height);
+ if (ctgc.test_image != NULL)
+ {
+ cdGetImage(ctgc.test_image, x, y);
+ sprintf(ctgc.status_line, "cdGetImage( image, %d, %d)", x, y);
+ set_status();
+ }
+
+ cdActivate(ctgc.iup_canvas);
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Coloca a imagem. */
+/*-------------------------------------------------------------------------*/
+int fImagePut(void)
+{
+ int x, y;
+
+ x = IupGetInt(IupGetHandle("txtImageX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageY"), IUP_VALUE);
+
+ if (ctgc.test_image != NULL)
+ {
+ if (ctgc.buffering)
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ cdActivate(ctgc.buffer_canvas);
+ }
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ cdWriteMode(ctgc.write_mode);
+ cdPutImage(ctgc.test_image, x, y);
+ sprintf(ctgc.status_line, "cdPutImage( image, %d, %d)", x, y);
+ set_status();
+
+ if (ctgc.buffering)
+ {
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Prepara a seleccao de imagens. */
+/*-------------------------------------------------------------------------*/
+int fImageRGB(Ihandle* self)
+{
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgImageRGB");
+ ctgc.cur_prim = RGB;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgImageRGB");
+ sprintf(ctgc.status_line, "LEFT click and drag to get. RIGHT click to put.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Pega a imagem. */
+/*-------------------------------------------------------------------------*/
+int fImageRGBGet(void)
+{
+ int x, y;
+
+ x = IupGetInt(IupGetHandle("txtImageRGBX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageRGBY"), IUP_VALUE);
+ ctgc.rgb_w = IupGetInt(IupGetHandle("txtImageRGBW"), IUP_VALUE);
+ ctgc.rgb_h = IupGetInt(IupGetHandle("txtImageRGBH"), IUP_VALUE);
+
+ if (ctgc.red) free(ctgc.red);
+ ctgc.red = (unsigned char *) malloc (ctgc.rgb_w*ctgc.rgb_h*sizeof(unsigned char));
+ if (ctgc.green) free(ctgc.green);
+ ctgc.green = (unsigned char *) malloc (ctgc.rgb_w*ctgc.rgb_h*sizeof(unsigned char));
+ if (ctgc.blue) free(ctgc.blue);
+ ctgc.blue = (unsigned char *) malloc (ctgc.rgb_w*ctgc.rgb_h*sizeof(unsigned char));
+
+ if ((ctgc.red!=NULL)&&(ctgc.green!=NULL)&&(ctgc.blue!=NULL)) {
+ sprintf(ctgc.status_line, "cdGetImageRGB( r, g, b, %d, %d, %d, %d)",
+ x, y, ctgc.rgb_w, ctgc.rgb_h);
+ set_status();
+
+ if (ctgc.buffering)
+ cdActivate(ctgc.buffer_canvas);
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ cdGetImageRGB(ctgc.red, ctgc.green, ctgc.blue, x, y, ctgc.rgb_w, ctgc.rgb_h);
+
+ cdActivate(ctgc.iup_canvas);
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Joga a imagem na tela. */
+/*-------------------------------------------------------------------------*/
+int fImageRGBPut(void)
+{
+ int x, y;
+
+ x = IupGetInt(IupGetHandle("txtImageRGBX"), IUP_VALUE);
+ y = IupGetInt(IupGetHandle("txtImageRGBY"), IUP_VALUE);
+
+ if ((ctgc.red!=NULL)&&(ctgc.green!=NULL)&&(ctgc.blue!=NULL))
+ {
+ if (ctgc.buffering)
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ cdActivate(ctgc.buffer_canvas);
+ }
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ cdWriteMode(ctgc.write_mode);
+ sprintf(ctgc.status_line, "cdPutImageRGB( %d, %d, r, g, b, %d, %d, %d, %d)",
+ ctgc.rgb_w, ctgc.rgb_h, x, y, ctgc.rgb_w, ctgc.rgb_h);
+ set_status();
+ cdPutImageRGB(ctgc.rgb_w, ctgc.rgb_h, ctgc.red, ctgc.green, ctgc.blue, x, y, ctgc.rgb_w, ctgc.rgb_h);
+
+ if (ctgc.buffering)
+ {
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fLine(Ihandle* self)
+{
+ if (ctgc.cur_prim != LINE) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgLine");
+ if (ctgc.cur_prim == POLY) { /* termina o poligono em andamento */
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = LINE;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim); /* esconde o dialogo anterior */
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Line Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fRect(Ihandle* self)
+{
+ if (ctgc.cur_prim != RECT) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgRect");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = RECT;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Rect Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+int fBox(Ihandle* self)
+{
+ if (ctgc.cur_prim != BOX) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgBox");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = BOX;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgLB");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Box Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fArc(Ihandle* self)
+{
+ if (ctgc.cur_prim != ARC) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgArc");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = ARC;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgAS");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Arc Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click at center and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fSector(Ihandle* self)
+{
+ if (ctgc.cur_prim != SECTOR) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgSector");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = SECTOR;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgAS");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Sector Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click at center and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+int fChord(Ihandle* self)
+{
+ if (ctgc.cur_prim != CHORD) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgChord");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = CHORD;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgAS");
+ IupSetAttribute(ctgc.dlg_cur_prim, IUP_TITLE, "Chord Parameters");
+ }
+ sprintf(ctgc.status_line, "LEFT click at center and drag.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fPixel(Ihandle* self)
+{
+ if (ctgc.cur_prim != PIXEL) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgPixel");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = PIXEL;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgPixel");
+ }
+ sprintf(ctgc.status_line, "LEFT click.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fMark(Ihandle* self)
+{
+ if (ctgc.cur_prim != MARK) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgMark");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = MARK;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgMark");
+ }
+ sprintf(ctgc.status_line, "LEFT click.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fText(Ihandle* self)
+{
+ if (ctgc.cur_prim != TEXT) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgText");
+ if (ctgc.cur_prim == POLY) {
+ fButtonCB(NULL, IUP_BUTTON3, 0, 0, 0, 0);
+ }
+ ctgc.cur_prim = TEXT;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgText");
+ }
+ sprintf(ctgc.status_line, "LEFT click.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Muda a primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fPoly(Ihandle* self)
+{
+ if (ctgc.cur_prim != POLY) {
+ IupSetAttribute(ctgc.bt_cur_prim, IUP_IMAGE, "imgPoly");
+ ctgc.cur_prim = POLY;
+ ctgc.following = FALSE;
+ ctgc.visible = iscurvisible();
+ IupHide(ctgc.dlg_cur_prim);
+ if (ctgc.visible)
+ {
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ }
+ ctgc.dlg_cur_prim = IupGetHandle("dlgPoly");
+ /* zera o buffer temporario de pontos */
+ ctgc.num_points = 0;
+ }
+ sprintf(ctgc.status_line, "LEFT click to add vertex. RIGHT click to end.");
+ set_status();
+ if (ctgc.visible || IupGetAttribute(self, "ISMENU"))
+ IupShowXY(ctgc.dlg_cur_prim, ctgc.dlg_x, ctgc.dlg_y);
+ return IUP_DEFAULT;
+}
+
+int fOptions(void)
+{
+ IupShow(IupGetHandle("dlgOptions"));
+ return IUP_DEFAULT;
+}
+
+int fOptionsHide(void)
+{
+ IupHide(IupGetHandle("dlgOptions"));
+ return IUP_DEFAULT;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a caixa de dialogo Attributes. */
+/*-------------------------------------------------------------------------*/
+int fAttributes(void)
+{
+ IupShow(IupGetHandle("dlgAttributes"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Esconde o dialogo de Attributes. */
+/*-------------------------------------------------------------------------*/
+int fAttributesHide(void)
+{
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+ cdFont(ctgc.font_typeface,ctgc.font_style,ctgc.font_size);
+ IupHide(IupGetHandle("dlgAttributes"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Esconde o dialogo de primitiva corrente. */
+/*-------------------------------------------------------------------------*/
+int fMsgHide(void)
+{
+ IupHide(ctgc.dlg_cur_prim);
+ ctgc.dlg_x = IupGetInt(ctgc.dlg_cur_prim, IUP_X);
+ ctgc.dlg_y = IupGetInt(ctgc.dlg_cur_prim, IUP_Y);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Filtra inteiros. */
+/*-------------------------------------------------------------------------*/
+int fInteger(Ihandle *self, int c)
+{
+ ignore(self);
+ if (isdigit(c) || c == '-')
+ return IUP_DEFAULT;
+ else if ((c==K_TAB) || (c==K_CR) || (c==K_LEFT) ||
+ (c==K_RIGHT) || (c==K_DEL) || (c==K_BS) || (c==K_sTAB))
+ return IUP_DEFAULT;
+ else
+ return IUP_IGNORE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Filtra reais. */
+/*-------------------------------------------------------------------------*/
+int fReal(Ihandle *self, int c)
+{
+ ignore(self);
+ if (isdigit(c))
+ return IUP_DEFAULT;
+ else if ((c==K_TAB) || (c==K_CR) || (c==K_LEFT) ||
+ (c==K_RIGHT) || (c==K_DEL) || (c==K_BS) || (c==K_sTAB))
+ return IUP_DEFAULT;
+ else if ((c=='.') || (c=='e') || (c=='E') || (c=='+') || (c=='-'))
+ return IUP_DEFAULT;
+ else
+ return IUP_IGNORE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a primitiva entrada na caixa de dialogo ativa. */
+/*-------------------------------------------------------------------------*/
+void draw(void)
+{
+ int a, b;
+
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_YES);
+ ctgc.line_width = IupGetInt(IupGetHandle("txtLineWidth"), IUP_VALUE);
+ if (ctgc.line_width < 1) ctgc.line_width = 1;
+ ctgc.font_size = IupGetInt(IupGetHandle("txtFontSize"), IUP_VALUE);
+
+ /* escolhe entre o canvas na tela e o off-screen */
+ if (ctgc.buffering)
+ {
+ cdActivate(ctgc.iup_canvas);
+ cdClip(CD_CLIPOFF);
+
+ cdActivate(ctgc.buffer_canvas);
+ }
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ /* atualiza os atributos */
+ cdWriteMode(ctgc.write_mode);
+ cdLineStyle(ctgc.line_style);
+ cdLineCap(ctgc.line_cap);
+ cdLineJoin(ctgc.line_join);
+ cdLineWidth(ctgc.line_width);
+ cdForeground(ctgc.foreground);
+ cdBackground(ctgc.background);
+ cdHatch(ctgc.hatch);
+ cdFillMode(ctgc.fill_mode);
+ cdInteriorStyle(ctgc.interior_style);
+ cdBackOpacity(ctgc.back_opacity);
+
+ cdClipArea(ctgc.clip_xmin,ctgc.clip_xmax,ctgc.clip_ymin,ctgc.clip_ymax);
+ cdClip(ctgc.clip_mode);
+
+ switch (ctgc.cur_prim) {
+ case LINE:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line, "cdLine( %d, %d, %d, %d)", line_pos.x1,
+ line_pos.y1, line_pos.x2, line_pos.y2);
+ set_status();
+ /* desenha a line na tela */
+ cdLine(line_pos.x1, line_pos.y1, line_pos.x2, line_pos.y2);
+ /* arquiva a line */
+ newline(line_pos.x1, line_pos.y1, line_pos.x2, line_pos.y2);
+ break;
+ case RECT:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdRect( %d, %d, %d, %d)",box_pos.xmin,
+ box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ set_status();
+ /* desenha a box na tela */
+ cdRect(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ /* armazena a box */
+ newrect(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ break;
+ case BOX:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdBox( %d, %d, %d, %d)",box_pos.xmin,
+ box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ set_status();
+ /* desenha a box na tela */
+ cdBox(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ /* armazena a box */
+ newbox(box_pos.xmin, box_pos.xmax, box_pos.ymin, box_pos.ymax);
+ break;
+ case ARC:
+ arc_pos.angle1 = IupGetFloat(IupGetHandle("txtASAngle1"),IUP_VALUE);
+ arc_pos.angle2 = IupGetFloat(IupGetHandle("txtASAngle2"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdArc( %d, %d, %d, %d, %.5G, %.5G)", arc_pos.xc,
+ arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1, arc_pos.angle2);
+ set_status();
+ /* desenha o arc na tela */
+ cdArc(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ /* armazena o arc */
+ newarc(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ break;
+ case SECTOR:
+ arc_pos.angle1 = IupGetFloat(IupGetHandle("txtASAngle1"),IUP_VALUE);
+ arc_pos.angle2 = IupGetFloat(IupGetHandle("txtASAngle2"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdSector( %d, %d, %d, %d, %.5G, %.5G)", arc_pos.xc,
+ arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1, arc_pos.angle2);
+ set_status();
+ /* desenha o sector na tela */
+ cdSector(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ /* armazena o sector */
+ newsector(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ break;
+ case CHORD:
+ arc_pos.angle1 = IupGetFloat(IupGetHandle("txtASAngle1"),IUP_VALUE);
+ arc_pos.angle2 = IupGetFloat(IupGetHandle("txtASAngle2"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdChord( %d, %d, %d, %d, %.5G, %.5G)", arc_pos.xc,
+ arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1, arc_pos.angle2);
+ set_status();
+ /* desenha o sector na tela */
+ cdChord(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ /* armazena o sector */
+ newchord(arc_pos.xc, arc_pos.yc, arc_pos.w, arc_pos.h, arc_pos.angle1,
+ arc_pos.angle2);
+ break;
+ case PIXEL:
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line, "cdPixel( %d, %d, 0x%.6lx )",pixel_pos.x, pixel_pos.y,ctgc.foreground);
+ set_status();
+ /* desenha o pixel na tela */
+ cdPixel(pixel_pos.x, pixel_pos.y, ctgc.foreground);
+ /* armazena o pixel */
+ newpixel(pixel_pos.x, pixel_pos.y);
+ break;
+ case MARK:
+ mark_pos.size = IupGetInt(IupGetHandle("txtMarkSize"),IUP_VALUE);
+ /* atualiza a linha de status */
+ sprintf(ctgc.status_line,"cdMark( %d, %d)", mark_pos.x, mark_pos.y);
+ set_status();
+ /* armazena a marca */
+ newmark(mark_pos.x, mark_pos.y, mark_pos.size);
+ /* desenha a marca na tela */
+ cdMarkType(ctgc.mark_type);
+ cdMarkSize(mark_pos.size);
+ cdMark(mark_pos.x, mark_pos.y);
+ break;
+ case TEXT:
+ if (IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE)) {
+ a=IupGetInt(IupGetHandle("txtTextX"),IUP_VALUE);
+ b=IupGetInt(IupGetHandle("txtTextY"),IUP_VALUE);
+ sprintf(ctgc.status_line," cdText( %d, %d, ""%.3s""...)", a, b,
+ IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE));
+ set_status();
+ ctgc.text_orientation = IupGetInt(IupGetHandle("txtTextOrientation"),IUP_VALUE);
+ newtext(a,b,IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE));
+ cdFont(ctgc.font_typeface,ctgc.font_style,ctgc.font_size);
+ cdTextAlignment(ctgc.text_alignment);
+ cdTextOrientation(ctgc.text_orientation);
+ cdText(a,b,IupGetAttribute(IupGetHandle("txtTextS"),IUP_VALUE));
+ }
+ case POLY:
+ if (ctgc.num_points > 1) {
+ cdBegin(ctgc.poly_mode);
+ for (a=0; (a<ctgc.num_points); a++) {
+ cdVertex(ctgc.points[a].x,ctgc.points[a].y);
+ }
+ cdEnd();
+ if (ctgc.poly_mode != CD_CLIP)
+ newpoly();
+ ctgc.num_points = 0;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (ctgc.buffering)
+ {
+ cdFlush();
+
+ cdActivate(ctgc.iup_canvas);
+ cdClip(ctgc.clip_mode);
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a primitiva entrada na caixa de dialogo corrente. */
+/*-------------------------------------------------------------------------*/
+int fDraw(void)
+{
+ /* atualiza os dados entrados na caixa de dialogo no contexto da */
+ /* primitiva corrente */
+ switch (ctgc.cur_prim) {
+ case LINE:
+ line_pos.x1 = IupGetInt(IupGetHandle("txtLBX1"), IUP_VALUE);
+ line_pos.x2 = IupGetInt(IupGetHandle("txtLBX2"), IUP_VALUE);
+ line_pos.y1 = IupGetInt(IupGetHandle("txtLBY1"), IUP_VALUE);
+ line_pos.y2 = IupGetInt(IupGetHandle("txtLBY2"), IUP_VALUE);
+ break;
+ case RECT:
+ case BOX:
+ box_pos.xmin = IupGetInt(IupGetHandle("txtLBX1"), IUP_VALUE);
+ box_pos.xmax = IupGetInt(IupGetHandle("txtLBX2"), IUP_VALUE);
+ box_pos.ymin = IupGetInt(IupGetHandle("txtLBY1"), IUP_VALUE);
+ box_pos.ymax = IupGetInt(IupGetHandle("txtLBY2"), IUP_VALUE);
+ break;
+ case ARC:
+ case CHORD:
+ case SECTOR:
+ arc_pos.xc = IupGetInt(IupGetHandle("txtASXC"), IUP_VALUE);
+ arc_pos.yc = IupGetInt(IupGetHandle("txtASYC"), IUP_VALUE);
+ arc_pos.w = IupGetInt(IupGetHandle("txtASW"), IUP_VALUE);
+ arc_pos.h = IupGetInt(IupGetHandle("txtASH"), IUP_VALUE);
+ break;
+ case PIXEL:
+ pixel_pos.x = IupGetInt(IupGetHandle("txtPixelX"), IUP_VALUE);
+ pixel_pos.y = IupGetInt(IupGetHandle("txtPixelY"), IUP_VALUE);
+ break;
+ case MARK:
+ mark_pos.x = IupGetInt(IupGetHandle("txtMarkX"), IUP_VALUE);
+ mark_pos.y = IupGetInt(IupGetHandle("txtMarkY"), IUP_VALUE);
+ break;
+ default:
+ break;
+ }
+
+ /* efetivamente desenha a primitiva */
+ draw();
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a janelinha de apresentacao. */
+/*-------------------------------------------------------------------------*/
+int fHelpAbout(void)
+{
+ IupSetAttribute(IupGetHandle("lblVersion"), IUP_TITLE, cdVersion());
+ IupShow(IupGetHandle("dlgHelpAbout"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mata a janelinha de apresentacao. */
+/*-------------------------------------------------------------------------*/
+int fCloseAbout(void)
+{
+ IupHide(IupGetHandle("dlgHelpAbout"));
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Limpa o canvas e a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int fEditClear(void)
+{
+ /* mata a lista de primitivas */
+ dellist();
+
+ /* torna inativo a opcap undo */
+ IupSetAttribute(IupGetHandle("itEditUndo"), IUP_ACTIVE, IUP_NO);
+
+ updatecanvas();
+
+ sprintf(ctgc.status_line, "cdClear()");
+ set_status();
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao ganho de focus do canvas. */
+/*-------------------------------------------------------------------------*/
+int fGetFocusCB(Ihandle *self)
+{
+ ignore(self);
+ /* avisa ao CD que o focus foi recebido, */
+ /* para que ele restaure o contexto grafico */
+ cdActivate(ctgc.iup_canvas);
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao movimento do mouse. */
+/*-------------------------------------------------------------------------*/
+int fMotionCB(Ihandle *self, int x, int y, char *r)
+{
+ ignore(self);
+ ignore(r);
+
+ cdActivate(ctgc.iup_canvas);
+ cdUpdateYAxis(&y);
+ mouse_pos(x, y);
+
+ if (ctgc.following) {
+ switch(ctgc.cur_prim) {
+ case LINE:
+ line(MOVE, x, y);
+ follow(x, y);
+ break;
+ case RECT:
+ case BOX:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case CLIP:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case SECTOR: /* sao equivalentes */
+ case CHORD:
+ arc(MOVE, x, y);
+ follow(x, y);
+ break;
+ case IMAGE:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case RGB:
+ box(MOVE, x, y);
+ follow(x, y);
+ break;
+ case POLY:
+ polygon(MOVE, x, y);
+ break;
+ default:
+ break;
+ }
+ }
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao botao do mouse. */
+/*-------------------------------------------------------------------------*/
+int fButtonCB(Ihandle *self, int b, int e, int x, int y, char *r)
+{
+ ignore(self);
+ ignore(r);
+
+ cdActivate(ctgc.iup_canvas);
+ cdWriteMode(CD_NOT_XOR);
+ cdForeground(CD_BLACK);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdClip(CD_CLIPOFF);
+
+ cdUpdateYAxis(&y);
+ mouse_pos(x, y);
+
+ if (b == IUP_BUTTON1) {
+ if (e) {
+ switch(ctgc.cur_prim) {
+ case LINE:
+ follow(x, y);
+ line(NEWPOINT, x, y);
+ line_pos.x1 = x;
+ line_pos.y1 = y;
+ ctgc.following = TRUE;
+ break;
+ case RECT:
+ case BOX:
+ follow(x, y);
+ box(NEWPOINT, x, y);
+ box_pos.x = x;
+ box_pos.y = y;
+ ctgc.following = TRUE;
+ break;
+ case CLIP:
+ box(NEWPOINT, x, y);
+ follow(x, y);
+ ctgc.following = TRUE;
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case SECTOR: /* sao equivalentes */
+ case CHORD:
+ follow(x, y);
+ arc(CENTER, x, y);
+ arc_pos.xc = x;
+ arc_pos.yc = y;
+ ctgc.following = TRUE;
+ break;
+ case MARK:
+ case PIXEL:
+ case TEXT:
+ follow(x, y);
+ draw();
+ break;
+ case IMAGE:
+ follow(x, y);
+ box(NEWPOINT, x, y);
+ ctgc.following = TRUE;
+ break;
+ case RGB:
+ follow(x, y);
+ box(NEWPOINT, x, y);
+ ctgc.following = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ else {
+ switch(ctgc.cur_prim) {
+ case LINE:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ line(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ draw();
+ }
+ break;
+ case RECT:
+ case BOX:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ draw();
+ }
+ break;
+ case CLIP:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ fClipArea();
+ }
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case SECTOR: /* ...sao equivalentes */
+ case CHORD:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ arc(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ draw();
+ arc_pos.w = 0;
+ arc_pos.h = 0;
+ }
+ break;
+ case POLY:
+ cdActivate(ctgc.iup_canvas);
+ polygon(NEWPOINT, x, y);
+ newpolypoint(x, y);
+ sprintf(ctgc.status_line, "cdVertex( %d, %d)", x, y);
+ set_status();
+ ctgc.following = TRUE;
+ break;
+ case IMAGE:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ fImageGet();
+ }
+ break;
+ case RGB:
+ if (ctgc.following) {
+ ctgc.following = FALSE;
+ box(CLOSE, x, y);
+ cdClip(ctgc.clip_mode);
+ fImageRGBGet();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else if (b == IUP_BUTTON3) {
+ if (e) {
+ switch (ctgc.cur_prim) {
+ case IMAGE:
+ cdClip(ctgc.clip_mode);
+ follow(x, y);
+ fImagePut();
+ break;
+ case RGB:
+ cdClip(ctgc.clip_mode);
+ follow(x, y);
+ fImageRGBPut();
+ break;
+ case CLIP:
+ fClipOff();
+ break;
+ default:
+ break;
+ }
+ }
+ else {
+ switch (ctgc.cur_prim) {
+ case POLY:
+ cdActivate(ctgc.iup_canvas);
+ ctgc.following = FALSE;
+ polygon(CLOSE, x, y);
+ sprintf(ctgc.status_line, "cdEnd()");
+ set_status();
+ fDraw();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao resize do canvas. */
+/*-------------------------------------------------------------------------*/
+int fResizeCB(Ihandle *self, int width, int height)
+{
+ ignore(self);
+
+ /* atualiza o contexto do programa */
+ ctgc.w = width;
+ ctgc.h = height;
+
+ /* atualiza o tamanho do canvas em pixels no titulo */
+ sprintf(ctgc.title, "CDTest 5.3 (%dx%d - %dbpp)", ctgc.w, ctgc.h, ctgc.bpp);
+ IupSetAttribute(IupGetHandle("dlgMain"), IUP_TITLE, ctgc.title);
+
+ /* reconstroi o buffer off-screen, se necessario */
+ if (ctgc.buffering)
+ cdActivate(ctgc.buffer_canvas);
+ else
+ cdActivate(ctgc.iup_canvas);
+
+ return IUP_DEFAULT;
+}
+
+void cdtest_loadled(void);
+
+/*-------------------------------------------------------------------------*/
+/* Rotina principal. */
+/*-------------------------------------------------------------------------*/
+void main(void)
+{
+ char *err = NULL;
+
+ /* inicializa o IUP */
+ IupOpen();
+
+ /* carrega o LED */
+#ifdef USE_LED
+ err = IupLoad("cdtest.led");
+#else
+ cdtest_loadled();
+#endif
+
+ if (!err)
+ {
+ /* inicializa o CDTest */
+ CDTestInit();
+ }
+ else
+ {
+ /* imprime uma mensagem de erro */
+ IupMessage("LED Error:", err);
+ IupClose();
+ return;
+ }
+
+ IupMainLoop();
+
+ CDTestClose();
+
+ IupClose();
+}
+
diff --git a/test/cdtest/cdtest.dsp b/test/cdtest/cdtest.dsp
new file mode 100644
index 0000000..80c1421
--- /dev/null
+++ b/test/cdtest/cdtest.dsp
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="cdtest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=cdtest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cdtest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cdtest.mak" CFG="cdtest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cdtest - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cdtest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "..\bin"
+# PROP BASE Intermediate_Dir "..\obj\cdtest"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\bin"
+# PROP Intermediate_Dir "..\obj\cdtest"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W3 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "CDTEST_WIN32" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp"..\obj/cdtest.pch" /Fo"$(IntDir)/" /Fd"..\obj/cdtest" /GZ /c /GX
+# ADD CPP /nologo /MTd /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W3 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "CDTEST_WIN32" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp"..\obj/cdtest.pch" /Fo"$(IntDir)/" /Fd"..\obj/cdtest" /GZ /c /GX
+# ADD BASE MTL /nologo /D"_DEBUG" /mktyplib203 /tlb"..\bin\cdtest.tlb" /win32
+# ADD MTL /nologo /D"_DEBUG" /mktyplib203 /tlb"..\bin\cdtest.tlb" /win32
+# ADD BASE RSC /l 1046 /d "_DEBUG"
+# ADD RSC /l 1046 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib cd.lib cdiup.lib cdgdiplus.lib iup.lib gdiplus.lib cdpdflib.lib /nologo /out:"..\bin\cdtest.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:"..\bin\cdtest.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib cd.lib cdiup.lib cdgdiplus.lib iup.lib gdiplus.lib cdpdflib.lib /nologo /out:"..\bin\cdtest.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:"..\bin\cdtest.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386
+
+!ENDIF
+
+# Begin Target
+
+# Name "cdtest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=Cdtest.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cdtest.led
+# End Source File
+# Begin Source File
+
+SOURCE=cdtest.rc
+# End Source File
+# Begin Source File
+
+SOURCE=cdtest_led.c
+# End Source File
+# Begin Source File
+
+SOURCE=Colorbar.c
+# End Source File
+# Begin Source File
+
+SOURCE=Drivers.c
+# End Source File
+# Begin Source File
+
+SOURCE=List.c
+# End Source File
+# Begin Source File
+
+SOURCE=Rubber.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=Cdtest.h
+# End Source File
+# End Group
+# End Target
+# End Project
+
diff --git a/test/cdtest/cdtest.h b/test/cdtest/cdtest.h
new file mode 100644
index 0000000..f670cc6
--- /dev/null
+++ b/test/cdtest/cdtest.h
@@ -0,0 +1,415 @@
+/*=========================================================================*/
+/* CDTEST.H - 05/12/95. */
+/*=========================================================================*/
+#ifndef CDTEST_H
+#define CDTEST_H
+
+/*- Constantes: -----------------------------------------------------------*/
+#define MAXPOINTS 300
+
+/*- Macros: ---------------------------------------------------------------*/
+#define isdigit(_) (((_)>='0') && ((_)<='9'))
+#define ignore(_) (void)(_)
+
+/*-------------------------------------------------------------------------*/
+/* Tipos enumerados. */
+/*-------------------------------------------------------------------------*/
+typedef enum {
+ LINE,
+ RECT,
+ BOX,
+ ARC,
+ SECTOR,
+ CHORD,
+ PIXEL,
+ MARK,
+ TEXT,
+ POLY,
+ CLIP,
+ IMAGE,
+ RGB,
+ META
+} tPrim;
+
+enum {
+ BACKGROUND,
+ FOREGROUND
+};
+
+enum {
+ NO_BUFFER,
+ IMAGE_BUFFER,
+ IMAGERGB_BUFFER
+};
+
+typedef enum {
+ NEWPOINT,
+ MOVE,
+ CLOSE,
+ CENTER,
+ REPAINT
+} tRubber;
+
+#if ((!defined(FALSE))&&(!defined(TRUE)))
+typedef enum {
+ FALSE,
+ TRUE
+} tBoolean;
+#else
+#define tBoolean int
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Definicao das estruturas de dados usadas. */
+/*-------------------------------------------------------------------------*/
+typedef struct {
+ int x, y;
+} tPoint;
+
+typedef struct {
+ cdContext* ctx;
+ char *filename;
+} tMeta;
+
+typedef struct {
+ int x1;
+ int y1;
+ int x2;
+ int y2;
+ int write_mode;
+ int line_style;
+ int line_width;
+ int line_cap;
+ int line_join;
+ int interior_style;
+ int back_opacity;
+ int hatch;
+ long foreground;
+ long background;
+} tLB; /* cdLine ou cdBox ou cdRect */
+
+typedef struct {
+ int xc;
+ int yc;
+ int w;
+ int h;
+ double angle1;
+ double angle2;
+ int write_mode;
+ int line_style;
+ int line_width;
+ int line_cap;
+ int line_join;
+ int interior_style;
+ int back_opacity;
+ int hatch;
+ long foreground;
+ long background;
+} tAS; /* cdArc e cdSector e Chord */
+
+typedef struct {
+ int x;
+ int y;
+ int write_mode;
+ long foreground;
+} tPixel; /* cdPixel */
+
+typedef struct {
+ int x;
+ int y;
+ int write_mode;
+ int mark_type;
+ int mark_size;
+ long foreground;
+} tMark; /* cdMark */
+
+typedef struct {
+ int x;
+ int y;
+ char *s;
+ int write_mode;
+ int font_size;
+ int font_style;
+ int font_typeface;
+ int back_opacity;
+ double text_orientation;
+ int text_alignment;
+ long foreground;
+ long background;
+} tText; /* cdText */
+
+typedef struct {
+ int poly_mode;
+ int write_mode;
+ int line_style;
+ int line_width;
+ int line_cap;
+ int line_join;
+ int fill_mode;
+ int back_opacity;
+ int interior_style;
+ int hatch;
+ long foreground;
+ long background;
+ int num_points;
+ tPoint *points;
+} tPoly; /* cdBegin, cdVertex e cdEnd */
+
+typedef struct tnode {
+ tPrim type;
+ union {
+ tLB lineboxpar;
+ tAS arcsectorpar;
+ tPoly polypar;
+ tPixel pixelpar;
+ tMark markpar;
+ tText textpar;
+ tMeta metapar;
+ } par;
+ struct tnode *next;
+} tList;
+
+/*-------------------------------------------------------------------------*/
+/* Contexto do CD Test. */
+/*-------------------------------------------------------------------------*/
+typedef struct {
+ cdCanvas *iup_canvas; /* canvas do iup */
+ int w, h; /* largura e altura do canvas */
+ double res;
+ int bpp;
+
+ cdCanvas *wd_canvas; /* canvas IUP p/ WD */
+ int wd_dialog; /* se o dialogo do canvas WD estah na tela */
+
+ cdCanvas *pic_canvas; /* canvas IUP p/ Picture */
+ cdCanvas *picture; /* Picture */
+ int pic_dialog; /* se o dialogo do canvas Picture estah na tela */
+
+ cdCanvas *buffer_canvas; /* canvas para double-buffering */
+ int buffering;
+
+ Ihandle *dlg_cur_prim; /* handle do dialogo de primitiva ativo */
+ Ihandle *bt_cur_prim; /* handle do botao da primitiva corente */
+
+ tPrim cur_prim; /* primitiva corrente */
+ tBoolean following; /* flag de rubber-band */
+ int dlg_x;
+ int dlg_y;
+ int visible;
+
+ int write_mode; /* atributos do CD */
+ int line_cap;
+ int line_join;
+ int line_style;
+ int line_width;
+ int fill_mode;
+ int font_typeface;
+ int font_style;
+ int font_size;
+ int text_alignment;
+ double text_orientation;
+ int back_opacity;
+ int mark_type;
+ int poly_mode;
+ long foreground;
+ long background;
+ int interior_style;
+ int hatch;
+
+ unsigned char stipple[100];/* sample stipple */
+ long pattern[100]; /* sample pattern */
+ int dashes[4]; /* sample dash */
+
+ int clip_xmin;
+ int clip_xmax;
+ int clip_ymin;
+ int clip_ymax;
+ int clip_mode;
+
+ unsigned char *red; /* imagem RGB */
+ unsigned char *green;
+ unsigned char *blue;
+ int rgb_w, rgb_h; /* largura e altura da imagem RGB */
+
+ cdImage *test_image; /* imagem off-screen para testes */
+
+ int num_points; /* numero de pontos no poligono corrente */
+ tPoint points[MAXPOINTS]; /* armazanamento temporario do poligono */
+
+ char status_line[256]; /* linha de status */
+ char title[80]; /* barra de titulo do programa */
+
+ int x, y; /* posiccao do mouse no canvas */
+ char mouse_pos[40]; /* posiccao do mouse em uma string */
+
+ int sim; /* flag para simulacao */
+ int stretch_play;
+
+ tList *head; /* lista de primitivas */
+} tCTC; /* CD Test Context */
+
+extern tCTC ctgc;
+
+/* parametros geometricos das primitivas */
+typedef struct {
+ int x1, x2, y1, y2;
+} tLinePos;
+
+typedef struct {
+ int xmin, xmax, ymin, ymax;
+ int x, y;
+} tBoxPos;
+
+typedef struct {
+ int x, y;
+} tPixelPos;
+
+typedef struct {
+ int x, y;
+ int size;
+} tMarkPos;
+
+typedef struct {
+ int xc, yc;
+ int w, h;
+ double angle1, angle2;
+} tArcPos;
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo CDTEST.C. */
+/*-------------------------------------------------------------------------*/
+int fEditUndo(void);
+int fEditClear(void);
+
+int fRepaint(void);
+int fFileExit(void);
+int fOK(void);
+int fOpenLines(void);
+int fClosedLines(void);
+int fPolyBezier(void);
+int fFill(void);
+int fSolid(void);
+int fHatch(void);
+int fStipple(void);
+int fPattern(void);
+
+int fPolyClip(void);
+int fClipPoly(void);
+
+int fWDCanvas(void);
+int fCloseWD(void);
+int fWDRepaint(void);
+
+int fPICCanvas(void);
+int fClosePIC(void);
+int fPICRepaint(void);
+
+int fOpacity(Ihandle *, char *, int, int);
+int fMarkType(Ihandle *, char *, int, int);
+
+int fNoBuffering(Ihandle *, int);
+int fImageBuffer(Ihandle *, int);
+int fRGBBuffer(Ihandle *, int);
+
+int fWriteMode(Ihandle *, char *, int, int);
+int fLineStyle(Ihandle *, char *, int, int);
+int fLineCap(Ihandle *, char *, int, int);
+int fLineJoin(Ihandle *, char *, int, int);
+int fFillMode(Ihandle *, char *, int, int);
+int fFontStyle(Ihandle *, char *, int, int);
+int fFontTypeFace(Ihandle *, char *, int, int);
+int fTextAlignment(Ihandle *, char *, int, int);
+int fHatchStyle(Ihandle *, char *, int, int);
+
+int fColor(Ihandle *);
+
+int fClip(Ihandle *);
+int fClipArea(void);
+int fClipOff(void);
+
+int fImage(Ihandle *);
+int fImagePut(void);
+int fImageGet(void);
+
+int fImageRGB(Ihandle *);
+int fImageRGBPut(void);
+int fImageRGBGet(void);
+
+int fLine(Ihandle *);
+int fRect(Ihandle *);
+int fBox(Ihandle *);
+int fArc(Ihandle *);
+int fSector(Ihandle *);
+int fChord(Ihandle *);
+int fPixel(Ihandle *);
+int fMark(Ihandle *);
+int fText(Ihandle *);
+int fPoly(Ihandle *);
+
+int fShowDialog(void);
+
+int fStretchPlay(Ihandle*, int);
+int fSimulate(Ihandle *, int);
+int fOptionsHide(void);
+int fOptions(void);
+int fAttributes(void);
+int fAttributesHide(void);
+int fMsgHide(void);
+
+int fInteger(Ihandle *, int);
+int fReal(Ihandle *, int);
+
+int fDraw(void);
+
+int fHelpAbout(void);
+int fCloseAbout(void);
+
+int fMotionCB(Ihandle *, int, int, char *);
+int fButtonCB(Ihandle *, int, int, int, int, char *);
+int fResizeCB(Ihandle *, int, int);
+int fGetFocusCB(Ihandle *);
+
+void set_status(void);
+void mouse_pos(int, int);
+void putlist(cdCanvas *target);
+void draw(void);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo RUBBER.C. */
+/*-------------------------------------------------------------------------*/
+void follow(int, int);
+void line(tRubber, int, int);
+void box(tRubber, int, int);
+void arc(tRubber, int, int);
+void polygon(tRubber, int, int);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo LIST.C. */
+/*-------------------------------------------------------------------------*/
+int newpolypoint(int, int);
+int newline(int, int, int, int);
+int newrect(int, int, int, int);
+int newbox(int, int, int, int);
+int newarc(int, int, int, int, double, double);
+int newsector(int, int, int, int, double, double);
+int newchord(int, int, int, int, double, double);
+int newpixel(int, int);
+int newmark(int, int, int);
+int newtext(int, int, char *);
+int newmetafile(char *, cdContext* ctx);
+int newpoly(void);
+void dellist(void);
+void dellast(void);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo DRIVERS.C. */
+/*-------------------------------------------------------------------------*/
+void DriversInit(void);
+
+/*-------------------------------------------------------------------------*/
+/* Funccoes do modulo COLORBAR.C. */
+/*-------------------------------------------------------------------------*/
+int ColorBarInit(Ihandle *parent, Ihandle *canvas, long *foreground, long *background);
+void ColorBarClose(void);
+
+#endif
diff --git a/test/cdtest/cdtest.ico b/test/cdtest/cdtest.ico
new file mode 100644
index 0000000..ba4b8af
--- /dev/null
+++ b/test/cdtest/cdtest.ico
Binary files differ
diff --git a/test/cdtest/cdtest.led b/test/cdtest/cdtest.led
new file mode 100644
index 0000000..1f2c412
--- /dev/null
+++ b/test/cdtest/cdtest.led
@@ -0,0 +1,1508 @@
+#===========================================================================#
+# CDTEST.LED - 05/12/95 #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Icones da Barra de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1,1,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+)
+
+#---------------------------------------------------------------------------#
+# Descricao dos Menus. #
+#---------------------------------------------------------------------------#
+mnOpen = MENU
+(
+ ITEM("MF...", cmdPlayMF),
+ itPlayCGM = ITEM[ACTIVE=NO]("CGM...", cmdPlayCGM),
+ itPlayEMF = ITEM[ACTIVE=NO]("EMF...", cmdPlayEMF),
+ itPlayWMF = ITEM[ACTIVE=NO]("WMF...", cmdPlayWMF)
+)
+
+mnSave = MENU
+(
+ ITEM("MF...", cmdMF),
+ itPDF = ITEM[ACTIVE=NO]("PDF...", cmdPDF),
+ itPS = ITEM[ACTIVE=NO]("PS...", cmdPS),
+ itEPS = ITEM[ACTIVE=NO]("EPS...", cmdEPS),
+ itCGMt = ITEM[ACTIVE=NO]("CGMt...", cmdCGMt),
+ itCGMb = ITEM[ACTIVE=NO]("CGMb...", cmdCGMb),
+ itDGN = ITEM[ACTIVE=NO]("DGN...", cmdDGN),
+ itDXF = ITEM[ACTIVE=NO]("DXF...", cmdDXF),
+ itEMF = ITEM[ACTIVE=NO]("EMF...", cmdEMF),
+ itWMF = ITEM[ACTIVE=NO]("WMF...", cmdWMF)
+)
+
+mnFile = MENU
+(
+ SUBMENU[KEY=K_O]("Open", mnOpen),
+ SEPARATOR(),
+ SUBMENU[KEY=K_S]("Save", mnSave),
+ SEPARATOR(),
+ itPrint = ITEM[KEY=K_P]("Print...", cmdPrint),
+ SEPARATOR(),
+ ITEM[KEY=K_x]("Exit", cmdFileExit)
+)
+
+mnEdit = MENU
+(
+ itEditUndo = ITEM("Undo", cmdEditUndo),
+ SEPARATOR(),
+ itClipBoard = ITEM[ACTIVE=NO]("Copy as EMF/WMF", cmdClipBoard),
+ itClipBoardBitmap = ITEM[ACTIVE=NO]("Copy as Bitmap", cmdClipBoardBitmap),
+ itClipBoardMetafile = ITEM[ACTIVE=NO]("Copy as CD Metafile", cmdClipBoardMetafile),
+ itClipBoardPaste = ITEM[ACTIVE=NO]("Paste", cmdClipBoardPaste),
+ SEPARATOR(),
+ ITEM("Clear", cmdEditClear),
+ SEPARATOR(),
+ ITEM("Options...", cmdOptions)
+)
+
+mnPrimitives = MENU
+(
+ ITEM("Pixel...", cmdPixel),
+ ITEM("Mark...", cmdMark),
+ ITEM("Line...", cmdLine),
+ ITEM("Polygon...", cmdPoly),
+ ITEM("Rect...", cmdRect),
+ ITEM("Box...", cmdBox),
+ ITEM("Arc...", cmdArc),
+ ITEM("Sector...", cmdSector),
+ ITEM("Chord...", cmdChord),
+ ITEM("Text...", cmdText),
+ SEPARATOR(),
+ ITEM("Server Image...", cmdImage),
+ ITEM("RGB Image...", cmdImageRGB)
+)
+
+mnDraw = MENU[ISMENU=YES]
+(
+ SUBMENU[KEY=K_P]("Primitives", mnPrimitives),
+ SEPARATOR(),
+ ITEM("Clipping...", cmdClip),
+ ITEM("Attributes...", cmdAttributes),
+ SEPARATOR(),
+ itWDCanvas = ITEM("Show WD Canvas", cmdWDCanvas),
+ itPICCanvas = ITEM("Show Picture Canvas", cmdPICCanvas)
+)
+
+mnHelp = MENU
+(
+ ITEM("About...", cmdHelpAbout)
+)
+
+mnMain = MENU
+(
+ SUBMENU[KEY=K_mF]("File", mnFile),
+ SUBMENU[KEY=K_mE]("Edit", mnEdit),
+ SUBMENU[KEY=K_mD]("Draw", mnDraw),
+ SUBMENU[KEY=K_mH]("Help", mnHelp)
+)
+
+#===========================================================================#
+# Barras de Ferramentas. #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Barra de status. #
+#---------------------------------------------------------------------------#
+lbStatusLine = LABEL[EXPAND=HORIZONTAL]("Esta eh a barra de status do CDTest.")
+
+#---------------------------------------------------------------------------#
+# Barra de Primitivas. #
+#---------------------------------------------------------------------------#
+
+btLine = BUTTON[IMAGE=imgLine, TIP="Line"]("",cmdLine)
+btBox = BUTTON[IMAGE=imgBox, TIP="Box"]("",cmdBox)
+btRect = BUTTON[IMAGE=imgRect, TIP="Rect"]("",cmdRect)
+btArc = BUTTON[IMAGE=imgArc, TIP="Arc"]("", cmdArc)
+btSector = BUTTON[IMAGE=imgSector, TIP="Sector"]("", cmdSector)
+btChord = BUTTON[IMAGE=imgChord, TIP="Chord"]("", cmdChord)
+btPixel = BUTTON[IMAGE=imgPixel, TIP="Pixel"]("", cmdPixel)
+btMark = BUTTON[IMAGE=imgMark, TIP="Mark"]("", cmdMark)
+btText = BUTTON[IMAGE=imgText, TIP="Text"]("", cmdText)
+btPoly = BUTTON[IMAGE=imgPoly, TIP="Polygon"]("", cmdPoly)
+
+btImageRGB = BUTTON[IMAGE=imgImageRGB, TIP="RGB Image"]("", cmdImageRGB)
+btImage = BUTTON[IMAGE=imgImage, TIP="Server Image"]("", cmdImage)
+btClip = BUTTON[IMAGE=imgClip, TIP="Clipping Area"]("", cmdClip)
+
+btCurPrim = BUTTON[IMAGE=imgLine, TIP="Show primitive dialog"]("", cmdShowDialog)
+
+lbMousePos = LABEL[SIZE=90]("( , )")
+
+PrimBar = VBOX[GAP=2]
+(
+ btCurPrim,
+ FILL[SIZE=20](),
+ btPixel,
+ btMark,
+ btLine,
+ btPoly,
+ btRect,
+ btBox,
+ btArc,
+ btSector,
+ btChord,
+ btText,
+ FILL[SIZE=5](),
+ btImage,
+ btImageRGB,
+ FILL[SIZE=5](),
+ btClip,
+ FILL[SIZE=30]()
+)
+
+#---------------------------------------------------------------------------#
+# Barra de Cores. #
+#---------------------------------------------------------------------------#
+cnvColorBar = CANVAS
+[
+ BUTTON_CB = cmdColorBarButtonCB,
+ RESIZE_CB = cmdColorBarResizeCB,
+ SIZE = 220x12,
+ BORDER = NO,
+ EXPAND = NO
+]
+(cmdColorBarRepaint)
+
+#===========================================================================#
+# Dialogo Principal #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Canvas para visualizacao das primitivas. #
+#---------------------------------------------------------------------------#
+cnvMain = CANVAS
+[
+ MOTION_CB=cmdMotionCB,
+ BUTTON_CB=cmdButtonCB,
+ RESIZE_CB=cmdResizeCB
+]
+(cmdRepaint)
+
+#---------------------------------------------------------------------------#
+# Area de trabalho. #
+#---------------------------------------------------------------------------#
+DeskTop = VBOX
+(
+ FILL[SIZE=5](),
+ HBOX
+ (
+ FILL[SIZE=5](),
+ PrimBar,
+ FILL[SIZE=2](),
+ VBOX
+ (
+ FILL[SIZE=2](),
+ lbMousePos,
+ FILL[SIZE=5](),
+ cnvMain,
+ FILL[SIZE=2](),
+ cnvColorBar,
+ FILL[SIZE=5](),
+ lbStatusLine
+ ),
+ FILL[SIZE=5]()
+ ),
+ FILL[SIZE=5]()
+)
+
+#---------------------------------------------------------------------------#
+# Dialogo principal. #
+#---------------------------------------------------------------------------#
+dlgMain = DIALOG
+[
+ TITLE = "CD Test 5.3",
+ MENU = mnMain,
+ ICON = "CdTestIcon",
+ K_cZ = cmdEditUndo,
+ GETFOCUS_CB = cmdGetFocusCB,
+ KILLFOCUS_CB = cmdKillFocusCB,
+ CLOSE_CB = cmdFileExit
+]
+(DeskTop)
+
+#===========================================================================#
+# Especificacao dos dialogos auxiliares. #
+#===========================================================================#
+
+#---------------------------------------------------------------------------#
+# Dialogo com o canvas para exibiccao de primitivas WD. #
+#---------------------------------------------------------------------------#
+cnvWDCanvas = CANVAS[BORDER=NO](cmdWDRepaint)
+dlgWDCanvas = DIALOG
+[
+ TITLE = "WD Canvas",
+ CLISE_CB = cmdCloseWD,
+ SIZE = 200x200,
+ PARENTDIALOG="dlgMain",
+ GAP=5x5
+]
+(cnvWDCanvas)
+
+cnvPICCanvas = CANVAS[BORDER=NO](cmdPICRepaint)
+dlgPICCanvas = DIALOG
+[
+ TITLE = "PIC Canvas",
+ CLISE_CB = cmdClosePIC,
+ SIZE = 200x200,
+ PARENTDIALOG="dlgMain",
+ GAP=5x5
+]
+(cnvPICCanvas)
+
+#---------------------------------------------------------------------------#
+# Dialogo Options #
+#---------------------------------------------------------------------------#
+btOptionsHide = BUTTON[SIZE=30]("Hide", cmdOptionsHide)
+
+tgSimulate = TOGGLE[VALUE=OFF, SIZE=55]("Simulate", cmdSimulate)
+tgStretchPlay = TOGGLE[VALUE=OFF, SIZE=70]("Stretch Play", cmdStretchPlay)
+
+tgNoBuffering = TOGGLE[VALUE=ON]("No buffering", cmdNoBuffering)
+tgImageBuffer = TOGGLE("CD_DBUFFER", cmdImageBuffer)
+tgRGBBuffer = TOGGLE("CD_DBUFFERRGB", cmdRGBBuffer)
+
+rdBuffering = RADIO
+(
+ VBOX
+ (
+ tgNoBuffering,
+ tgImageBuffer,
+ tgRGBBuffer
+ )
+)
+
+OptionsDesktop = VBOX
+(
+ VBOX[GAP=2]
+ (
+ FRAME[TITLE="Buffering:", MARGIN=5x5, SIZE=80]
+ (
+ rdBuffering
+ ),
+ FILL[SIZE=10](),
+ tgSimulate,
+ tgStretchPlay,
+ FILL[SIZE=10](),
+ btOptionsHide,
+ FILL[SIZE=2]()
+ )
+)
+
+dlgOptions = DIALOG
+[
+ TITLE="Options",
+ PARENTDIALOG="dlgMain",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ MARGIN=5x2
+]
+(OptionsDesktop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Attributes #
+#---------------------------------------------------------------------------#
+lstTextAlignment = LIST
+[
+ 1="CD_NORTH",
+ 2="CD_SOUTH",
+ 3="CD_EAST",
+ 4="CD_WEST",
+ 5="CD_NORTH_EAST",
+ 6="CD_NORTH_WEST",
+ 7="CD_SOUTH_EAST",
+ 8="CD_SOUTH_WEST",
+ 9="CD_CENTER",
+ 10="CD_BASE_LEFT",
+ 11="CD_BASE_CENTER",
+ 12="CD_BASE_RIGHT",
+ DROPDOWN=YES,
+ VALUE=10,
+ SIZE=89
+]
+(cmdTextAlignment)
+
+txtMarkSize = TEXT[NC=4, SIZE=20x12, VALUE="10"](cmdInteger)
+
+lstMarkType = LIST
+[
+ 1="CD_PLUS",
+ 2="CD_STAR",
+ 3="CD_CIRCLE",
+ 4="CD_X",
+ 5="CD_BOX",
+ 6="CD_DIAMOND",
+ 7="CD_HOLLOW_CIRCLE",
+ 8="CD_HOLLOW_BOX",
+ 9="CD_HOLLOW_DIAMOND",
+ DROPDOWN=YES,
+ VALUE=2,
+ SIZE=80
+](cmdMarkType)
+
+lstWriteMode = LIST
+[
+ 1="CD_REPLACE",
+ 2="CD_XOR",
+ 3="CD_NOT_XOR",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdWriteMode)
+
+lstFontTypeFace = LIST
+[
+ 1="CD_SYSTEM",
+ 2="CD_COURIER",
+ 3="CD_TIMES_ROMAN",
+ 4="CD_HELVETICA",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdFontTypeFace)
+
+lstLineCap = LIST
+[
+ 1="CD_CAPFLAT",
+ 2="CD_CAPSQUARE",
+ 3="CD_CAPROUND",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdLineCap)
+
+lstLineJoin = LIST
+[
+ 1="CD_BEVEL",
+ 2="CD_MITER",
+ 3="CD_ROUND",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdLineJoin)
+
+lstFillMode = LIST
+[
+ 1="CD_EVENODD",
+ 2="CD_WINDING",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdFillMode)
+
+lstFontStyle = LIST
+[
+ 1="CD_PLAIN",
+ 2="CD_BOLD",
+ 3="CD_ITALIC",
+ 4="CD_BOLD_ITALIC",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdFontStyle)
+
+txtLineWidth = TEXT[SIZE=30, NC=3, VALUE="1"](cmdInteger)
+txtFontSize = TEXT[SIZE=30, NC=3, VALUE="12"](cmdInteger)
+txtTextOrientation = TEXT[SIZE=30, NC=3, VALUE="0"](cmdInteger)
+
+lstLineStyle = LIST
+[
+ 1="CD_CONTINUOUS",
+ 2="CD_DASHED",
+ 3="CD_DOTTED",
+ 4="CD_DASH_DOT",
+ 5="CD_DASH_DOT_DOT",
+ 6="CD_CUSTOM",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80
+]
+(cmdLineStyle)
+
+tgSolid = TOGGLE[VALUE=ON] ("CD_SOLID", cmdSolid)
+tgHatch = TOGGLE("CD_HATCH", cmdHatch)
+tgStipple = TOGGLE("CD_STIPPLE", cmdStipple)
+tgPattern = TOGGLE("CD_PATTERN", cmdPattern)
+
+lstOpacity = LIST
+[
+ 1="CD_OPAQUE",
+ 2="CD_TRANSPARENT",
+ VALUE=2,
+ DROPDOWN=YES,
+ SIZE=80,
+ ACTIVE=YES
+]
+(cmdOpacity)
+
+lstHatchStyle = LIST
+[
+ 1="CD_HORIZONTAL",
+ 2="CD_VERTICAL",
+ 3="CD_FDIAGONAL",
+ 4="CD_BDIAGONAL",
+ 5="CD_CROSS",
+ 6="CD_DIAGCROSS",
+ VALUE=1,
+ DROPDOWN=YES,
+ SIZE=80,
+ ACTIVE=YES
+]
+(cmdHatchStyle)
+
+btAttributesHide = BUTTON[SIZE=30]("Hide", cmdAttributesHide)
+
+rdInteriorStyle = RADIO
+(
+ VBOX
+ (
+ tgSolid,
+ tgHatch,
+ tgStipple,
+ tgPattern
+ )
+)
+
+AttributesDesktop = VBOX
+(
+ HBOX
+ (
+ VBOX[GAP=2]
+ (
+ LABEL("Write Mode:"),
+ lstWriteMode,
+ FILL[SIZE=4](),
+ FRAME[TITLE="Fill Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Back Opacity:"),
+ lstOpacity,
+ FILL[SIZE=2](),
+ LABEL("Fill Mode:"),
+ lstFillMode,
+ FILL[SIZE=2](),
+ FRAME[TITLE="Interior Style:", MARGIN=5x5, SIZE=80]
+ (
+ rdInteriorStyle
+ ),
+ FILL[SIZE=2](),
+ LABEL("Hatch Style:"),
+ lstHatchStyle
+ )
+ ),
+ FILL[SIZE=10](),
+ FRAME[TITLE="Mark Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Mark Type:"),
+ lstMarkType,
+ FILL[SIZE=2](),
+ LABEL("Mark Size:"),
+ txtMarkSize
+ )
+ ),
+ FILL[SIZE=10](),
+ btAttributesHide
+ ),
+ VBOX[GAP=2]
+ (
+ FRAME[TITLE="Text Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Font Typeface:"),
+ lstFontTypeFace,
+ FILL[SIZE=2](),
+ LABEL("Font Style:"),
+ lstFontStyle,
+ FILL[SIZE=2](),
+ LABEL("Font Size:"),
+ txtFontSize,
+ FILL[SIZE=2](),
+ LABEL[SIZE=x9]("Text Alignment:"),
+ lstTextAlignment,
+ FILL[SIZE=2](),
+ LABEL[SIZE=x9]("Text Orientation:"),
+ txtTextOrientation
+ )
+ ),
+ FILL[SIZE=10](),
+ FRAME[TITLE="Line Attributes", MARGIN=5x5]
+ (
+ VBOX
+ (
+ LABEL("Line Style:"),
+ lstLineStyle,
+ FILL[SIZE=2](),
+ LABEL("Line Width:"),
+ txtLineWidth,
+ FILL[SIZE=2](),
+ LABEL("Line Cap:"),
+ lstLineCap,
+ FILL[SIZE=2](),
+ LABEL("Line Join:"),
+ lstLineJoin
+ )
+ )
+ )
+ )
+)
+
+dlgAttributes = DIALOG
+[
+ TITLE="Attributes",
+ PARENTDIALOG="dlgMain",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdAttributesHide,
+ MARGIN=5x2
+]
+(AttributesDesktop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Line ou Box ou Rect. #
+#---------------------------------------------------------------------------#
+txtLBX1 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+txtLBX2 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+txtLBY1 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+txtLBY2 = TEXT[NC=8, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btLBDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btLBHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+LBData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=15x9]("X1:"),
+ txtLBX1,
+ FILL[SIZE=5](),
+ LABEL[SIZE=15x9]("Y1:"),
+ txtLBY1
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=15x9]("X2:"),
+ txtLBX2,
+ FILL[SIZE=5](),
+ LABEL[SIZE=15x9]("Y2:"),
+ txtLBY2
+ )
+)
+
+LBDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ LBData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btLBDraw,
+ FILL[SIZE=5](),
+ btLBHide,
+ FILL()
+ )
+)
+
+dlgLB = DIALOG
+[
+ TITLE="Line Parameters",
+ PARENTDIALOG="dlgMain",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(LBDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Arc ou Sector. #
+#---------------------------------------------------------------------------#
+txtASXC = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASYC = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASW = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASH = TEXT[NC=4, SIZE=30x12, VALUE="0"](cmdInteger)
+txtASAngle1 = TEXT[NC=10, SIZE=30x12, VALUE="0"](cmdReal)
+txtASAngle2 = TEXT[NC=10, SIZE=30x12, VALUE="360"](cmdReal)
+
+btASDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btASHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ASData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Xc:"),
+ txtASXC,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Yc:"),
+ txtASYC
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("W:"),
+ txtASW,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("H:"),
+ txtASH
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Angle1:"),
+ txtASAngle1,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Angle2:"),
+ txtASAngle2
+ )
+)
+
+ASDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ASData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btASDraw,
+ FILL[SIZE=5](),
+ btASHide,
+ FILL()
+ )
+)
+
+dlgAS = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Arc Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(ASDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Pixel. #
+#---------------------------------------------------------------------------#
+txtPixelX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtPixelY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btPixelDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btPixelHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+PixelData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=10x9]("X:"),
+ txtPixelX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=10x9]("Y:"),
+ txtPixelY
+ )
+)
+
+PixelDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ PixelData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btPixelDraw,
+ FILL[SIZE=5](),
+ btPixelHide,
+ FILL()
+ )
+)
+
+dlgPixel = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Pixel Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(PixelDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Mark. #
+#---------------------------------------------------------------------------#
+txtMarkX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtMarkY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btMarkDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btMarkHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+MarkData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ FILL(),
+ LABEL[SIZE=10x9]("X:"),
+ txtMarkX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=10x9]("Y:"),
+ txtMarkY,
+ FILL()
+ )
+)
+
+MarkDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ MarkData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btMarkDraw,
+ FILL[SIZE=5](),
+ btMarkHide,
+ FILL()
+ )
+)
+
+dlgMark = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Mark Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide,
+ MARGIN=5x5
+]
+(MarkDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Text. #
+#---------------------------------------------------------------------------#
+txtTextX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtTextY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtTextS = TEXT[NC=100, SIZE=89x12, VALUE="Text"](cmdString)
+
+btTextDraw = BUTTON[SIZE=30]("Draw", cmdDraw)
+btTextHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+TextData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=10x9]("X:"),
+ txtTextX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=10x9]("Y:"),
+ txtTextY
+ ),
+ HBOX
+ (
+ VBOX
+ (
+ LABEL[SIZE=25x9]("Text:"),
+ txtTextS
+ )
+ )
+)
+
+TextDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ TextData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btTextDraw,
+ FILL[SIZE=5](),
+ btTextHide,
+ FILL()
+ )
+)
+
+dlgText = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Text Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(TextDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Poly. #
+#---------------------------------------------------------------------------#
+tgOpenLines = TOGGLE[VALUE=ON]("CD_OPEN_LINES", cmdOpenLines)
+tgClosedLines = TOGGLE("CD_CLOSED_LINES", cmdClosedLines)
+tgFilled = TOGGLE("CD_FILL", cmdFill)
+tgClip = TOGGLE("CD_CLIP", cmdPolyClip)
+tgBezier = TOGGLE("CD_BEZIER", cmdPolyBezier)
+
+btPolyHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+rdMode = RADIO
+(
+ VBOX
+ (
+ tgOpenLines,
+ tgClosedLines,
+ tgFilled,
+ tgClip,
+ tgBezier
+ )
+)
+
+PolyDesktop = VBOX
+(
+ FILL[SIZE=5](),
+ HBOX
+ (
+ FILL(),
+ FRAME[TITLE="Polygon Mode:"]
+ (
+ HBOX
+ (
+ FILL[SIZE=5](),
+ rdMode
+ )
+ ),
+ FILL()
+ ),
+ FILL[SIZE=10](),
+ HBOX
+ (
+ FILL(),
+ btPolyHide,
+ FILL()
+ ),
+ FILL[SIZE=5]()
+)
+
+dlgPoly = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Polygon Parameters",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO,
+ CLOSE_CB=cmdMsgHide
+]
+(PolyDesktop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Clip. #
+#---------------------------------------------------------------------------#
+txtClipXmin = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtClipXmax = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtClipYmin = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtClipYmax = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btClipOff = BUTTON[SIZE=30]("Off", cmdClipOff)
+btClipArea = BUTTON[SIZE=30]("Area", cmdClipArea)
+btClipPoly = BUTTON[SIZE=50]("Polygon", cmdClipPoly)
+btClipHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ClipData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=25x9]("Xmin:"),
+ txtClipXmin,
+ FILL[SIZE=5](),
+ LABEL[SIZE=25x9]("Ymin:"),
+ txtClipYmin
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=25x9]("Xmax:"),
+ txtClipXmax,
+ FILL[SIZE=5](),
+ LABEL[SIZE=25x9]("Ymax:"),
+ txtClipYmax
+ )
+)
+
+ClipDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ClipData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btClipOff,
+ FILL[SIZE=5](),
+ btClipArea,
+ FILL[SIZE=5](),
+ btClipPoly,
+ FILL[SIZE=5](),
+ btClipHide,
+ FILL()
+ )
+)
+
+dlgClip = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Clipping",
+ MAXBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ MINBOX=NO,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(ClipDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo Image. #
+#---------------------------------------------------------------------------#
+txtImageX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageW = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageH = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btImagePut = BUTTON[SIZE=30]("Put", cmdImagePut)
+btImageGet = BUTTON[SIZE=30]("Get", cmdImageGet)
+btImageHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ImageData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("X:"),
+ txtImageX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Y:"),
+ txtImageY
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Width:"),
+ txtImageW,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Height:"),
+ txtImageH
+ )
+)
+
+ImageDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ImageData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btImageGet,
+ FILL[SIZE=5](),
+ btImagePut,
+ FILL[SIZE=5](),
+ btImageHide,
+ FILL()
+ )
+)
+
+dlgImage = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="Server Image",
+ MAXBOX=NO,
+ MINBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(ImageDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo ImageRGB. #
+#---------------------------------------------------------------------------#
+txtImageRGBX = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageRGBY = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageRGBW = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+txtImageRGBH = TEXT[NC=5, SIZE=30x12, VALUE="0"](cmdInteger)
+
+btImageRGBPut = BUTTON[SIZE=30]("Put", cmdImageRGBPut)
+btImageRGBGet = BUTTON[SIZE=30]("Get", cmdImageRGBGet)
+btImageRGBHide = BUTTON[SIZE=30]("Hide", cmdMsgHide)
+
+ImageRGBData = VBOX
+(
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("X:"),
+ txtImageRGBX,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Y:"),
+ txtImageRGBY
+ ),
+ HBOX[ALIGNMENT=ACENTER]
+ (
+ LABEL[SIZE=30x9]("Width:"),
+ txtImageRGBW,
+ FILL[SIZE=5](),
+ LABEL[SIZE=30x9]("Height:"),
+ txtImageRGBH
+ )
+)
+
+ImageRGBDeskTop = VBOX
+(
+ HBOX
+ (
+ FILL(),
+ ImageRGBData,
+ FILL()
+ ),
+ HBOX
+ (
+ FILL(),
+ btImageRGBGet,
+ FILL[SIZE=5](),
+ btImageRGBPut,
+ FILL[SIZE=5](),
+ btImageRGBHide,
+ FILL()
+ )
+)
+
+dlgImageRGB = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="RGB Image",
+ MAXBOX=NO,
+ MINBOX=NO,
+ CLOSE_CB=cmdMsgHide,
+ RESIZE=NO,
+ MARGIN=5x5
+]
+(ImageRGBDeskTop)
+
+#---------------------------------------------------------------------------#
+# Dialogo About. #
+#---------------------------------------------------------------------------#
+
+btCDTest = BUTTON("Close", cmdCloseAbout)
+
+AboutDeskTop = HBOX[MARGIN=5x5, GAP=2]
+(
+ FILL(),
+ VBOX[ALIGNMENT=ACENTER](
+ LABEL("CD Test 5.3"),
+ FILL[SIZE=5](),
+ LABEL("Antonio Scuri"),
+ LABEL("Diego Nehab"),
+ FILL[SIZE=5](),
+ LABEL("Tecgraf/PUC-Rio"),
+ FILL[SIZE=5](),
+ LABEL("CD Library Version"),
+ lblVersion = LABEL(""),
+ btCDTest
+ ),
+ FILL()
+)
+
+dlgHelpAbout = DIALOG
+[
+ PARENTDIALOG="dlgMain",
+ TITLE="About",
+ MAXBOX=NO,
+ MINBOX=NO,
+ RESIZE=NO
+]
+(AboutDeskTop)
+
+
+ \ No newline at end of file
diff --git a/test/cdtest/cdtest.rc b/test/cdtest/cdtest.rc
new file mode 100644
index 0000000..c7e3ebc
--- /dev/null
+++ b/test/cdtest/cdtest.rc
@@ -0,0 +1 @@
+CdTestIcon ICON "cdtest.ico"
diff --git a/test/cdtest/cdtest.sln b/test/cdtest/cdtest.sln
new file mode 100644
index 0000000..fb19d0c
--- /dev/null
+++ b/test/cdtest/cdtest.sln
@@ -0,0 +1,16 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdtest", "cdtest.vcproj", "{A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}.Debug|Win32.Build.0 = Debug|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/test/cdtest/cdtest.vcproj b/test/cdtest/cdtest.vcproj
new file mode 100644
index 0000000..2323676
--- /dev/null
+++ b/test/cdtest/cdtest.vcproj
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="cdtest"
+ ProjectGUID="{A7E49FB8-700A-45EC-9174-FB1C2C7E83C9}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\bin"
+ IntermediateDirectory="..\obj\cdtest"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName="..\bin/cdtest.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include,..\..\..\iup\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;CDTEST_WIN32;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile="..\obj/cdtest.pch"
+ AssemblerListingLocation=""
+ ObjectFile="$(IntDir)/"
+ ProgramDataBaseFileName="..\obj/cdtest"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1046"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="comctl32.lib cd.lib cdiup.lib cdgdiplus.lib iup.lib gdiplus.lib cdpdflib.lib"
+ OutputFile="..\bin/cdtest.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib,..\..\..\iup\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="..\bin/cdtest.pdb"
+ SubSystem="2"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="Cdtest.c"
+ >
+ </File>
+ <File
+ RelativePath=".\cdtest.led"
+ >
+ </File>
+ <File
+ RelativePath="cdtest.rc"
+ >
+ </File>
+ <File
+ RelativePath="cdtest_led.c"
+ >
+ </File>
+ <File
+ RelativePath="Colorbar.c"
+ >
+ </File>
+ <File
+ RelativePath="Drivers.c"
+ >
+ </File>
+ <File
+ RelativePath="List.c"
+ >
+ </File>
+ <File
+ RelativePath="Rubber.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="Cdtest.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/test/cdtest/cdtest_led.c b/test/cdtest/cdtest_led.c
new file mode 100644
index 0000000..b48b467
--- /dev/null
+++ b/test/cdtest/cdtest_led.c
@@ -0,0 +1,1590 @@
+/* Arquivo gerado automaticamente por ledc 2.5 */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <iup.h>
+
+static Ihandle* named[ 172 ];
+
+static Ihandle* decl( char* name, Ihandle* elem, char* first, ...)
+{
+ char *attr, *val;
+ va_list arg;
+ va_start (arg, first);
+ attr = first;
+ while (attr)
+ {
+ val = va_arg(arg,char*);
+ IupSetAttribute( elem, attr, val );
+ attr = va_arg(arg,char*);
+ }
+ va_end (arg);
+ if(name) IupSetHandle( name, elem );
+ return elem;
+}
+
+static void image_imgLine (void)
+{
+ char map[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0,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,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -1 };
+
+ decl( "imgPixel", IupImage( 18, 18, map ),
+ "0", "BGCOLOR",
+ "1", "0 0 0",
+ "2", "255 255 255", 0 );
+}
+
+
+void cdtest_loadled (void)
+{
+ image_imgLine ();
+ image_imgClip ();
+ image_imgImage ();
+ image_imgImageRGB ();
+ image_imgBox ();
+ image_imgRect ();
+ image_imgSector ();
+ image_imgChord ();
+ image_imgArc ();
+ image_imgText ();
+ image_imgPoly ();
+ image_imgMark ();
+ image_imgPixel ();
+ named[0] = decl( "mnOpen", IupMenu(
+ IupItem( "MF...", "cmdPlayMF" ),
+ named[1] = decl( "itPlayCGM", IupItem( "CGM...", "cmdPlayCGM" ),
+ "ACTIVE", "NO", 0 ),
+ named[2] = decl( "itPlayEMF", IupItem( "EMF...", "cmdPlayEMF" ),
+ "ACTIVE", "NO", 0 ),
+ named[3] = decl( "itPlayWMF", IupItem( "WMF...", "cmdPlayWMF" ),
+ "ACTIVE", "NO", 0 ),
+ NULL), 0 );
+ named[4] = decl( "mnSave", IupMenu(
+ IupItem( "MF...", "cmdMF" ),
+ named[5] = decl( "itPDF", IupItem( "PDF...", "cmdPDF" ),
+ "ACTIVE", "NO", 0 ),
+ named[6] = decl( "itPS", IupItem( "PS...", "cmdPS" ),
+ "ACTIVE", "NO", 0 ),
+ named[7] = decl( "itEPS", IupItem( "EPS...", "cmdEPS" ),
+ "ACTIVE", "NO", 0 ),
+ named[8] = decl( "itCGMt", IupItem( "CGMt...", "cmdCGMt" ),
+ "ACTIVE", "NO", 0 ),
+ named[9] = decl( "itCGMb", IupItem( "CGMb...", "cmdCGMb" ),
+ "ACTIVE", "NO", 0 ),
+ named[10] = decl( "itDGN", IupItem( "DGN...", "cmdDGN" ),
+ "ACTIVE", "NO", 0 ),
+ named[11] = decl( "itDXF", IupItem( "DXF...", "cmdDXF" ),
+ "ACTIVE", "NO", 0 ),
+ named[12] = decl( "itEMF", IupItem( "EMF...", "cmdEMF" ),
+ "ACTIVE", "NO", 0 ),
+ named[13] = decl( "itWMF", IupItem( "WMF...", "cmdWMF" ),
+ "ACTIVE", "NO", 0 ),
+ NULL), 0 );
+ named[14] = decl( "mnFile", IupMenu(
+ decl( 0, IupSubmenu( "Open",
+ named[0] /* mnOpen */
+ ),
+ "KEY", "K_O", 0 ),
+ IupSeparator(),
+ decl( 0, IupSubmenu( "Save",
+ named[4] /* mnSave */
+ ),
+ "KEY", "K_S", 0 ),
+ IupSeparator(),
+ named[15] = decl( "itPrint", IupItem( "Print...", "cmdPrint" ),
+ "KEY", "K_P", 0 ),
+ IupSeparator(),
+ decl( 0, IupItem( "Exit", "cmdFileExit" ),
+ "KEY", "K_x", 0 ),
+ NULL), 0 );
+ named[16] = decl( "mnEdit", IupMenu(
+ named[17] = decl( "itEditUndo", IupItem( "Undo", "cmdEditUndo" ), 0 ),
+ IupSeparator(),
+ named[18] = decl( "itClipBoard", IupItem( "Copy as EMF/WMF", "cmdClipBoard" ),
+ "ACTIVE", "NO", 0 ),
+ named[19] = decl( "itClipBoardBitmap", IupItem( "Copy as Bitmap", "cmdClipBoardBitmap" ),
+ "ACTIVE", "NO", 0 ),
+ named[20] = decl( "itClipBoardMetafile", IupItem( "Copy as CD Metafile", "cmdClipBoardMetafile" ),
+ "ACTIVE", "NO", 0 ),
+ named[21] = decl( "itClipBoardPaste", IupItem( "Paste", "cmdClipBoardPaste" ),
+ "ACTIVE", "NO", 0 ),
+ IupSeparator(),
+ IupItem( "Clear", "cmdEditClear" ),
+ IupSeparator(),
+ IupItem( "Options...", "cmdOptions" ),
+ NULL), 0 );
+ named[22] = decl( "mnPrimitives", IupMenu(
+ IupItem( "Pixel...", "cmdPixel" ),
+ IupItem( "Mark...", "cmdMark" ),
+ IupItem( "Line...", "cmdLine" ),
+ IupItem( "Polygon...", "cmdPoly" ),
+ IupItem( "Rect...", "cmdRect" ),
+ IupItem( "Box...", "cmdBox" ),
+ IupItem( "Arc...", "cmdArc" ),
+ IupItem( "Sector...", "cmdSector" ),
+ IupItem( "Chord...", "cmdChord" ),
+ IupItem( "Text...", "cmdText" ),
+ IupSeparator(),
+ IupItem( "Server Image...", "cmdImage" ),
+ IupItem( "RGB Image...", "cmdImageRGB" ),
+ NULL), 0 );
+ named[23] = decl( "mnDraw", IupMenu(
+ decl( 0, IupSubmenu( "Primitives",
+ named[22] /* mnPrimitives */
+ ),
+ "KEY", "K_P", 0 ),
+ IupSeparator(),
+ IupItem( "Clipping...", "cmdClip" ),
+ IupItem( "Attributes...", "cmdAttributes" ),
+ IupSeparator(),
+ named[24] = decl( "itWDCanvas", IupItem( "Show WD Canvas", "cmdWDCanvas" ), 0 ),
+ named[25] = decl( "itPICCanvas", IupItem( "Show Picture Canvas", "cmdPICCanvas" ), 0 ),
+ NULL),
+ "ISMENU", "YES", 0 );
+ named[26] = decl( "mnHelp", IupMenu(
+ IupItem( "About...", "cmdHelpAbout" ),
+ NULL), 0 );
+ named[27] = decl( "mnMain", IupMenu(
+ decl( 0, IupSubmenu( "File",
+ named[14] /* mnFile */
+ ),
+ "KEY", "K_mF", 0 ),
+ decl( 0, IupSubmenu( "Edit",
+ named[16] /* mnEdit */
+ ),
+ "KEY", "K_mE", 0 ),
+ decl( 0, IupSubmenu( "Draw",
+ named[23] /* mnDraw */
+ ),
+ "KEY", "K_mD", 0 ),
+ decl( 0, IupSubmenu( "Help",
+ named[26] /* mnHelp */
+ ),
+ "KEY", "K_mH", 0 ),
+ NULL), 0 );
+ named[28] = decl( "lbStatusLine", IupLabel( "Esta eh a barra de status do CDTest." ),
+ "EXPAND", "HORIZONTAL", 0 );
+ named[29] = decl( "btLine", IupButton( "", "cmdLine" ),
+ "IMAGE", "imgLine",
+ "TIP", "Line", 0 );
+ named[30] = decl( "btBox", IupButton( "", "cmdBox" ),
+ "IMAGE", "imgBox",
+ "TIP", "Box", 0 );
+ named[31] = decl( "btRect", IupButton( "", "cmdRect" ),
+ "IMAGE", "imgRect",
+ "TIP", "Rect", 0 );
+ named[32] = decl( "btArc", IupButton( "", "cmdArc" ),
+ "IMAGE", "imgArc",
+ "TIP", "Arc", 0 );
+ named[33] = decl( "btSector", IupButton( "", "cmdSector" ),
+ "IMAGE", "imgSector",
+ "TIP", "Sector", 0 );
+ named[34] = decl( "btChord", IupButton( "", "cmdChord" ),
+ "IMAGE", "imgChord",
+ "TIP", "Chord", 0 );
+ named[35] = decl( "btPixel", IupButton( "", "cmdPixel" ),
+ "IMAGE", "imgPixel",
+ "TIP", "Pixel", 0 );
+ named[36] = decl( "btMark", IupButton( "", "cmdMark" ),
+ "IMAGE", "imgMark",
+ "TIP", "Mark", 0 );
+ named[37] = decl( "btText", IupButton( "", "cmdText" ),
+ "IMAGE", "imgText",
+ "TIP", "Text", 0 );
+ named[38] = decl( "btPoly", IupButton( "", "cmdPoly" ),
+ "IMAGE", "imgPoly",
+ "TIP", "Polygon", 0 );
+ named[39] = decl( "btImageRGB", IupButton( "", "cmdImageRGB" ),
+ "IMAGE", "imgImageRGB",
+ "TIP", "RGB Image", 0 );
+ named[40] = decl( "btImage", IupButton( "", "cmdImage" ),
+ "IMAGE", "imgImage",
+ "TIP", "Server Image", 0 );
+ named[41] = decl( "btClip", IupButton( "", "cmdClip" ),
+ "IMAGE", "imgClip",
+ "TIP", "Clipping Area", 0 );
+ named[42] = decl( "btCurPrim", IupButton( "", "cmdShowDialog" ),
+ "IMAGE", "imgLine",
+ "TIP", "Show primitive dialog", 0 );
+ named[43] = decl( "lbMousePos", IupLabel( "( , )" ),
+ "SIZE", "90", 0 );
+ named[44] = decl( "PrimBar", IupVbox(
+ named[42] /* btCurPrim */,
+ decl( 0, IupFill(),
+ "SIZE", "20", 0 ),
+ named[35] /* btPixel */,
+ named[36] /* btMark */,
+ named[29] /* btLine */,
+ named[38] /* btPoly */,
+ named[31] /* btRect */,
+ named[30] /* btBox */,
+ named[32] /* btArc */,
+ named[33] /* btSector */,
+ named[34] /* btChord */,
+ named[37] /* btText */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[40] /* btImage */,
+ named[39] /* btImageRGB */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[41] /* btClip */,
+ decl( 0, IupFill(),
+ "SIZE", "30", 0 ),
+ NULL),
+ "GAP", "2", 0 );
+ named[45] = decl( "cnvColorBar", IupCanvas( "cmdColorBarRepaint" ),
+ "BUTTON_CB", "cmdColorBarButtonCB",
+ "RESIZE_CB", "cmdColorBarResizeCB",
+ "SIZE", "220x12",
+ "BORDER", "NO",
+ "EXPAND", "NO", 0 );
+ named[46] = decl( "cnvMain", IupCanvas( "cmdRepaint" ),
+ "MOTION_CB", "cmdMotionCB",
+ "BUTTON_CB", "cmdButtonCB",
+ "RESIZE_CB", "cmdResizeCB", 0 );
+ named[47] = decl( "DeskTop", IupVbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupHbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[44] /* PrimBar */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupVbox(
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ named[43] /* lbMousePos */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[46] /* cnvMain */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ named[45] /* cnvColorBar */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[28] /* lbStatusLine */,
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ NULL), 0 );
+ named[48] = decl( "dlgMain", IupDialog(
+ named[47] /* DeskTop */
+ ),
+ "TITLE", "CD Test 5.3",
+ "MENU", "mnMain",
+ "ICON", "CdTestIcon",
+ "K_cZ", "cmdEditUndo",
+ "GETFOCUS_CB", "cmdGetFocusCB",
+ "KILLFOCUS_CB", "cmdKillFocusCB",
+ "CLOSE_CB", "cmdFileExit", 0 );
+ named[49] = decl( "cnvWDCanvas", IupCanvas( "cmdWDRepaint" ),
+ "BORDER", "NO", 0 );
+ named[50] = decl( "dlgWDCanvas", IupDialog(
+ named[49] /* cnvWDCanvas */
+ ),
+ "TITLE", "WD Canvas",
+ "CLISE_CB", "cmdCloseWD",
+ "SIZE", "200x200",
+ "PARENTDIALOG", "dlgMain",
+ "GAP", "5x5", 0 );
+ named[51] = decl( "cnvPICCanvas", IupCanvas( "cmdPICRepaint" ),
+ "BORDER", "NO", 0 );
+ named[52] = decl( "dlgPICCanvas", IupDialog(
+ named[51] /* cnvPICCanvas */
+ ),
+ "TITLE", "PIC Canvas",
+ "CLISE_CB", "cmdClosePIC",
+ "SIZE", "200x200",
+ "PARENTDIALOG", "dlgMain",
+ "GAP", "5x5", 0 );
+ named[53] = decl( "btOptionsHide", IupButton( "Hide", "cmdOptionsHide" ),
+ "SIZE", "30", 0 );
+ named[54] = decl( "tgSimulate", IupToggle( "Simulate", "cmdSimulate" ),
+ "VALUE", "OFF",
+ "SIZE", "55", 0 );
+ named[55] = decl( "tgStretchPlay", IupToggle( "Stretch Play", "cmdStretchPlay" ),
+ "VALUE", "OFF",
+ "SIZE", "70", 0 );
+ named[56] = decl( "tgNoBuffering", IupToggle( "No buffering", "cmdNoBuffering" ),
+ "VALUE", "ON", 0 );
+ named[57] = decl( "tgImageBuffer", IupToggle( "CD_DBUFFER", "cmdImageBuffer" ), 0 );
+ named[58] = decl( "tgRGBBuffer", IupToggle( "CD_DBUFFERRGB", "cmdRGBBuffer" ), 0 );
+ named[59] = decl( "rdBuffering", IupRadio(
+ IupVbox(
+ named[56] /* tgNoBuffering */,
+ named[57] /* tgImageBuffer */,
+ named[58] /* tgRGBBuffer */,
+ NULL)
+ ), 0 );
+ named[60] = decl( "OptionsDesktop", IupVbox(
+ decl( 0, IupVbox(
+ decl( 0, IupFrame(
+ named[59] /* rdBuffering */
+ ),
+ "TITLE", "Buffering:",
+ "MARGIN", "5x5",
+ "SIZE", "80", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ named[54] /* tgSimulate */,
+ named[55] /* tgStretchPlay */,
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ named[53] /* btOptionsHide */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ NULL),
+ "GAP", "2", 0 ),
+ NULL), 0 );
+ named[61] = decl( "dlgOptions", IupDialog(
+ named[60] /* OptionsDesktop */
+ ),
+ "TITLE", "Options",
+ "PARENTDIALOG", "dlgMain",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "MARGIN", "5x2", 0 );
+ named[62] = decl( "lstTextAlignment", IupList( "cmdTextAlignment" ),
+ "1", "CD_NORTH",
+ "2", "CD_SOUTH",
+ "3", "CD_EAST",
+ "4", "CD_WEST",
+ "5", "CD_NORTH_EAST",
+ "6", "CD_NORTH_WEST",
+ "7", "CD_SOUTH_EAST",
+ "8", "CD_SOUTH_WEST",
+ "9", "CD_CENTER",
+ "10", "CD_BASE_LEFT",
+ "11", "CD_BASE_CENTER",
+ "12", "CD_BASE_RIGHT",
+ "DROPDOWN", "YES",
+ "VALUE", "10",
+ "SIZE", "89", 0 );
+ named[63] = decl( "txtMarkSize", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "20x12",
+ "VALUE", "10", 0 );
+ named[64] = decl( "lstMarkType", IupList( "cmdMarkType" ),
+ "1", "CD_PLUS",
+ "2", "CD_STAR",
+ "3", "CD_CIRCLE",
+ "4", "CD_X",
+ "5", "CD_BOX",
+ "6", "CD_DIAMOND",
+ "7", "CD_HOLLOW_CIRCLE",
+ "8", "CD_HOLLOW_BOX",
+ "9", "CD_HOLLOW_DIAMOND",
+ "DROPDOWN", "YES",
+ "VALUE", "2",
+ "SIZE", "80", 0 );
+ named[65] = decl( "lstWriteMode", IupList( "cmdWriteMode" ),
+ "1", "CD_REPLACE",
+ "2", "CD_XOR",
+ "3", "CD_NOT_XOR",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[66] = decl( "lstFontTypeFace", IupList( "cmdFontTypeFace" ),
+ "1", "CD_SYSTEM",
+ "2", "CD_COURIER",
+ "3", "CD_TIMES_ROMAN",
+ "4", "CD_HELVETICA",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[67] = decl( "lstLineCap", IupList( "cmdLineCap" ),
+ "1", "CD_CAPFLAT",
+ "2", "CD_CAPSQUARE",
+ "3", "CD_CAPROUND",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[68] = decl( "lstLineJoin", IupList( "cmdLineJoin" ),
+ "1", "CD_BEVEL",
+ "2", "CD_MITER",
+ "3", "CD_ROUND",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[69] = decl( "lstFillMode", IupList( "cmdFillMode" ),
+ "1", "CD_EVENODD",
+ "2", "CD_WINDING",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[70] = decl( "lstFontStyle", IupList( "cmdFontStyle" ),
+ "1", "CD_PLAIN",
+ "2", "CD_BOLD",
+ "3", "CD_ITALIC",
+ "4", "CD_BOLD_ITALIC",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[71] = decl( "txtLineWidth", IupText( "cmdInteger" ),
+ "SIZE", "30",
+ "NC", "3",
+ "VALUE", "1", 0 );
+ named[72] = decl( "txtFontSize", IupText( "cmdInteger" ),
+ "SIZE", "30",
+ "NC", "3",
+ "VALUE", "12", 0 );
+ named[73] = decl( "txtTextOrientation", IupText( "cmdInteger" ),
+ "SIZE", "30",
+ "NC", "3",
+ "VALUE", "0", 0 );
+ named[74] = decl( "lstLineStyle", IupList( "cmdLineStyle" ),
+ "1", "CD_CONTINUOUS",
+ "2", "CD_DASHED",
+ "3", "CD_DOTTED",
+ "4", "CD_DASH_DOT",
+ "5", "CD_DASH_DOT_DOT",
+ "6", "CD_CUSTOM",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80", 0 );
+ named[75] = decl( "tgSolid", IupToggle( "CD_SOLID", "cmdSolid" ),
+ "VALUE", "ON", 0 );
+ named[76] = decl( "tgHatch", IupToggle( "CD_HATCH", "cmdHatch" ), 0 );
+ named[77] = decl( "tgStipple", IupToggle( "CD_STIPPLE", "cmdStipple" ), 0 );
+ named[78] = decl( "tgPattern", IupToggle( "CD_PATTERN", "cmdPattern" ), 0 );
+ named[79] = decl( "lstOpacity", IupList( "cmdOpacity" ),
+ "1", "CD_OPAQUE",
+ "2", "CD_TRANSPARENT",
+ "VALUE", "2",
+ "DROPDOWN", "YES",
+ "SIZE", "80",
+ "ACTIVE", "YES", 0 );
+ named[80] = decl( "lstHatchStyle", IupList( "cmdHatchStyle" ),
+ "1", "CD_HORIZONTAL",
+ "2", "CD_VERTICAL",
+ "3", "CD_FDIAGONAL",
+ "4", "CD_BDIAGONAL",
+ "5", "CD_CROSS",
+ "6", "CD_DIAGCROSS",
+ "VALUE", "1",
+ "DROPDOWN", "YES",
+ "SIZE", "80",
+ "ACTIVE", "YES", 0 );
+ named[81] = decl( "btAttributesHide", IupButton( "Hide", "cmdAttributesHide" ),
+ "SIZE", "30", 0 );
+ named[82] = decl( "rdInteriorStyle", IupRadio(
+ IupVbox(
+ named[75] /* tgSolid */,
+ named[76] /* tgHatch */,
+ named[77] /* tgStipple */,
+ named[78] /* tgPattern */,
+ NULL)
+ ), 0 );
+ named[83] = decl( "AttributesDesktop", IupVbox(
+ IupHbox(
+ decl( 0, IupVbox(
+ IupLabel( "Write Mode:" ),
+ named[65] /* lstWriteMode */,
+ decl( 0, IupFill(),
+ "SIZE", "4", 0 ),
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Back Opacity:" ),
+ named[79] /* lstOpacity */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Fill Mode:" ),
+ named[69] /* lstFillMode */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ decl( 0, IupFrame(
+ named[82] /* rdInteriorStyle */
+ ),
+ "TITLE", "Interior Style:",
+ "MARGIN", "5x5",
+ "SIZE", "80", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Hatch Style:" ),
+ named[80] /* lstHatchStyle */,
+ NULL)
+ ),
+ "TITLE", "Fill Attributes",
+ "MARGIN", "5x5", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Mark Type:" ),
+ named[64] /* lstMarkType */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Mark Size:" ),
+ named[63] /* txtMarkSize */,
+ NULL)
+ ),
+ "TITLE", "Mark Attributes",
+ "MARGIN", "5x5", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ named[81] /* btAttributesHide */,
+ NULL),
+ "GAP", "2", 0 ),
+ decl( 0, IupVbox(
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Font Typeface:" ),
+ named[66] /* lstFontTypeFace */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Font Style:" ),
+ named[70] /* lstFontStyle */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Font Size:" ),
+ named[72] /* txtFontSize */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ decl( 0, IupLabel( "Text Alignment:" ),
+ "SIZE", "x9", 0 ),
+ named[62] /* lstTextAlignment */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ decl( 0, IupLabel( "Text Orientation:" ),
+ "SIZE", "x9", 0 ),
+ named[73] /* txtTextOrientation */,
+ NULL)
+ ),
+ "TITLE", "Text Attributes",
+ "MARGIN", "5x5", 0 ),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ decl( 0, IupFrame(
+ IupVbox(
+ IupLabel( "Line Style:" ),
+ named[74] /* lstLineStyle */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Line Width:" ),
+ named[71] /* txtLineWidth */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Line Cap:" ),
+ named[67] /* lstLineCap */,
+ decl( 0, IupFill(),
+ "SIZE", "2", 0 ),
+ IupLabel( "Line Join:" ),
+ named[68] /* lstLineJoin */,
+ NULL)
+ ),
+ "TITLE", "Line Attributes",
+ "MARGIN", "5x5", 0 ),
+ NULL),
+ "GAP", "2", 0 ),
+ NULL),
+ NULL), 0 );
+ named[84] = decl( "dlgAttributes", IupDialog(
+ named[83] /* AttributesDesktop */
+ ),
+ "TITLE", "Attributes",
+ "PARENTDIALOG", "dlgMain",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdAttributesHide",
+ "MARGIN", "5x2", 0 );
+ named[85] = decl( "txtLBX1", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[86] = decl( "txtLBX2", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[87] = decl( "txtLBY1", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[88] = decl( "txtLBY2", IupText( "cmdInteger" ),
+ "NC", "8",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[89] = decl( "btLBDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[90] = decl( "btLBHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[91] = decl( "LBData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X1:" ),
+ "SIZE", "15x9", 0 ),
+ named[85] /* txtLBX1 */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y1:" ),
+ "SIZE", "15x9", 0 ),
+ named[87] /* txtLBY1 */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X2:" ),
+ "SIZE", "15x9", 0 ),
+ named[86] /* txtLBX2 */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y2:" ),
+ "SIZE", "15x9", 0 ),
+ named[88] /* txtLBY2 */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[92] = decl( "LBDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[91] /* LBData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[89] /* btLBDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[90] /* btLBHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[93] = decl( "dlgLB", IupDialog(
+ named[92] /* LBDeskTop */
+ ),
+ "TITLE", "Line Parameters",
+ "PARENTDIALOG", "dlgMain",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[94] = decl( "txtASXC", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[95] = decl( "txtASYC", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[96] = decl( "txtASW", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[97] = decl( "txtASH", IupText( "cmdInteger" ),
+ "NC", "4",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[98] = decl( "txtASAngle1", IupText( "cmdReal" ),
+ "NC", "10",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[99] = decl( "txtASAngle2", IupText( "cmdReal" ),
+ "NC", "10",
+ "SIZE", "30x12",
+ "VALUE", "360", 0 );
+ named[100] = decl( "btASDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[101] = decl( "btASHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[102] = decl( "ASData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Xc:" ),
+ "SIZE", "30x9", 0 ),
+ named[94] /* txtASXC */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Yc:" ),
+ "SIZE", "30x9", 0 ),
+ named[95] /* txtASYC */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "W:" ),
+ "SIZE", "30x9", 0 ),
+ named[96] /* txtASW */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "H:" ),
+ "SIZE", "30x9", 0 ),
+ named[97] /* txtASH */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Angle1:" ),
+ "SIZE", "30x9", 0 ),
+ named[98] /* txtASAngle1 */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Angle2:" ),
+ "SIZE", "30x9", 0 ),
+ named[99] /* txtASAngle2 */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[103] = decl( "ASDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[102] /* ASData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[100] /* btASDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[101] /* btASHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[104] = decl( "dlgAS", IupDialog(
+ named[103] /* ASDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Arc Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[105] = decl( "txtPixelX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[106] = decl( "txtPixelY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[107] = decl( "btPixelDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[108] = decl( "btPixelHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[109] = decl( "PixelData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "10x9", 0 ),
+ named[105] /* txtPixelX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "10x9", 0 ),
+ named[106] /* txtPixelY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[110] = decl( "PixelDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[109] /* PixelData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[107] /* btPixelDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[108] /* btPixelHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[111] = decl( "dlgPixel", IupDialog(
+ named[110] /* PixelDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Pixel Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[112] = decl( "txtMarkX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[113] = decl( "txtMarkY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[114] = decl( "btMarkDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[115] = decl( "btMarkHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[116] = decl( "MarkData", IupVbox(
+ decl( 0, IupHbox(
+ IupFill(),
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "10x9", 0 ),
+ named[112] /* txtMarkX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "10x9", 0 ),
+ named[113] /* txtMarkY */,
+ IupFill(),
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[117] = decl( "MarkDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[116] /* MarkData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[114] /* btMarkDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[115] /* btMarkHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[118] = decl( "dlgMark", IupDialog(
+ named[117] /* MarkDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Mark Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MARGIN", "5x5", 0 );
+ named[119] = decl( "txtTextX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[120] = decl( "txtTextY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[121] = decl( "txtTextS", IupText( "cmdString" ),
+ "NC", "100",
+ "SIZE", "89x12",
+ "VALUE", "Text", 0 );
+ named[122] = decl( "btTextDraw", IupButton( "Draw", "cmdDraw" ),
+ "SIZE", "30", 0 );
+ named[123] = decl( "btTextHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[124] = decl( "TextData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "10x9", 0 ),
+ named[119] /* txtTextX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "10x9", 0 ),
+ named[120] /* txtTextY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ IupHbox(
+ IupVbox(
+ decl( 0, IupLabel( "Text:" ),
+ "SIZE", "25x9", 0 ),
+ named[121] /* txtTextS */,
+ NULL),
+ NULL),
+ NULL), 0 );
+ named[125] = decl( "TextDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[124] /* TextData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[122] /* btTextDraw */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[123] /* btTextHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[126] = decl( "dlgText", IupDialog(
+ named[125] /* TextDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Text Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[127] = decl( "tgOpenLines", IupToggle( "CD_OPEN_LINES", "cmdOpenLines" ),
+ "VALUE", "ON", 0 );
+ named[128] = decl( "tgClosedLines", IupToggle( "CD_CLOSED_LINES", "cmdClosedLines" ), 0 );
+ named[129] = decl( "tgFilled", IupToggle( "CD_FILL", "cmdFill" ), 0 );
+ named[130] = decl( "tgClip", IupToggle( "CD_CLIP", "cmdPolyClip" ), 0 );
+ named[131] = decl( "tgBezier", IupToggle( "CD_BEZIER", "cmdPolyBezier" ), 0 );
+ named[132] = decl( "btPolyHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[133] = decl( "rdMode", IupRadio(
+ IupVbox(
+ named[127] /* tgOpenLines */,
+ named[128] /* tgClosedLines */,
+ named[129] /* tgFilled */,
+ named[130] /* tgClip */,
+ named[131] /* tgBezier */,
+ NULL)
+ ), 0 );
+ named[134] = decl( "PolyDesktop", IupVbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupHbox(
+ IupFill(),
+ decl( 0, IupFrame(
+ IupHbox(
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[133] /* rdMode */,
+ NULL)
+ ),
+ "TITLE", "Polygon Mode:", 0 ),
+ IupFill(),
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "10", 0 ),
+ IupHbox(
+ IupFill(),
+ named[132] /* btPolyHide */,
+ IupFill(),
+ NULL),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ NULL), 0 );
+ named[135] = decl( "dlgPoly", IupDialog(
+ named[134] /* PolyDesktop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Polygon Parameters",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "CLOSE_CB", "cmdMsgHide", 0 );
+ named[136] = decl( "txtClipXmin", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[137] = decl( "txtClipXmax", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[138] = decl( "txtClipYmin", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[139] = decl( "txtClipYmax", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[140] = decl( "btClipOff", IupButton( "Off", "cmdClipOff" ),
+ "SIZE", "30", 0 );
+ named[141] = decl( "btClipArea", IupButton( "Area", "cmdClipArea" ),
+ "SIZE", "30", 0 );
+ named[142] = decl( "btClipPoly", IupButton( "Polygon", "cmdClipPoly" ),
+ "SIZE", "50", 0 );
+ named[143] = decl( "btClipHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[144] = decl( "ClipData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Xmin:" ),
+ "SIZE", "25x9", 0 ),
+ named[136] /* txtClipXmin */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Ymin:" ),
+ "SIZE", "25x9", 0 ),
+ named[138] /* txtClipYmin */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Xmax:" ),
+ "SIZE", "25x9", 0 ),
+ named[137] /* txtClipXmax */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Ymax:" ),
+ "SIZE", "25x9", 0 ),
+ named[139] /* txtClipYmax */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[145] = decl( "ClipDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[144] /* ClipData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[140] /* btClipOff */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[141] /* btClipArea */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[142] /* btClipPoly */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[143] /* btClipHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[146] = decl( "dlgClip", IupDialog(
+ named[145] /* ClipDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Clipping",
+ "MAXBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "MINBOX", "NO",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[147] = decl( "txtImageX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[148] = decl( "txtImageY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[149] = decl( "txtImageW", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[150] = decl( "txtImageH", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[151] = decl( "btImagePut", IupButton( "Put", "cmdImagePut" ),
+ "SIZE", "30", 0 );
+ named[152] = decl( "btImageGet", IupButton( "Get", "cmdImageGet" ),
+ "SIZE", "30", 0 );
+ named[153] = decl( "btImageHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[154] = decl( "ImageData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "30x9", 0 ),
+ named[147] /* txtImageX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "30x9", 0 ),
+ named[148] /* txtImageY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Width:" ),
+ "SIZE", "30x9", 0 ),
+ named[149] /* txtImageW */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Height:" ),
+ "SIZE", "30x9", 0 ),
+ named[150] /* txtImageH */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[155] = decl( "ImageDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[154] /* ImageData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[152] /* btImageGet */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[151] /* btImagePut */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[153] /* btImageHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[156] = decl( "dlgImage", IupDialog(
+ named[155] /* ImageDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "Server Image",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[157] = decl( "txtImageRGBX", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[158] = decl( "txtImageRGBY", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[159] = decl( "txtImageRGBW", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[160] = decl( "txtImageRGBH", IupText( "cmdInteger" ),
+ "NC", "5",
+ "SIZE", "30x12",
+ "VALUE", "0", 0 );
+ named[161] = decl( "btImageRGBPut", IupButton( "Put", "cmdImageRGBPut" ),
+ "SIZE", "30", 0 );
+ named[162] = decl( "btImageRGBGet", IupButton( "Get", "cmdImageRGBGet" ),
+ "SIZE", "30", 0 );
+ named[163] = decl( "btImageRGBHide", IupButton( "Hide", "cmdMsgHide" ),
+ "SIZE", "30", 0 );
+ named[164] = decl( "ImageRGBData", IupVbox(
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "X:" ),
+ "SIZE", "30x9", 0 ),
+ named[157] /* txtImageRGBX */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Y:" ),
+ "SIZE", "30x9", 0 ),
+ named[158] /* txtImageRGBY */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ decl( 0, IupHbox(
+ decl( 0, IupLabel( "Width:" ),
+ "SIZE", "30x9", 0 ),
+ named[159] /* txtImageRGBW */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ decl( 0, IupLabel( "Height:" ),
+ "SIZE", "30x9", 0 ),
+ named[160] /* txtImageRGBH */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ NULL), 0 );
+ named[165] = decl( "ImageRGBDeskTop", IupVbox(
+ IupHbox(
+ IupFill(),
+ named[164] /* ImageRGBData */,
+ IupFill(),
+ NULL),
+ IupHbox(
+ IupFill(),
+ named[162] /* btImageRGBGet */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[161] /* btImageRGBPut */,
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ named[163] /* btImageRGBHide */,
+ IupFill(),
+ NULL),
+ NULL), 0 );
+ named[166] = decl( "dlgImageRGB", IupDialog(
+ named[165] /* ImageRGBDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "RGB Image",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "CLOSE_CB", "cmdMsgHide",
+ "RESIZE", "NO",
+ "MARGIN", "5x5", 0 );
+ named[167] = decl( "btCDTest", IupButton( "Close", "cmdCloseAbout" ), 0 );
+ named[168] = decl( "AboutDeskTop", IupHbox(
+ IupFill(),
+ decl( 0, IupVbox(
+ IupLabel( "CD Test 5.3" ),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupLabel( "Antonio Scuri" ),
+ IupLabel( "Diego Nehab" ),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupLabel( "Tecgraf/PUC-Rio" ),
+ decl( 0, IupFill(),
+ "SIZE", "5", 0 ),
+ IupLabel( "CD Library Version" ),
+ named[169] = decl( "lblVersion", IupLabel( "" ), 0 ),
+ named[167] /* btCDTest */,
+ NULL),
+ "ALIGNMENT", "ACENTER", 0 ),
+ IupFill(),
+ NULL),
+ "MARGIN", "5x5",
+ "GAP", "2", 0 );
+ named[170] = decl( "dlgHelpAbout", IupDialog(
+ named[168] /* AboutDeskTop */
+ ),
+ "PARENTDIALOG", "dlgMain",
+ "TITLE", "About",
+ "MAXBOX", "NO",
+ "MINBOX", "NO",
+ "RESIZE", "NO", 0 );
+}
diff --git a/test/cdtest/colobar.h b/test/cdtest/colobar.h
new file mode 100644
index 0000000..263cb53
--- /dev/null
+++ b/test/cdtest/colobar.h
@@ -0,0 +1,7 @@
+#ifndef COLORBAR_H
+#define COLORBAR_H
+
+int ColorBarInit(Ihandle *parent, Ihandle *canvas, long int *fc, long int *bc);
+void ColorBarClose(void);
+
+#endif
diff --git a/test/cdtest/colorbar.c b/test/cdtest/colorbar.c
new file mode 100644
index 0000000..c83f539
--- /dev/null
+++ b/test/cdtest/colorbar.c
@@ -0,0 +1,565 @@
+/*=========================================================================*/
+/* COLORBAR.C - 03/03/96 */
+/* Color Bar implementation. */
+/*=========================================================================*/
+
+/*- Constantes: -----------------------------------------------------------*/
+#define NUMCOLORS 16
+
+/*- Bibliotecas padrao usadas ---------------------------------------------*/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+#include <iupkey.h>
+
+/*- Declaraccoes e Prototypes: --------------------------------------------*/
+#include "cdtest.h"
+
+#undef isdigit
+#include <ctype.h>
+
+
+/*- Globais: --------------------------------------------------------------*/
+static struct {
+ cdCanvas *bar_canvas; /* canvas da colorbar */
+ cdCanvas *other_canvas; /* canvas ativo anteriormente */
+ int w, h; /* dimensoes do canvas */
+ int bgr, bgg, bgb; /* cor de fundo do dialogo pai */
+ int bci, fci; /* indice das cores correntes */
+ long *p_foreground, *p_background; /* variaveis do usuario */
+ long colors[NUMCOLORS]; /* palheta interna */
+ int bounds[2*(NUMCOLORS+1)]; /* fronteiras dos elementos da palheta */
+} colorbar; /* contexto da colorbar */
+
+/*- Dialogo para mudancca da cor da palheta: ------------------------------*/
+static struct {
+ Ihandle *dialog;
+ Ihandle *red;
+ Ihandle *green;
+ Ihandle *blue;
+ Ihandle *alpha;
+ Ihandle *bt_ok;
+ Ihandle *bt_cancel;
+ int to_change;
+} color_change;
+
+/*- Macros: ---------------------------------------------------------------*/
+#define ignore(_) (void)(_)
+
+/*-------------------------------------------------------------------------*/
+/* Filtra inteiros. */
+/*-------------------------------------------------------------------------*/
+static int integer(Ihandle *self, int c)
+{
+ ignore(self);
+
+ if (isdigit(c)) {
+ return IUP_DEFAULT;
+ }
+ else if ((c==K_TAB) || (c==K_CR) || (c==K_LEFT) ||
+ (c==K_RIGHT) || (c==K_DEL) || (c==K_BS) || (c==K_sTAB)) {
+ return IUP_DEFAULT;
+ }
+ else {
+ return IUP_IGNORE;
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+/* Retorna a cor de indice i. */
+/*-------------------------------------------------------------------------*/
+static long getcolor(int i)
+{
+ if (i<=NUMCOLORS) {
+ return colorbar.colors[i-1];
+ }
+ else return 0;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mostra a caixa de dialogo Color Change. */
+/*-------------------------------------------------------------------------*/
+static void color_change_show(int c)
+{
+ unsigned char r, g, b, a;
+ long color;
+ char s[4];
+
+ /* mostra o dialogo Color Change */
+ IupShow(color_change.dialog);
+
+ /* mostra a cor atual */
+ color = getcolor(c);
+ cdDecodeColor(color, &r, &g, &b);
+ sprintf(s, "%d", r);
+ IupSetAttribute(color_change.red, IUP_VALUE, s);
+ sprintf(s, "%d", g);
+ IupSetAttribute(color_change.green, IUP_VALUE, s);
+ sprintf(s, "%d", b);
+ IupSetAttribute(color_change.blue, IUP_VALUE, s);
+
+ a = cdDecodeAlpha(color);
+ sprintf(s, "%d", a);
+ IupSetAttribute(color_change.alpha, IUP_VALUE, s);
+
+ /* salva cor a ser alterada no contexto */
+ color_change.to_change = c;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Cancela a operaccao de mudancca de cor. */
+/*-------------------------------------------------------------------------*/
+static int color_change_cancel(void)
+{
+ IupHide(color_change.dialog);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Determina as fronteiras dos elementos da palheta. */
+/*-------------------------------------------------------------------------*/
+static void bounds(int dx, int p, int *x)
+{
+ int i; /* contador dos intervalos */
+ int j; /* indice do vetor x */
+ int k; /* inicio do intervalo */
+ int e; /* erro da aproximacao inteira */
+ int _2p; /* dobro do numero de intervalos */
+ int q; /* quociente da divisao inteira */
+ int _2r; /* dobro do resto da divisao inteira */
+
+ /* inicializa as variaveis */
+ k = 0; /* inicio do primeiro intervalo */
+ j = 0; /* indice do vetor x */
+ e = 0; /* inicializa o erro */
+ _2p = p << 1; /* dobro do numero de intervalos */
+ _2r = (dx % p) << 1; /* dobro do resto da divisao inteira */
+ q = dx / p; /* quociente da divisao inteira */
+
+ /* gera o vetor de intervalos */
+ for (i=0; i<p; i++) { /* para p intervalos */
+ e += _2r; /* incrementa o erro */
+ x[j++] = k; /* inicio do intervalo */
+ if (e >= p) { /* estourou? */
+ e -= _2p; /* ajusta o novo limite */
+ k += q + 1; /* arredonda para cima */
+ }
+ else {
+ k += q; /* arredonda para baixo */
+ }
+ x[j++] = k - 2; /* fim do intervalo */
+ }
+}
+
+/*-------------------------------------------------------------------------*/
+/* Acha a cor onde o mouse foi clicado por busca binaria. Retorna zero se */
+/* o click foi fora de qualquer cor. */
+/*-------------------------------------------------------------------------*/
+static int findwhere(int x, int y, int c1, int c2)
+{
+ int mid;
+
+ /* so pode ser este ou o click foi fora */
+ if (c1 == c2) {
+ if ((x > colorbar.bounds[c1<<1]) && (x < colorbar.bounds[(c1<<1) + 1])) {
+ if ((y > 0) && (y < (colorbar.h-1))) return c1;
+ else return 0;
+ }
+ else return 0;
+ }
+
+ /* elemento intermediario */
+ mid = (c1 + c2)>>1;
+
+ /* se o click estah a direita do elemento intermediario */
+ if (x > colorbar.bounds[(mid<<1) + 1]) return findwhere(x, y, mid+1, c2);
+
+ /* se estah a esquerda do elemento intermediario */
+ else if (x < colorbar.bounds[mid<<1]) return findwhere(x, y, c1, mid-1);
+
+ /* estah no meio do intermediario e a vertical estah legal, eh esse */
+ else if ((y > 0) && (y < (colorbar.h-1))) return mid;
+
+ /* o programa nunca chega aqui, mas o compilador fica feliz */
+ return 0;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a moldura do elemento da palheta. */
+/*-------------------------------------------------------------------------*/
+static void hollowbox(int xmin, int xmax, int ymin, int ymax)
+{
+ cdForeground(cdEncodeColor(255, 255, 255));
+ cdLine(xmin, ymin, xmax, ymin);
+ cdLine(xmax, ymin+1, xmax, ymax);
+
+ cdForeground(cdEncodeColor(102, 102, 102));
+ cdLine(xmin, ymin+1, xmin, ymax);
+ cdLine(xmin+1, ymax, xmax-1, ymax);
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Muda a cor de indice i e retorna a anterior. */
+/*-------------------------------------------------------------------------*/
+static long changecolor(int i, long color)
+{
+ long temp;
+
+ if (i<=NUMCOLORS) {
+ temp = colorbar.colors[i-1];
+ colorbar.colors[i-1] = color;
+ return temp;
+ }
+ else return 0;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa o vetor de cores. */
+/*-------------------------------------------------------------------------*/
+static void resetcolors(void)
+{
+ colorbar.colors[ 0] = cdEncodeColor( 0, 0, 0);
+ colorbar.colors[ 1] = cdEncodeColor(153, 153, 153);
+ colorbar.colors[ 2] = cdEncodeColor(178, 178, 178);
+ colorbar.colors[ 3] = cdEncodeColor(255, 255, 255);
+ colorbar.colors[ 4] = cdEncodeColor(255, 255, 0);
+ colorbar.colors[ 5] = cdEncodeColor(255, 0, 0);
+ colorbar.colors[ 6] = cdEncodeColor(255, 0, 255);
+ colorbar.colors[ 7] = cdEncodeColor( 0, 255, 255);
+ colorbar.colors[ 8] = cdEncodeColor( 0, 0, 255);
+ colorbar.colors[ 9] = cdEncodeColor( 0, 255, 0);
+ colorbar.colors[10] = cdEncodeColor(128, 128, 0);
+ colorbar.colors[11] = cdEncodeColor(128, 0, 0);
+ colorbar.colors[12] = cdEncodeColor(128, 0, 128);
+ colorbar.colors[13] = cdEncodeColor( 0, 128, 128);
+ colorbar.colors[14] = cdEncodeColor( 0, 0, 128);
+ colorbar.colors[15] = cdEncodeColor( 0, 128, 0);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha a ColorBar. */
+/*-------------------------------------------------------------------------*/
+static int fColorBarRepaint(void)
+{
+ int i;
+ double dt;
+
+ /* salva o canvas ativo no momento */
+ colorbar.other_canvas = cdActiveCanvas();
+
+ /* ativa o canvas da colorbar */
+ if (cdActivate(colorbar.bar_canvas) == CD_ERROR) {
+ printf("Color Bar Error: Unable to activate canvas.");
+ return 1;
+ }
+ cdClear();
+
+ /* desenha as cores da palheta */
+ for (i=2; i<=2*NUMCOLORS; i+=2) {
+ cdForeground(getcolor(i>>1));
+ cdBox(colorbar.bounds[i], colorbar.bounds[i+1], 1, colorbar.h-1);
+ hollowbox(colorbar.bounds[i], colorbar.bounds[i+1], 1, colorbar.h-1);
+ }
+
+ /* desenha o fedback */
+ dt = (colorbar.w-1)/(NUMCOLORS+1);
+ /* desenha a cor de fundo */
+ cdForeground(getcolor(colorbar.bci));
+ cdBox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ hollowbox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ /* desenha a cor de frente */
+ cdForeground(getcolor(colorbar.fci));
+ cdBox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ hollowbox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+
+ /* restaura o canvas anteriormente ativo */
+ cdActivate(colorbar.other_canvas);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Funcao associada ao botao do mouse. */
+/*-------------------------------------------------------------------------*/
+static int fColorBarButtonCB(Ihandle *self, int b, int e, int x, int y, char *r)
+{
+ int c;
+
+ ignore(self);
+ ignore(r);
+
+ /* salva o canvas ativo no momento */
+ colorbar.other_canvas = cdActiveCanvas();
+
+ /* ativa o canvas da colorbar */
+ if (cdActivate(colorbar.bar_canvas) == CD_ERROR) {
+ printf("Color Bar Error: Unable to activate canvas.");
+ return 1;
+ }
+
+ /* converte para coordenadas do canvas */
+ cdUpdateYAxis(&y);
+
+ /* se o botao foi pressionado */
+ if (e) {
+
+ /* acha onde foi o click */
+ c = findwhere(x, y, 1, 16);
+
+ /* se o click foi dentro de alguma cor... */
+ if (c != 0) {
+
+ /* botao da esquerda eh mudancca de cor de foreground */
+ if (b == IUP_BUTTON1) {
+
+ /* se for double-click */
+ if ((isdouble(r)) && (c == colorbar.fci) ) {
+
+ /* mostra o dialogo */
+ color_change_show(c);
+ }
+
+ /* muda a cor de frente corrente */
+ else {
+
+ /* largura de cada celula */
+ double dt;
+ unsigned char r, g, b;
+
+ /* altera a variavel do usuario */
+ *(colorbar.p_foreground) = getcolor(c);
+
+ /* altera o indice da cor de frente corrente */
+ colorbar.fci = c;
+
+ cdDecodeColor(getcolor(colorbar.fci), &r, &g, &b);
+ sprintf(ctgc.status_line, "cdForeground(cdEncodeColor(%d, %d, %d))", (int)r, (int)g, (int)b);
+ set_status();
+
+ /* altera o feedback no primeiro elemento da palheta */
+ dt = (colorbar.w-1)/(NUMCOLORS+1);
+ cdForeground(getcolor(colorbar.fci));
+ cdBox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ hollowbox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ }
+
+ }
+
+ else if (b == IUP_BUTTON3) {
+
+ /* largura de cada celula */
+ double dt;
+ unsigned char r, g, b;
+
+ /* altera a variavel do usuario */
+ *(colorbar.p_background) = getcolor(c);
+
+ /* altera o indice da cor de frente corrente */
+ colorbar.bci = c;
+
+ cdDecodeColor(getcolor(colorbar.bci), &r, &g, &b);
+ sprintf(ctgc.status_line, "cdBackground(cdEncodeColor(%d, %d, %d))", (int)r, (int)g, (int)b);
+ set_status();
+
+ /* altera o feedback no primeiro elemento da palheta */
+ dt = (colorbar.w-1)/(NUMCOLORS+1);
+ cdForeground(getcolor(colorbar.bci));
+ cdBox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ hollowbox(1, (int)(2.0*dt/3.0), 1, (int)(2.0*(colorbar.h-1)/3.0));
+ cdForeground(getcolor(colorbar.fci));
+ cdBox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ hollowbox((int)(dt/3.0), (int)(dt)-1, (int)((colorbar.h-1)/3.0)+1, colorbar.h-1);
+ }
+
+ }
+
+ }
+
+ /* restaura o canvas anteriormente ativo */
+ cdActivate(colorbar.other_canvas);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Callback associado ao resize do canvas. */
+/*-------------------------------------------------------------------------*/
+static int fColorBarResizeCB(Ihandle *self, int w, int h)
+{
+ ignore(self);
+
+ /* atualiza as dimensoes do canvas */
+ colorbar.w = w;
+ colorbar.h = h;
+
+ /* atualiza as fronteiras dos elementos da palheta */
+ bounds(colorbar.w, NUMCOLORS+1, colorbar.bounds);
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Confirma a mudanca de cores. */
+/*-------------------------------------------------------------------------*/
+static int color_change_ok(void)
+{
+ int r, g, b, a;
+ long new_color;
+
+ /* pega os novos valores */
+ r = IupGetInt(color_change.red, IUP_VALUE);
+ g = IupGetInt(color_change.green, IUP_VALUE);
+ b = IupGetInt(color_change.blue, IUP_VALUE);
+ a = IupGetInt(color_change.alpha, IUP_VALUE);
+
+ /* se todos forem validos */
+ if ((r<256)&&(g<256)&&(b<256)) {
+
+ /* esconde a caixa de dialogo */
+ IupHide(color_change.dialog);
+
+ /* atualiza a cor no contexto */
+ new_color = cdEncodeColor((unsigned char)r, (unsigned char) g, (unsigned char) b);
+ new_color = cdEncodeAlpha(new_color, (unsigned char)a);
+ changecolor(color_change.to_change, new_color);
+
+ colorbar.fci = color_change.to_change;
+
+ /* redesenha a colorbar */
+ fColorBarRepaint();
+
+ /* altera a variavel do usuario */
+ *(colorbar.p_foreground) = new_color;
+
+ }
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa a ColorBar. */
+/*-------------------------------------------------------------------------*/
+void ColorBarClose(void)
+{
+ cdKillCanvas(colorbar.bar_canvas);
+ IupDestroy(color_change.dialog);
+}
+
+int ColorBarInit(Ihandle *parent, Ihandle *canvas, long *foreground, long *background)
+{
+ char *bg_color;
+
+ /* pega a cor de fundo do dialogo parente */
+ bg_color = IupGetAttribute(parent, "BGCOLOR");
+ if (bg_color == NULL) {
+ printf("Color Bar Error: Unable to get bg_color.");
+ return 0;
+ }
+ sscanf(bg_color, "%d %d %d", &colorbar.bgr, &colorbar.bgg, &colorbar.bgb);
+
+ /* inicializa as cores de fundo e de frente defaults */
+ colorbar.fci = 1;
+ colorbar.bci = 4;
+
+ /* pega o enderecco das variaveis do usuario */
+ colorbar.p_foreground = foreground;
+ colorbar.p_background = background;
+
+ /* inicializa a palheta interna de cores */
+ resetcolors();
+
+ /* cria o canvas do CD */
+ colorbar.bar_canvas = cdCreateCanvas(CD_IUP, canvas);
+ if (colorbar.bar_canvas == NULL) {
+ printf("Color Bar Error: Unable to create canvas.");
+ return 0;
+ }
+
+ /* salva o canvas ativo no momento */
+ colorbar.other_canvas = cdActiveCanvas();
+
+ /* ativa o canvas da colorbar */
+ if (cdActivate(colorbar.bar_canvas) == CD_ERROR) {
+ printf("Color Bar Error: Unable to activate canvas.");
+ return 0;
+ }
+
+ /* pega as dimensoes do canvas pela primeira vez */
+ cdGetCanvasSize(&colorbar.w, &colorbar.h, NULL, NULL);
+
+ /* restaura o canvas anteriormente ativo */
+ if (colorbar.other_canvas != NULL) cdActivate(colorbar.other_canvas);
+
+ /* cria o vetor com as fronteiras dos elementos da palheta */
+ bounds(colorbar.w, NUMCOLORS+1, colorbar.bounds);
+
+ /* associa os callbacks */
+ IupSetFunction("cmdColorBarButtonCB", (Icallback) fColorBarButtonCB);
+ IupSetFunction("cmdColorBarRepaint", (Icallback) fColorBarRepaint);
+ IupSetFunction("cmdColorBarResizeCB", (Icallback) fColorBarResizeCB);
+
+ /* desenha a barra de cores pela primeira vez */
+ fColorBarRepaint();
+
+ /* inicializa o dialogo de troca de cores da palheta */
+ color_change.dialog = IupDialog(
+ IupVbox(
+ IupHbox(
+ IupLabel("R:"),
+ color_change.red = IupText("cmdInteger"),
+ IupLabel("G:"),
+ color_change.green = IupText("cmdInteger"),
+ IupLabel("B:"),
+ color_change.blue = IupText("cmdInteger"),
+ IupLabel("A:"),
+ color_change.alpha = IupText("cmdInteger"),
+ NULL
+ ),
+ IupHbox(
+ IupFill(),
+ color_change.bt_ok = IupButton("OK", "cmdColorChangeOK"),
+ color_change.bt_cancel = IupButton("Cancel", "cmdColorChangeCancel"),
+ IupFill(),
+ NULL
+ ),
+ NULL
+ )
+ );
+
+ /* atributos do dialogo */
+ IupSetAttribute(color_change.dialog, IUP_TITLE, "Color Change:");
+ IupSetAttribute(color_change.dialog, IUP_MARGIN, "5x5");
+ IupSetAttribute(color_change.dialog, IUP_GAP, "5");
+ IupSetAttribute(color_change.dialog, "MAXBOX", "NO");
+ IupSetAttribute(color_change.dialog, "MINBOX", "NO");
+ IupSetAttribute(color_change.dialog, "PARENTDIALOG", "dlgMain");
+
+ /* atributos dos texts */
+ IupSetFunction("cmdInteger", (Icallback) integer);
+ IupSetAttribute(color_change.red, "NC", "3");
+ IupSetAttribute(color_change.green, "NC", "3");
+ IupSetAttribute(color_change.blue, "NC", "3");
+ IupSetAttribute(color_change.alpha, "NC", "3");
+ IupSetAttribute(color_change.red, "SIZE", "24");
+ IupSetAttribute(color_change.green, "SIZE", "24");
+ IupSetAttribute(color_change.blue, "SIZE", "24");
+ IupSetAttribute(color_change.alpha, "SIZE", "24");
+
+ /* atributos dos botoes */
+ IupSetAttribute(color_change.bt_ok, IUP_SIZE, "30");
+ IupSetAttribute(color_change.bt_cancel, IUP_SIZE, "30");
+ IupSetFunction("cmdColorChangeCancel", (Icallback) color_change_cancel);
+ IupSetFunction("cmdColorChangeOK", (Icallback) color_change_ok);
+
+ return 1;
+}
diff --git a/test/cdtest/config.mak b/test/cdtest/config.mak
new file mode 100644
index 0000000..9453944
--- /dev/null
+++ b/test/cdtest/config.mak
@@ -0,0 +1,24 @@
+APPNAME = cdtest
+
+SRC = cdtest.c cdtest_led.c colorbar.c drivers.c list.c rubber.c
+
+ifeq "$(TEC_SYSNAME)" "Win32"
+ SRC += cdtest.rc
+endif
+
+USE_CD=Yes
+USE_IUP=Yes
+
+cdtest_led.c: cdtest.led
+ ledc -f cdtest_loadled -o cdtest_led.c cdtest.led
+
+USE_STATIC = Yes
+
+#IUP = ../../../iup
+CD = ../..
+
+ifneq ($(findstring Win, $(TEC_SYSNAME)), )
+ LIBS = cdpdflib
+else
+ SLIB = $(CD)/lib/$(TEC_UNAME)/libcdpdflib.a
+endif
diff --git a/test/cdtest/drivers.c b/test/cdtest/drivers.c
new file mode 100644
index 0000000..93918d5
--- /dev/null
+++ b/test/cdtest/drivers.c
@@ -0,0 +1,457 @@
+/*=========================================================================*/
+/* DRIVERS.C - 10/02/95 */
+/* Suporte para os drivers do CD. */
+/*=========================================================================*/
+
+/*- Bibliotecas padrao usadas: --------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+
+/*- Prototypes e declaracoes do CDTest: -----------------------------------*/
+#include "cdtest.h"
+
+/*- Contexto do CDTest (declarado em CDTEST.C): ---------------------------*/
+extern tCTC ctgc;
+
+#ifdef CDTEST_WIN32
+#define CLIPBOARD_WIN32
+#define WMF
+#define PRINTER
+#endif
+
+#define CLIPBOARD
+#define CGM
+#define MF
+#define PS
+#define DXF
+#define DGN
+#define PDF
+
+static int LoadCanvas(char* ctx_name, cdContext* ctx, char *filename)
+{
+ if (IupGetFile(filename) == 0)
+ {
+ newmetafile(filename, ctx);
+ cdActivate(ctgc.iup_canvas);
+ cdWriteMode(CD_REPLACE);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackground(CD_WHITE);
+ cdBackOpacity(CD_TRANSPARENT);
+ cdForeground(CD_BLACK);
+ cdInteriorStyle(CD_SOLID);
+ if (ctgc.stretch_play)
+ {
+ cdPlay(ctx, 0, ctgc.w-1, 0, ctgc.h-1, filename);
+ sprintf(ctgc.status_line, "cdPlay(%s, 0, %d, 0, %d, %s)", ctx_name, ctgc.w-1, ctgc.h-1, filename);
+ }
+ else
+ {
+ cdPlay(ctx, 0, 0, 0, 0, filename);
+ sprintf(ctgc.status_line, "cdPlay(%s, 0, 0, 0, 0, %s)", ctx_name, filename);
+ }
+ set_status();
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int SaveCanvas(char* ctx_name, cdContext* ctx, char *data)
+{
+ cdCanvas *canvas;
+
+ canvas = cdCreateCanvas(ctx, data);
+ if (!canvas)
+ {
+ IupMessage("Error!", "Can not create canvas.");
+ return IUP_DEFAULT;
+ }
+
+ cdActivate(canvas);
+
+ cdPattern(10, 10, ctgc.pattern);
+ cdStipple(10, 10, ctgc.stipple);
+ cdInteriorStyle(CD_SOLID);
+
+ if (ctgc.sim == 1)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+
+ putlist(canvas);
+
+ cdKillCanvas(canvas);
+
+ return IUP_DEFAULT;
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para o clipboard do Windows, vetorial. */
+/*-------------------------------------------------------------------------*/
+#ifdef CLIPBOARD
+#include <cdclipbd.h>
+
+static int fClipBoard(void)
+{
+ char data[1000];
+ sprintf(data, "%dx%d %g", ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_CLIPBOARD", CD_CLIPBOARD, data);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para o clipboard do Windows, BitMap. */
+/*-------------------------------------------------------------------------*/
+static int fClipBoardBitmap(void)
+{
+ char data[1000];
+ sprintf(data, "%dx%d %g -b", ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_CLIPBOARD", CD_CLIPBOARD, data);
+}
+
+static int fClipBoardMetafile(void)
+{
+ char data[1000];
+#ifdef WIN32
+ sprintf(data, "%gx%g %g -m", ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+#else
+ sprintf(data, "%p %gx%g %g", IupGetAttribute(IupGetHandle("cnvMain"), "XDISPLAY"), ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+#endif
+ return SaveCanvas("CD_CLIPBOARD", CD_CLIPBOARD, data);
+}
+
+static int fClipBoardPaste(void)
+{
+ char* data;
+ newmetafile("", CD_CLIPBOARD);
+ cdActivate(ctgc.iup_canvas);
+ cdWriteMode(CD_REPLACE);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackground(CD_WHITE);
+ cdBackOpacity(CD_TRANSPARENT);
+ cdForeground(CD_BLACK);
+ cdInteriorStyle(CD_SOLID);
+
+#ifdef WIN32
+ data = "";
+#else
+ data = IupGetAttribute(IupGetHandle("cnvMain"), "XDISPLAY");
+#endif
+
+ if (ctgc.stretch_play)
+ {
+ cdPlay(CD_CLIPBOARD, 0, ctgc.w-1, 0, ctgc.h-1, data);
+ sprintf(ctgc.status_line, "cdPlay(CD_CLIPBOARD, 0, %d, 0, %d, \"\")", ctgc.w-1, ctgc.h-1);
+ }
+ else
+ {
+ cdPlay(CD_CLIPBOARD, 0, 0, 0, 0, data);
+ sprintf(ctgc.status_line, "cdPlay(CD_CLIPBOARD, 0, 0, 0, 0, \"\")");
+ }
+ set_status();
+ return IUP_DEFAULT;
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo PostScript. */
+/*-------------------------------------------------------------------------*/
+#ifdef PS
+#include <cdps.h>
+
+static int fPS(void)
+{
+ char filename[1024]="*.ps";
+ char data[1024];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s -s%d", filename, (int)(ctgc.res * 25.4));
+ return SaveCanvas("CD_PS", CD_PS, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fEPS(void)
+{
+ char filename[1024]="*.eps";
+ char data[1024];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s -s%d -e -l0 -r0 -t0 -b0", filename, (int)(ctgc.res * 25.4));
+ return SaveCanvas("CD_PS", CD_PS, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+#ifdef PDF
+#include <cdpdf.h>
+
+static int fPDF(void)
+{
+ char filename[1024]="*.pdf";
+ char data[1024];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s -s%d", filename, (int)(ctgc.res * 25.4));
+ return SaveCanvas("CD_PDF", CD_PDF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo CGM. */
+/*-------------------------------------------------------------------------*/
+#ifdef CGM
+#include <cdcgm.h>
+
+static int fCGMb(void)
+{
+ char filename[1024]="*.cgm";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_CGM", CD_CGM, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fCGMt(void)
+{
+ char filename[1024]="*.cgm";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g -t", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_CGM", CD_CGM, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fPlayCGM(void)
+{
+ char filename[1024]="*.cgm";
+ return LoadCanvas("CD_CGM", CD_CGM, filename);
+}
+
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo DXF. */
+/*-------------------------------------------------------------------------*/
+#ifdef DXF
+#include <cddxf.h>
+
+static int fDXF(void)
+{
+ char filename[1024]="*.dxf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_DXF", CD_DXF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo DGN. */
+/*-------------------------------------------------------------------------*/
+#ifdef DGN
+#include <cddgn.h>
+
+static int fDGN(void)
+{
+ char filename[1024]="*.dgn";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g -sseed2d.dgn", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_DGN", CD_DGN, data);
+ }
+
+ return IUP_DEFAULT;
+}
+#endif
+
+#ifdef MF
+#include <cdmf.h>
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo metafile do CD. */
+/*-------------------------------------------------------------------------*/
+static int fMF(void)
+{
+ char filename[1024]="*.mf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res);
+ return SaveCanvas("CD_METAFILE", CD_METAFILE, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo metafile do CD. */
+/*-------------------------------------------------------------------------*/
+static int fPlayMF(void)
+{
+ char filename[1024]="*.mf";
+ return LoadCanvas("CD_METAFILE", CD_METAFILE, filename);
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo WMF. */
+/*-------------------------------------------------------------------------*/
+#ifdef WMF
+#include <cdwmf.h>
+
+static int fWMF(void)
+{
+ char filename[1024]="*.wmf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %dx%d %g", filename, ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_WMF", CD_WMF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fPlayWMF(void)
+{
+ char filename[1024]="*.wmf";
+ return LoadCanvas("CD_WMF", CD_WMF, filename);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para um arquivo EMF. */
+/*-------------------------------------------------------------------------*/
+#include <cdemf.h>
+
+static int fEMF(void)
+{
+ char filename[1024]="*.emf";
+ char data[1000];
+
+ if (IupGetFile(filename)>=0)
+ {
+ sprintf(data, "%s %dx%d %g", filename, ctgc.w, ctgc.h, ctgc.res);
+ return SaveCanvas("CD_EMF", CD_EMF, data);
+ }
+
+ return IUP_DEFAULT;
+}
+
+static int fPlayEMF(void)
+{
+ char filename[1024]="*.emf";
+ return LoadCanvas("CD_EMF", CD_EMF, filename);
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Copia o conteudo do canvas para a impressora. */
+/*-------------------------------------------------------------------------*/
+#ifdef PRINTER
+#include <cdprint.h>
+
+static int fPrint(void)
+{
+ char *data = "CDTEST.PRN -d";
+ return SaveCanvas("CD_PRINTER", CD_PRINTER, data);
+ return IUP_DEFAULT;
+}
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* Inicializa os menus de Save e Open. */
+/*-------------------------------------------------------------------------*/
+void DriversInit(void)
+{
+#ifdef MF
+ IupSetFunction("cmdMF", (Icallback) fMF);
+ IupSetFunction("cmdPlayMF", (Icallback) fPlayMF);
+#endif
+#ifdef PS
+ IupSetAttribute(IupGetHandle("itPS"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itEPS"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPS", (Icallback) fPS);
+ IupSetFunction("cmdEPS", (Icallback) fEPS);
+#endif
+#ifdef PDF
+ IupSetAttribute(IupGetHandle("itPDF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPDF", (Icallback) fPDF);
+#endif
+#ifdef CLIPBOARD
+ IupSetAttribute(IupGetHandle("itClipBoardMetafile"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itClipBoardPaste"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdClipBoardMetafile", (Icallback)fClipBoardMetafile);
+ IupSetFunction("cmdClipBoardPaste", (Icallback)fClipBoardPaste);
+#endif
+#ifdef CLIPBOARD_WIN32
+ IupSetAttribute(IupGetHandle("itClipBoardBitmap"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itClipBoard"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdClipBoardBitmap", (Icallback)fClipBoardBitmap);
+ IupSetFunction("cmdClipBoard", (Icallback)fClipBoard);
+#endif
+#ifdef DXF
+ IupSetAttribute(IupGetHandle("itDXF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdDXF", (Icallback) fDXF);
+#endif
+#ifdef DGN
+ IupSetAttribute(IupGetHandle("itDGN"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdDGN", (Icallback) fDGN);
+#endif
+#ifdef CGM
+ IupSetAttribute(IupGetHandle("itCGMb"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdCGMb", (Icallback) fCGMb);
+ IupSetAttribute(IupGetHandle("itCGMt"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdCGMt", (Icallback) fCGMt);
+ IupSetAttribute(IupGetHandle("itPlayCGM"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPlayCGM", (Icallback) fPlayCGM);
+#endif
+#ifdef WMF
+ IupSetAttribute(IupGetHandle("itEMF"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itWMF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdEMF", (Icallback) fEMF);
+ IupSetFunction("cmdWMF", (Icallback) fWMF);
+ IupSetAttribute(IupGetHandle("itPlayEMF"), IUP_ACTIVE, IUP_YES);
+ IupSetAttribute(IupGetHandle("itPlayWMF"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPlayEMF", (Icallback) fPlayEMF);
+ IupSetFunction("cmdPlayWMF", (Icallback) fPlayWMF);
+#endif
+#ifdef PRINTER
+ IupSetAttribute(IupGetHandle("itPrint"), IUP_ACTIVE, IUP_YES);
+ IupSetFunction("cmdPrint", (Icallback) fPrint);
+#endif
+}
diff --git a/test/cdtest/list.c b/test/cdtest/list.c
new file mode 100644
index 0000000..a41c5bc
--- /dev/null
+++ b/test/cdtest/list.c
@@ -0,0 +1,278 @@
+/*=========================================================================*/
+/* LIST.C 10/12/95 */
+/* Funcoes para a manipulacao da lista de primitivas. */
+/*=========================================================================*/
+
+/*- Bibliotecas padrao usadas ---------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+
+/*- Prototypes e declaracoes do CD Test: ----------------------------------*/
+#include "cdtest.h"
+
+/*- Contexto do CD Test (declarado em CDTEST.C): --------------------------*/
+extern tCTC ctgc;
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um ponto ao poligono temporario corrente. */
+/*-------------------------------------------------------------------------*/
+int newpolypoint(int x, int y)
+{
+ if (ctgc.num_points <= MAXPOINTS) {
+ ctgc.points[ctgc.num_points].x = x;
+ ctgc.points[ctgc.num_points].y = y;
+ ctgc.num_points++;
+ return TRUE;
+ }
+ else return FALSE;
+}
+
+tList* newNode(void)
+{
+ tList *newnode = (tList *) malloc(sizeof (tList));
+ newnode->next = NULL;
+
+ if (ctgc.head != NULL)
+ {
+ tList *temp;
+ for(temp = ctgc.head; temp->next; temp = (tList *)temp->next);
+ temp->next = newnode; /* coloca o novo item no final da lista */
+ }
+ else
+ ctgc.head = newnode;
+
+ return newnode;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona uma linha/rect/caixa a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+
+static int newtLB(int x1, int y1, int x2, int y2, int type)
+{
+ tList* newnode = newNode();
+
+ newnode->type = type;
+ newnode->par.lineboxpar.x1 = x1;
+ newnode->par.lineboxpar.x2 = x2;
+ newnode->par.lineboxpar.y1 = y1;
+ newnode->par.lineboxpar.y2 = y2;
+ newnode->par.lineboxpar.foreground = ctgc.foreground;
+ newnode->par.lineboxpar.background = ctgc.background;
+ newnode->par.lineboxpar.line_style = ctgc.line_style;
+ newnode->par.lineboxpar.line_width = ctgc.line_width;
+ newnode->par.lineboxpar.write_mode = ctgc.write_mode;
+ newnode->par.lineboxpar.line_cap = ctgc.line_cap;
+ newnode->par.lineboxpar.line_join = ctgc.line_join;
+ newnode->par.lineboxpar.interior_style = ctgc.interior_style;
+ newnode->par.lineboxpar.back_opacity = ctgc.back_opacity;
+ newnode->par.lineboxpar.hatch = ctgc.hatch;
+
+ return TRUE;
+}
+
+int newline(int x1, int y1, int x2, int y2)
+{
+ return newtLB(x1, y1, x2, y2, LINE);
+}
+
+int newrect(int x1, int x2, int y1, int y2)
+{
+ return newtLB(x1, y1, x2, y2, RECT);
+}
+
+int newbox(int x1, int x2, int y1, int y2)
+{
+ return newtLB(x1, y1, x2, y2, BOX);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um arc/sector/chord a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+static int newtAS(int xc, int yc, int w, int h, double angle1, double angle2, int type)
+{
+ tList* newnode = newNode();
+
+ newnode->type = type;
+ newnode->par.arcsectorpar.xc = xc;
+ newnode->par.arcsectorpar.yc = yc;
+ newnode->par.arcsectorpar.w = w;
+ newnode->par.arcsectorpar.h = h;
+ newnode->par.arcsectorpar.angle1 = angle1;
+ newnode->par.arcsectorpar.angle2 = angle2;
+ newnode->par.arcsectorpar.foreground = ctgc.foreground;
+ newnode->par.arcsectorpar.background = ctgc.background;
+ newnode->par.arcsectorpar.line_style = ctgc.line_style;
+ newnode->par.arcsectorpar.line_width = ctgc.line_width;
+ newnode->par.arcsectorpar.line_cap = ctgc.line_cap;
+ newnode->par.arcsectorpar.line_join = ctgc.line_join;
+ newnode->par.arcsectorpar.write_mode = ctgc.write_mode;
+ newnode->par.arcsectorpar.interior_style = ctgc.interior_style;
+ newnode->par.arcsectorpar.back_opacity = ctgc.back_opacity;
+ newnode->par.arcsectorpar.hatch = ctgc.hatch;
+
+ return TRUE;
+}
+
+int newarc(int xc, int yc, int w, int h, double angle1, double angle2)
+{
+ return newtAS(xc, yc, w, h, angle1, angle2, ARC);
+}
+
+int newsector(int xc, int yc, int w, int h, double angle1, double angle2)
+{
+ return newtAS(xc, yc, w, h, angle1, angle2, SECTOR);
+}
+
+int newchord(int xc, int yc, int w, int h, double angle1, double angle2)
+{
+ return newtAS(xc, yc, w, h, angle1, angle2, CHORD);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um pixel a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newpixel(int x, int y)
+{
+ tList* newnode = newNode();
+
+ newnode->type = PIXEL;
+ newnode->par.pixelpar.x = x;
+ newnode->par.pixelpar.y = y;
+ newnode->par.pixelpar.foreground = ctgc.foreground;
+ newnode->par.pixelpar.write_mode = ctgc.write_mode;
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um metafile a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newmetafile(char *filename, cdContext* ctx)
+{
+ tList* newnode = newNode();
+
+ newnode->type = META;
+ newnode->par.metapar.filename = (char *) malloc(strlen(filename) + 1);
+ newnode->par.metapar.ctx = ctx;
+ strcpy(newnode->par.metapar.filename, filename);
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona uma marca a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newmark(int x, int y, int mark_size)
+{
+ tList* newnode = newNode();
+
+ newnode->type = MARK;
+ newnode->par.markpar.x = x;
+ newnode->par.markpar.y = y;
+ newnode->par.markpar.mark_size = mark_size;
+ newnode->par.markpar.foreground = ctgc.foreground;
+ newnode->par.markpar.write_mode = ctgc.write_mode;
+ newnode->par.markpar.mark_type = ctgc.mark_type;
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um texto a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newtext(int x, int y, char *s)
+{
+ tList* newnode = newNode();
+
+ newnode->type = TEXT;
+ newnode->par.textpar.x = x;
+ newnode->par.textpar.y = y;
+ newnode->par.textpar.foreground = ctgc.foreground;
+ newnode->par.textpar.background = ctgc.background;
+ newnode->par.textpar.font_style = ctgc.font_style;
+ newnode->par.textpar.font_typeface = ctgc.font_typeface;
+ newnode->par.textpar.font_size = ctgc.font_size;
+ newnode->par.textpar.write_mode = ctgc.write_mode;
+ newnode->par.textpar.back_opacity = ctgc.back_opacity;
+ newnode->par.textpar.text_alignment = ctgc.text_alignment;
+ newnode->par.textpar.text_orientation = ctgc.text_orientation;
+ newnode->par.textpar.s = (char *) malloc(strlen(s) + 1);
+ strcpy(newnode->par.textpar.s, s);
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Adiciona um poligono a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+int newpoly(void)
+{
+ tList* newnode = newNode();
+
+ newnode->type = POLY;
+ newnode->par.polypar.foreground = ctgc.foreground;
+ newnode->par.polypar.background = ctgc.background;
+ newnode->par.polypar.line_style = ctgc.line_style;
+ newnode->par.polypar.line_width = ctgc.line_width;
+ newnode->par.polypar.write_mode = ctgc.write_mode;
+ newnode->par.polypar.fill_mode = ctgc.fill_mode;
+ newnode->par.polypar.line_cap = ctgc.line_cap;
+ newnode->par.polypar.line_join = ctgc.line_join;
+ newnode->par.polypar.poly_mode = ctgc.poly_mode;
+ newnode->par.polypar.interior_style = ctgc.interior_style;
+ newnode->par.polypar.back_opacity = ctgc.back_opacity;
+ newnode->par.polypar.hatch = ctgc.hatch;
+ newnode->par.polypar.points = (tPoint *) malloc(ctgc.num_points*sizeof(tPoint));
+ newnode->par.polypar.num_points = ctgc.num_points;
+ memcpy(newnode->par.polypar.points, ctgc.points, ctgc.num_points*sizeof(tPoint));
+ newnode->next = NULL;
+
+ return TRUE;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mata a lista de primitivas. */
+/*-------------------------------------------------------------------------*/
+void dellist(void)
+{
+ tList *killer, *back;
+
+ for (killer = ctgc.head; killer; killer = back) {
+ back = (tList *) (killer->next);
+ if (killer->type == TEXT) { /* se for TEXT... */
+ free(killer->par.textpar.s); /* ...mata a string */
+ }
+ if (killer->type == POLY) { /* se for POLY... */
+ free(killer->par.polypar.points); /* ...mata os pontos */
+ }
+ free(killer);
+ }
+ ctgc.head = NULL;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Mata a ultima primitiva. */
+/*-------------------------------------------------------------------------*/
+void dellast(void)
+{
+ tList *killer;
+
+ if (ctgc.head == NULL ) return;
+ else if (ctgc.head->next == NULL) {
+ free(ctgc.head);
+ ctgc.head = NULL;
+ }
+ else {
+ for (killer = ctgc.head; killer->next->next; killer = killer->next);
+ free(killer->next);
+ killer->next = NULL;
+ }
+}
diff --git a/test/cdtest/rubber.c b/test/cdtest/rubber.c
new file mode 100644
index 0000000..80a5921
--- /dev/null
+++ b/test/cdtest/rubber.c
@@ -0,0 +1,387 @@
+/*=========================================================================*/
+/* RUBBER.C - 10/12/95 */
+/* Funcoes para o desenho interativo das primitivas. */
+/*=========================================================================*/
+
+/*- Bibliotecas padrao usadas ---------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+/*- Inclusao das bibliotecas IUP e CD: ------------------------------------*/
+#include <iup.h>
+#include <cd.h>
+#include <cdiup.h>
+
+/*- Prototypes e declaracoes do CD Test: ----------------------------------*/
+#include "cdtest.h"
+
+/*- Contexto do CD Test (declarado em CDTEST.C): --------------------------*/
+extern tCTC ctgc;
+
+/*- Parametros para o desenho das primitivas: -----------------------------*/
+extern tLinePos line_pos;
+extern tBoxPos box_pos;
+extern tPixelPos pixel_pos;
+extern tMarkPos mark_pos;
+extern tArcPos arc_pos;
+
+/*-------------------------------------------------------------------------*/
+/* Segue as coordenadas do mouse atualizando o TXT apropriado. */
+/*-------------------------------------------------------------------------*/
+void follow(int x, int y)
+{
+ static char mx[10], my[10];
+ static char nx[10], ny[10];
+
+ sprintf(nx, "%d", x);
+ sprintf(ny, "%d", y);
+
+ switch(ctgc.cur_prim) {
+ case PIXEL:
+ /* atualiza os parametros do pixel */
+ pixel_pos.x = x;
+ pixel_pos.y = y;
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ IupSetAttribute(IupGetHandle("txtPixelX"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtPixelY"), IUP_VALUE, my);
+ break;
+ case MARK:
+ /* atualiza os parametros da mark */
+ mark_pos.x = x;
+ mark_pos.y = y;
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ IupSetAttribute(IupGetHandle("txtMarkX"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtMarkY"), IUP_VALUE, my);
+ break;
+ case RECT:
+ case BOX:
+ /* atualiza os parametros da box */
+ if (ctgc.following) {
+ if (x < box_pos.x) {
+ box_pos.xmin = x;
+ box_pos.xmax = box_pos.x;
+ }
+ else {
+ box_pos.xmax = x;
+ box_pos.xmin = box_pos.x;
+ }
+
+ if (y < box_pos.y) {
+ box_pos.ymin = y;
+ box_pos.ymax = box_pos.y;
+ }
+ else {
+ box_pos.ymax = y;
+ box_pos.ymin = box_pos.y;
+ }
+ }
+ else {
+ box_pos.xmax = box_pos.xmin = x;
+ box_pos.ymax = box_pos.ymin = y;
+ }
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", box_pos.xmin);
+ sprintf(nx, "%d", box_pos.xmax);
+ sprintf(my, "%d", box_pos.ymin);
+ sprintf(ny, "%d", box_pos.ymax);
+ IupSetAttribute(IupGetHandle("txtLBX1"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBX2"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtLBY1"), IUP_VALUE, my);
+ IupSetAttribute(IupGetHandle("txtLBY2"), IUP_VALUE, ny);
+ break;
+ case LINE:
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ line_pos.x2 = x;
+ line_pos.y2 = y;
+ if (ctgc.following) {
+ IupSetAttribute(IupGetHandle("txtLBX2"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBY2"), IUP_VALUE, my);
+ }
+ else {
+ line_pos.x1 = x;
+ line_pos.y1 = y;
+ IupSetAttribute(IupGetHandle("txtLBX1"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBX2"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtLBY1"), IUP_VALUE, my);
+ IupSetAttribute(IupGetHandle("txtLBY2"), IUP_VALUE, my);
+ }
+ break;
+ case ARC: /* ARC e SECTOR... */
+ case CHORD:
+ case SECTOR: /* ...sao equivalentes */
+ if (ctgc.following) {
+ /* atualiza os parametros do arc */
+ arc_pos.w = 2*abs(arc_pos.xc-x+1);
+ arc_pos.h = 2*abs(arc_pos.yc-y+1);
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", arc_pos.w);
+ sprintf(my, "%d", arc_pos.h);
+ IupSetAttribute(IupGetHandle("txtASW"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtASH"), IUP_VALUE, my);
+ }
+ else {
+ /* atualiza os parametros do arc */
+ arc_pos.xc = x;
+ arc_pos.xc = y;
+ /* atualiza a caixa de dialogo */
+ sprintf(mx, "%d", x);
+ sprintf(my, "%d", y);
+ IupSetAttribute(IupGetHandle("txtASXC"), IUP_VALUE, mx);
+ IupSetAttribute(IupGetHandle("txtASYC"), IUP_VALUE, my);
+ }
+ break;
+ case TEXT:
+ IupSetAttribute(IupGetHandle("txtTextX"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtTextY"), IUP_VALUE, ny);
+ break;
+ case CLIP:
+ if (ctgc.following) {
+ if (atoi(nx) >= atoi(mx)) {
+ IupSetAttribute(IupGetHandle("txtClipXmax"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipXmin"), IUP_VALUE, mx);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtClipXmin"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipXmax"), IUP_VALUE, mx);
+ }
+ if (atoi(ny) >= atoi(my)) {
+ IupSetAttribute(IupGetHandle("txtClipYmax"), IUP_VALUE, ny);
+ IupSetAttribute(IupGetHandle("txtClipYmin"), IUP_VALUE, my);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtClipYmin"), IUP_VALUE, ny);
+ IupSetAttribute(IupGetHandle("txtClipYmax"), IUP_VALUE, my);
+ }
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtClipXmin"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipYmin"), IUP_VALUE, ny);
+ IupSetAttribute(IupGetHandle("txtClipXmax"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtClipYmax"), IUP_VALUE, ny);
+ strcpy(mx, nx);
+ strcpy(my, ny);
+ }
+ break;
+ case IMAGE:
+ if (ctgc.following) {
+ if (atoi(mx) <= atoi(nx)) {
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageW"), IUP_VALUE, nx);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageX"), IUP_VALUE, nx);
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageW"), IUP_VALUE, nx);
+ }
+ if (atoi(my) <= atoi(ny)) {
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageH"), IUP_VALUE, ny);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageY"), IUP_VALUE, ny);
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageH"), IUP_VALUE, ny);
+ }
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageX"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtImageY"), IUP_VALUE, ny);
+ strcpy(mx, nx);
+ strcpy(my, ny);
+ }
+ break;
+ case RGB:
+ if (ctgc.following) {
+ if (atoi(mx) <= atoi(nx)) {
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageRGBW"), IUP_VALUE, nx);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageRGBX"), IUP_VALUE, nx);
+ sprintf(nx, "%d", abs(atoi(nx)-atoi(mx)));
+ IupSetAttribute(IupGetHandle("txtImageRGBW"), IUP_VALUE, nx);
+ }
+ if (atoi(my) <= atoi(ny)) {
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageRGBH"), IUP_VALUE, ny);
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageRGBY"), IUP_VALUE, ny);
+ sprintf(ny, "%d", abs(atoi(ny)-atoi(my)));
+ IupSetAttribute(IupGetHandle("txtImageRGBH"), IUP_VALUE, ny);
+ }
+ }
+ else {
+ IupSetAttribute(IupGetHandle("txtImageRGBX"), IUP_VALUE, nx);
+ IupSetAttribute(IupGetHandle("txtImageRGBY"), IUP_VALUE, ny);
+ strcpy(mx, nx);
+ strcpy(my, ny);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+/*-------------------------------------------------------------------------*/
+/* Desenha uma linha em rubber band. */
+/*-------------------------------------------------------------------------*/
+void line(tRubber what, int x, int y)
+{
+ static int x1, x2, y1, y2;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case NEWPOINT:
+ x1 = x2 = x; /* novo segmento comeca no... */
+ y1 = y2 = y; /* ...fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ cdLine(x1, y1, x2, y2); /* apaga o segmento velho */
+ }
+ cdLine(x1, y1, x, y); /* desenha o novo */
+ x2 = x; /* o novo se... */
+ y2 = y; /* ...torna velho */
+ break;
+ case REPAINT:
+ cdLine(x1, y1, x2, y2); /* recupera o segmento perdido */
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ cdLine(x1, y1, x2, y2); /* apaga o ultimo segmento */
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
+
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+/* Desenha uma caixa vazia (funcao nao exportada). */
+/*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
+static void frame(int x1, int y1, int x2, int y2)
+{
+ cdLine(x1, y1, x1, y2);
+ cdLine(x2, y1, x2, y2);
+ cdLine(x1, y1, x2, y1);
+ cdLine(x1, y2, x2, y2);
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha uma caixa em rubber band. */
+/*-------------------------------------------------------------------------*/
+void box(tRubber what, int x, int y)
+{
+ static int x1, x2, y1, y2;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case NEWPOINT:
+ x1 = x2 = x; /* novo segmento comeca no... */
+ y1 = y2 = y; /* fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ frame(x1, y1, x2, y2); /* apaga a caixa anterior */
+ }
+ frame(x1, y1, x, y); /* desenha a nova */
+ x2 = x; /* o novo se... */
+ y2 = y; /* torna velho */
+ break;
+ case REPAINT:
+ frame(x1, y1, x2, y2); /* restaura a caixa perdida */
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ frame(x1, y1, x2, y2); /* apaga a caixa definitiva */
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha uma caixa centrada, em rubber band. */
+/*-------------------------------------------------------------------------*/
+void arc(tRubber what, int x, int y)
+{
+ static int xc, yc, y1, x1;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case CENTER:
+ xc = x1 = x; /* novo segmento comeca no... */
+ yc = y1 = y; /* fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ cdArc(xc, yc, 2*abs(xc-x1+1), 2*abs(yc-y1+1), 0, 360);
+ }
+ cdArc(xc, yc, 2*abs(xc-x+1), 2*abs(yc-y+1), 0, 360);
+ x1 = x; /* o novo se... */
+ y1 = y; /* torna velho */
+ break;
+ case REPAINT:
+ cdArc(xc, yc, 2*abs(xc-x1+1), 2*abs(yc-y1+1), 0, 360);
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ cdArc(xc, yc, 2*abs(xc-x1+1), 2*abs(yc-y1+1), 0, 360);
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
+
+/*-------------------------------------------------------------------------*/
+/* Desenha o poligono em rubber band. */
+/*-------------------------------------------------------------------------*/
+void polygon(tRubber what, int x, int y)
+{
+ static int x1, x2, y1, y2;
+ static int lastwhat = CLOSE;
+
+ switch (what) {
+ case NEWPOINT:
+ if (lastwhat != CLOSE) {
+ cdLine(x1, y1, x2, y2); /* ...apaga a anterior e... */
+ cdLine(x1, y1, x, y); /* desenha a definitiva */
+ }
+ x1 = x; /* novo segmento comeca no... */
+ y1 = y; /* fim do primeiro */
+ break;
+ case MOVE:
+ if (lastwhat == MOVE) {
+ cdLine(x1, y1, x2, y2); /* apaga o segmento velho */
+ }
+ cdLine(x1, y1, x, y); /* desenha o novo */
+ x2 = x; /* o novo se... */
+ y2 = y; /* torna velho */
+ break;
+ case REPAINT:
+ cdLine(x1, y1, x2, y2); /* recupera o segmento perdido */
+ return; /* nao modifica lastwhat */
+ case CLOSE:
+ if (lastwhat != CLOSE) {
+ int i;
+ cdLine(x1, y1, x2, y2); /* apaga o ultimo segmento */
+ /* apaga o poligono temporario inteiro */
+ for (i=0; (i<ctgc.num_points-1); i++) {
+ cdLine(ctgc.points[i].x, ctgc.points[i].y,
+ ctgc.points[i+1].x, ctgc.points[i+1].y);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ lastwhat = what;
+}
diff --git a/test/lua/cdalign.wlua b/test/lua/cdalign.wlua
new file mode 100644
index 0000000..849d258
--- /dev/null
+++ b/test/lua/cdalign.wlua
@@ -0,0 +1,67 @@
+require("iupcdaux") -- utility module used in some samples
+
+dlg = iupcdaux.new_dialog(w, h)
+cnv = dlg[1] -- retrieve the IUP canvas
+
+function DrawText(canvas, x, y, text, align)
+ canvas:TextAlignment(align)
+ canvas:Mark(x, y)
+ canvas:Text(x, y, text)
+ xmin, xmax, ymin, ymax = canvas:GetTextBox(x, y, text)
+ canvas:Rect(xmin, xmax, ymin, ymax)
+end
+
+text_aligment = {
+ cd.NORTH,
+ cd.SOUTH,
+ cd.EAST,
+ cd.WEST,
+ cd.NORTH_EAST,
+ cd.NORTH_WEST,
+ cd.SOUTH_EAST,
+ cd.SOUTH_WEST,
+ cd.CENTER,
+ cd.BASE_LEFT,
+ cd.BASE_CENTER,
+ cd.BASE_RIGHT
+}
+
+text_aligment_str = {
+ "NORTH",
+ "SOUTH",
+ "EAST",
+ "WEST",
+ "NORTH EAST",
+ "NORTH WEST",
+ "SOUTH EAST",
+ "SOUTH WEST",
+ "CENTER",
+ "BASE LEFT",
+ "BASE CENTER",
+ "BASE RIGHT"
+}
+
+
+-- custom function used in action callback
+-- from the iupcdaux module
+function cnv:Draw(canvas)
+ canvas:MarkSize(40)
+ canvas:Font("Courier", cd.PLAIN, 12)
+
+ i = 1
+ while (i <= 12) do
+ DrawText(canvas, 100, 35*i + 30, text_aligment_str[i], text_aligment[i])
+ i = i + 1
+ end
+end
+
+
+--tmpCanvas = cd.CreateCanvas(cd.PS, "cdalign.ps")
+--tmpCanvas:Clear()
+--cnv:Draw(tmpCanvas)
+--tmpCanvas:Kill()
+
+
+dlg:show()
+iup.MainLoop()
+
diff --git a/test/lua/cdtext.wlua b/test/lua/cdtext.wlua
new file mode 100644
index 0000000..556d02f
--- /dev/null
+++ b/test/lua/cdtext.wlua
@@ -0,0 +1,59 @@
+require("iupcdaux") -- utility module used in some samples
+
+--require"cdluacontextplus"
+--cd.UseContextPlus(1)
+
+dlg = iupcdaux.new_dialog(w, h)
+cnv = dlg[1] -- retrieve the IUP canvas
+
+function DrawTextBox(canvas, x, y, text)
+ canvas:Mark(x, y)
+ canvas:Text(x, y, text)
+ w, h = canvas:GetTextSize(text)
+ xmin = x - w/2
+ ymin = y - h/2
+ xmax = x + w/2
+ ymax = y + h/2
+ canvas:Line(xmin, ymin, xmax, ymin)
+ canvas:Line(xmin, ymin, xmin, ymax)
+ canvas:Line(xmin, ymax, xmax, ymax)
+ canvas:Line(xmax, ymin, xmax, ymax)
+end
+
+-- custom function used in action callback
+-- from the iupcdaux module
+function cnv:Draw(canvas)
+
+ -- Available in ContextPlus drivers or in IMAGERGB driver
+ -- canvas:SetAttribute("ANTIALIAS", "1")
+
+ canvas:TextAlignment(cd.CENTER)
+ canvas:MarkSize(40)
+
+ canvas:Font("Courier", cd.PLAIN, 12)
+ local aa = canvas:GetAttribute("ANTIALIAS")
+ if (aa == "1") then
+ DrawTextBox(canvas, 130, 30, "ANTIALIAS=1")
+ else
+ DrawTextBox(canvas, 130, 30, "ANTIALIAS=0")
+ end
+
+ canvas:Font("Courier", cd.ITALIC, 34)
+ DrawTextBox(canvas, 130, 160, "xxxxxppx")
+
+ canvas:Font("Times", cd.PLAIN, 12)
+ DrawTextBox(canvas, 130, 290, "taaaa")
+
+ canvas:Font("Times", cd.BOLD, 14)
+ DrawTextBox(canvas, 130, 370, "gggggggg")
+end
+
+
+--tmpCanvas = cd.CreateCanvas(cd.PS, "cdtext.ps")
+--tmpCanvas:Clear()
+--cnv:Draw(tmpCanvas)
+--tmpCanvas:Kill()
+
+
+dlg:show()
+iup.MainLoop()
diff --git a/test/lua/imagergb.wlua b/test/lua/imagergb.wlua
new file mode 100644
index 0000000..b7c6f11
--- /dev/null
+++ b/test/lua/imagergb.wlua
@@ -0,0 +1,35 @@
+require("iupcdaux") -- utility module used in some samples
+
+w = 100
+h = 100
+
+image_rgb = cd.CreateImageRGB(w, h)
+
+size = w * h
+i = 0
+while i < size do
+
+ if i < size/2 then
+ image_rgb.r[i] = 255
+ image_rgb.g[i] = 0
+ image_rgb.b[i] = 0
+ else
+ image_rgb.r[i] = 0
+ image_rgb.g[i] = 0
+ image_rgb.b[i] = 255
+ end
+
+ i = i + 1
+end
+
+dlg = iupcdaux.new_dialog(w, h)
+cnv = dlg[1] -- retrieve the IUP canvas
+
+-- custom function used in action callback
+-- from the iupcdaux module
+function cnv:Draw(canvas)
+ canvas:PutImageRectRGB(image_rgb, 0, 0, w, h, 0, 0, 0, 0)
+end
+
+dlg:show()
+iup.MainLoop()
diff --git a/test/lua/iupcdaux.lua b/test/lua/iupcdaux.lua
new file mode 100644
index 0000000..a56ac1a
--- /dev/null
+++ b/test/lua/iupcdaux.lua
@@ -0,0 +1,45 @@
+require"cdlua"
+require"cdluaiup"
+require"iuplua"
+
+iupcdaux = {}
+iupcdaux.count = 0
+
+-- Function to easy create a new IUP dialog with an IUP canvas,
+-- and a CD canvas pointing to that IUP canvas
+
+function iupcdaux.new_dialog(w, h)
+
+ -- defaul size
+ w = w or 300
+ h = h or 200
+
+ cnv = iup.canvas { bgcolor="255 255 255", rastersize=w.."x"..h }
+ dlg = iup.dialog { cnv; title="canvas_"..(iupcdaux.count+1) }
+
+ function cnv:map_cb()
+ canvas = cd.CreateCanvas(cd.IUP, self)
+ self.canvas = canvas -- store the CD canvas in a IUP attribute
+ end
+
+ function cnv:action()
+ canvas = self.canvas -- retrieve the CD canvas from the IUP attribute
+ canvas:Activate()
+ canvas:Clear()
+
+ if (self.Draw) then
+ self:Draw(canvas)
+ end
+ end
+
+ function dlg:close_cb()
+ cnv = self[1]
+ canvas = cnv.canvas -- retrieve the CD canvas from the IUP attribute
+ canvas:Kill()
+ self:destroy()
+ return iup.IGNORE -- because we destroy the dialog
+ end
+
+ iupcdaux.count = iupcdaux.count + 1
+ return dlg
+end
diff --git a/test/lua/iuplua_cdlua.wlua b/test/lua/iuplua_cdlua.wlua
new file mode 100644
index 0000000..f595987
--- /dev/null
+++ b/test/lua/iuplua_cdlua.wlua
@@ -0,0 +1,58 @@
+require"iuplua"
+require"cdlua"
+require"cdluaiup"
+
+cnv = iup.canvas {size = "200x100"}
+
+box = iup.vbox{
+ iup.button { title="Version" },
+ cnv,
+ iup.button { title="Close" },
+ }
+
+dlg = iup.dialog{box; title="Example IUPLUA/CDLUA"}
+
+function cnv:map_cb()
+ canvas = cd.CreateCanvas(cd.IUP, self)
+ self.canvas = canvas -- store the CD canvas in a IUP attribute
+end
+
+function dlg:close_cb()
+ cnv = self[1][2]
+ canvas = cnv.canvas -- retrieve the CD canvas from the IUP attribute
+ canvas:Kill()
+ self:destroy()
+ return iup.IGNORE -- because we destroy the dialog
+end
+
+bt_version = dlg[1][1]
+function bt_version:action()
+ iup.Message("Version", "CD Version: " .. cd.Version() .. "\nIUP Version: " .. iup.Version() .. "\n" .. _VERSION)
+end
+
+bt_close = dlg[1][3]
+function bt_close:action()
+ return iup.CLOSE
+end
+
+function cnv:action()
+ canvas = self.canvas -- retrieve the CD canvas from the IUP attribute
+
+ canvas:Activate()
+ canvas:Clear()
+ canvas:Foreground (cd.RED)
+ canvas:Box (10, 55, 10, 55)
+ canvas:Foreground(cd.EncodeColor(255, 32, 140))
+ canvas:Line(0, 0, 300, 100)
+end
+
+function cnv:button_cb(b, e, x, y, r)
+ print ("Button: " .. "Button="..tostring(b).." Pressed="..tostring(e).." X="..tostring(x).." Y="..tostring(y) )
+end
+
+function cnv:resize_cb(w, h)
+ print("Resize: Width="..w.." Height="..h)
+end
+
+dlg:show()
+iup.MainLoop()
diff --git a/test/lua/rubberband.wlua b/test/lua/rubberband.wlua
new file mode 100644
index 0000000..595373a
--- /dev/null
+++ b/test/lua/rubberband.wlua
@@ -0,0 +1,54 @@
+require("iupcdaux") -- utility module used in some samples
+
+dlg = iupcdaux.new_dialog(w, h)
+cnv = dlg[1] -- retrieve the IUP canvas
+
+
+function cnv:button_cb(button,pressed,x,y,r)
+ canvas = self.canvas -- retrieve the CD canvas from the IUP attribute
+
+ -- start drag if button1 is pressed
+ if button ==iup.BUTTON1 and pressed == 1 then
+ y = canvas:UpdateYAxis(y)
+
+ -- prepare for XOR
+ canvas:Foreground(cd.WHITE)
+ canvas:WriteMode(cd.XOR)
+
+ xstart = x
+ ystart = y
+ drag = 1
+ first = 1
+ else
+ if (drag == 1) then
+ drag = 0
+ canvas:Rect(xstart,xend,ystart,yend)
+ end
+ end
+end
+
+
+function cnv:motion_cb(x,y,r)
+ canvas = self.canvas -- retrieve the CD canvas from the IUP attribute
+
+ if (drag == 1) then
+ y = canvas:UpdateYAxis(y)
+
+ if (first == 1) then
+ first = 0
+ else
+ canvas:Rect(xstart,xend,ystart,yend)
+ end
+
+ canvas:Rect(xstart,x,ystart,y)
+
+ xend = x
+ yend = y
+ end
+end
+
+first = 1
+drag = 0
+
+dlg:show()
+iup.MainLoop()
diff --git a/test/metafile.c b/test/metafile.c
new file mode 100644
index 0000000..ab34795
--- /dev/null
+++ b/test/metafile.c
@@ -0,0 +1,107 @@
+#include <cd.h>
+#include <cdmf.h>
+void draw();
+int marktype;
+
+void main(void)
+{
+ cdCanvas *canvas;
+ canvas = cdCreateCanvas(CD_METAFILE,"TESTE.MF 100x100");
+ cdActivate(canvas);
+ draw();
+ cdKillCanvas(canvas);
+}
+
+void draw(void)
+{
+ cdMarkSize(5)
+ cdMarkType(CD_PLUS);
+ cdMark(10,90);
+ cdMarkType(CD_STAR);
+ cdMark(20,90);
+ cdMarkType(CD_CIRCLE);
+ cdMark(30,90);
+ cdMarkType(CD_X);
+ cdMark(40,90);
+ cdMarkType(CD_BOX);
+ cdMark(50,90);
+ cdMarkType(CD_DIAMOND);
+ cdMark(60,90);
+ cdMarkType(CD_HOLLOW_CIRCLE);
+ cdMark(70,90);
+ cdMarkType(CD_HOLLOW_BOX);
+ cdMark(80,90);
+ cdMarkType(CD_HOLLOW_DIAMOND);
+ cdMark(90,90);
+
+ cdLineStyle(CD_CONTINUOUS);
+ cdLine(10,80,80,80);
+ cdLineStyle(CD_DASHED);
+ cdLine(10,75,80,75);
+ cdLineStyle(CD_DOTTED);
+ cdLine(10,70,80,70);
+ cdLineStyle(CD_DASH_DOT);
+ cdLine(10,65,80,65);
+ cdLineStyle(CD_DASH_DOT_DOT);
+ cdLine(10,60,80,60);
+
+ cdLineStyle(CD_CONTINUOUS);
+
+ cdHatch(CD_HORIZONTAL);
+
+ cdBegin(CD_FILL);
+ cdVertex(10,50);
+ cdVertex(50,50);
+ cdVertex(50,10);
+ cdVertex(10,10);
+ cdEnd();
+
+ cdHatch(CD_VERTICAL);
+ cdBegin(CD_FILL);
+ cdVertex(60,50);
+ cdVertex(100,50);
+ cdVertex(100,10);
+ cdVertex(60,10);
+ cdEnd();
+
+ cdHatch(CD_FDIAGONAL);
+ cdBegin(CD_FILL);
+ cdVertex(110,50);
+ cdVertex(150,50);
+ cdVertex(150,10);
+ cdVertex(110,10);
+ cdEnd();
+
+ cdHatch(CD_BDIAGONAL);
+ cdBegin(CD_FILL);
+ cdVertex(160,50);
+ cdVertex(200,50);
+ cdVertex(200,10);
+ cdVertex(160,10);
+ cdEnd();
+
+ cdHatch(CD_CROSS);
+ cdBegin(CD_FILL);
+ cdVertex(210,50);
+ cdVertex(250,50);
+ cdVertex(250,10);
+ cdVertex(210,10);
+ cdEnd();
+
+ cdHatch(CD_DIAGCROSS);
+ cdBegin(CD_FILL);
+ cdVertex(260,50);
+ cdVertex(300,50);
+ cdVertex(300,10);
+ cdVertex(260,10);
+ cdEnd();
+
+ cdFont(CD_SYSTEM,CD_BOLD,CD_STANDARD);
+ cdText(10,100,'Teste');
+ cdFont(CD_COURIER,CD_BOLD,CD_STANDARD);
+ cdText(60,100,'Teste');
+ cdFont(CD_TIMES_ROMAN,CD_BOLD,CD_STANDARD);
+ cdText(110,100,'Teste');
+ cdFont(CD_HELVETICA,CD_BOLD,CD_STANDARD);
+ cdText(160,100,'Teste');
+}
diff --git a/test/mf/align.mf b/test/mf/align.mf
new file mode 100644
index 0000000..110ac39
--- /dev/null
+++ b/test/mf/align.mf
@@ -0,0 +1,45 @@
+CDMF 383 410
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+25 5
+27 0 255 255
+12 151 328
+21 2 0 10
+8 151 329 TMWjfgoiuá
+23 10
+8 150 328 TMWjfgoiuá
+23 11
+8 151 327 TMWjfgoiuá
+12 151 253
+23 0
+8 151 253 TMWjfgoiuá
+23 1
+8 151 252 TMWjfgoiuá
+23 2
+8 150 254 TMWjfgoiuá
+23 3
+8 152 255 TMWjfgoiuá
+12 285 335
+23 8
+8 285 336 TMWjfgoiuá
+12 150 151
+23 4
+8 151 151 TMWjfgoiuá
+23 5
+8 150 151 TMWjfgoiuá
+23 6
+8 149 152 TMWjfgoiuá
+23 7
+8 149 152 TMWjfgoiuá
diff --git a/test/mf/alignorient.mf b/test/mf/alignorient.mf
new file mode 100644
index 0000000..dbaa907
--- /dev/null
+++ b/test/mf/alignorient.mf
@@ -0,0 +1,44 @@
+CDMF 383 410
+27 255 255 255
+28 0 255 255
+13 1
+14 1
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 60
+24 1
+25 10
+1
+25 5
+12 151 328
+21 2 0 24
+8 151 329 Text
+23 10
+8 150 328 Text
+23 11
+8 151 327 Text
+12 151 253
+23 0
+8 151 253 Text
+23 1
+8 151 252 Text
+23 2
+8 150 254 Text
+23 3
+8 152 255 Text
+12 285 335
+23 8
+8 285 336 Text
+12 150 151
+23 4
+8 151 151 Text
+23 5
+8 150 151 Text
+23 6
+8 149 152 Text
+23 7
+8 149 152 Text
diff --git a/test/mf/alignxor.mf b/test/mf/alignxor.mf
new file mode 100644
index 0000000..0b7f25d
--- /dev/null
+++ b/test/mf/alignxor.mf
@@ -0,0 +1,44 @@
+CDMF 383 410
+27 255 255 255
+28 0 255 255
+13 0
+14 1
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+25 5
+12 151 328
+21 2 0 24
+8 151 329 Text
+23 10
+8 150 328 Text
+23 11
+8 151 327 Text
+12 151 253
+23 0
+8 151 253 Text
+23 1
+8 151 252 Text
+23 2
+8 150 254 Text
+23 3
+8 152 255 Text
+12 285 335
+23 8
+8 285 336 Text
+12 150 151
+23 4
+8 151 151 Text
+23 5
+8 150 151 Text
+23 6
+8 149 152 Text
+23 7
+8 149 152 Text
diff --git a/test/mf/arc.mf b/test/mf/arc.mf
new file mode 100644
index 0000000..cf4a8b7
--- /dev/null
+++ b/test/mf/arc.mf
@@ -0,0 +1,25 @@
+CDMF 383 410
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+13 0
+6 59 351 74 84 0 360
+6 185 348 86 76 0 180
+6 155 309 94 60 180 360
+6 307 284 86 84 180 360
+6 55 218 80 72 0 90
+6 181 190 66 84 90 180
+6 79 124 86 96 180 270
+6 236 150 82 92 45 100
+6 228 104 112 118 100 200
diff --git a/test/mf/circles.mf b/test/mf/circles.mf
new file mode 100644
index 0000000..e1ea53c
--- /dev/null
+++ b/test/mf/circles.mf
@@ -0,0 +1,47 @@
+CDMF 619334269 619334269
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+6 582 376 788 718 0 360
+6 555 359 376 374 0 360
+6 537 360 124 116 0 360
+6 534 359 32 32 0 360
+6 534 359 8 8 0 360
+6 858 436 4 4 0 360
+6 869 425 4 6 0 360
+6 851 424 2 2 0 360
diff --git a/test/mf/cliparea.mf b/test/mf/cliparea.mf
new file mode 100644
index 0000000..eb5a938
--- /dev/null
+++ b/test/mf/cliparea.mf
@@ -0,0 +1,80 @@
+CDMF 499 442
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+1
+3 72 308 136 284
+2 1
+28 255 0 0
+18 0
+17 0
+5 7 369 38 368
+27 0 0 0
+4 144 347 376 144
+28 0 0 255
+4 214 329 362 161
+4 202 136 362 220
+4 18 282 169 83
+27 255 255 255
+34 27 161 211 318
+27 0 0 0
+6 56 190 114 72 0 360
+27 255 255 255
+18 0
+17 0
+7 166 150 52 60 0 360
+8 57 129 Text
+8 92 132 Text
+8 101 134 Text
+8 166 278 Text
+8 169 287 Text
+8 206 285 Text
+18 0
+17 0
+9 1
+10 190 260
+10 305 342
+10 399 254
+10 262 197
+10 181 220
+11
+18 0
+17 0
+9 0
+10 120 253
+10 72 324
+10 134 326
+10 141 294
+11
diff --git a/test/mf/fill.mf b/test/mf/fill.mf
new file mode 100644
index 0000000..8367875
--- /dev/null
+++ b/test/mf/fill.mf
@@ -0,0 +1,48 @@
+CDMF 480 405
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+1
+3 0 272 0 396
+28 255 0 0
+17 0
+13 0
+5 40 111 256 330
+17 1
+5 153 215 265 326
+17 2
+5 43 155 140 206
+17 3
+5 219 324 107 201
diff --git a/test/mf/fill_x_hollow.mf b/test/mf/fill_x_hollow.mf
new file mode 100644
index 0000000..b8f429a
--- /dev/null
+++ b/test/mf/fill_x_hollow.mf
@@ -0,0 +1,170 @@
+CDMF 1239 759
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+18 0
+17 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+18 0
+17 0
+9 2
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+9 2
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 2
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+9 2
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
+28 255 0 0
+9 0
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 0
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 0
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 0
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
+28 0 0 0
+34 318 394 283 376
+28 255 0 0
+18 0
+17 0
+5 318 394 283 376
+28 0 0 0
+6 363 174 82 148 0 360
+28 255 0 0
+18 0
+17 0
+7 363 174 82 148 0 360
diff --git a/test/mf/font.mf b/test/mf/font.mf
new file mode 100644
index 0000000..72f16ad
--- /dev/null
+++ b/test/mf/font.mf
@@ -0,0 +1,49 @@
+CDMF 488 466
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+3 0 382 0 409
+21 0 0 24
+13 0
+8 39 420 System
+21 0 1 24
+8 48 383 System
+21 0 2 24
+8 49 352 System
+21 0 3 24
+8 67 317 System
+21 1 3 24
+8 229 316 Courier
+21 1 2 24
+8 236 352 Courier
+21 1 1 24
+8 233 387 Courier
+21 1 0 24
+8 229 430 Courier
+21 2 0 24
+8 57 264 Times
+21 2 1 24
+8 89 226 Times
+21 2 2 24
+8 104 187 Times
+21 2 3 24
+8 99 157 Times
+21 3 0 24
+8 302 273 Helvetica
+21 3 1 24
+8 326 238 Helvetica
+21 3 2 24
+8 337 200 Helvetica
+21 3 3 24
+8 336 145 Helvetica
diff --git a/test/mf/grays.mf b/test/mf/grays.mf
new file mode 100644
index 0000000..23a176c
--- /dev/null
+++ b/test/mf/grays.mf
@@ -0,0 +1,59 @@
+CDMF 980 599
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+25 5
+12 167 511
+12 166 487
+12 167 472
+12 168 440
+12 167 423
+12 168 402
+12 167 377
+12 166 358
+12 166 329
+12 166 312
+31 227 512 0 0 0
+31 227 313 255 255 255
+31 232 401 128 128 128
+31 229 460 64 64 64
+31 232 348 192 192 192
+31 228 484 32 32 32
+31 230 431 96 96 96
+31 233 374 160 160 160
+31 232 326 224 224 224
diff --git a/test/mf/hatch.mf b/test/mf/hatch.mf
new file mode 100644
index 0000000..d8e30d6
--- /dev/null
+++ b/test/mf/hatch.mf
@@ -0,0 +1,47 @@
+CDMF 472 410
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+3 0 382 0 409
+28 255 0 0
+18 5
+17 0
+5 20 455 264 370
+5 21 452 124 229
+28 0 0 255
+18 0
+13 0
+5 29 78 286 347
+18 1
+5 97 142 285 346
+18 2
+5 165 214 286 345
+18 3
+5 231 287 285 346
+18 4
+5 307 366 284 346
+18 5
+5 386 438 286 347
+13 1
+5 383 439 142 202
+18 4
+5 308 362 145 203
+18 3
+5 234 290 144 202
+18 2
+5 163 218 142 203
+18 1
+5 99 149 140 208
+18 0
+5 28 87 141 208
diff --git a/test/mf/lines.mf b/test/mf/lines.mf
new file mode 100644
index 0000000..1b91129
--- /dev/null
+++ b/test/mf/lines.mf
@@ -0,0 +1,44 @@
+CDMF 511 397
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+3 0 272 0 396
+28 255 0 0
+13 0
+5 58 439 214 345
+5 59 454 40 158
+28 0 0 255
+4 74 318 419 315
+15 1
+4 79 294 409 286
+15 2
+4 81 276 414 260
+15 3
+4 79 258 416 236
+15 4
+4 77 231 411 223
+13 1
+4 81 49 417 47
+15 3
+4 84 63 427 59
+15 2
+4 88 80 443 75
+15 1
+4 78 100 440 93
+15 0
+4 79 122 436 113
+16 10
+4 76 201 438 201
+15 1
+4 80 174 441 176
diff --git a/test/mf/marks.mf b/test/mf/marks.mf
new file mode 100644
index 0000000..2e3d561
--- /dev/null
+++ b/test/mf/marks.mf
@@ -0,0 +1,33 @@
+CDMF 511 397
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+3 0 272 0 396
+25 15
+28 0 0 255
+12 37 344
+24 2
+12 84 343
+24 3
+12 129 335
+24 4
+12 173 332
+24 5
+12 227 334
+24 6
+12 274 331
+24 7
+12 297 329
+24 8
+12 338 319
diff --git a/test/mf/natal.mf b/test/mf/natal.mf
new file mode 100644
index 0000000..85de77f
--- /dev/null
+++ b/test/mf/natal.mf
@@ -0,0 +1,1933 @@
+CDMF 719 433
+27 255 255 255
+2 0
+1
+3 0 383 0 381
+2 0
+28 0 128 0
+27 255 255 255
+14 0
+15 0
+16 1
+18 0
+17 0
+13 0
+9 1
+10 297 384
+10 375 314
+10 313 310
+10 413 246
+10 331 243
+10 407 166
+10 328 165
+10 368 112
+10 243 115
+10 295 151
+10 228 153
+10 281 225
+10 210 229
+10 283 294
+10 226 299
+10 297 383
+11
+3 0 383 0 381
+2 0
+14 0
+31 285 351 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 301 356 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 285 338 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 275 331 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 318 332 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 299 332 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 297 313 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 307 289 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 296 267 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 274 254 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 256 253 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 252 253 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 252 246 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 293 243 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 295 244 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 292 272 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 290 277 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 345 271 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 363 260 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 387 254 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 374 258 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 300 256 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 310 254 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 312 244 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 323 264 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 316 267 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 302 238 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 282 198 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 319 193 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 325 216 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 350 193 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 365 187 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 331 182 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 236 176 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 281 169 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 270 169 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 277 195 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 297 219 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 299 215 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 291 171 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 306 164 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 309 147 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 273 137 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 295 128 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 363 119 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 317 119 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 320 123 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 321 127 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 341 123 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 342 127 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 318 143 0 128 0
+3 0 383 0 381
+2 0
+14 0
+31 316 163 0 128 0
+3 0 383 0 381
+2 0
+28 0 128 0
+27 0 128 0
+14 0
+15 0
+16 1
+18 0
+17 0
+13 0
+9 1
+10 297 382
+10 374 314
+10 316 310
+10 416 244
+10 338 240
+10 406 168
+10 329 164
+10 369 114
+10 243 114
+10 296 151
+10 235 153
+10 281 229
+10 208 229
+10 279 293
+10 238 302
+10 297 380
+11
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 107 123 111 127
+4 107 127 111 123
+4 107 125 111 125
+4 109 123 109 127
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 294 224 298 228
+4 294 228 298 224
+4 294 226 298 226
+4 296 224 296 228
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 318 173 322 177
+4 318 177 322 173
+4 318 175 322 175
+4 320 173 320 177
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 293 165 297 169
+4 293 169 297 165
+4 293 167 297 167
+4 295 165 295 169
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 294 164 298 168
+4 294 168 298 164
+4 294 166 298 166
+4 296 164 296 168
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 153 153 153
+17 0
+15 0
+16 1
+4 153 62 157 66
+4 153 66 157 62
+4 153 64 157 64
+4 155 62 155 66
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+25 5
+24 1
+28 153 153 153
+17 0
+15 0
+16 1
+4 251 95 255 99
+4 251 99 255 95
+4 251 97 255 97
+4 253 95 253 99
+17 0
+15 0
+16 1
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 153 153 153
+4 298 377 300 377
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 300 379 245 308
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 241 303 288 300
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 288 297 217 232
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 217 232 287 232
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 286 229 227 156
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 227 156 285 153
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 285 152 228 104
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 228 104 360 106
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 359 112 324 166
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 324 166 395 167
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 392 177 331 238
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 331 240 411 249
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 411 249 310 312
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 310 312 363 321
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 363 321 302 375
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 302 375 333 323
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 319 322 292 367
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 285 353 302 316
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 273 335 333 243
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 258 320 283 308
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 303 309 348 253
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 333 291 366 254
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 369 266 377 261
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 282 284 352 182
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 328 235 374 174
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 345 177 351 173
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 294 286 313 234
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 277 268 336 180
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 257 267 274 244
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 240 249 261 241
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 288 238 323 169
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 280 217 340 119
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 268 200 315 116
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 248 177 253 165
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 255 187 263 170
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 263 199 329 113
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 282 141 306 112
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 271 130 280 110
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 261 123 264 106
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 0 128 0
+4 255 177 323 165
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 245 307 10 8 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 259 314 10 8 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 277 343 6 10 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 331 328 10 14 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 357 322 6 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 284 270 2 2 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 297 296 8 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 329 280 18 26 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 356 260 8 8 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 298 256 8 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 271 254 8 8 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 244 248 2 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 284 235 22 14 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 323 224 12 16 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 341 204 12 16 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 379 177 2 4 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 337 177 10 4 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 354 183 6 10 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 356 172 4 10 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 268 199 10 14 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 294 205 4 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 266 190 4 14 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 240 174 8 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 276 170 24 10 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 309 165 0 4 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 310 176 6 8 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 314 158 2 4 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 320 138 6 10 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 338 114 6 2 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 287 115 8 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 291 131 6 4 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 264 122 6 10 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 244 111 6 6 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 0 0
+27 0 128 0
+18 0
+17 0
+13 0
+7 322 110 8 2 0 360
+3 0 383 0 381
+2 0
+14 0
+15 0
+16 14
+28 255 255 255
+27 0 128 0
+18 0
+17 0
+13 0
+7 287 359 0 0 0 360
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 273 355 285 367
+4 273 367 285 355
+4 273 361 285 361
+4 279 355 279 367
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 309 352 321 364
+4 309 364 321 352
+4 309 358 321 358
+4 315 352 315 364
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 309 318 321 330
+4 309 330 321 318
+4 309 324 321 324
+4 315 318 315 330
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 279 299 291 311
+4 279 311 291 299
+4 279 305 291 305
+4 285 299 285 311
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 268 267 280 279
+4 268 279 280 267
+4 268 273 280 273
+4 274 267 274 279
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 269 242 281 254
+4 269 254 281 242
+4 269 248 281 248
+4 275 242 275 254
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 237 236 249 248
+4 237 248 249 236
+4 237 242 249 242
+4 243 236 243 248
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 214 239 226 251
+4 214 251 226 239
+4 214 245 226 245
+4 220 239 220 251
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 212 206 224 218
+4 212 218 224 206
+4 212 212 224 212
+4 218 206 218 218
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 280 240 292 252
+4 280 252 292 240
+4 280 246 292 246
+4 286 240 286 252
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 344 249 356 261
+4 344 261 356 249
+4 344 255 356 255
+4 350 249 350 261
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 342 287 354 299
+4 342 299 354 287
+4 342 293 354 293
+4 348 287 348 299
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 376 264 388 276
+4 376 276 388 264
+4 376 270 388 270
+4 382 264 382 276
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 380 229 392 241
+4 380 241 392 229
+4 380 235 392 235
+4 386 229 386 241
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 380 241 392 253
+4 380 253 392 241
+4 380 247 392 247
+4 386 241 386 253
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 311 283 323 295
+4 311 295 323 283
+4 311 289 323 289
+4 317 283 317 295
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 306 339 318 351
+4 306 351 318 339
+4 306 345 318 345
+4 312 339 312 351
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 299 359 311 371
+4 299 371 311 359
+4 299 365 311 365
+4 305 359 305 371
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 277 325 289 337
+4 277 337 289 325
+4 277 331 289 331
+4 283 325 283 337
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 259 315 271 327
+4 259 327 271 315
+4 259 321 271 321
+4 265 315 265 327
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 306 282 318 294
+4 306 294 318 282
+4 306 288 318 288
+4 312 282 312 294
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 308 236 320 248
+4 308 248 320 236
+4 308 242 320 242
+4 314 236 314 248
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 294 215 306 227
+4 294 227 306 215
+4 294 221 306 221
+4 300 215 300 227
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 290 191 302 203
+4 290 203 302 191
+4 290 197 302 197
+4 296 191 296 203
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 248 156 260 168
+4 248 168 260 156
+4 248 162 260 162
+4 254 156 254 168
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 216 157 228 169
+4 216 169 228 157
+4 216 163 228 163
+4 222 157 222 169
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 246 187 258 199
+4 246 199 258 187
+4 246 193 258 193
+4 252 187 252 199
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 296 182 308 194
+4 296 194 308 182
+4 296 188 308 188
+4 302 182 302 194
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 360 175 372 187
+4 360 187 372 175
+4 360 181 372 181
+4 366 175 366 187
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 398 170 410 182
+4 398 182 410 170
+4 398 176 410 176
+4 404 170 404 182
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 355 208 367 220
+4 355 220 367 208
+4 355 214 367 214
+4 361 208 361 220
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 323 210 335 222
+4 323 222 335 210
+4 323 216 335 216
+4 329 210 329 222
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 324 183 336 195
+4 324 195 336 183
+4 324 189 336 189
+4 330 183 330 195
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 323 152 335 164
+4 323 164 335 152
+4 323 158 335 158
+4 329 152 329 164
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 328 131 340 143
+4 328 143 340 131
+4 328 137 340 137
+4 334 131 334 143
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 334 110 346 122
+4 334 122 346 110
+4 334 116 346 116
+4 340 110 340 122
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 289 109 301 121
+4 289 121 301 109
+4 289 115 301 115
+4 295 109 295 121
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 284 135 296 147
+4 284 147 296 135
+4 284 141 296 141
+4 290 135 290 147
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 267 127 279 139
+4 267 139 279 127
+4 267 133 279 133
+4 273 127 273 139
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 259 111 271 123
+4 259 123 271 111
+4 259 117 271 117
+4 265 111 265 123
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 233 109 245 121
+4 233 121 245 109
+4 233 115 245 115
+4 239 109 239 121
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 303 107 315 119
+4 303 119 315 107
+4 303 113 315 113
+4 309 107 309 119
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 317 111 329 123
+4 317 123 329 111
+4 317 117 329 117
+4 323 111 323 123
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 312 134 324 146
+4 312 146 324 134
+4 312 140 324 140
+4 318 134 318 146
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 255
+17 0
+15 0
+16 1
+4 313 191 325 203
+4 313 203 325 191
+4 313 197 325 197
+4 319 191 319 203
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 12
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 295 377 307 389
+4 295 389 307 377
+4 295 383 307 383
+4 301 377 301 389
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 292 369 314 391
+4 292 391 314 369
+4 292 380 314 380
+4 303 369 303 391
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 287 371 309 393
+4 287 393 309 371
+4 287 382 309 382
+4 298 371 298 393
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 292 380 314 402
+4 292 402 314 380
+4 292 391 314 391
+4 303 380 303 402
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 287 370 309 392
+4 287 392 309 370
+4 287 381 309 381
+4 298 370 298 392
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 287 372 309 394
+4 287 394 309 372
+4 287 383 309 383
+4 298 372 298 394
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 290 373 312 395
+4 290 395 312 373
+4 290 384 312 384
+4 301 373 301 395
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 292 373 314 395
+4 292 395 314 373
+4 292 384 314 384
+4 303 373 303 395
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 294 373 316 395
+4 294 395 316 373
+4 294 384 316 384
+4 305 373 305 395
+17 0
+15 0
+16 14
+3 0 383 0 381
+2 0
+14 0
+25 22
+24 1
+28 255 255 0
+17 0
+15 0
+16 1
+4 291 383 313 405
+4 291 405 313 383
+4 291 394 313 394
+4 302 383 302 405
+17 0
+15 0
+16 14
+2 0
diff --git a/test/mf/poly.mf b/test/mf/poly.mf
new file mode 100644
index 0000000..d299180
--- /dev/null
+++ b/test/mf/poly.mf
@@ -0,0 +1,88 @@
+CDMF 619334269 619334269
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+18 0
+17 0
+58 0
+9 0
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 0
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 0
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 0
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
diff --git a/test/mf/poly2.mf b/test/mf/poly2.mf
new file mode 100644
index 0000000..387431c
--- /dev/null
+++ b/test/mf/poly2.mf
@@ -0,0 +1,88 @@
+CDMF 619334269 619334269
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+18 0
+17 0
+58 0
+9 2
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 2
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 2
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 2
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
diff --git a/test/mf/poly3.mf b/test/mf/poly3.mf
new file mode 100644
index 0000000..e9f06d1
--- /dev/null
+++ b/test/mf/poly3.mf
@@ -0,0 +1,136 @@
+CDMF 619334269 619334269
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+18 0
+17 0
+58 0
+9 2
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 2
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 2
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 2
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
+28 255 0 0
+58 0
+9 0
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 0
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 0
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 0
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
diff --git a/test/mf/poly4.mf b/test/mf/poly4.mf
new file mode 100644
index 0000000..83cf601
--- /dev/null
+++ b/test/mf/poly4.mf
@@ -0,0 +1,136 @@
+CDMF 619334269 619334269
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+18 0
+17 0
+58 0
+9 0
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 0
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 0
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 0
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
+28 255 0 0
+58 0
+9 2
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 2
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 2
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 2
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
diff --git a/test/mf/poly5.mf b/test/mf/poly5.mf
new file mode 100644
index 0000000..acbb116
--- /dev/null
+++ b/test/mf/poly5.mf
@@ -0,0 +1,89 @@
+CDMF 619334269 619334269
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+60 0
+61 0
+18 0
+17 0
+74 0 12 System
+23 9
+33 0
+20 10 10
+255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 255 255 255 255 255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 19 10 10
+0 0 0 0 0 0 0 0 0 0
+0 1 1 1 1 1 0 0 0 0
+0 1 0 0 0 1 1 0 0 0
+0 1 0 0 0 1 0 1 0 0
+0 1 0 0 0 1 0 0 1 0
+0 1 1 1 1 1 0 0 1 0
+0 0 1 0 0 0 1 0 1 0
+0 0 0 1 0 0 0 1 1 0
+0 0 0 0 1 1 1 1 1 0
+0 0 0 0 0 0 0 0 0 0
+17 0
+1
+3 0 272 0 396
+18 0
+17 0
+28 255 0 0
+58 0
+9 0
+10 55 428
+10 300 427
+10 121 345
+10 159 499
+10 252 334
+11
+18 0
+17 0
+58 1
+9 0
+10 444 432
+10 637 430
+10 472 357
+10 529 502
+10 596 350
+11
+18 0
+17 0
+9 0
+10 499 98
+10 684 96
+10 680 215
+10 546 215
+10 546 171
+10 633 169
+10 634 132
+10 578 132
+10 578 258
+10 473 256
+11
+18 0
+17 0
+58 0
+9 0
+10 90 94
+10 264 95
+10 259 220
+10 140 220
+10 141 149
+10 218 151
+10 218 117
+10 168 116
+10 168 255
+10 73 253
+11
diff --git a/test/mf/sector.mf b/test/mf/sector.mf
new file mode 100644
index 0000000..d889752
--- /dev/null
+++ b/test/mf/sector.mf
@@ -0,0 +1,22 @@
+CDMF 383 410
+27 255 255 255
+28 0 0 0
+13 1
+14 0
+15 0
+16 1
+18 0
+17 0
+21 0 0 12
+23 9
+33 0
+24 1
+25 10
+1
+13 0
+7 66 336 70 74 0 360
+7 181 348 74 88 45 100
+7 188 234 122 102 0 180
+7 126 96 150 100 180 360
+7 238 159 88 70 180 360
+7 309 63 76 68 100 200
diff --git a/test/screencapture.c b/test/screencapture.c
new file mode 100644
index 0000000..1ac8d2c
--- /dev/null
+++ b/test/screencapture.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <cd.h>
+#include <cdnative.h>
+#include <im.h>
+
+void main()
+{
+ cdCanvas *cd_canvas;
+ unsigned char *red, *green, *blue;
+ int width, height, size;
+
+ cd_canvas = cdCreateCanvas(CD_NATIVEWINDOW, NULL);
+ if (!cd_canvas)
+ {
+ printf("Error creating canvas.\n");
+ return;
+ }
+
+ cdActivate(cd_canvas);
+
+ cdGetCanvasSize(&width, &height, NULL, NULL);
+ size = width * height;
+ red = (unsigned char*)calloc(size, 1);
+ green = (unsigned char*)calloc(size, 1);
+ blue = (unsigned char*)calloc(size, 1);
+
+ cdGetImageRGB(red, green, blue, 0, 0, width, height);
+ imSaveRGB(width, height, IM_JPG|IM_COMPRESSED, red, green, blue, "scap.jpg");
+
+ cdKillCanvas(cd_canvas);
+
+ free(red);
+ free(green);
+ free(blue);
+}
diff --git a/test/screencapture.mak b/test/screencapture.mak
new file mode 100644
index 0000000..1744375
--- /dev/null
+++ b/test/screencapture.mak
@@ -0,0 +1,8 @@
+APPNAME = screencapture
+APPTYPE = console
+
+USE_CD = Yes
+USE_IUP = YEs
+USE_IM = Yes
+
+SRC = screencapture.c
diff --git a/test/simple/.cvsignore b/test/simple/.cvsignore
new file mode 100644
index 0000000..c29a181
--- /dev/null
+++ b/test/simple/.cvsignore
@@ -0,0 +1,21 @@
+*.emf
+*.mf
+*.cgm
+*.eps
+*.ps
+*.wmf
+*.pdf
+simple_debug.txt
+so_locations
+*.dep
+*.wdep
+*.loh
+.plan
+.project
+*.err
+Makefile
+*.make
+*.suo
+*.ncb
+*.opt
+*.user
diff --git a/test/simple/config.mak b/test/simple/config.mak
new file mode 100644
index 0000000..319568a
--- /dev/null
+++ b/test/simple/config.mak
@@ -0,0 +1,25 @@
+APPNAME = simple
+
+#SRC = simple.c simple_led.c iupmain.c
+SRC = teste.cpp
+
+#DBG = Yes
+USE_CD=Yes
+USE_IUP=Yes
+
+simple_led.c: simple.led
+ ledc -f simple_loadled -o simple_led.c simple.led
+
+USE_STATIC = Yes
+
+#IUP = ../../../iup
+#CD = ../..
+
+USE_IM = Yes
+
+#ifneq ($(findstring Win, $(TEC_SYSNAME)), )
+# LIBS = cdpdflib cdgdiplus gdiplus
+#else
+# SLIB = $(CD)/lib/$(TEC_UNAME)/libcdpdflib.a $(CD)/lib/$(TEC_UNAME)/libcdxrender.a
+# LIBS = Xrender Xft
+#endif
diff --git a/test/simple/gdiplustest.cpp b/test/simple/gdiplustest.cpp
new file mode 100644
index 0000000..af7b643
--- /dev/null
+++ b/test/simple/gdiplustest.cpp
@@ -0,0 +1,116 @@
+#include <windows.h>
+#include <gdiplus.h>
+using namespace Gdiplus;
+
+/* Visual C++ 7.1 + SP1
+ GDI+ 1.0 File Version 5.1.3102.2180
+*/
+
+void DrawLineMarks(Graphics* graphics, Pen* greenPen, int x, int y, int w, int h)
+{
+ graphics->DrawLine(greenPen, x+w-1, y-5, x+w-1, y+5); // end markers
+ graphics->DrawLine(greenPen, x-5, y+h-1, x+5, y+h-1);
+}
+
+void SimpleImageTest(HWND hWnd)
+{
+ int x, y;
+ Graphics* graphics = new Graphics(hWnd);
+ graphics->Clear(Color(255, 255, 255)); // white background
+
+ Bitmap image(16, 16, PixelFormat24bppRGB);
+ image.SetResolution(graphics->GetDpiX(), graphics->GetDpiX());
+
+ /* black pixel border */
+ for (y = 0; y < 16; y++)
+ image.SetPixel(0, y, Color(0, 0, 0));
+ for (y = 0; y < 16; y++)
+ image.SetPixel(15, y, Color(0, 0, 0));
+ for (x = 1; x < 15; x++)
+ image.SetPixel(x, 0, Color(0, 0, 0));
+ for (x = 1; x < 15; x++)
+ image.SetPixel(x, 15, Color(0, 0, 0));
+
+ /* light yellow contents */
+ for (y = 1; y < 15; y++)
+ for (x = 1; x < 15; x++)
+ image.SetPixel(x, y, Color(192, 192, 0));
+
+ Pen redPen(Color(255, 0, 0), 1);
+ redPen.SetDashStyle(DashStyleDash);
+ Pen greenPen(Color(0, 255, 0), 1);
+ greenPen.SetDashStyle(DashStyleDash);
+
+ // I add {} to avoid reusing some Rect in the next test
+
+ graphics->SetPixelOffsetMode(PixelOffsetModeHalf); // pixel center is (.5,.5) instead of (0, 0)
+
+ // NO zoom
+ {
+ RectF actualRect(10, 10, 16, 16);
+ graphics->DrawImage(&image, 10, 10);
+ graphics->DrawRectangle(&redPen, actualRect);
+ DrawLineMarks(graphics, &greenPen, 10, 10, 16, 16);
+ }
+
+ // zoom using Bilinear Interpolation
+ {
+ RectF zoomRect(50, 10, 160, 160);
+ graphics->SetInterpolationMode(InterpolationModeBilinear);
+ graphics->DrawImage(&image, zoomRect);
+ graphics->DrawRectangle(&redPen, zoomRect);
+ DrawLineMarks(graphics, &greenPen, 50, 10, 160, 160);
+ }
+
+ // zoom using Nearest Neighborhood
+ {
+ RectF zoomRect2(250, 10, 160, 160);
+ graphics->SetInterpolationMode(InterpolationModeNearestNeighbor);
+ graphics->DrawImage(&image, zoomRect2);
+ graphics->DrawRectangle(&redPen, zoomRect2);
+ DrawLineMarks(graphics, &greenPen, 250, 10, 160, 160);
+ }
+
+
+ // Using a source image size, smaller than actual
+
+
+ // NO zoom
+ {
+ RectF actualRect3(10, 200, 16, 16);
+ graphics->DrawImage(&image, actualRect3, 0, 0, 16-1, 16-1, UnitPixel, NULL, NULL);
+ graphics->DrawRectangle(&redPen, actualRect3);
+ DrawLineMarks(graphics, &greenPen, 10, 400, 16, 16);
+ }
+
+ // zoom using Bilinear Interpolation
+ {
+ RectF zoomRect6(50, 200, 160, 160);
+ graphics->SetInterpolationMode(InterpolationModeBilinear);
+ graphics->DrawImage(&image, zoomRect6, 0, 0, 16-1, 16-1, UnitPixel, NULL, NULL);
+ graphics->DrawRectangle(&redPen, zoomRect6);
+ DrawLineMarks(graphics, &greenPen, 50, 400, 160, 160);
+ }
+
+ // zoom using Nearest Neighborhood
+ {
+ RectF zoomRect7(250, 200, 160, 160);
+ graphics->SetInterpolationMode(InterpolationModeNearestNeighbor);
+ graphics->DrawImage(&image, zoomRect7, 0, 0, 16-1, 16-1, UnitPixel, NULL, NULL);
+ graphics->DrawRectangle(&redPen, zoomRect7);
+ DrawLineMarks(graphics, &greenPen, 250, 400, 160, 160);
+ }
+
+ delete graphics;
+}
+
+#include <iup.h>
+
+extern "C" char* winData;
+extern "C" void SimpleDrawTest(void);
+
+void SimpleDrawTest(void)
+{
+ HWND hWnd = (HWND)IupGetAttribute((Ihandle*)winData, "HWND");
+ SimpleImageTest(hWnd);
+}
diff --git a/test/simple/iupmain.c b/test/simple/iupmain.c
new file mode 100644
index 0000000..7db2672
--- /dev/null
+++ b/test/simple/iupmain.c
@@ -0,0 +1,83 @@
+
+#include <iup.h>
+#include <cd.h>
+
+#include "simple.h"
+
+int cmdExit(void)
+{
+ return IUP_CLOSE;
+}
+
+void simple_loadled (void);
+
+int main(void)
+{
+ IupOpen();
+
+ cdInitContextPlus();
+
+ simple_loadled();
+
+ IupSetAttribute(IupGetHandle("SimpleDialog"), "PLACEMENT", "MAXIMIZED");
+ IupShow(IupGetHandle("SimpleDialog"));
+
+ SimpleCreateCanvas((char*)IupGetHandle("SimpleCanvas"));
+
+ IupSetFunction("cmdExit", (Icallback) cmdExit);
+
+ IupSetFunction("SimplePlayClipboard", (Icallback) SimplePlayClipboard);
+ IupSetFunction("SimplePlayCGMText", (Icallback) SimplePlayCGMText);
+ IupSetFunction("SimplePlayCGMBin", (Icallback) SimplePlayCGMBin);
+ IupSetFunction("SimplePlayMetafile", (Icallback) SimplePlayMetafile);
+ IupSetFunction("SimplePlayWMF", (Icallback) SimplePlayWMF);
+ IupSetFunction("SimplePlayEMF", (Icallback) SimplePlayEMF);
+
+ IupSetFunction("SimpleDrawDebug", (Icallback) SimpleDrawDebug);
+ IupSetFunction("SimpleDrawWindow", (Icallback) SimpleDrawWindow);
+ IupSetFunction("SimpleDrawCGMText", (Icallback) SimpleDrawCGMText);
+ IupSetFunction("SimpleDrawCGMBin", (Icallback) SimpleDrawCGMBin);
+ IupSetFunction("SimpleDrawDXF", (Icallback) SimpleDrawDXF);
+ IupSetFunction("SimpleDrawDGN", (Icallback) SimpleDrawDGN);
+ IupSetFunction("SimpleDrawEMF", (Icallback) SimpleDrawEMF);
+ IupSetFunction("SimpleDrawMetafile", (Icallback) SimpleDrawMetafile);
+ IupSetFunction("SimpleDrawPDF", (Icallback) SimpleDrawPDF);
+ IupSetFunction("SimpleDrawPS", (Icallback) SimpleDrawPS);
+ IupSetFunction("SimpleDrawEPS", (Icallback) SimpleDrawEPS);
+ IupSetFunction("SimpleDrawWMF", (Icallback) SimpleDrawWMF);
+ IupSetFunction("SimpleDrawPrint", (Icallback) SimpleDrawPrint);
+ IupSetFunction("SimpleDrawPrintDialog", (Icallback) SimpleDrawPrintDialog);
+ IupSetFunction("SimpleDrawClipboardBitmap", (Icallback) SimpleDrawClipboardBitmap);
+ IupSetFunction("SimpleDrawClipboardMetafile", (Icallback) SimpleDrawClipboardMetafile);
+ IupSetFunction("SimpleDrawClipboardEMF", (Icallback) SimpleDrawClipboardEMF);
+ IupSetFunction("SimpleDrawImage", (Icallback) SimpleDrawImage);
+ IupSetFunction("SimpleDrawImageRGB", (Icallback) SimpleDrawImageRGB);
+ IupSetFunction("SimpleDrawSimulate", (Icallback) SimpleDrawSimulate);
+
+ IupSetFunction("SimpleNotXor", (Icallback) SimpleNotXor);
+ IupSetFunction("SimpleXor", (Icallback) SimpleXor);
+ IupSetFunction("SimpleReplace", (Icallback) SimpleReplace);
+ IupSetFunction("SimpleClippingOff", (Icallback) SimpleClippingOff);
+ IupSetFunction("SimpleClippingArea", (Icallback) SimpleClippingArea);
+ IupSetFunction("SimpleClippingPolygon", (Icallback) SimpleClippingPolygon);
+ IupSetFunction("SimpleClippingRegion", (Icallback) SimpleClippingRegion);
+ IupSetFunction("SimpleContextPlus", (Icallback) SimpleContextPlus);
+ IupSetFunction("SimpleTransform", (Icallback) SimpleTransform);
+
+ IupSetFunction("SimpleDrawAll", (Icallback) SimpleDrawAll);
+ IupSetFunction("SimpleDrawTextAlign", (Icallback) SimpleDrawTextAlign);
+ IupSetFunction("SimpleDrawTextFonts", (Icallback) SimpleDrawTextFonts);
+ IupSetFunction("SimpleDrawTest", (Icallback) SimpleDrawTest);
+
+ IupSetFunction("SimpleRepaint", (Icallback) SimpleDrawRepaint);
+
+ SimpleDrawWindow();
+
+ IupMainLoop();
+
+ SimpleKillCanvas();
+
+ IupClose();
+
+ return 1;
+}
diff --git a/test/simple/makefile.linux b/test/simple/makefile.linux
new file mode 100644
index 0000000..5d014e0
--- /dev/null
+++ b/test/simple/makefile.linux
@@ -0,0 +1,18 @@
+CC = gcc
+
+CFLAGS = -I../cd/include -I../iup/include -I/usr/X11R6/include
+
+LIBS = -L../cd/lib/Linux26 -L../iup/lib/Linux26 -L/usr/X11R6/lib \
+ -lcdiup -lcd -liup \
+ -lXm -lXpm -lXmu -lXt -lXext -lX11
+
+OBJS = simple.o iupmain.o
+
+simple.o: simple.c simple.h
+ $(CC) -o $@ -c simple.c $(CFLAGS)
+
+iupmain.o: iupmain.c simple.h
+ $(CC) -o $@ -c iupmain.c $(CFLAGS)
+
+simple: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS)
diff --git a/test/simple/makefile.mingw3 b/test/simple/makefile.mingw3
new file mode 100644
index 0000000..cf735e8
--- /dev/null
+++ b/test/simple/makefile.mingw3
@@ -0,0 +1,20 @@
+CC = gcc
+
+CFLAGS = -I../cd/include -I../iup/include
+
+LIBS = -L../cd/lib/mingw3 -L../iup/lib/mingw3 \
+ -lcdiup -lcd -liup \
+ -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lole32 -lcomctl32
+
+OBJS = simple.o iupmain.o
+
+all: simple.exe
+
+simple.o: simple.c simple.h
+ $(CC) -o $@ -c simple.c $(CFLAGS)
+
+iupmain.o: iupmain.c simple.h
+ $(CC) -o $@ -c iupmain.c $(CFLAGS)
+
+simple.exe: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS)
diff --git a/test/simple/simple.bat b/test/simple/simple.bat
new file mode 100644
index 0000000..fa8f118
--- /dev/null
+++ b/test/simple/simple.bat
@@ -0,0 +1,3 @@
+@echo off
+REM Script generated automatically by tecmake v3.13
+..\bin\Win32\simple.exe %*
diff --git a/test/simple/simple.c b/test/simple/simple.c
new file mode 100644
index 0000000..efdee2e
--- /dev/null
+++ b/test/simple/simple.c
@@ -0,0 +1,1312 @@
+/*
+
+ Simple Draw Application
+
+ Shows the same picture on several canvas. Used to quick test the CD library and
+ to demonstrate the use of CD library functions.
+
+ This module uses only the CD library, there is another module to initialize the Window and its menus.
+
+*/
+
+
+#include "cd.h"
+#include "cdcgm.h"
+#include "cddgn.h"
+#include "cddxf.h"
+#include "cdclipbd.h"
+#include "cdemf.h"
+#include "cdimage.h"
+#include "cdirgb.h"
+#include "cdmf.h"
+#include "cdprint.h"
+#include "cdps.h"
+#include "cdpdf.h"
+#include "cdwmf.h"
+#include "cdiup.h"
+#include "cddbuf.h"
+#include "cddebug.h"
+#include "wd.h"
+#include "cdgdiplus.h"
+
+#include "simple.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+#include <string.h>
+
+/* Global variables */
+
+cdCanvas *winCanvas = NULL; /* The window drawing canvas */
+char* winData = NULL;
+cdCanvas *dbCanvas = NULL; /* The double buffer canvas */
+cdCanvas *curCanvas = NULL; /* The current canvas */
+
+int clipping = CD_CLIPOFF; /* Clipping flag, same as the CD */
+int write_mode = CD_REPLACE; /* Write Mode flag, same as the CD */
+int gdpiplus = 0;
+int simple_draw = 0;
+int use_transform = 0;
+int simulate = 0;
+
+enum {DRAW_ALL, DRAW_TEXTFONTS, DRAW_TEXTALIGN, DRAW_TEST};
+
+#define STYLE_SIZE 10 /* A small pattern and stipple size */
+long pattern[STYLE_SIZE*STYLE_SIZE]; /* Pattern buffer */
+unsigned char stipple[STYLE_SIZE*STYLE_SIZE]; /* Stipple buffer */
+
+#define IMAGE_SIZE 100
+unsigned char red[IMAGE_SIZE*IMAGE_SIZE]; /* Red image buffer */
+unsigned char green[IMAGE_SIZE*IMAGE_SIZE]; /* Green image buffer */
+unsigned char blue[IMAGE_SIZE*IMAGE_SIZE]; /* Blue image buffer */
+unsigned char alpha[IMAGE_SIZE*IMAGE_SIZE]; /* Alpha image buffer */
+
+
+/* Prototype of the function that makes the drawing independent of canvas. */
+void SimpleDraw(void);
+
+void SimpleInitAlpha(int width, int height, unsigned char* _alpha)
+{
+ int c, l;
+ /* initialize the alpha image buffer with a degrade from transparent to opaque */
+ for (l = 0; l < height; l++)
+ for (c = 0; c < width; c++)
+ _alpha[l*width + c] = (unsigned char)((c*255)/(width-1));
+}
+
+void SimpleCreateCanvasWindow(void)
+{
+ /* creates the canvas based in an existing window */
+ if (gdpiplus) cdUseContextPlus(1);
+ winCanvas = cdCreateCanvas(CD_IUP, winData);
+ if (gdpiplus) cdUseContextPlus(0);
+ curCanvas = winCanvas;
+}
+
+void SimpleCreateCanvas(char* data)
+{
+ int c, l;
+
+ memset(pattern, 0xFF, STYLE_SIZE*STYLE_SIZE*4);
+
+ pattern[11] = CD_RED; /*------------*/
+ pattern[21] = CD_RED; /* 0123456789*/
+ pattern[31] = CD_RED; /* */
+ pattern[41] = CD_RED; /*9 WWWWWWWWWW*/
+ pattern[51] = CD_RED; /*8 WWWWGGGGGW*/
+ pattern[12] = CD_RED; /*7 WWWGGGGGBW*/
+ pattern[22] = CD_RED; /*6 WWGGGGGBBW*/
+ pattern[32] = CD_RED; /*5 WrrrrrBBBW*/
+ pattern[42] = CD_RED; /*4 WrrrrrBBBW*/
+ pattern[52] = CD_RED; /*3 WrrrrrBBWW*/
+ pattern[13] = CD_RED; /*2 WrrrrrBWWW*/
+ pattern[23] = CD_RED; /*1 WrrrrrWWWW*/
+ pattern[33] = CD_RED; /*0 WWWWWWWWWW*/
+ pattern[43] = CD_RED; /*------------*/
+ pattern[53] = CD_RED;
+ pattern[14] = CD_RED; pattern[15] = CD_RED;
+ pattern[24] = CD_RED; pattern[25] = CD_RED;
+ pattern[34] = CD_RED; pattern[35] = CD_RED;
+ pattern[44] = CD_RED; pattern[45] = CD_RED;
+ pattern[54] = CD_RED; pattern[55] = CD_RED;
+
+ pattern[26] = CD_BLUE; pattern[37] = CD_BLUE;
+ pattern[36] = CD_BLUE; pattern[47] = CD_BLUE;
+ pattern[46] = CD_BLUE; pattern[57] = CD_BLUE;
+ pattern[56] = CD_BLUE; pattern[67] = CD_BLUE;
+
+ pattern[48] = CD_BLUE; pattern[62] = CD_GREEN;
+ pattern[58] = CD_BLUE; pattern[63] = CD_GREEN;
+ pattern[68] = CD_BLUE; pattern[64] = CD_GREEN;
+ pattern[78] = CD_BLUE; pattern[65] = CD_GREEN;
+ pattern[66] = CD_GREEN;
+
+ pattern[73] = CD_GREEN; pattern[84] = CD_GREEN;
+ pattern[74] = CD_GREEN; pattern[85] = CD_GREEN;
+ pattern[75] = CD_GREEN; pattern[86] = CD_GREEN;
+ pattern[76] = CD_GREEN; pattern[87] = CD_GREEN;
+ pattern[77] = CD_GREEN; pattern[88] = CD_GREEN;
+
+ /* initialize the stipple buffer with cross pattern */
+ for (l = 0; l < STYLE_SIZE; l++)
+ for (c = 0; c < STYLE_SIZE; c++)
+ stipple[l*STYLE_SIZE + c] = (c % 4) == 0? 1: 0;
+
+ SimpleInitAlpha(IMAGE_SIZE, IMAGE_SIZE, alpha);
+
+ winData = data;
+ SimpleCreateCanvasWindow();
+ SimpleDrawWindow();
+}
+
+int SimpleTransform(void)
+{
+ use_transform = !use_transform;
+ SimpleDrawRepaint();
+ return 0;
+}
+
+int SimpleContextPlus(void)
+{
+ gdpiplus = !gdpiplus;
+ SimpleKillCanvas();
+ SimpleCreateCanvasWindow();
+ SimpleDrawRepaint();
+ return 0;
+}
+
+void PlayCanvasDriver(cdContext* ctx, char* StrData)
+{
+ int w, h;
+ cdActivate(curCanvas);
+ cdBackground(CD_WHITE);
+ cdClear();
+ cdGetCanvasSize(&w, &h, 0, 0);
+ cdPlay(ctx, 100, w-100, 100, h-100, StrData);
+// cdPlay(ctx, 0, 0, 0, 0, StrData);
+}
+
+int SimplePlayClipboard(void)
+{
+ PlayCanvasDriver(CD_CLIPBOARD, NULL);
+ return 0;
+}
+
+int SimplePlayCGMBin(void)
+{
+ PlayCanvasDriver(CD_CGM, "simple_b.cgm");
+ return 0;
+}
+
+int SimplePlayCGMText(void)
+{
+ PlayCanvasDriver(CD_CGM, "simple_t.cgm");
+ return 0;
+}
+
+int SimplePlayMetafile(void)
+{
+ PlayCanvasDriver(CD_METAFILE, "simple.mf");
+ return 0;
+}
+
+int SimplePlayWMF(void)
+{
+ PlayCanvasDriver(CD_WMF, "simple.wmf");
+ return 0;
+}
+
+int SimplePlayEMF(void)
+{
+ PlayCanvasDriver(CD_EMF, "simple.emf");
+ return 0;
+}
+
+int SimpleDrawRepaint(void)
+{
+ cdActivate(curCanvas);
+ SimpleDraw();
+ cdFlush();
+ return 0;
+}
+
+int SimpleDrawWindow(void)
+{
+ curCanvas = winCanvas;
+ return SimpleDrawRepaint();
+}
+
+void DrawCanvasDriver(cdContext* ctx, char* StrData)
+{
+ cdCanvas* tmpCanvas = cdCreateCanvas(ctx, StrData);
+ if (tmpCanvas == NULL) return;
+ cdActivate(tmpCanvas);
+ SimpleDraw();
+ cdKillCanvas(tmpCanvas);
+ cdActivate(curCanvas);
+}
+
+void DrawCanvasDriverSize(cdContext* ctx, char* name, int pixels)
+{
+ char StrData[100];
+ int w, h;
+ double w_mm, h_mm;
+ cdActivate(curCanvas);
+ cdGetCanvasSize(&w, &h, &w_mm, &h_mm);
+ if (pixels)
+ sprintf(StrData, "%s %dx%d", name, w, h);
+ else
+ sprintf(StrData, "%s %gx%g", name, w_mm, h_mm);
+ DrawCanvasDriver(ctx, StrData);
+}
+
+void DrawCanvasDriverSizeParam(cdContext* ctx, char* param)
+{
+ char StrData[100];
+ int w, h;
+ cdActivate(curCanvas);
+ cdGetCanvasSize(&w, &h, 0, 0);
+ sprintf(StrData, "%dx%d %s", w, h, param);
+ DrawCanvasDriver(ctx, StrData);
+}
+
+int SimpleDrawDebug(void)
+{
+ DrawCanvasDriverSize(CD_DEBUG, "simple_debug.txt", 0);
+ return 0;
+}
+
+int SimpleDrawCGMText(void)
+{
+ DrawCanvasDriverSize(CD_CGM, "simple_t.cgm - t", 0);
+ return 0;
+}
+
+int SimpleDrawCGMBin(void)
+{
+ DrawCanvasDriverSize(CD_CGM, "simple_b.cgm", 0);
+ return 0;
+}
+
+int SimpleDrawDXF(void)
+{
+ DrawCanvasDriverSize(CD_DXF, "simple.dxf", 0);
+ return 0;
+}
+
+int SimpleDrawDGN(void)
+{
+ DrawCanvasDriverSize(CD_DGN, "simple.dgn", 0);
+ return 0;
+}
+
+int SimpleDrawEMF(void)
+{
+ if (gdpiplus) cdUseContextPlus(1);
+ DrawCanvasDriverSize(CD_EMF, "simple.emf", 1);
+ if (gdpiplus) cdUseContextPlus(0);
+ return 0;
+}
+
+int SimpleDrawMetafile(void)
+{
+ DrawCanvasDriverSize(CD_METAFILE, "simple.mf", 0);
+ return 0;
+}
+
+int SimpleDrawPS(void)
+{
+ DrawCanvasDriver(CD_PS, "simple.ps");
+ return 0;
+}
+
+int SimpleDrawPDF(void)
+{
+// DrawCanvasDriver(CD_PDF, "simple.pdf");
+ return 0;
+}
+
+int SimpleDrawEPS(void)
+{
+ DrawCanvasDriver(CD_PS, "simple.eps -e");
+ return 0;
+}
+
+int SimpleDrawWMF(void)
+{
+ DrawCanvasDriverSize(CD_WMF, "simple.wmf", 1);
+ return 0;
+}
+
+int SimpleDrawPrint(void)
+{
+ if (gdpiplus) cdUseContextPlus(1);
+ DrawCanvasDriver(CD_PRINTER, "simple print");
+ if (gdpiplus) cdUseContextPlus(0);
+ return 0;
+}
+
+int SimpleDrawPrintDialog(void)
+{
+ if (gdpiplus) cdUseContextPlus(1);
+ DrawCanvasDriver(CD_PRINTER, "simple -d");
+ if (gdpiplus) cdUseContextPlus(0);
+ return 0;
+}
+
+int SimpleDrawClipboardBitmap(void)
+{
+ if (gdpiplus) cdUseContextPlus(1);
+ DrawCanvasDriverSizeParam(CD_CLIPBOARD, "-b");
+ if (gdpiplus) cdUseContextPlus(0);
+ return 0;
+}
+
+int SimpleDrawClipboardMetafile(void)
+{
+ if (gdpiplus) cdUseContextPlus(1);
+ DrawCanvasDriverSizeParam(CD_CLIPBOARD, "-m");
+ if (gdpiplus) cdUseContextPlus(0);
+ return 0;
+}
+
+int SimpleDrawClipboardEMF(void)
+{
+ if (gdpiplus) cdUseContextPlus(1);
+ DrawCanvasDriverSizeParam(CD_CLIPBOARD, "");
+ if (gdpiplus) cdUseContextPlus(0);
+ return 0;
+}
+
+int SimpleReplace(void)
+{
+ write_mode = CD_REPLACE;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+int SimpleXor(void)
+{
+ write_mode = CD_XOR;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+int SimpleNotXor(void)
+{
+ write_mode = CD_NOT_XOR;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+int SimpleClippingOff(void)
+{
+ clipping = CD_CLIPOFF;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+int SimpleClippingArea(void)
+{
+ clipping = CD_CLIPAREA;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+int SimpleClippingPolygon(void)
+{
+ clipping = CD_CLIPPOLYGON;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+int SimpleClippingRegion(void)
+{
+ clipping = CD_CLIPREGION;
+ cdActivate(curCanvas);
+ SimpleDrawAll();
+ return 0;
+}
+
+void* CreateImageRGBA(int w, int h)
+{
+ void* myImage;
+ unsigned char * _alpha = malloc(w * h);
+ SimpleInitAlpha(w, h, _alpha);
+ cdSetAttribute("IMAGEALPHA", (char*)_alpha);
+ cdSetAttribute("IMAGEFORMAT", "32"); // afetara´ o proximo cdCreateImage
+ myImage = cdCreateImage(w, h);
+ cdSetAttribute("IMAGEFORMAT", NULL); // remove o atributo para nao afetar outros cdCreateImage
+ return myImage;
+}
+
+int SimpleDrawImage(void)
+{
+ if (dbCanvas) cdKillCanvas(dbCanvas);
+
+ if (gdpiplus) cdUseContextPlus(1);
+ dbCanvas = cdCreateCanvas(CD_DBUFFER, winCanvas);
+ if (gdpiplus) cdUseContextPlus(0);
+
+ curCanvas = dbCanvas;
+ SimpleDrawRepaint();
+
+ return 0;
+}
+
+int SimpleDrawImageRGB(void)
+{
+ if (dbCanvas) cdKillCanvas(dbCanvas);
+
+ if (gdpiplus) cdUseContextPlus(1);
+ dbCanvas = cdCreateCanvas(CD_DBUFFERRGB, winCanvas);
+ if (gdpiplus) cdUseContextPlus(0);
+
+ curCanvas = dbCanvas;
+ SimpleDrawRepaint();
+
+ return 0;
+}
+
+int SimpleDrawSimulate(void)
+{
+ cdActivate(curCanvas);
+
+ simulate = !simulate;
+
+ if (simulate)
+ cdSimulate(CD_SIM_ALL);
+ else
+ cdSimulate(CD_SIM_NONE);
+
+ SimpleDrawRepaint();
+
+ return 0;
+}
+
+void SimpleKillCanvas(void)
+{
+ if (dbCanvas)
+ {
+ cdKillCanvas(dbCanvas);
+ dbCanvas = NULL;
+ }
+ if (winCanvas)
+ {
+ cdKillCanvas(winCanvas);
+ winCanvas = NULL;
+ }
+}
+
+void SimpleDraw(void)
+{
+ if (simple_draw == DRAW_TEXTFONTS)
+ SimpleDrawTextFonts();
+ else if (simple_draw == DRAW_TEXTALIGN)
+ SimpleDrawTextAlign();
+ else if (simple_draw == DRAW_TEST)
+ SimpleDrawTest();
+ else
+ SimpleDrawAll();
+}
+
+int SimpleDrawAll(void)
+{
+ int w, h;
+ cdGetCanvasSize(&w, &h, 0, 0);
+
+ simple_draw = DRAW_ALL;
+
+ wdViewport(0,w-1,0,h-1);
+ if (w>h)
+ wdWindow(0,(double)w/(double)h,0,1);
+ else
+ wdWindow(0,1,0,(double)h/(double)w);
+
+ /* Clear the background to be white */
+// cdBackground(CD_WHITE);
+ cdBackground(CD_GREEN);
+ cdClear();
+
+ cdLineWidth(3);
+ cdForeground(cdEncodeAlpha(CD_DARK_MAGENTA, 128));
+ cdRect(100, 200, 100, 200);
+
+ cdBegin(CD_OPEN_LINES);
+ cdVertex(300, 250);
+ cdVertex(320, 270);
+ cdVertex(350, 260);
+ cdVertex(340, 200);
+ cdVertex(310, 210);
+ cdEnd();
+
+ cdInteriorStyle(CD_SOLID);
+
+ cdForeground(CD_RED);
+ cdLineWidth(3);
+ {
+ int dashes[] = {20, 15, 5, 5};
+ cdLineStyleDashes(dashes, 4);
+ }
+ cdLineStyle(CD_CUSTOM);
+ cdLine(0, 0, w-1, h-1);
+
+ cdForeground(CD_BLUE);
+ cdLineWidth(10);
+ cdLineStyle(CD_DOTTED);
+ //cdLine(0, 0, 500, 500);
+// wdLine(0, 1, 1, 0);
+ cdLine(0, h-1, w-1, 0);
+
+ switch(clipping)
+ {
+ case CD_CLIPOFF:
+ cdClip(CD_CLIPOFF);
+ break;
+ case CD_CLIPAREA:
+ /* Defines the clipping area equals the canvas area minus a 100 pixels margin. */
+ cdClipArea(100, w - 100, 100, h - 100);
+ cdClip(CD_CLIPAREA);
+ break;
+ case CD_CLIPPOLYGON:
+ cdBegin(CD_CLIP);
+ cdVertex(100, 100);
+ cdVertex(w - 100, 100);
+ cdVertex(w / 2, h - 100);
+ cdEnd();
+ cdClip(CD_CLIPPOLYGON);
+ break;
+ case CD_CLIPREGION:
+ cdTextAlignment(CD_CENTER);
+ cdFont(CD_TIMES_ROMAN, CD_BOLD, 50);
+
+ cdBegin(CD_REGION);
+ cdRegionCombineMode(CD_UNION);
+ cdBox(100, 200, 100, 200);
+ cdSector(w/2-50, h/2+50, 150, 150, 0, 360);
+ cdSector(w/2-50, h/2-50, 150, 150, 0, 360);
+ cdSector(w/2+50, h/2+50, 150, 150, 0, 360);
+ cdSector(w/2+50, h/2-50, 150, 150, 0, 360);
+ cdRegionCombineMode(CD_DIFFERENCE);
+ cdText(w/2, h/2, "TEXT");
+ cdEnd();
+// cdOffsetRegion(-50, 50);
+ cdClip(CD_CLIPREGION);
+
+ cdForeground(CD_DARK_RED);
+ cdBox(0,w,0,h);
+ break;
+ }
+
+ switch(write_mode)
+ {
+ case CD_REPLACE:
+ cdWriteMode(CD_REPLACE);
+ break;
+ case CD_XOR:
+ cdWriteMode(CD_XOR);
+ break;
+ case CD_NOT_XOR:
+ cdWriteMode(CD_NOT_XOR);
+ break;
+ }
+
+ if (use_transform)
+ {
+ cdCanvasTransform(cdActiveCanvas(), NULL);
+ cdCanvasTransformTranslate(cdActiveCanvas(), w/2, h/2);
+ cdCanvasTransformRotate(cdActiveCanvas(), 30);
+ cdCanvasTransformScale(cdActiveCanvas(), 0.5, 0.5);
+ cdCanvasTransformTranslate(cdActiveCanvas(), -w/2, -h/2);
+ }
+
+// cdSetfAttribute("ROTATE", "15 %d %d", w/2, h/2);
+
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdBackOpacity(CD_TRANSPARENT);
+
+ cdForeground(CD_MAGENTA);
+ cdSector(w-100, 100, 100, 100, 50, 180);
+ cdForeground(CD_RED);
+ cdArc(100, 100, 100, 100, 50, 180);
+
+ cdForeground(CD_YELLOW);
+ cdBox(w/2 - 100, w/2 + 100, h/2 - 100, h/2 + 100);
+
+ cdTextAlignment(CD_CENTER);
+ cdTextOrientation(70);
+ cdFont(CD_TIMES_ROMAN, CD_BOLD, 24);
+
+ {
+ int rect[8];
+ cdTextBounds(w/2, h/2, "cdMin Draw (çãí)", rect);
+ cdForeground(CD_RED);
+ cdBegin(CD_CLOSED_LINES);
+ cdVertex(rect[0], rect[1]);
+ cdVertex(rect[2], rect[3]);
+ cdVertex(rect[4], rect[5]);
+ cdVertex(rect[6], rect[7]);
+ cdEnd();
+ }
+ cdForeground(CD_BLUE);
+ cdText(w/2, h/2, "cdMin Draw (çãí)");
+ cdTextOrientation(0);
+
+ wdBox(0.20, 0.30, 0.40, 0.50);
+ cdForeground(CD_RED);
+ wdLine(0.20, 0.40, 0.30, 0.50);
+
+// wdVectorTextDirection(0, 0, 1, 1);
+ wdVectorCharSize(0.07);
+
+// wdVectorText(0.1, 0.4, "ñç áéíóú àèìòù âêîôû äëïöü");
+// wdVectorText(0.1, 0.2, "ÑÇ ÁÉÍÓÚ ÀÈÌÒÙ ÂÊÎÔÛ ÄËÏÖÜ");
+ //{
+ // int i;
+ // char t[2];
+ // char s[10];
+ // int x = 20;
+ // int y = 0;
+ // t[1] = 0;
+ // for (i = 0; i < 256; i++)
+ // {
+ // int dx = 90;
+ // t[0] = (char)i;
+ // sprintf(s, "%d", i);
+ // cdText(x, y, s);
+ // cdText(x+dx, y, t);
+ // cdVectorText(x+2*dx, y, t);
+ //
+ // x += 3*dx + 2*dx/3;
+ // if ((i+1) % 7 == 0)
+ // {
+ // x = 20;
+ // y += 90;
+ // }
+
+ // }
+ //}
+
+ {
+ double rect[8];
+ cdForeground(CD_RED);
+ if (gdpiplus)
+ wdGetVectorTextBounds("WDj-Plus", 0.25, 0.35, rect);
+ else
+ wdGetVectorTextBounds("WDj", 0.25, 0.35, rect);
+ cdBegin(CD_CLOSED_LINES);
+ wdVertex(rect[0], rect[1]);
+ wdVertex(rect[2], rect[3]);
+ wdVertex(rect[4], rect[5]);
+ wdVertex(rect[6], rect[7]);
+ cdEnd();
+ }
+
+ cdPixel(10, h/2+0, CD_RED);
+ cdPixel(11, h/2+1, CD_GREEN);
+ cdPixel(12, h/2+2, CD_BLUE);
+
+ /* draws all the mark type possibilities */
+ cdForeground(CD_RED);
+ cdMarkSize(30);
+ cdMarkType(CD_PLUS);
+ cdMark(200, 200);
+ cdMarkType(CD_CIRCLE);
+ cdMark(w - 200, 200);
+ cdMarkType(CD_HOLLOW_CIRCLE);
+ cdMark(200, h - 200);
+ cdMarkType(CD_DIAMOND);
+ cdMark(w - 200, h - 200);
+
+ /* draws all the line style possibilities */
+ cdLineWidth(1);
+ cdLineStyle(CD_CONTINUOUS);
+ cdLine(0, 10, w, 10);
+ cdLineStyle(CD_DASHED);
+ cdLine(0, 20, w, 20);
+ cdLineStyle(CD_DASH_DOT);
+ cdLine(0, 30, w, 30);
+ cdLineStyle(CD_DASH_DOT_DOT);
+ cdLine(0, 40, w, 40);
+
+ /* draws all the hatch style possibilities */
+ cdHatch(CD_VERTICAL);
+ cdBox(0, 50, h - 60, h);
+ cdHatch(CD_FDIAGONAL);
+ cdBox(50, 100, h - 60, h);
+ cdHatch(CD_BDIAGONAL);
+ cdBox(100, 150, h - 60, h);
+ cdHatch(CD_CROSS);
+ cdBox(150, 200, h - 60, h);
+ cdHatch(CD_HORIZONTAL);
+ cdBox(200, 250, h - 60, h);
+ cdHatch(CD_DIAGCROSS);
+ cdBox(250, 300, h - 60, h);
+
+ /* closed polygon */
+ cdBegin(CD_CLOSED_LINES);
+ cdVertex(w/2, h - 100);
+ cdVertex(w/2 + 50, h - 150);
+ cdVertex(w/2, h - 200);
+ cdVertex(w/2 - 50, h - 150);
+ cdEnd();
+
+ /* hatch filled polygon */
+ cdHatch(CD_DIAGCROSS);
+ cdBegin(CD_FILL);
+ cdVertex(100, h/2);
+ cdVertex(150, h/2 + 50);
+ cdVertex(200, h/2);
+ cdVertex(150, h/2 - 50);
+ cdEnd();
+
+ /* pattern filled polygon */
+ cdPattern(STYLE_SIZE, STYLE_SIZE, pattern);
+ cdBegin(CD_FILL);
+ cdVertex(w - 100, h/2);
+ cdVertex(w - 150, h/2 + 50);
+ cdVertex(w - 200, h/2);
+ cdVertex(w - 150, h/2 - 50);
+ cdEnd();
+
+ /* stipple filled polygon */
+ cdStipple(STYLE_SIZE, STYLE_SIZE, stipple);
+ cdBegin(CD_FILL);
+ cdVertex(w/2, 100);
+ cdVertex(w/2 + 50, 150);
+ cdVertex(w/2, 200);
+ cdVertex(w/2 - 50, 150);
+ cdEnd();
+
+ cdBegin(CD_BEZIER);
+ cdVertex(100, 100);
+ cdVertex(150, 200);
+ cdVertex(180, 250);
+ cdVertex(180, 200);
+ cdVertex(180, 150);
+ cdVertex(150, 100);
+ cdVertex(300, 100);
+ cdEnd();
+
+ cdLineWidth(2);
+ cdLineStyle(CD_CONTINUOUS);
+ if (gdpiplus)
+ wdVectorText(0.25, 0.35, "WDj-Plus");
+ else
+ wdVectorText(0.25, 0.35, "WDj");
+
+ /* always clear the image buffer contents */
+//#define IMAGE_SIZE 16
+ memset(red, 0xFF, IMAGE_SIZE*IMAGE_SIZE/2);
+ memset(green, 0x5F, IMAGE_SIZE*IMAGE_SIZE/2);
+ memset(blue, 0x5F, IMAGE_SIZE*IMAGE_SIZE/2);
+ memset(red+IMAGE_SIZE*IMAGE_SIZE/2, 0x5F, IMAGE_SIZE*IMAGE_SIZE/2);
+ memset(green+IMAGE_SIZE*IMAGE_SIZE/2, 0x8F, IMAGE_SIZE*IMAGE_SIZE/2);
+ memset(blue+IMAGE_SIZE*IMAGE_SIZE/2, 0x5F, IMAGE_SIZE*IMAGE_SIZE/2);
+ memset(red+IMAGE_SIZE*(IMAGE_SIZE-1), 0, IMAGE_SIZE);
+ memset(green+IMAGE_SIZE*(IMAGE_SIZE-1), 0, IMAGE_SIZE);
+ memset(blue+IMAGE_SIZE*(IMAGE_SIZE-1), 0, IMAGE_SIZE);
+ memset(red, 0, IMAGE_SIZE);
+ memset(green, 0, IMAGE_SIZE);
+ memset(blue, 0, IMAGE_SIZE);
+ {
+ int i, offset;
+ for (i = 0; i < IMAGE_SIZE; i++)
+ {
+ offset = i*IMAGE_SIZE;
+ red[offset] = 0;
+ green[offset] = 0;
+ blue[offset] = 0;
+ red[offset+IMAGE_SIZE-1] = 0;
+ green[offset+IMAGE_SIZE-1] = 0;
+ blue[offset+IMAGE_SIZE-1] = 0;
+ }
+ }
+
+ //cdSetAttribute("ANTIALIAS", "0");
+// cdGetImageRGB(red, green, blue, w/2 - 50, h/2-50, 100, 100);
+// cdPutImageRectRGB(14, 13, red, green, blue, -20, -15, 649, 603, 0, 13, 0, 12);
+// cdPutImageRectRGB(16, 16, red, green, blue, 10, 10, 608, 608, 5, 10, 5, 10);
+// cdPutImageRectRGB(16, 16, red, green, blue, 10, 10, 64, 64, 5, 10, 5, 10);
+
+// cdPutImageRGB(IMAGE_SIZE, IMAGE_SIZE, red, green, blue, 100, h - 200, IMAGE_SIZE, IMAGE_SIZE);
+// cdPutImageRGBA(IMAGE_SIZE, IMAGE_SIZE, red, green, blue, alpha, 100, h - 200, IMAGE_SIZE, IMAGE_SIZE);
+ cdPutImageRGB(IMAGE_SIZE, IMAGE_SIZE, red, green, blue, w - 400, h - 310, 3*IMAGE_SIZE, 3*IMAGE_SIZE);
+// cdPutImageRGBA(IMAGE_SIZE, IMAGE_SIZE, red, green, blue, alpha, w - 400, h - 310, 3*IMAGE_SIZE, 3*IMAGE_SIZE);
+
+ cdSetAttribute("ROTATE", NULL);
+ if (use_transform)
+ cdCanvasTransform(cdActiveCanvas(), NULL);
+ cdClip(CD_CLIPOFF);
+ cdFlush();
+
+ return 0;
+}
+
+void DrawTextBox(int x, int y, char* text)
+{
+ int xmin, xmax, ymin, ymax;
+
+ cdLineWidth(1);
+ cdLineStyle(CD_CONTINUOUS);
+
+ /* bounding box */
+ cdTextBox(x, y, text, &xmin, &xmax, &ymin, &ymax);
+ cdForeground(CD_GREEN);
+ cdRect(xmin, xmax, ymin, ymax);
+
+ /* baseline */
+ cdForeground(CD_RED);
+ cdLine(xmin, y, xmax, y);
+
+ /* reference point */
+ cdForeground(CD_BLUE);
+ cdMarkType(CD_PLUS);
+ cdMarkSize(30);
+ cdMark(x, y);
+
+ cdForeground(CD_BLACK);
+ cdText(x, y, text);
+}
+
+int SimpleDrawTextAlign(void)
+{
+ int w, h, i, xoff, yoff;
+
+ int text_aligment[] = {
+ CD_NORTH,
+ CD_SOUTH,
+ CD_EAST,
+ CD_WEST,
+ CD_NORTH_EAST,
+ CD_NORTH_WEST,
+ CD_SOUTH_EAST,
+ CD_SOUTH_WEST,
+ CD_CENTER,
+ CD_BASE_CENTER,
+ CD_BASE_RIGHT,
+ CD_BASE_LEFT
+ };
+
+ char* text_aligment_str[] = {
+ "jNorth (Ãy)",
+ "jSouth (Ãy)",
+ "jEast (Ãy)",
+ "jWest (Ãy)",
+ "jNorth East (Ãy)",
+ "jNorth West (Ãy)",
+ "jSouth East (Ãy)",
+ "jSouth West (Ãy)",
+ "jCenter (Ãy)",
+ "jBase Center (Ãy)",
+ "jBase Right (Ãy)",
+ "jBase Left (Ãy)"
+ };
+
+ cdGetCanvasSize(&w, &h, 0, 0);
+
+ cdBackground(CD_WHITE);
+ cdClear();
+
+ simple_draw = DRAW_TEXTALIGN;
+
+// cdTextOrientation(45);
+
+ xoff = w/4;
+ yoff = h/7;
+
+//cdFont(CD_TIMES_ROMAN, CD_PLAIN, 14);
+ cdFont(CD_HELVETICA, CD_PLAIN, 18);
+
+ for (i = 0; i < 12; i++)
+ {
+ cdTextAlignment(text_aligment[i]);
+ if (i < 6)
+ {
+ DrawTextBox(xoff, yoff*(i+1), text_aligment_str[i]);
+ }
+ else
+ {
+ DrawTextBox(3*xoff, yoff*(i-5), text_aligment_str[i]);
+ }
+ }
+ cdFlush();
+ return 0;
+}
+
+void DrawTextFont(int font, int size, int xoff, int yoff, char* text)
+{
+ cdFont(font, CD_PLAIN, size);
+ DrawTextBox(xoff, yoff, text);
+
+ cdFont(font, CD_BOLD, size);
+ DrawTextBox(2*xoff, yoff, text);
+
+ cdFont(font, CD_ITALIC, size);
+ DrawTextBox(3*xoff, yoff, text);
+
+ cdFont(font, CD_BOLD_ITALIC, size);
+ DrawTextBox(4*xoff, yoff, text);
+}
+
+int SimpleDrawTextFonts(void)
+{
+ int xoff, yoff, size;
+
+ cdBackground(CD_WHITE);
+ cdClear();
+
+ simple_draw = DRAW_TEXTFONTS;
+
+ xoff = 470;
+ yoff = 150;
+ size = -30;
+
+ cdTextAlignment(CD_CENTER);
+
+// DrawTextFont(CD_COURIER, size, xoff, yoff, "Courier");
+
+// DrawTextFont(CD_TIMES_ROMAN, size, xoff, 2*yoff, "Times Roman");
+
+// DrawTextFont(CD_HELVETICA, size, xoff, 3*yoff, "Helvetica");
+
+// DrawTextFont(CD_SYSTEM, size, xoff, 4*yoff, "System");
+
+ {
+// static char native[50] = "Tecmedia, -60";
+// static char native[50] = "-*-helvetica-medium-r-*-*-8-*";
+// static char native[50] = "Edwardian Script ITC, 24";
+// cdSetAttribute("ADDFONTMAP","Edwardian Script ITC=ITCEDSCR");
+
+// char native[50] = "Book Antiqua, 24";
+// cdSetAttribute("ADDFONTMAP", "Book Antiqua=BKANT");
+
+// cdNativeFont("-d");
+// cdNativeFont(native);
+// DrawTextBox(xoff, yoff, native);
+// DrawTextBox(xoff, yoff, "The quick brown fox.");
+ }
+
+ //cdNativeFont("Tecmedia, 36");
+
+ cdSetAttribute("ADDFONTMAP", "WingDings=WingDing");
+ cdNativeFont("WingDings, 36");
+
+ cdText(500, 50, "X");
+ //cdText(500, 50, "abcdefghijklmnopqrstuvwxyz");
+ //cdText(500, 150, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ //cdText(500, 250, "1234567890");
+ //cdText(500, 350, "'\"!@#$%¨&*()_+-=[]^/;.,");
+
+ //cdFont(CD_COURIER, 0, 22);
+ //cdText(10, 60, "abcdefghijklmnopqrstuvwxyz");
+ //cdText(10, 160, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ //cdText(10, 260, "1234567890");
+ //cdText(500, 360, "'\"!@#$%¨&*()_+-=[]^/;.,");
+
+ cdFlush();
+ return 0;
+}
+
+void SimpleDrawTest(void)
+//void SimpleDrawMainTest(void)
+{
+ long pattern[16]; /* 4x4 pattern */
+ int w, h;
+ int xmin, xmax, ymin, ymax;
+
+ simple_draw = DRAW_TEST;
+
+/* notice that if we are not using world coordinates
+ it is harder to position all the objetcs we want. */
+ cdGetCanvasSize(&w, &h, 0, 0);
+
+ cdBackground(CD_WHITE);
+ cdClear();
+
+/* pattern initialization */
+ pattern[0] = CD_RED; pattern[1] = CD_RED; /* first line */
+ pattern[2] = CD_YELLOW; pattern[3] = CD_YELLOW;
+ pattern[4] = CD_RED; pattern[5] = CD_RED; /* second line */
+ pattern[6] = CD_YELLOW; pattern[7] = CD_YELLOW;
+ pattern[8] = CD_YELLOW; pattern[9] = CD_YELLOW; /* third line */
+ pattern[10] = CD_YELLOW; pattern[11] = CD_YELLOW;
+ pattern[12] = CD_YELLOW; pattern[13] = CD_YELLOW; /* fourth line */
+ pattern[14] = CD_YELLOW; pattern[15] = CD_YELLOW;
+
+/* set the line attributes */
+ cdLineWidth(4);
+ cdLineStyle(CD_CONTINUOUS);
+
+/* in the center draw a pattern pizza
+ with a slice mising */
+ cdPattern(4, 4, pattern);
+ cdSector(w/2, h/2, w/2, h/2, 45, 0);
+/* draws a dark red border */
+ cdForeground(CD_DARK_RED);
+ cdInteriorStyle(CD_HOLLOW);
+ cdSector(w/2, h/2, w/2, h/2, 45, 0);
+
+/* on the left a red hash diamond */
+/* notice the the default back opacity is transparent
+ and the pattern of the sector will still be visible
+ inside the hatch where the two objects intersect */
+ cdForeground(CD_RED);
+ cdHatch(CD_DIAGCROSS);
+ cdBegin(CD_FILL);
+ cdVertex(w/4, h/4);
+ cdVertex(w/2-w/8, h/2);
+ cdVertex(w/4, 3*h/4);
+ cdVertex(w/8, h/2);
+ cdEnd();
+
+/* draws a blue roof.*/
+ cdForeground(CD_BLUE);
+ cdLine(w/8, h/2, w/4, 3*h/4);
+ cdLine(w/4, 3*h/4, w/2-w/8, h/2);
+
+/* draws a dashed ribbon on the right
+ with a custom color */
+ cdForeground(cdEncodeColor(100, 25, 200));
+ cdLineStyle(CD_DASH_DOT);
+ cdBegin(CD_BEZIER);
+ cdVertex(3*w/4-20, h/2-50);
+ cdVertex(3*w/4+150, 3*h/4-50);
+ cdVertex(3*w/4-150, 3*h/4-50);
+ cdVertex(3*w/4+20, h/2-50);
+ cdEnd();
+
+ cdFont(CD_HELVETICA, CD_BOLD, 40);
+ cdTextAlignment(CD_CENTER);
+ cdText(w/2, h/4-50, "Canvas Draw");
+ cdTextBox(w/2, h/4-50, "Canvas Draw", &xmin, &xmax, &ymin, &ymax);
+ cdRect(xmin, xmax, ymin, ymax);
+ cdFlush();
+}
+
+void draw_wd(void)
+{
+ cdBackground(CD_WHITE);
+ cdClear();
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+
+ wdVectorTextDirection(0, 0, 1, 1);
+
+ wdVectorCharSize(0.1);
+ wdVectorText(0.25, 0.35, "Vector Text");
+
+ {
+ double rect[8];
+ cdForeground(CD_RED);
+ wdGetVectorTextBounds("Vector Text", 0.25, 0.35, rect);
+ cdBegin(CD_CLOSED_LINES);
+ wdVertex(rect[0], rect[1]);
+ wdVertex(rect[2], rect[3]);
+ wdVertex(rect[4], rect[5]);
+ wdVertex(rect[6], rect[7]);
+ cdEnd();
+ }
+ cdFlush();
+}
+
+void SimpleDrawTestHardCopy(void)
+{
+ int w, h;
+ cdGetCanvasSize(&w, &h, 0, 0);
+
+ simple_draw = DRAW_ALL;
+
+ wdViewport(0,w-1,0,h-1);
+ if (w>h)
+ wdWindow(0,(double)w/(double)h,0,1);
+ else
+ wdWindow(0,1,0,(double)h/(double)w);
+
+ draw_wd();
+
+ wdHardcopy(CD_CLIPBOARD, "800x600", cdActiveCanvas(), draw_wd );
+ cdFlush();
+}
+
+void SimpleDrawTestImageRGB(void)
+{
+ int size = 2048*2048;
+ unsigned char *red, *green, *blue;
+ cdCanvas* canvas = cdCreateCanvas(CD_IMAGERGB, "2048x2048");
+ cdActivate(canvas);
+
+ red = calloc(size, 1);
+ green = calloc(size, 1);
+ blue = calloc(size, 1);
+
+ cdPutImageRectRGB(2048, 2048, red, green, blue, 0, 3, 2048, 2017, 0, 2047, 3, 2020);
+
+ free(red);
+ free(green);
+ free(blue);
+
+ cdKillCanvas(canvas);
+ cdFlush();
+}
+
+//void SimpleDrawTest(void)
+void SimpleDrawVectorText(void)
+{
+ simple_draw = DRAW_TEST;
+ cdBackground(CD_WHITE);
+ cdClear();
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+
+// wdVectorText(0.1, 0.4, "ãõñç áéíóú àèìòù âêîôû äëïöü");
+// wdVectorText(0.1, 0.2, "ÃÕÑÇ ÁÉÍÓÚ ÀÈÌÒÙ ÂÊÎÔÛ ÄËÏÖÜ ");
+ cdVectorFont("../../etc/vectorfont26.txt"); /* original Simplex II */
+ {
+ int i;
+ char t[2];
+ char s[10];
+ int x = 10;
+ int y = 600;
+ t[1] = 0;
+ cdFont(CD_COURIER, CD_BOLD, 14);
+ cdVectorCharSize(25);
+ for (i = 128; i < 256; i++)
+ {
+ int dx = 30;
+ t[0] = (char)i;
+ sprintf(s, "%3d", i);
+ cdForeground(CD_DARK_RED);
+ cdText(x, y, s);
+// cdText(x+dx, y, t);
+ cdForeground(CD_BLACK);
+ cdVectorText(x+2*dx-10, y, t);
+
+ x += 3*dx;
+ if ((i+1) % 8 == 0)
+ {
+ x = 10;
+ y -= 30;
+ }
+ }
+ //cdFont(CD_TIMES_ROMAN, CD_PLAIN, 24);
+ //cdVectorCharSize(24);
+ // for (i = 192; i < 256; i++)
+ // {
+ // int dx = 92;
+ // t[0] = (char)i;
+ // sprintf(s, "%d", i);
+ // cdText(x, y, s);
+ // cdText(x+dx, y, t);
+ // cdVectorText(x+2*dx, y, t);
+ //
+ // x += 3*dx + 2*dx/3;
+ // if ((i+1) % 4 == 0)
+ // {
+ // x = 30;
+ // y += 52;
+ // }
+ // }
+ }
+ cdFlush();
+}
+
+typedef struct _point
+{
+ double x, y;
+} point;
+
+point* load_point_file(const char* file_name, int *count)
+{
+ float x, y;
+ point* point_list;
+ int max_count = 100, dummy;
+ FILE* file = fopen(file_name, "rb");
+ if (!file)
+ return NULL;
+
+ point_list = malloc(max_count*sizeof(point));
+
+ /* read header */
+ fscanf(file, "##### %d\n", &dummy);
+
+ *count = 0;
+ while (!feof(file))
+ {
+ if (fscanf(file, "( %g | %g )\n", &x, &y) == 2)
+ {
+ if (*count == max_count)
+ {
+ max_count += 100;
+ point_list = realloc(point_list, max_count*sizeof(point));
+ }
+
+ point_list[*count].x = x;
+ point_list[*count].y = y;
+
+ (*count)++;
+ }
+ }
+
+ fclose(file);
+
+ return point_list;
+}
+
+point square[4] = {
+ {100,100},
+ {200,100},
+ {200,200},
+ {100,200},
+};
+
+point corner[6] = {
+ {100,100},
+ {200,100},
+ {200,200},
+ {150,200},
+ {150,300},
+ {100,300},
+};
+
+//void SimpleDrawTest(void)
+void SimpleDrawPolygon(void)
+{
+ int count, i;
+ point* point_list;
+ char* file_name;
+
+ simple_draw = DRAW_TEST;
+ cdBackground(CD_WHITE);
+ cdClear();
+ cdLineStyle(CD_CONTINUOUS);
+ cdLineWidth(1);
+ cdInteriorStyle(CD_SOLID);
+
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\continentes_geom_id_78_polygon_1_440x512.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\continentes_geom_id_78_polygon_1_558x650.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_2.txt";
+ file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_6.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_15.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_34.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_37.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_53.txt";
+// file_name = "D:\\Downloads\\TesteCdCanvas\\example_data\\guanabara_oceano_obj_id_5_geom_id_11_polygon_ring_59.txt";
+
+// point_list = square;
+// count = 4;
+// point_list = corner;
+// count = 6;
+
+ point_list = load_point_file(file_name, &count);
+ if (!point_list)
+ return;
+
+ cdForeground(CD_BLACK);
+ cdBegin(CD_CLOSED_LINES);
+ for (i=0; i<count; i++)
+ {
+ cdVertex((int)point_list[i].x, (int)point_list[i].y);
+ }
+ cdEnd();
+
+ cdForeground(CD_RED);
+ cdBegin(CD_FILL);
+ for (i=0; i<count; i++)
+ {
+ cdVertex((int)point_list[i].x, (int)point_list[i].y);
+ }
+ cdEnd();
+
+ cdFlush();
+
+ free(point_list);
+}
diff --git a/test/simple/simple.dsp b/test/simple/simple.dsp
new file mode 100644
index 0000000..c69b8df
--- /dev/null
+++ b/test/simple/simple.dsp
@@ -0,0 +1,83 @@
+# Microsoft Developer Studio Project File - Name="simple" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=simple - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "simple.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "simple.mak" CFG="simple - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "simple - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "simple - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "..\bin"
+# PROP BASE Intermediate_Dir "..\obj\simple"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\bin"
+# PROP Intermediate_Dir "..\obj\simple"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W4 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "__CD__" /D "simple" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp".\..\obj\simple/simple.pch" /Fo".\..\obj\simple/" /Fd".\..\obj\simple/" /GZ /c /GX
+# ADD CPP /nologo /MT /I "..\..\include" /I "..\..\..\iup\include" /Z7 /W4 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "__CD__" /D "simple" /D "_CRT_SECURE_NO_DEPRECATE" /D "_MBCS" /Fp".\..\obj\simple/simple.pch" /Fo".\..\obj\simple/" /Fd".\..\obj\simple/" /GZ /c /GX
+# ADD BASE MTL /nologo /tlb".\..\bin\simple.tlb" /win32
+# ADD MTL /nologo /tlb".\..\bin\simple.tlb" /win32
+# ADD BASE RSC /l 1046 /d "_DEBUG"
+# ADD RSC /l 1046 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cd.lib cdiup.lib iup.lib comctl32.lib cdgdiplus.lib gdiplus.lib cdpdflib.lib iupcontrols.lib /nologo /out:"..\bin\simple.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:".\..\bin\simple.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib cd.lib cdiup.lib iup.lib comctl32.lib cdgdiplus.lib gdiplus.lib cdpdflib.lib iupcontrols.lib /nologo /out:"..\bin\simple.exe" /incremental:yes /libpath:"..\..\lib" /libpath:"..\..\..\iup\lib" /debug /pdb:".\..\bin\simple.pdb" /pdbtype:sept /subsystem:windows /MACHINE:I386
+
+!ENDIF
+
+# Begin Target
+
+# Name "simple - Win32 Debug"
+# Begin Source File
+
+SOURCE=iupmain.c
+# End Source File
+# Begin Source File
+
+SOURCE=simple.c
+# End Source File
+# Begin Source File
+
+SOURCE=simple.h
+# End Source File
+# Begin Source File
+
+SOURCE=simple.led
+# End Source File
+# Begin Source File
+
+SOURCE=simple_led.c
+# End Source File
+# End Target
+# End Project
+
diff --git a/test/simple/simple.h b/test/simple/simple.h
new file mode 100644
index 0000000..123b31c
--- /dev/null
+++ b/test/simple/simple.h
@@ -0,0 +1,54 @@
+
+#ifndef __Simple_H
+#define __Simple_H
+
+#include <cd.h>
+
+void SimpleCreateCanvas(char* data);
+void SimpleKillCanvas(void);
+
+int SimplePlayClipboard(void);
+int SimplePlayCGMBin(void);
+int SimplePlayCGMText(void);
+int SimplePlayMetafile(void);
+int SimplePlayWMF(void);
+int SimplePlayEMF(void);
+
+int SimpleDrawDebug(void);
+int SimpleDrawWindow(void);
+int SimpleDrawCGMText(void);
+int SimpleDrawCGMBin(void);
+int SimpleDrawDXF(void);
+int SimpleDrawDGN(void);
+int SimpleDrawEMF(void);
+int SimpleDrawMetafile(void);
+int SimpleDrawPDF(void);
+int SimpleDrawPS(void);
+int SimpleDrawEPS(void);
+int SimpleDrawWMF(void);
+int SimpleDrawPrint(void);
+int SimpleDrawPrintDialog(void);
+int SimpleDrawClipboardBitmap(void);
+int SimpleDrawClipboardMetafile(void);
+int SimpleDrawClipboardEMF(void);
+int SimpleDrawImage(void);
+int SimpleDrawImageRGB(void);
+int SimpleDrawSimulate(void);
+
+int SimpleNotXor(void);
+int SimpleXor(void);
+int SimpleReplace(void);
+int SimpleClippingOff(void);
+int SimpleClippingArea(void);
+int SimpleClippingPolygon(void);
+int SimpleClippingRegion(void);
+
+int SimpleTransform(void);
+int SimpleContextPlus(void);
+int SimpleDrawAll(void);
+int SimpleDrawTextAlign(void);
+int SimpleDrawTextFonts(void);
+void SimpleDrawTest(void);
+int SimpleDrawRepaint(void);
+
+#endif
diff --git a/test/simple/simple.led b/test/simple/simple.led
new file mode 100644
index 0000000..cdf4430
--- /dev/null
+++ b/test/simple/simple.led
@@ -0,0 +1,93 @@
+mnOpen = MENU
+(
+ ITEM("CGM - Binary", SimplePlayCGMBin),
+ ITEM("CGM - Text", SimplePlayCGMText),
+ ITEM("METAFILE", SimplePlayMetafile),
+ ITEM("WMF", SimplePlayWMF),
+ ITEM("EMF", SimplePlayEMF)
+)
+
+mnSaveAs = MENU
+(
+ ITEM("DEBUG", SimpleDrawDebug),
+ ITEM("CGM - Binary", SimpleDrawCGMBin),
+ ITEM("CGM - Text", SimpleDrawCGMText),
+ ITEM("DGN", SimpleDrawDGN),
+ ITEM("DXF", SimpleDrawDXF),
+ ITEM("EMF", SimpleDrawEMF),
+ ITEM("METAFILE", SimpleDrawMetafile),
+ ITEM("PDF", SimpleDrawPDF),
+ ITEM("PS", SimpleDrawPS),
+ ITEM("EPS", SimpleDrawEPS),
+ ITEM("WMF", SimpleDrawWMF)
+)
+
+mnFile = MENU
+(
+ SUBMENU("Open", mnOpen),
+ SUBMENU("Save As", mnSaveAs),
+ SEPARATOR(),
+ ITEM("Print", SimpleDrawPrint),
+ ITEM("Print Dialog...", SimpleDrawPrintDialog),
+ SEPARATOR(),
+ ITEM("Exit", cmdExit)
+)
+
+mnEdit = MENU
+(
+ ITEM("Copy as Metafile", SimpleDrawClipboardMetafile),
+ ITEM("Copy as EMF", SimpleDrawClipboardEMF),
+ ITEM("Copy as Bitmap", SimpleDrawClipboardBitmap),
+ ITEM("Paste", SimplePlayClipboard)
+)
+
+mnClipping = MENU
+(
+ ITEM("Off", SimpleClippingOff),
+ ITEM("Area", SimpleClippingArea),
+ ITEM("Polygon", SimpleClippingPolygon),
+ ITEM("Region", SimpleClippingRegion)
+)
+
+mnWriteMode = MENU
+(
+ ITEM("Replace", SimpleReplace),
+ ITEM("Xor", SimpleXor),
+ ITEM("Not Xor", SimpleNotXor)
+)
+
+mnOptions = MENU
+(
+ SUBMENU("Clipping", mnClipping),
+ SUBMENU("Write Mode", mnWriteMode),
+ ITEM("Simulate", SimpleDrawSimulate),
+ ITEM("Transform", SimpleTransform),
+ ITEM("Context Plus", SimpleContextPlus)
+)
+
+mnSurface = MENU
+(
+ ITEM("Window", SimpleDrawWindow),
+ ITEM("Server Image", SimpleDrawImage),
+ ITEM("Image RGB", SimpleDrawImageRGB)
+)
+
+mnPrimitives = MENU
+(
+ ITEM("All", SimpleDrawAll),
+ ITEM("Text Align", SimpleDrawTextAlign),
+ ITEM("Text Fonts", SimpleDrawTextFonts),
+ ITEM("Test", SimpleDrawTest)
+)
+
+mnSimpleMenu = MENU
+(
+ SUBMENU("File", mnFile),
+ SUBMENU("Edit", mnEdit),
+ SUBMENU("Options", mnOptions),
+ SUBMENU("Surface", mnSurface),
+ SUBMENU("Primitives", mnPrimitives)
+)
+
+SimpleCanvas = CANVAS[BORDER=0](SimpleRepaint)
+SimpleDialog = DIALOG [TITLE="Simple Draw", MENU=mnSimpleMenu](SimpleCanvas)
diff --git a/test/simple/simple.sln b/test/simple/simple.sln
new file mode 100644
index 0000000..fc2222e
--- /dev/null
+++ b/test/simple/simple.sln
@@ -0,0 +1,20 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple", "simple.vcproj", "{82BC36B1-9F7A-41D4-A24F-DBE012378CE6}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {82BC36B1-9F7A-41D4-A24F-DBE012378CE6}.Debug.ActiveCfg = Debug|Win32
+ {82BC36B1-9F7A-41D4-A24F-DBE012378CE6}.Debug.Build.0 = Debug|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/test/simple/simple.vcproj b/test/simple/simple.vcproj
new file mode 100644
index 0000000..87a199c
--- /dev/null
+++ b/test/simple/simple.vcproj
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="simple"
+ ProjectGUID="{82BC36B1-9F7A-41D4-A24F-DBE012378CE6}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\bin"
+ IntermediateDirectory="..\obj\simple"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\..\bin/simple.tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\include,..\..\..\iup\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__CD__;simple;_CRT_SECURE_NO_DEPRECATE"
+ RuntimeLibrary="0"
+ PrecompiledHeaderFile=".\..\obj\simple/simple.pch"
+ AssemblerListingLocation=".\..\obj\simple/"
+ ObjectFile=".\..\obj\simple/"
+ ProgramDataBaseFileName=".\..\obj\simple/"
+ WarningLevel="4"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1046"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="freetype6.lib cd.lib iupcd.lib iup.lib comctl32.lib cdgdiplus.lib gdiplus.lib cdpdflib.lib iupcontrols.lib"
+ OutputFile="..\bin/simple.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\lib,..\..\..\iup\lib"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\..\bin/simple.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="iupmain.c"
+ >
+ </File>
+ <File
+ RelativePath="simple.c"
+ >
+ </File>
+ <File
+ RelativePath="simple.h"
+ >
+ </File>
+ <File
+ RelativePath="simple.led"
+ >
+ </File>
+ <File
+ RelativePath="simple_led.c"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/test/simple/simple_led.c b/test/simple/simple_led.c
new file mode 100644
index 0000000..07eebc8
--- /dev/null
+++ b/test/simple/simple_led.c
@@ -0,0 +1,125 @@
+/* Arquivo gerado automaticamente por ledc 2.5 */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <iup.h>
+
+static Ihandle* named[ 13 ];
+
+static Ihandle* decl( char* name, Ihandle* elem, char* first, ...)
+{
+ char *attr, *val;
+ va_list arg;
+ va_start (arg, first);
+ attr = first;
+ while (attr)
+ {
+ val = va_arg(arg,char*);
+ IupSetAttribute( elem, attr, val );
+ attr = va_arg(arg,char*);
+ }
+ va_end (arg);
+ if(name) IupSetHandle( name, elem );
+ return elem;
+}
+
+
+void simple_loadled (void)
+{
+ named[0] = decl( "mnOpen", IupMenu(
+ IupItem( "CGM - Binary", "SimplePlayCGMBin" ),
+ IupItem( "CGM - Text", "SimplePlayCGMText" ),
+ IupItem( "METAFILE", "SimplePlayMetafile" ),
+ IupItem( "WMF", "SimplePlayWMF" ),
+ IupItem( "EMF", "SimplePlayEMF" ),
+ NULL), NULL );
+ named[1] = decl( "mnSaveAs", IupMenu(
+ IupItem( "DEBUG", "SimpleDrawDebug" ),
+ IupItem( "CGM - Binary", "SimpleDrawCGMBin" ),
+ IupItem( "CGM - Text", "SimpleDrawCGMText" ),
+ IupItem( "DGN", "SimpleDrawDGN" ),
+ IupItem( "DXF", "SimpleDrawDXF" ),
+ IupItem( "EMF", "SimpleDrawEMF" ),
+ IupItem( "METAFILE", "SimpleDrawMetafile" ),
+ IupItem( "PDF", "SimpleDrawPDF" ),
+ IupItem( "PS", "SimpleDrawPS" ),
+ IupItem( "EPS", "SimpleDrawEPS" ),
+ IupItem( "WMF", "SimpleDrawWMF" ),
+ NULL), NULL );
+ named[2] = decl( "mnFile", IupMenu(
+ IupSubmenu( "Open",
+ named[0] /* mnOpen */
+ ),
+ IupSubmenu( "Save As",
+ named[1] /* mnSaveAs */
+ ),
+ IupSeparator(),
+ IupItem( "Print", "SimpleDrawPrint" ),
+ IupItem( "Print Dialog...", "SimpleDrawPrintDialog" ),
+ IupSeparator(),
+ IupItem( "Exit", "cmdExit" ),
+ NULL), NULL );
+ named[3] = decl( "mnEdit", IupMenu(
+ IupItem( "Copy as Metafile", "SimpleDrawClipboardMetafile" ),
+ IupItem( "Copy as EMF", "SimpleDrawClipboardEMF" ),
+ IupItem( "Copy as Bitmap", "SimpleDrawClipboardBitmap" ),
+ IupItem( "Paste", "SimplePlayClipboard" ),
+ NULL), NULL );
+ named[4] = decl( "mnClipping", IupMenu(
+ IupItem( "Off", "SimpleClippingOff" ),
+ IupItem( "Area", "SimpleClippingArea" ),
+ IupItem( "Polygon", "SimpleClippingPolygon" ),
+ IupItem( "Region", "SimpleClippingRegion" ),
+ NULL), NULL );
+ named[5] = decl( "mnWriteMode", IupMenu(
+ IupItem( "Replace", "SimpleReplace" ),
+ IupItem( "Xor", "SimpleXor" ),
+ IupItem( "Not Xor", "SimpleNotXor" ),
+ NULL), NULL );
+ named[6] = decl( "mnOptions", IupMenu(
+ IupSubmenu( "Clipping",
+ named[4] /* mnClipping */
+ ),
+ IupSubmenu( "Write Mode",
+ named[5] /* mnWriteMode */
+ ),
+ IupItem( "Simulate", "SimpleDrawSimulate" ),
+ IupItem( "Transform", "SimpleTransform" ),
+ IupItem( "Context Plus", "SimpleContextPlus" ),
+ NULL), NULL );
+ named[7] = decl( "mnSurface", IupMenu(
+ IupItem( "Window", "SimpleDrawWindow" ),
+ IupItem( "Server Image", "SimpleDrawImage" ),
+ IupItem( "Image RGB", "SimpleDrawImageRGB" ),
+ NULL), NULL );
+ named[8] = decl( "mnPrimitives", IupMenu(
+ IupItem( "All", "SimpleDrawAll" ),
+ IupItem( "Text Align", "SimpleDrawTextAlign" ),
+ IupItem( "Text Fonts", "SimpleDrawTextFonts" ),
+ IupItem( "Test", "SimpleDrawTest" ),
+ NULL), NULL );
+ named[9] = decl( "mnSimpleMenu", IupMenu(
+ IupSubmenu( "File",
+ named[2] /* mnFile */
+ ),
+ IupSubmenu( "Edit",
+ named[3] /* mnEdit */
+ ),
+ IupSubmenu( "Options",
+ named[6] /* mnOptions */
+ ),
+ IupSubmenu( "Surface",
+ named[7] /* mnSurface */
+ ),
+ IupSubmenu( "Primitives",
+ named[8] /* mnPrimitives */
+ ),
+ NULL), NULL );
+ named[10] = decl( "SimpleCanvas", IupCanvas( "SimpleRepaint" ),
+ "BORDER", "0", NULL );
+ named[11] = decl( "SimpleDialog", IupDialog(
+ named[10] /* SimpleCanvas */
+ ),
+ "TITLE", "Simple Draw",
+ "MENU", "mnSimpleMenu", NULL );
+}
diff --git a/test/simple/teste.cpp b/test/simple/teste.cpp
new file mode 100644
index 0000000..83fbbac
--- /dev/null
+++ b/test/simple/teste.cpp
@@ -0,0 +1,219 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <io.h>
+
+#include "iup.h"
+#include "cd.h"
+#include "cdiup.h"
+#include "cdirgb.h"
+
+/***************************************************************************
+* callbacks do IUP *
+****************************************************************************/
+int Draw( Ihandle *dial )
+{
+ cdCanvas *cnv = (cdCanvas *) IupGetAttribute(dial, "CDCANVAS");
+ cdCanvas *imgCnv = (cdCanvas *) IupGetAttribute(dial, "IMGCNV");
+
+ if (cnv==NULL)
+ return IUP_DEFAULT;
+
+ int width, height;
+ cdCanvasGetSize(cnv, &width, &height, NULL, NULL);
+
+ cdCanvasInteriorStyle(cnv, CD_SOLID);
+ cdCanvasForeground(cnv, CD_WHITE);
+ cdCanvasBox(cnv, 0, width, 0, height);
+
+ if (imgCnv==NULL)
+ return IUP_DEFAULT;
+
+ int w, h;
+ cdCanvasGetSize(imgCnv, &w, &h, NULL, NULL);
+
+ unsigned char* red = cdRedImage(imgCnv);
+ unsigned char* green = cdGreenImage(imgCnv);
+ unsigned char* blue = cdBlueImage(imgCnv);
+
+ int dx = width - w;
+ int dy = height - h;
+
+ cdCanvasPutImageRectRGB(cnv, w, h, red, green, blue, (int)(dx / 2.0), (int)(dy / 2.0), 0, 0, 0, 0, 0, 0);
+
+ return IUP_DEFAULT;
+}
+
+int repaint (Ihandle *self, float x, float y)
+{
+ Ihandle *dial = (Ihandle *) IupGetDialog(self);
+
+ cdCanvas *cnv = (cdCanvas *) IupGetAttribute(dial, "CDCANVAS");
+
+ Draw(dial);
+
+ return IUP_DEFAULT;
+}
+
+static int Resize (Ihandle *self, int larg, int alt)
+{
+ Ihandle *dial = IupGetDialog(self);
+
+ if (dial==NULL) return IUP_DEFAULT;
+
+ cdCanvas *cnv = (cdCanvas *) IupGetAttribute(dial, "CDCANVAS");
+
+ if (cnv!=NULL)
+ cdCanvasActivate(cnv);
+
+ Draw(dial);
+
+ return IUP_DEFAULT;
+}
+
+static int doexit(Ihandle *self)
+{
+ return IUP_CLOSE;
+}
+
+cdCanvas* buildBackImage(Ihandle* dial)
+{
+ unsigned char* r = (unsigned char*) IupGetAttribute(dial, "BUFFRED");
+ unsigned char* g = (unsigned char*) IupGetAttribute(dial, "BUFFGREEN");
+ unsigned char* b = (unsigned char*) IupGetAttribute(dial, "BUFFBLUE");
+
+ cdCanvas* imgCnv = (cdCanvas*) IupGetAttribute(dial, "IMGCNV");
+
+ if (imgCnv!=NULL)
+ delete imgCnv;
+
+ if (r!=NULL)
+ delete r;
+ if (g!=NULL)
+ delete g;
+ if (b!=NULL)
+ delete b;
+
+ int w = 200;
+ int h = 200;
+
+ int size = w * h;
+
+ r = new unsigned char[size];
+ g = new unsigned char[size];
+ b = new unsigned char[size];
+
+ char data[100];
+ sprintf(data, "%dx%d %p %p %p", w, h, r, g, b);
+ imgCnv = cdCreateCanvas(CD_IMAGERGB, data);
+
+ IupSetAttribute(dial, "BUFFRED", (char*) r);
+ IupSetAttribute(dial, "BUFFGREEN", (char*) g);
+ IupSetAttribute(dial, "BUFFBLUE", (char*) b);
+
+ IupSetAttribute(dial, "IMGCNV", (char*) imgCnv);
+
+ return imgCnv;
+}
+
+void drawInImage(cdCanvas* cnv)
+{
+ int w, h;
+ cdCanvasGetSize(cnv, &w, &h, NULL, NULL);
+
+ cdCanvasBegin(cnv, CD_CLIP);
+#if 0
+ cdCanvasVertex(cnv, 0, 0);
+ cdCanvasVertex(cnv, w, 0);
+ cdCanvasVertex(cnv, w, h);
+ cdCanvasVertex(cnv, 0, h);
+#else
+ cdCanvasVertex(cnv, -100, -100);
+ cdCanvasVertex(cnv, w+100, -100);
+ cdCanvasVertex(cnv, w+100, h+100);
+ cdCanvasVertex(cnv, -100, h+100);
+#endif
+ cdCanvasEnd(cnv);
+
+ cdCanvasClip(cnv, CD_CLIPPOLYGON);
+
+ cdCanvasInteriorStyle(cnv, CD_SOLID);
+ cdCanvasForeground(cnv, CD_WHITE);
+ cdCanvasBox(cnv, 0, w, 0, h);
+
+ cdCanvasForeground(cnv, CD_RED);
+ cdCanvasTextAlignment(cnv, CD_CENTER);
+ cdCanvasText(cnv, w/2, h/2, "SCURI É BOIOLA!");
+}
+
+static int tofly(Ihandle *self)
+{
+ Ihandle *dial = IupGetDialog(self);
+
+ cdCanvas* back = buildBackImage(dial);
+
+ if (back!=NULL)
+ drawInImage(back);
+
+ Draw(dial);
+
+ return IUP_DEFAULT;
+}
+
+Ihandle *BuildDialog(void)
+{
+ Ihandle *saida = IupItem ("Saida", "acao_sai");
+ Ihandle *voe = IupItem ("Voe", "acao_voar");
+ Ihandle *main_menu = IupMenu ( saida, voe, NULL );
+
+ Ihandle *tela = IupCanvas("rpaint");
+ IupSetAttribute(tela, IUP_BUTTON_CB, "buttonCb");
+ IupSetAttribute(tela, IUP_MOTION_CB, "motionCb");
+
+ Ihandle *hbox = IupHbox ( tela, NULL );
+
+ Ihandle *dial = IupDialog ( hbox );
+
+ IupSetHandle( "main_menu", main_menu );
+ IupSetHandle( "tela", tela );
+ IupSetAttribute( dial, IUP_MENU, "main_menu" );
+ IupSetAttribute( dial, IUP_SIZE, "HALFxHALF" );
+ IupSetAttribute( tela, IUP_SIZE, "300x200" );
+ IupSetAttribute( tela, IUP_RESIZE_CB, "resize_cb");
+
+ IupSetFunction( "rpaint", (Icallback) repaint );
+ IupSetFunction( "acao_sai", (Icallback) doexit );
+ IupSetFunction( "acao_voar", (Icallback) tofly );
+ IupSetFunction( "resize_cb", (Icallback) Resize );
+
+ IupMap(dial);
+
+ return dial;
+}
+
+int main (void)
+{
+ Ihandle *dial;
+
+ /* Abre IUP */
+ IupOpen();
+
+ dial = BuildDialog();
+
+ cdCanvas *cnv = cdCreateCanvas( CD_IUP, IupGetHandle("tela") );
+
+ IupSetAttribute(dial, "CDCANVAS", (char *) cnv);
+
+ /* Exibe dialogo */
+ IupShow(dial);
+
+ /* Interage com o usuario */
+ IupMainLoop();
+
+ cdKillCanvas( cnv );
+
+ /* Fecha IUP */
+ IupClose();
+
+ return 1;
+}