aboutsummaryrefslogtreecommitdiff
path: root/zinclib.d/src/Zinc.hpp
blob: 417b697f6292639768c979864841def2ae5f1b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
/**       Zinc.hpp
 *      zinclib
 *
 *   This software is the property of IntuiLab SA, France.
 *   All rights reserved.
 *
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
 *   are met:
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *   3. The name of the author may not be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 * 
 *   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 *   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 *   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 *   IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *   Here is the declaration of the Zinc object
 *
 *      08/03/05
 *
 *      Contributors:
 *           Benoit Peccatte <peccatte@intuilab.com>
 *           David Thevenin <thevenin@intuilab.com>
 *
 */
#include "ZincTypes.hpp"
#include "ZincObjects.hpp"
#include "ZincPath.hpp"
#include "ZincExtern.hpp"
#include <tcl.h>

#ifndef ZINC_HEADER
#define ZINC_HEADER


/** Number of objects in the pool */
const int ZINC_POOL_COUNT   = 7;
/** maximum number of parameter in a zinc function */
const int  ZINC_PARAM_COUNT = 10;

/**Defaults zinc group */
const int DEFAULT_GROUP = 1;

/**
 * This class contains a zinc widget and members to create and modify items
 */
class Zinc
{
  friend class ZincPath;
  
public:
  Tcl_Obj *id;           ///< the id of this object
  WidgetObjCmd objCmd;   ///< the command associated with this object
  ClientData wi;         ///< the zinc object itself
  String tclCb;          ///< name of the binding callback
  int znId;              ///< the znCount at creation time
  String window;         ///< the window which contains the widget

  static int znCount;                   ///< count to create unique ids
  static Tcl_CmdInfo topCmdInfo;        ///< the command associated with toplevel
  static Tcl_CmdInfo zncCmdInfo;        ///< the command associated with zinc
  static Tcl_CmdInfo imgCmdInfo;        ///< the command associated with image
  static Tcl_CmdInfo fntCmdInfo;        ///< the command associated with font
  static Tcl_CmdInfo focCmdInfo;        ///< the command associated with fous
  static Tcl_CmdInfo bndCmdInfo;        ///< the command associated with bind
  static Tcl_Obj* pool[ZINC_POOL_COUNT];///< a pool of tclobj ready to be used
  static Tcl_Obj* p1[ZINC_PARAM_COUNT]; ///< table of pointeur use for parameters
  static Tcl_Obj* p2[ZINC_PARAM_COUNT]; ///< table of pointeur use for parameters

public:
  static Tcl_Interp *interp;            ///< the tcl interpreter

  /**
   * The public constructor
   *
   * @param renderingMode ZINC_BACKEND_X11 or ZINC_BACKEND_OPENGL
   */
  Zinc (int renderingMode);

  /**
   * The public destructor
   */
  ~Zinc ();

  /**
   * Change window title
   *
   * @param title the title string
   */
  void setTitle (String title);

/*****************************************
          WIDGET PROPERTIES
*****************************************/
  
  /**
   * Call zinc->configure ( -backcolor )
   *
   * @param value the backcolor to set
   */
  void setBackcolor (String value);

  /**
   * Call zinc->cget ( -backcolor )
   *
   * @return backcolor value
   */
  String getBackcolor ();

  /**
   * Call zinc->configure ( -forecolor )
   *
   * @param value the forecolor to set
   */
  void setForecolor (String value);

  /**
   * Call zinc->cget ( -forecolor )
   *
   * @return forecolor value
   */
  String getForecolor ();

  /**
   * Call zinc->configure ( -width )
   *
   * @param value the width to set
   */
  void setWidth (int value);

  /**
   * Call zinc->cget ( -width )
   *
   * @return width value
   */
  int getWidth ();

  /**
   * Call zinc->configure ( -height )
   *
   * @param value the height to set
   */
  void setHeight (int value);

  /**
   * Call zinc->cget ( -height )
   *
   * @return height value
   */
  int getHeight ();

  /**
   * Call zinc->configure ( -borderwidth )
   *
   * @param value the borderwidth to set
   */
  void setBorderwidth (int value);

  /**
   * Call zinc->cget ( -borderwidth )
   *
   * @return borderwidth value
   */
  int getBorderwidth ();

  /**
   * Call zinc->configure ( -font )
   *
   * @param value the font to set
   */
  void setFont (ZincFont* value);

  /**
   * Call zinc->cget ( -font )
   *
   * @return font value
   */
  ZincFont* getFont ();

/*****************************************
          WIDGET METHODS
*****************************************/

  /**
   * Get the bounding box of an item
   *
   * @param item the item to get bbox
   * @param bbox a table where we'll put the bounding box
   *             bbox[0] = x0, bbox[1] = y0, bbox[2] = xc, bbox[3] = yc
   */
  void bbox (ZincItem* item, double bbox[4]);

  /**
   * Get the bounding box of an item in its parent group
   *
   * @param item the item to get bbox in its parent group
   * @param bbox a table where we'll put the bounding box
   *             bbox[0] = x0, bbox[1] = y0, bbox[2] = xc, bbox[3] = yc
   */
  void relativeBbox (ZincItem* item, double bbox[4]);


  /**
   * Change the group of an item
   *
   * @param item the item to move
   * @param parentGroup new group for the item
   */
  void chggroup (ZincItem *item, ZincItem *parentGroup);

  /**
   * Clone an item
   *
   * @param item the item to clone
   * @return the cloned item
   */
  ZincItem* clone (ZincItem *item);

  /**
   * Get the number of contour of an item
   *
   * @return number of contour
   */
  int contour (ZincItem *item);

  /**
   * Set the contour of an item to the one of an other
   *
   * @param item the item on which we set the contour
   * @param flag the operation to do on the contour
   * @param reference the item to set contour from
   * @return the number of contour
   */
  int contour (ZincItem *item, itemOperator flag, ZincItem *reference);

  /**
   * Set the contour of an item
   *
   * @param item the item on which we set the contour
   * @param add true to add a path, false to remove
   * @param reference the new contour
   * @return the number of contour
   */
  int contour (ZincItem *item, bool add, ZincPath *contour);

  /**
   * Set or modify the coordinates of an item
   *
   * @param item the item to modify
   * @param contour new coords for the item
   * @param add true to add coords, false to replace
   * @param contourIndex the contour do modify
   * @param coordIndex the coordinate to modify (WARNING, path must be one
   *                   point if the is not the default)
   */
  void coords (ZincItem *item, ZincPath *contour, bool add,
               int contourIndex = -1, int coordIndex = -1);

  /**
   * Remove coords of an item
   *
   * @param item the item to modify
   * @param coordIndex the coordinate to rmove
   * @param contourIndex the contour on which we remove
   */
  void coordsRemove (ZincItem *item, int coordIndex, int contourIndex = -1);

  /**
   * Add a tag to an item
   *
   * @param item the item to add tag to
   * @param tag a tag to add
   */
  void addTag (ZincItem *item, String tag);

  /**
   * Remove a tag from an item
   *
   * @param item the item to remove tag from
   * @param tag a tag to remove (nothing to remove all tags)
   */  
  void dTag (ZincItem *item, String tag = String(""));

  /**
   * List all tags of an item
   * It's up to the caller to delete the resulting table and strings
   *
   * @param item the item to list tag from
   * @param lagList a pointer to a table of String containing tags
   * @return the number of tags
   */
  int getTags (ZincItem *item, String*** tagList);

  /**
   * Set the focus to an item
   *
   * @param item the item to set the focus to
   */
  void focus (ZincItem *item);

  /**
   * Tell if the name is a gradient name
   *
   * @param gname a gradient name
   * @return true if the name is a gradient name, false otherwise
   */
  bool isGname (String gname);

  /**
   * Create a named gradient
   *
   * @param gradient a gradient
   * @param gname a gradient name
   */
  void gname (String gradient, String gname);

  /**
   * Retreive the group of an item
   *
   * @param item the item to get the group from
   * @return the group
   */
  ZincItem* group (ZincItem *item);

  /**
   * Reorder items to lower one
   *
   * @param item the item to lower
   */
  void lower (ZincItem *item);

  /**
   * Reorder items to lower one
   *
   * @param item the item to lower
   * @param belowThis and item that will be over item
   */
  void lower (ZincItem *item, ZincItem *belowThis);

  /**
   * Reorder items to raise one
   *
   * @param item the item to raise
   */
  void raise (ZincItem *item);

  /**
   * Reorder items to raise one
   *
   * @param item the item to raise
   * @param aboveThis an item that will be under item
   */
  void raise (ZincItem *item, ZincItem *aboveThis);

  /**
   * Return the type of an item
   *
   * @param item an item
   * @return the type of the item
   */
   itemType type (ZincItem *item);

  /**
   * Create a Zinc Tag that can be used in place of any item
   *  for zinc functions that must be called using tagOrId
   *
   * @param tag the text of the tag
   * @return a tag item
   */
  ZincItem* createTag(String tag);

/*****************************************
          ITEMS MANIPULATION
*****************************************/
  /**
   * Suppress an item
   *
   * @param item the item to suppress
   */
  void itemRemove (ZincItem *item);

  /**
   * Create a group item
   *
   * @param parentGroup group where we'll put the new group, if NULL we create
   * in the defaults group
   * @return the group item
   */
  ZincItem *itemCreateGroup (ZincItem *parentGroup);

  /**
   * Create a rectangle item
   *
   * @param parentGroup group where we'll put it
   * @param x y width height the coordinates of the new rectangle
   * @return the rectangle item
   */
  ZincItem *itemCreateRectangle (ZincItem *parentGroup, double x, double y,
                                double width, double height);

  /**
   * Create an arc item
   *
   * @param parentGroup group where we'll put it
   * @param x y width height the coordinates of the new rectangle
   * @return the arc item
   */
  ZincItem *itemCreateArc (ZincItem *parentGroup, double x, double y,
                           double width, double height);

  /**
   * Create a text item
   *
   * @param parentGroup group where we'll put it
   * @return the text item
   */
  ZincItem *itemCreateText (ZincItem *parentGroup);

  /**
   * Create a curve item
   *
   * @param parentGroup group where we'll put it
   * @param path the path to display
   * @return the curve item
   */
  ZincItem *itemCreateCurve (ZincItem *parentGroup, ZincPath *path);

  /**
   * Create an icon item
   *
   * @param parentGroup group where we'll put it
   * @param image a zincImage to display
   * @return the icon item
   */
  ZincItem *itemCreateIcon (ZincItem *parentGroup, ZincImage* image);


/**************************************************
                    BINDING
**************************************************/

  /**
   * Bind a function to an event on the zinc widget
   *
   * @param eventSpecification tcl style event specicication
   * @param callBack the function which will be called back
   * @param userData data we will give back to the callback when called
   * @param add false to replace existing bind or true to add
   */
  void bind (String eventSpecification,
             ZincWidgetCallback callBack, void *userData, bool add = false);

  /**
   * Annulate a binding
   *
   * @param eventSpecification tcl style event specicication
   */
  void unbind (String eventSpecification);
  
  /**
   * Bind a function to an event on an item
   *
   * @param item the item on which to bind
   * @param eventSpecification tcl style event specicication
   * @param callBack the function which will be called back
   * @param userData data we will give back to the callback when called
   * @param add false to replace existing bind or true to add
   */
  void itemBind (ZincItem *item, String eventSpecification,
                 ZincItemCallback callBack, void *userData, bool add = false);

  /**
   * Annulate a binding
   *
   * @param item the item on which to unbind
   * @param eventSpecification tcl style event specicication
   */
  void itemUnbind (ZincItem *item, String eventSpecification);

/**************************************************
           TRANSFORMATION METHODS
**************************************************/

  /**
   * Translate the item
   *
   * @param item the item to which we apply the transform
   * @param dx dy translation vector
   */
  void itemTranslate (ZincItem * item, double dx, double dy);

  /**
   * Translate the item
   *
   * @param item the item to which we apply the transform
   * @param x y translation vector
   * @param absolute true if the translation is absolute
   */
  void itemTranslate (ZincItem * item, double x, double y, bool absolute);

  /**
   * Rotate an item
   *
   * @param item the item to which we apply the transform
   * @param angle the angle to rotate in radian
   */
  void itemRotate (ZincItem * item, double angle);

  /**
   * Rotate an item
   *
   * @param item the item to which we apply the transform
   * @param angle the angle to rotate in radian
   * @param x y the center of the rotation
   */
  void itemRotate (ZincItem * item, double angle, double x, double y);

  /**
   * Rotate an item
   *
   * @param item the item to which we apply the transform
   * @param angle the angle to rotate
   * @param degree true for an angle in degree, false for an angle in radians
   */
  void itemRotate (ZincItem * item, double angle, bool degree);

  /**
   * Rotate an item
   *
   * @param item the item to which we apply the transform
   * @param angle the angle to rotate in radian
   * @param x y the center of the rotation
   * @param degree true for an angle in degree, false for an angle in radians
   */
  void itemRotate (ZincItem * item, double angle, double x, double y,
                   bool degree);

  /**
   * Scale an item
   *
   * @param item the item to which we apply the transform
   * @param ax horizontal scale
   * @param ay vertical scale
   */
  void itemScale (ZincItem * item, double ax, double ay);

  /**
   * Scale an item using a specified center
   *
   * @param item the item to which we apply the transform
   * @param ax horizontal scale
   * @param ay vertical scale
   * @param cx cy center of the scale
   */
  void itemScale (ZincItem * item, double ax, double ay, double cx, double cy);

  
  /**
   * Skew an item
   *
   * @param item the item to which we apply the transform
   * @param sx horizontal skew
   * @param sy vertical skew
   */
  void itemSkew (ZincItem * item, double sx, double sy);

  /**
   * Skew an item horizontaly
   *
   * @param item the item to which we apply the transform
   * @param sx horizontal skew
   */
  void itemSkewX (ZincItem * item, double sx);

  /**
   * Skew an item verticaly
   *
   * @param item the item to which we apply the transform
   * @param sy vertical skew
   */
  void itemSkewY (ZincItem * item, double sy);

  /**
   * Reset all transformations associated with the item
   *
   * @param item the item to which we apply the transform
   */
  void itemResetTransformation (ZincItem * item);

  /**
   * Replace current transform by a matrix
   *
   * @param item the item to which we apply the transform
   * @param a,b,c,d,e,f the new transform matrix 
   */
  void itemSetTransformation (ZincItem * item,
                              double a, double b, double c,
                              double d, double e, double f);

  /**
   * Get current transform matrix
   *
   * @param item the item to which we apply the transform
   * @param a,b,c,d,e,f places where we'll put the transform matrix
   */
  void itemGetTransformation (ZincItem * item,
                              double *a, double *b, double *c,
                              double *d, double *e, double *f);

  /**
   * Multiply current transform by a matrix
   *
   * @param item the item to which we apply the transform
   * @param a,b,c,d,e,f the new transform matrix 
   */
  void itemMatrix (ZincItem * item,
                   double a, double b, double c,
                   double d, double e, double f);

/*******************************************************
             AUTOGENERATED METHODS (itemconfigure)
"code.hpp" in Tkzins/generic source from :
   ./gen.pl Arc.c Attrs.c Color.c Curve.c Draw.c  Group.c
        Image.c List.c Item.c Icon.c Rectangle.c tkZinc.c Text.c
*******************************************************/

  /**
   * Call zinc->itemconfigure ( -closed )
   * @param item the item to configure
   * @param value the closed to set
   */
  void itemSetClosed (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -closed )
   * @param item the item to get closed from
   * @return closed value
   */
  bool itemGetClosed (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -composealpha )
   * @param item the item to configure
   * @param value the composealpha to set
   */
  void itemSetComposealpha (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -composealpha )
   * @param item the item to get composealpha from
   * @return composealpha value
   */
  bool itemGetComposealpha (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -composerotation )
   * @param item the item to configure
   * @param value the composerotation to set
   */
  void itemSetComposerotation (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -composerotation )
   * @param item the item to get composerotation from
   * @return composerotation value
   */
  bool itemGetComposerotation (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -composescale )
   * @param item the item to configure
   * @param value the composescale to set
   */
  void itemSetComposescale (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -composescale )
   * @param item the item to get composescale from
   * @return composescale value
   */
  bool itemGetComposescale (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -extent )
   * @param item the item to configure
   * @param value the extent to set
   */
  void itemSetExtent (ZincItem * item, unsigned int value);

  /**
   * Call zinc->itemcget ( -extent )
   * @param item the item to get extent from
   * @return extent value
   */
  unsigned int itemGetExtent (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -fillcolor )
   * @param item the item to configure
   * @param value the fillcolor to set
   */
  void itemSetFillcolor (ZincItem * item, String value);

  /**
   * Call zinc->itemcget ( -fillcolor )
   * @param item the item to get fillcolor from
   * @return fillcolor value
   */
  String itemGetFillcolor (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -filled )
   * @param item the item to configure
   * @param value the filled to set
   */
  void itemSetFilled (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -filled )
   * @param item the item to get filled from
   * @return filled value
   */
  bool itemGetFilled (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -fillpattern )
   * @param item the item to configure
   * @param value the fillpattern to set
   */
  void itemSetFillpattern (ZincItem * item, ZincBitmap * value);

  /**
   * Call zinc->itemcget ( -fillpattern )
   * @param item the item to get fillpattern from
   * @return fillpattern value
   */
  ZincBitmap * itemGetFillpattern (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -linecolor )
   * @param item the item to configure
   * @param value the linecolor to set
   */
  void itemSetLinecolor (ZincItem * item, String value);

  /**
   * Call zinc->itemcget ( -linecolor )
   * @param item the item to get linecolor from
   * @return linecolor value
   */
  String itemGetLinecolor (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -linepattern )
   * @param item the item to configure
   * @param value the linepattern to set
   */
  void itemSetLinepattern (ZincItem * item, ZincBitmap * value);

  /**
   * Call zinc->itemcget ( -linepattern )
   * @param item the item to get linepattern from
   * @return linepattern value
   */
  ZincBitmap * itemGetLinepattern (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -linestyle )
   * @param item the item to configure
   * @param value the linestyle to set
   */
  void itemSetLinestyle (ZincItem * item, lineStyle value);

  /**
   * Call zinc->itemcget ( -linestyle )
   * @param item the item to get linestyle from
   * @return linestyle value
   */
  lineStyle itemGetLinestyle (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -linewidth )
   * @param item the item to configure
   * @param value the linewidth to set
   */
  void itemSetLinewidth (ZincItem * item, double value);

  /**
   * Call zinc->itemcget ( -linewidth )
   * @param item the item to get linewidth from
   * @return linewidth value
   */
  double itemGetLinewidth (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -pieslice )
   * @param item the item to configure
   * @param value the pieslice to set
   */
  void itemSetPieslice (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -pieslice )
   * @param item the item to get pieslice from
   * @return pieslice value
   */
  bool itemGetPieslice (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -priority )
   * @param item the item to configure
   * @param value the priority to set
   */
  void itemSetPriority (ZincItem * item, unsigned int value);

  /**
   * Call zinc->itemcget ( -priority )
   * @param item the item to get priority from
   * @return priority value
   */
  unsigned int itemGetPriority (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -sensitive )
   * @param item the item to configure
   * @param value the sensitive to set
   */
  void itemSetSensitive (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -sensitive )
   * @param item the item to get sensitive from
   * @return sensitive value
   */
  bool itemGetSensitive (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -startangle )
   * @param item the item to configure
   * @param value the startangle to set
   */
  void itemSetStartangle (ZincItem * item, unsigned int value);

  /**
   * Call zinc->itemcget ( -startangle )
   * @param item the item to get startangle from
   * @return startangle value
   */
  unsigned int itemGetStartangle (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -tile )
   * @param item the item to configure
   * @param value the tile to set
   */
  void itemSetTile (ZincItem * item, ZincBitmap * value);

  /**
   * Call zinc->itemcget ( -tile )
   * @param item the item to get tile from
   * @return tile value
   */
  ZincBitmap * itemGetTile (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -visible )
   * @param item the item to configure
   * @param value the visible to set
   */
  void itemSetVisible (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -visible )
   * @param item the item to get visible from
   * @return visible value
   */
  bool itemGetVisible (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -capstyle )
   * @param item the item to configure
   * @param value the capstyle to set
   */
  void itemSetCapstyle (ZincItem * item, capStyle value);

  /**
   * Call zinc->itemcget ( -capstyle )
   * @param item the item to get capstyle from
   * @return capstyle value
   */
  capStyle itemGetCapstyle (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -fillrule )
   * @param item the item to configure
   * @param value the fillrule to set
   */
  void itemSetFillrule (ZincItem * item, fillRule value);

  /**
   * Call zinc->itemcget ( -fillrule )
   * @param item the item to get fillrule from
   * @return fillrule value
   */
  fillRule itemGetFillrule (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -joinstyle )
   * @param item the item to configure
   * @param value the joinstyle to set
   */
  void itemSetJoinstyle (ZincItem * item, joinStyle value);

  /**
   * Call zinc->itemcget ( -joinstyle )
   * @param item the item to get joinstyle from
   * @return joinstyle value
   */
  joinStyle itemGetJoinstyle (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -relief )
   * @param item the item to configure
   * @param value the relief to set
   */
  void itemSetRelief (ZincItem * item, relief value);

  /**
   * Call zinc->itemcget ( -relief )
   * @param item the item to get relief from
   * @return relief value
   */
  relief itemGetRelief (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -smoothrelief )
   * @param item the item to configure
   * @param value the smoothrelief to set
   */
  void itemSetSmoothrelief (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -smoothrelief )
   * @param item the item to get smoothrelief from
   * @return smoothrelief value
   */
  bool itemGetSmoothrelief (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -alpha )
   * @param item the item to configure
   * @param value the alpha to set
   */
  void itemSetAlpha (ZincItem * item, unsigned int value);

  /**
   * Call zinc->itemcget ( -alpha )
   * @param item the item to get alpha from
   * @return alpha value
   */
  unsigned int itemGetAlpha (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -atomic )
   * @param item the item to configure
   * @param value the atomic to set
   */
  void itemSetAtomic (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -atomic )
   * @param item the item to get atomic from
   * @return atomic value
   */
  bool itemGetAtomic (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -clip )
   * @param item the item to configure
   * @param value the clip to set
   */
  void itemSetClip (ZincItem * item, ZincItem * value);

  /**
   * Call zinc->itemcget ( -clip )
   * @param item the item to get clip from
   * @return clip value
   */
  ZincItem * itemGetClip (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -anchor )
   * @param item the item to configure
   * @param value the anchor to set
   */
  void itemSetAnchor (ZincItem * item, anchor value);

  /**
   * Call zinc->itemcget ( -anchor )
   * @param item the item to get anchor from
   * @return anchor value
   */
  anchor itemGetAnchor (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -color )
   * @param item the item to configure
   * @param value the color to set
   */
  void itemSetColor (ZincItem * item, String value);

  /**
   * Call zinc->itemcget ( -color )
   * @param item the item to get color from
   * @return color value
   */
  String itemGetColor (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -connecteditem )
   * @param item the item to configure
   * @param value the connecteditem to set
   */
  void itemSetConnecteditem (ZincItem * item, ZincItem * value);

  /**
   * Call zinc->itemcget ( -connecteditem )
   * @param item the item to get connecteditem from
   * @return connecteditem value
   */
  ZincItem * itemGetConnecteditem (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -connectionanchor )
   * @param item the item to configure
   * @param value the connectionanchor to set
   */
  void itemSetConnectionanchor (ZincItem * item, anchor value);

  /**
   * Call zinc->itemcget ( -connectionanchor )
   * @param item the item to get connectionanchor from
   * @return connectionanchor value
   */
  anchor itemGetConnectionanchor (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -image )
   * @param item the item to configure
   * @param value the image to set
   */
  void itemSetImage (ZincItem * item, ZincImage * value);

  /**
   * Call zinc->itemcget ( -image )
   * @param item the item to get image from
   * @return image value
   */
  ZincImage * itemGetImage (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -mask )
   * @param item the item to configure
   * @param value the mask to set
   */
  void itemSetMask (ZincItem * item, ZincBitmap * value);

  /**
   * Call zinc->itemcget ( -mask )
   * @param item the item to get mask from
   * @return mask value
   */
  ZincBitmap * itemGetMask (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -alignment )
   * @param item the item to configure
   * @param value the alignment to set
   */
  void itemSetAlignment (ZincItem * item, alignment value);

  /**
   * Call zinc->itemcget ( -alignment )
   * @param item the item to get alignment from
   * @return alignment value
   */
  alignment itemGetAlignment (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -font )
   * @param item the item to configure
   * @param value the font to set
   */
  void itemSetFont (ZincItem * item, ZincFont * value);

  /**
   * Call zinc->itemcget ( -font )
   * @param item the item to get font from
   * @return font value
   */
  ZincFont * itemGetFont (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -overstriked )
   * @param item the item to configure
   * @param value the overstriked to set
   */
  void itemSetOverstriked (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -overstriked )
   * @param item the item to get overstriked from
   * @return overstriked value
   */
  bool itemGetOverstriked (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -spacing )
   * @param item the item to configure
   * @param value the spacing to set
   */
  void itemSetSpacing (ZincItem * item, short value);

  /**
   * Call zinc->itemcget ( -spacing )
   * @param item the item to get spacing from
   * @return spacing value
   */
  short itemGetSpacing (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -text )
   * @param item the item to configure
   * @param value the text to set
   */
  void itemSetText (ZincItem * item, String value);

  /**
   * Call zinc->itemcget ( -text )
   * @param item the item to get text from
   * @return text value
   */
  String itemGetText (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -underlined )
   * @param item the item to configure
   * @param value the underlined to set
   */
  void itemSetUnderlined (ZincItem * item, bool value);

  /**
   * Call zinc->itemcget ( -underlined )
   * @param item the item to get underlined from
   * @return underlined value
   */
  bool itemGetUnderlined (ZincItem * item);

  /**
   * Call zinc->itemconfigure ( -width )
   * @param item the item to configure
   * @param value the width to set
   */
  void itemSetWidth (ZincItem * item, unsigned short value);

  /**
   * Call zinc->itemcget ( -width )
   * @param item the item to get width from
   * @return width value
   */
  unsigned short itemGetWidth (ZincItem * item);


/*******************************************************
             END OF AUTOGENERATED METHODS
*******************************************************/

  /**
   * Call zinc->itemconfigure ( -firstend )
   *
   * @param item the item to set firstend to
   * @param a,b,c values used to set end
   */
  void itemSetFirstend (ZincItem * item, double a, double b, double c);
  
  /**
   * Call zinc->itemcget ( -firstend )
   *
   * @param item the item to get firstend from
   * @param a,b,c values used to sedwhere we'll put end
   */
  void itemGetFirstend (ZincItem * item, double *a, double *b, double *c);

  /**
   * Call zinc->itemconfigure ( -lastend )
   *
   * @param item the item to set lastend to
   * @param a,b,c values used to set end
   */
  void itemSetLastend (ZincItem * item, double a, double b, double c);

  /**
   * Call zinc->itemcget ( -lastend )
   *
   * @param item the item to get lastend from
   * @param a,b,c values used to sedwhere we'll put end
   */
  void itemGetLastend (ZincItem * item, double *a, double *b, double *c);

  /**
   * Call zinc->itemconfigure ( -position )
   *
   * @param item the item to get width fromset position to
   * @param x,y position
   */
  void itemSetPosition (ZincItem * item, double x, double y);

  /**
   * Call zinc->itemcget ( -position )
   *
   * @param item the item to get position from
   * @param x,y position
   */
  void itemGetPosition (ZincItem * item, double *x, double *y);

  /**
   * Create an image object from a file
   *
   * @param image the image reference (a file name)
   */
  ZincImage* createImageFromFile (String image);

  /**
   * Create an image object using base64 data
   *
   * @param image the image reference (a base64 String or binary data)
   */
  ZincImage* createImageFromData (String image);

  /**
   * Create a bitmap object from a file
   *
   * @param image the bitmap reference (a file name)
   */
  ZincBitmap* createBitmapFromFile (String image);

  /**
   * Create a bitmap object base64 data
   *
   * @param image the bitmap reference (a base64 String or binary data)
   */
  ZincBitmap* createBitmapFromData (String image);

  /**
   * Create a bitmap object using a predefined name
   *
   * @param image the bitmap reference (a name)
   */
  ZincBitmap* createBitmapFromName (String image);

  /**
   * Create an image object
   *
   * @param width Width of image
   * @param height Height of image
   * @param aggBuffer An AGG buffer
   */
  ZincImage* createImageFromAGGBuffer (int width, int height, unsigned char *aggBuffer);


  /**
   * Create a font object
   *
   * @param family the font mamily
   * @param size if a positive number, it is in points, if a negative number,
   *   its absolute value is a size in pixels.
   * @param bold 1 for a bold font, 0 for a normal font, -1 for unspecified
   * @param italic 1 an italic font, 0 for a roman font, -1 for unspecified
   * @param underline 1 for an underlined, 0 for a normal font, -1 for
   *    unspecified
   * @param overstrike 1 for an overstriked font, 0 for a normal font, -1 for unspecified
   */
  ZincFont* createFont (String family, int size, int bold = -1,
                        int italic = -1, int underline = -1,
                        int overstrike = -1);
 
  /**
   * Get font ascent
   *
   * @param font the font
   * @return the font ascent
   */
  int getFontAscent (ZincFont* font);

  /**
   * Get Image width
   *
   * @param ZincImage the image to get width from
   * @return the width of the image
   */
  int getImageWidth (ZincImage *image);
  
  /**
   * Get Image height
   *
   * @param ZincImage the image to get height from
   * @return the height of the image
   */
  int getImageHeight (ZincImage *image);
  
/*******************************************************
                STATIC PROCEDURES
*******************************************************/

  /**
   * Loads the zinc library and initialize tcl and tk
   *
   * @param argv0 the name of the execytable as passed in argv[0]
   */
  static void loadZinc (char *argv0) throw (ZincException);

  /**
   * Run tk mainloop and returns when there is no more Tk window
   */
  static void zincMainLoop ();

/*******************************************************
               errors management
*******************************************************/
  /**
   * This is inline because it is called frequently and needs to be optimized
   * Use this when you need to call a function that can return a TCL error code.
   *
   * @param fct the full function call
   * @param msg the error message to throw in case of error
   */ 
  static void z_tcl_call (int result, char* p_msg) throw (ZincException);

  /**
   * This is a inline because it is called frequently and needs to be optimized
   * Use this to call the zinObjectCommand fuction. The call is made using the
   * pre allocated table p1, it must contain Tcl_Obj thar are parameters to
   * the zinObjectCommand function. A parameter indicate how many parameters
   * are passed to the zinObjectCommand function.
   *
   * @param count the number of parameters in p1
   * @param msg the error message to throw in case of error
   */ 
  void z_command (int count, char* p_msg) throw (ZincException);

};

#endif