IupgraphGL
 All Files Functions Enumerations Enumerator
iupgraph_gl.h
Go to the documentation of this file.
1 /* iupgraph_gl.h */
2 
3 #ifndef iupgraph_h
4 #define iupgraph_h
5 #include <iup.h>
6 #include <cd.h>
7 #include <im.h>
8 #include <im_image.h>
9 
10 //#define IUPGRAPH_GL
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
22  typedef enum
23  {
24  IUPG_BMP = 0 ,
25  IUPG_PCX = 1 ,
26  IUPG_GIF = 2 ,
27  IUPG_TIFF = 3 ,
28  IUPG_RAS = 4 ,
29  IUPG_SGI = 5 ,
30  IUPG_JPEG = 6 ,
31  IUPG_LED = 7 ,
32  IUPG_TGA = 8 ,
33  IUPG_RAW = 9 ,
34  IUPG_PNM = 10,
35  IUPG_ICO = 11,
36  IUPG_PNG = 12,
37  IUPG_SVG = -1,
38  IUPG_PDF = -2,
39  IUPG_PS = -3,
40  IUPG_EPS = -4
42 
62 void* IupGraphCreate(Ihandle *canvas, double xmin, double xmax, double ymin, double ymax);
63 
64 
82 void* IupGraphCreatePassive(int w, int h, double xmin, double xmax, double ymin, double ymax);
83 
91 void IupGraphDestroy (void *graph);
92 
100 void IupGraphRedraw (void *graph);
101 
102 
112 void IupGraphDump (void *graph, const char *fname, IupGraphImageFmt image_format);
121 void IupGraphFit (void *graph);
122 
123 
134 void IupGraphFitLimits (void *graph);
135 
136 
137 
139 typedef enum
140 {
141  IUPG_CENTER= CD_CENTER , /* NWEST NORTH NEAST */
142  IUPG_NORTH = CD_NORTH , /* O*******O*******O */
143  IUPG_SOUTH = CD_SOUTH , /* * * */
144  IUPG_WEST = CD_WEST , /* * * */
145  IUPG_EAST = CD_EAST , /* WEST O O O EAST */
146  IUPG_NWEST = CD_NORTH_WEST, /* * CENTER * */
147  IUPG_NEAST = CD_NORTH_EAST, /* * * */
148  IUPG_SWEST = CD_SOUTH_WEST, /* O*******O*******O */
149  IUPG_SEAST = CD_SOUTH_EAST /* SWEST SOUTH SEAST */
151 
152 
153 
154 // *** * * *** **** *****
155 // * * * * * * * *
156 // * ***** ***** **** *
157 // * * * * * * * *
158 // *** * * * * * * *
159 
163  typedef enum
164  {
165  IUPG_CHART_CART ,
171 
183 void *IupGraphChartCreate(int npoints, double *x, double *y, const char *name, IupGraphChartType type);
184 
192 void *IupGraphChartCopy(void *chart);
193 
194 
204 void *IupGraphChartCreateCb (int npoints, int (*cb) (void *chart, int i, double *x, double *y), const char *name, IupGraphChartType type);
205 
214 int IupGraphChartInsert(void *graph, void *chart);
215 
223 void IupGraphChartRemove(void *graph, void *chart);
224 
229 void IupGraphChartDestroy (void *chart);
230 
233 void IupGraphChartDestroyAll(void *graph);
234 
235 
241 void IupGraphChartRefreshData (void *graph, void *chart, double *x , double *y, int npoints);
242 
243 typedef enum /*relevant to bar and step charts*/
244 {
245  IUPG_VERTICAL,
246  IUPG_HORIZONTAL
247 } ChartOrientation;
248 
249 typedef enum /*relevant to bar, step and pie charts*/
250 {
251  IUPG_USEX, /*uses X values */
252  IUPG_USEY, /*uses Y values */
253  IUPG_USEP /*uses Points. In this case, step and x0 attributes are ignored */
254 } ChartDataInput;
255 typedef enum /*applicable to bar, step and pie*/
256 {
257  IUPG_SINGLE, /*every category has the same color */
258  IUPG_POSNEG, /*positive and negative values are displayed with different colors*/
259  IUPG_MULTIPLE /*each category has its own color */
260  } ColorScheme;
261 
262 
267 void IupGraphChartSetShow (void *chart, int show);
268 
269 
270 void IupGraphChartSetLine(void *chart, int show, float width, int style, long int color);
271 void IupGraphChartSetMark(void *chart, int show, int size , int type , long int color);
272 /*The following functions are not supported in Iupgraph GL, yet*/
273 //void IupGraphChartSetBar (void *chart, int show, double width, double step, double x0, int Orientation, int DataInput);
274 //void IupGraphChartSetStep(void *chart, int show, double step, double x0, int Orientation, int DataInput);
275 //void IupGraphChartSetPie (void *chart, int show, double inner_radius, double outter_radius, int solid, int DataInput);
276 
277 
282  void IupGraphChartSetPosition (void *chart, double x, double y);
283 
284 
285  void *IupGraphChartGetLine (void *chart);
286 
287 
289  void IupGraphChartSetClient (void *chart, void *client);
290 
291 
293  void *IupGraphChartGetClient (void *chart);
294 
295 
298  void *IupGraphChartGetGraph (void *chart);
299 
301  void IupGraphChartSetLabel_i (void *chart, int i, char *label_i);
302 
304  void *IupGraphChartGetLabel_i (void *chart, int i);
305 
307  void IupGraphChartSetColor_i (void *chart, int i, long int color_i);
308 
310  void IupGraphChartPieSetPosition (void *chart, double x, double y);
311 
313  void IupGraphChartPieSetRadius (void *chart, double radius);
314 
316  void* IupGraphChartGetLabelConnectorLine (void *chart);
317 
318 
319  void *IupGraphChartGetLegend (void *chart);
320 
321 
322 /***********************************************************************/
323 /* AXIS */
324 /***********************************************************************/
325 
326 typedef enum
327 {
328  IUPGRAPH_AXIS_X ,
329  IUPGRAPH_AXIS_Y ,
330  IUPGRAPH_GRID_X ,
331  IUPGRAPH_GRID_Y ,
332  IUPGRAPH_GRID_AUX_X,
333  IUPGRAPH_GRID_AUX_Y
334 } AxisLine;
335 
336 void IupGraphAxisSetLimits (void *g, float xmin, float xmax, float ymin, float ymax, float ox, float oy, int nx, int ny);
337 void IupGraphAxisGetLimits (void *g, float *xmin, float *xmax, float *ymin, float *ymax, float *ox, float *oy, int *nx, int *ny);
338 void *IupGraphAxisGetTitleX (void *g);
339 void *IupGraphAxisGetTitleY (void *g);
340 void IupGraphAxisSetDecimalPlacesX (void *g, int d);
341 void IupGraphAxisSetDecimalPlacesY (void *g, int d);
342 void *IupGraphAxisGetLine (void *g, AxisLine line);
343 
344 
345 /***********************************************************************/
346 /* SCALE */
347 /***********************************************************************/
348 
349 void* IupGraphScaleGetX (void *g);
350 void* IupGraphScaleGetY (void *g);
351 
352 void IupGraphScaleSetShow (void *scale, int show);
353 int IupGraphScaleGetShow (void *scale);
354 
355 void IupGraphScaleSetPosition (void *scale, float x, float y);
356 void IupGraphScaleGetPosition (void *scale, float *x, float *y);
357 
358 
359 
360 
361 
362 /***********************************************************************/
363 /* WINDOW AXES */
364 /***********************************************************************/
365 void IupGraphWindowAxesShow (void *g, int show);
366 
367 
368 /***********************************************************************/
369 /* LINE MASK */
370 /***********************************************************************/
371 void IupGraphLineSetShow (void *line,int show );
372 void IupGraphLineSetWidth(void *line,float width);
373 void IupGraphLineSetStyle(void *line,int style);
374 void IupGraphLineSetColor(void *line,long int color);
375 
376 int IupGraphLineGetShow (void *line);
377 float IupGraphLineGetWidth(void *line);
378 int IupGraphLineGetStyle(void *line);
379 long int IupGraphLineGetColor(void *line);
380 
381 /************************************************************************/
382 /* TEXT */
383 /************************************************************************/
385 void *IupGraphTextCreate(char *text_string);
386 
388 void IupGraphTextInsert (void *graph, void *text);
389 
391 void IupGraphTextDestroy(void *graph, void *text);
392 
393 
397 void *IupGraphGetTitle (void *graph);
398 
402 void *IupGraphChartGetTitle (void *chart);
403 
404 /*Sets*/
405 void IupGraphTextSetShow (void *text, int a);
406 void IupGraphTextSetValue (void *text, char *a);
407 void IupGraphTextSetFont (void *text, char *a);
408 void IupGraphTextSetOpaque (void *text, int a);
409 void IupGraphTextSetSize (void *text, int a);
410 void IupGraphTextSetColor (void *text, long int a);
411 void IupGraphTextSetDrawbox (void *text, int a);
412 void IupGraphTextSetBoxbgcolor (void *text, long int a);
413 void IupGraphTextSetBoxlinecolor(void *text, long int a);
414 
423 void IupGraphTextSetAlignment (void *text, int a);
424 
425 
431 void IupGraphTextSetPosition (void *text, float x, float y);
432 
443 void IupGraphTextSetNormalizedPosition (void *graph, void *text, float x, float y);
444 
446 void IupGraphTextSetAngle (void *text, float angle);
447 
448 
449 /*Gets*/
450 int IupGraphTextIsShown (void *text);
451 const char *IupGraphTextGetValue (void *text);
452 const char *IupGraphTextGetFont (void *text);
453 int IupGraphTextGetOpaque (void *text);
454 int IupGraphTextGetSize (void *text);
455 long int IupGraphTextGetTextcolor (void *text);
456 int IupGraphTextGetDrawbox (void *text);
457 long int IupGraphTextGetBoxbgcolor (void *text);
458 long int IupGraphTextGetBoxlinecolor(void *text);
459 void IupGraphTextGetPosition (void *text, float *x, float *y);
460 float IupGraphTextGetAngle (void *text);
461 
462 /***********************************************************************/
463 /* LEGEND */
464 /***********************************************************************/
465 void IupGraphLegendShow (void *graph, int show);
466 void IupGraphLegendSetUseChartColor (void *graph, int use);
467 int IupGraphLegendGetUseChartColor (void *graph);
468 
471 void IupGraphLegendSetPosition (void *graph, float x, float y);
472 void IupGraphLegendSetAlignment (void *graph, int align);
473 void IupGraphLegendSetOpaque (void *graph, int a);
474 void IupGraphLegendSetBoxbgcolor (void *graph, long int a);
475 
476 /*Gets*/
477 int IupGraphLegendGetOpaque (void *graph);
478 
479 
480 /***********************************************************************/
481 /* PICK */
482 /***********************************************************************/
484 void IupGraphPickSetTolerance(void *graph, int tol);
485 
486 
487 //void IupGraphSetBackgroundImage(void *graph, imImage *image);
488 /*Sets a background image created with IM library */
489 /*http://www.tecgraf.puc-rio.br/im */
490 /*Do not destroy the image yourself!!! Iupgraph does it internally */
491 
492 /***********************************************************************/
493 /* ZOOM */
494 /***********************************************************************/
495 
498 void IupGraphSetZoomStep(void *graph, float step);
499 
500 
503 void IupGraphSetZoomFactor(void *graph, float factor);
504 
505 
509 void IupGraphGetZoomBox (void *graph, float *xmin, float *xmax, float *ymin, float *ymax);
510 
511 
515 void IupGraphSetZoomBox (void *graph, float xmin, float xmax, float ymin, float ymax);
516 
517 
519 void IupGraphSetClipCharts (void *graph, int clip);
520 
522 int IupGraphGetClipCharts (void *graph);
523 
524 
525 /***********************************************************************/
526 /* BACKGROUND */
527 /***********************************************************************/
529 void IupGraphBgSetColor (void *graph, float r, float g, float b);
530 void IupGraphBgGetColor (void *graph, float *r, float *g,float *b);
531 
532 
533 /***********************************************************************/
534 /* CALLBACKS */
535 /***********************************************************************/
536 void IupGraphSetMouseMvCallback(void *g, void (*fcn) (double x,
537  double y,
538  char *r,
539  void **curve_vector,
540  double *picked_x,
541  double *picked_y,
542  int nsel_curves));
543 
544 void IupGraphSetMouseBtCallback(void *g, void (*fcn) (int bt,
545  int status,
546  double x,
547  double y,
548  void **curve_vector,
549  double *picked_x,
550  double *picked_y,
551  int nsel_curves));
552 
553 
554 
555 /***********************************************************************/
556 /* CHARTS */
557 /***********************************************************************/
558 /*Complete Charts API */
559 
560 /*All Charts' types attributes*/
561 void IupGraphChartSetFocusable (void *chart, int b);
562 void IupGraphChartSetPickable (void *chart, int b);
563 void IupGraphChartShowLabelX (void *chart, int b);
564 void IupGraphChartShowLabelY (void *chart, int b);
565 void IupGraphChartAllowUser2Destroy(void *chart, int b);
566 
567 void IupGraphChartGetLimits (void *chart, double *xmin, double *xmax, double *ymin, double *ymax);
568 
569 
570 /***********************************************************************/
571 /* CURVE AREAS */
572 /***********************************************************************/
573 
589 void* IupGraphCAreaCreate(void *chart1, void* chart2, double x0, double y0,double x1, double y1);
590 
596 void IupGraphCAreaInsert(void *graph, void* curvearea);
597 
607 void IupGraphCAreaSetUpper(void *carea,unsigned char r,unsigned char g,unsigned char b,unsigned char a);
608 
618 void IupGraphCAreaSetLower(void *carea,unsigned char r,unsigned char g,unsigned char b,unsigned char a);
619 
620 
624 void IupGraphCAreaSetLimits(void *carea,double xmin, double xmax, double ymin, double ymax);
625 
626 
630 int IupGraphCAreaDestroy(void *graph, void *carea);
631 
632 
635 void IupGraphCAreaDestroyAll(void *graph);
636 
637 
638  /* MARK */
639  void IupGraphChartShowMark (void *chart, int show);
640  void IupGraphChartSetMarkColor (void *chart, long int color);
641  void IupGraphChartSetMarkSize (void *chart, int size);
642  void IupGraphChartSetMarkType (void *chart, int type);
643 
644  int IupGraphChartIsMarkShown (void *chart);
645  long IupGraphChartGetMarkColor (void *chart);
646  int IupGraphChartGetMarkSize (void *chart);
647  int IupGraphChartGetMarkType (void *chart);
648 
649 #ifdef __cplusplus
650 }
651 #endif
652 
653 #endif