forked from arrayfire/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphics.h
More file actions
1189 lines (912 loc) · 43 KB
/
Copy pathgraphics.h
File metadata and controls
1189 lines (912 loc) · 43 KB
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
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#pragma once
#include <af/defines.h>
#include <af/array.h>
typedef void* af_window;
typedef struct {
int row;
int col;
const char* title;
af_colormap cmap;
} af_cell;
#ifdef __cplusplus
namespace af
{
/**
\class Window
\brief Window object to render af::arrays
Windows are not CopyConstructible or CopyAssignable.
\ingroup graphics_func
*/
class AFAPI Window {
private:
af_window wnd;
/* below attributes are used to track which
* cell in the grid is being rendered currently */
int _r;
int _c;
ColorMap _cmap;
void initWindow(const int width, const int height, const char* const title);
Window(const Window&); // Prevent copy-construction
Window& operator=(const Window&); // Prevent assignment
public:
/**
Creates a window object with default width
and height with title set to "ArrayFire"
\ingroup gfx_func_window
*/
Window();
/**
Creates a window object with default width
and height using the title provided by the user
\param[in] title is the window title
\ingroup gfx_func_window
*/
Window(const char* const title);
/**
Creates a window object using the parameters
provided by the user
\param[in] width is the window width
\param[in] height is the window height
\param[in] title is the window title with default value as "ArrayFire"
\ingroup gfx_func_window
*/
Window(const int width, const int height, const char* const title="ArrayFire");
/**
Creates a window object with default width
and height with title set to "ArrayFire"
\param[in] wnd is an \ref af_window handle which can be retrieved by
doing a get call on any \ref Window object
\ingroup gfx_func_window
*/
Window(const af_window wnd);
/**
Destroys the window handle
\ingroup gfx_func_window
*/
~Window();
// FIXME handle copying properly
/**
\return Returns the \ref af_window window handle.
\ingroup gfx_func_window
*/
af_window get() const { return wnd; }
/**
Set the start position where the window will appear
\param[in] x is horizontal coordinate
\param[in] y is vertical coordinate
\ingroup gfx_func_window
*/
void setPos(const unsigned x, const unsigned y);
/**
Set the window title
\param[in] title is the window title
\ingroup gfx_func_window
*/
void setTitle(const char* const title);
#if AF_API_VERSION >= 31
/**
Set the window size
\param[in] w is target width of the window
\param[in] h is target height of the window
\ingroup gfx_func_window
*/
void setSize(const unsigned w, const unsigned h);
#endif
/**
Set the colormap to be used for subsequent rendering calls
\param[in] cmap should be one of the enum values from \ref ColorMap
\ingroup gfx_func_window
*/
void setColorMap(const ColorMap cmap);
/**
Renders the input array as an image to the window
\param[in] in is an \ref array
\param[in] title parameter is used when this function is called in grid mode
\note \p in should be 2d array or 3d array with 3 channels.
\ingroup gfx_func_draw
*/
void image(const array& in, const char* title=NULL);
#if AF_API_VERSION >= 32
/**
Renders the input array as an 3d line plot to the window
\param[in] in is an \ref array
\param[in] title parameter is used when this function is called in grid mode
\note \p in should be 1d array of size 3n or 2d array with (3 x n) or (n x 3) channels.
\ingroup gfx_func_draw
*/
AF_DEPRECATED("Use plot instead")
void plot3(const array& in, const char* title=NULL);
#endif
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 2D or 3D plot to the window
\param[in] in is an \ref array with the data points
\param[in] title parameter is used when this function is called in grid mode
\note \p in must be 2d and of the form [n, order], where order is either 2 or 3.
If order is 2, then chart is 2D and if order is 3, then chart is 3D.
\ingroup gfx_func_draw
*/
void plot(const array& in, const char* const title=NULL);
#endif
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 3D plot to the window
\param[in] X is an \ref array with the x-axis data points
\param[in] Y is an \ref array with the y-axis data points
\param[in] Z is an \ref array with the z-axis data points
\param[in] title parameter is used when this function is called in grid mode
\note \p X, \p Y and \p Z should be vectors.
\ingroup gfx_func_draw
*/
void plot(const array& X, const array& Y, const array& Z, const char* const title=NULL);
#endif
/**
Renders the input arrays as a 2D plot to the window
\param[in] X is an \ref array with the x-axis data points
\param[in] Y is an \ref array with the y-axis data points
\param[in] title parameter is used when this function is called in grid mode
\note \p X and \p Y should be vectors.
\ingroup gfx_func_draw
*/
void plot(const array& X, const array& Y, const char* const title=NULL);
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 2D or 3D scatter-plot to the window
\param[in] in is an \ref array with the data points
\param[in] marker is an \ref markerType enum specifying which marker to use in the scatter plot
\param[in] title parameter is used when this function is called in grid mode
\note \p in must be 2d and of the form [n, order], where order is either 2 or 3.
If order is 2, then chart is 2D and if order is 3, then chart is 3D.
\ingroup gfx_func_draw
*/
void scatter(const array& in, const af::markerType marker = AF_MARKER_POINT,
const char* const title = NULL);
#endif
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 3D scatter-plot to the window
\param[in] X is an \ref array with the x-axis data points
\param[in] Y is an \ref array with the y-axis data points
\param[in] Z is an \ref array with the z-axis data points
\param[in] marker is an \ref markerType enum specifying which marker to use in the scatter plot
\param[in] title parameter is used when this function is called in grid mode
\note \p X, \p Y and \p Z should be vectors.
\ingroup gfx_func_draw
*/
void scatter(const array& X, const array& Y, const array& Z,
const af::markerType marker = AF_MARKER_POINT, const char* const title = NULL);
#endif
#if AF_API_VERSION >= 33
/**
Renders the input arrays as a 2D scatter-plot to the window
\param[in] X is an \ref array with the x-axis data points
\param[in] Y is an \ref array with the y-axis data points
\param[in] marker is an \ref markerType enum specifying which marker to use in the scatter plot
\param[in] title parameter is used when this function is called in grid mode
\note \p X and \p Y should be vectors.
\ingroup gfx_func_draw
*/
void scatter(const array& X, const array& Y,
const af::markerType marker = AF_MARKER_POINT, const char* const title = NULL);
#endif
#if AF_API_VERSION >= 33
/**
Renders the input arrays as a 3D scatter-plot to the window
\param[in] P is an \ref af_array or matrix with the xyz-values of the points
\param[in] marker is an \ref markerType enum specifying which marker to use in the scatter plot
\param[in] title parameter is used when this function is called in grid mode
\ingroup gfx_func_draw
*/
AF_DEPRECATED("Use scatter instead")
void scatter3(const array& P, const af::markerType marker = AF_MARKER_POINT,
const char* const title = NULL);
#endif
/**
Renders the input array as a histogram to the window
\param[in] X is the data frequency \ref array
\param[in] minval is the value of the minimum data point of the array whose histogram(\p X) is going to be rendered.
\param[in] maxval is the value of the maximum data point of the array whose histogram(\p X) is going to be rendered.
\param[in] title parameter is used when this function is called in grid mode
\note \p X should be a vector.
\ingroup gfx_func_draw
*/
void hist(const array& X, const double minval, const double maxval, const char* const title=NULL);
#if AF_API_VERSION >= 32
/**
Renders the input arrays as a 3D surface plot to the window
\param[in] S is an \ref array with the z-axis data points
\param[in] title parameter is used when this function is called in grid mode
\note \p S should be a 2D array
\ingroup gfx_func_draw
*/
void surface(const array& S, const char* const title = NULL);
#endif
#if AF_API_VERSION >= 32
/**
Renders the input arrays as a 3D surface plot to the window
\param[in] xVals is an \ref array with the x-axis data points
\param[in] yVals is an \ref array with the y-axis data points
\param[in] S is an \ref array with the z-axis data points
\param[in] title parameter is used when this function is called in grid mode
\note \p X and \p Y should be vectors or 2D arrays \p S should be s 2D array
\ingroup gfx_func_draw
*/
void surface(const array& xVals, const array& yVals, const array& S, const char* const title = NULL);
#endif
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 2D or 3D vector field plot to the window
\param[in] points is an \ref array with the points
\param[in] directions is an \ref array with the directions at the points
\param[in] title parameter is used when this function is called in grid mode
\note \p points and \p directions should have the same size and must
be 2D.
The number of rows (dim 0) determines are number of points and the
number columns determines the type of plot. If the number of columns
are 2, then the plot is 2D and if there are 3 columns, then the plot
is 3D.
\ingroup gfx_func_draw
*/
void vectorField(const array& points, const array& directions, const char* const title = NULL);
#endif
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 3D vector field plot to the window
\param[in] xPoints is an \ref array with the x-coordinate points
\param[in] yPoints is an \ref array with the y-coordinate points
\param[in] zPoints is an \ref array with the z-coordinate points
\param[in] xDirs is an \ref array with the x-coordinate directions at the points
\param[in] yDirs is an \ref array with the y-coordinate directions at the points
\param[in] zDirs is an \ref array with the z-coordinate directions at the points
\param[in] title parameter is used when this function is called in grid mode
\note All the array inputs must be vectors and must have the size sizes.
\ingroup gfx_func_draw
*/
void vectorField(const array& xPoints, const array& yPoints, const array& zPoints,
const array& xDirs , const array& yDirs , const array& zDirs ,
const char* const title = NULL);
#endif
#if AF_API_VERSION >= 34
/**
Renders the input arrays as a 2D vector field plot to the window
\param[in] xPoints is an \ref array with the x-coordinate points
\param[in] yPoints is an \ref array with the y-coordinate points
\param[in] xDirs is an \ref array with the x-coordinate directions at the points
\param[in] yDirs is an \ref array with the y-coordinate directions at the points
\param[in] title parameter is used when this function is called in grid mode
\note All the array inputs must be vectors and must have the size sizes.
\ingroup gfx_func_draw
*/
void vectorField(const array& xPoints, const array& yPoints,
const array& xDirs , const array& yDirs ,
const char* const title = NULL);
#endif
#if AF_API_VERSION >= 34
/**
Setup the axes limits for a 2D histogram/plot/vector field
This function computes the minimum and maximum for each dimension
\param[in] x the data to compute the limits for x-axis.
\param[in] y the data to compute the limits for y-axis.
\param[in] exact is for using the exact min/max values from \p x and \p y.
If exact is false then the most significant digit is rounded up
to next power of 2 and the magnitude remains the same.
\ingroup gfx_func_window
*/
void setAxesLimits(const array &x, const array &y, const bool exact = false);
#endif
#if AF_API_VERSION >= 34
/**
Setup the axes limits for a histogram/plot/surface/vector field
This function computes the minimum and maximum for each dimension
\param[in] x the data to compute the limits for x-axis.
\param[in] y the data to compute the limits for y-axis.
\param[in] z the data to compute the limits for z-axis.
\param[in] exact is for using the exact min/max values from \p x and \p y.
If exact is false then the most significant digit is rounded up
to next power of 2 and the magnitude remains the same.
\ingroup gfx_func_window
*/
void setAxesLimits(const array &x, const array &y, const array &z,
const bool exact = false);
#endif
#if AF_API_VERSION >= 34
/**
Setup the axes limits for a histogram/plot/surface/vector field
This function sets the axes limits to the ones provided by the user.
\param[in] xmin is the minimum on x-axis
\param[in] xmax is the maximum on x-axis
\param[in] ymin is the minimum on y-axis
\param[in] ymax is the maximum on y-axis
\param[in] exact is for using the exact min/max values from \p x and \p y.
If exact is false then the most significant digit is rounded up
to next power of 2 and the magnitude remains the same.
\ingroup gfx_func_window
*/
void setAxesLimits(const float xmin, const float xmax,
const float ymin, const float ymax,
const bool exact = false);
#endif
#if AF_API_VERSION >= 34
/**
Setup the axes limits for a histogram/plot/surface/vector field
This function sets the axes limits to the ones provided by the user.
\param[in] xmin is the minimum on x-axis
\param[in] xmax is the maximum on x-axis
\param[in] ymin is the minimum on y-axis
\param[in] ymax is the maximum on y-axis
\param[in] zmin is the minimum on z-axis
\param[in] zmax is the maximum on z-axis
\param[in] exact is for using the exact min/max values from \p x, \p y and \p z.
If exact is false then the most significant digit is rounded up
to next power of 2 and the magnitude remains the same.
\ingroup gfx_func_window
*/
void setAxesLimits(const float xmin, const float xmax,
const float ymin, const float ymax,
const float zmin, const float zmax,
const bool exact = false);
#endif
#if AF_API_VERSION >= 34
/**
Setup the axes titles for a plot/surface/vector field
This function creates the axis titles for a chart.
\param[in] xtitle is the name of the x-axis
\param[in] ytitle is the name of the y-axis
\param[in] ztitle is the name of the z-axis
\ingroup gfx_func_window
*/
void setAxesTitles(const char * const xtitle = "X-Axis",
const char * const ytitle = "Y-Axis",
const char * const ztitle = NULL);
#endif
#if AF_API_VERSION >= 37
/**
Setup the axes label formats for charts
\param[in] xformat is a printf-style format specifier for x-axis
\param[in] yformat is a printf-style format specifier for y-axis
\param[in] zformat is a printf-style format specifier for z-axis
\ingroup gfx_func_window
*/
void setAxesLabelFormat(const char *const xformat = "4.1%f",
const char *const yformat = "4.1%f",
const char *const zformat = NULL);
#endif
/**
Setup grid layout for multiview mode in a window
\param[in] rows is number of rows you want to divide the display area
\param[in] cols is number of coloumns you want to divide the display area
\ingroup gfx_func_window
*/
void grid(const int rows, const int cols);
/**
This function swaps the background buffer to current view
and polls for any key strokes while the window was in focus
\ingroup gfx_func_window
*/
void show();
/**
Check if window is marked for close. This usually
happens when user presses ESC key while the window is in focus.
\return \ref AF_SUCCESS if window show is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_window
*/
bool close();
#if AF_API_VERSION >= 33
/**
Hide/Show the window
\param[in] isVisible indicates if the window is to be hidden or brought into focus
\ingroup gfx_func_window
*/
void setVisibility(const bool isVisible);
#endif
/**
This function is used to keep track of which cell in the grid mode is
being currently rendered. When a user does Window(0,0), we internally
store the cell coordinates and return a reference to the very object that
called upon this function. This reference can be used later to issue
draw calls using rendering functions.
\param[in] r is row identifier where current object has to be rendered
\param[in] c is column identifier where current object has to be rendered
\return a reference to the object pointed by this
to enable cascading this call with rendering functions.
\ingroup gfx_window_func
*/
inline Window& operator()(const int r, const int c) {
_r = r; _c = c;
return *this;
}
};
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
C Interface wrapper for creating a window
\param[out] out is the handle to the created window
\param[in] width is the width of the window that will be created
\param[in] height is the height of the window that will be created
\param[in] title is the window title
\return \ref AF_SUCCESS if window creation is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_window
*/
AFAPI af_err af_create_window(af_window *out, const int width, const int height, const char* const title);
/**
C Interface wrapper for setting the start position when window is displayed
\param[in] wind is the window handle
\param[in] x is horizontal start coordinate
\param[in] y is vertical start coordinate
\return \ref AF_SUCCESS if set position for window is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_window
*/
AFAPI af_err af_set_position(const af_window wind, const unsigned x, const unsigned y);
/**
C Interface wrapper for setting window title
\param[in] wind is the window handle
\param[in] title is title of the window
\return \ref AF_SUCCESS if set title for window is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_window
*/
AFAPI af_err af_set_title(const af_window wind, const char* const title);
#if AF_API_VERSION >= 31
/**
C Interface wrapper for setting window position
\param[in] wind is the window handle
\param[in] w is target width of the window
\param[in] h is target height of the window
\return \ref AF_SUCCESS if set size for window is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_window
*/
AFAPI af_err af_set_size(const af_window wind, const unsigned w, const unsigned h);
#endif
/**
C Interface wrapper for drawing an array as an image
\param[in] wind is the window handle
\param[in] in is an \ref af_array
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p in should be 2d array or 3d array with 3 channels.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_image(const af_window wind, const af_array in, const af_cell* const props);
/**
C Interface wrapper for drawing an array as a plot
\param[in] wind is the window handle
\param[in] X is an \ref af_array with the x-axis data points
\param[in] Y is an \ref af_array with the y-axis data points
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X and \p Y should be vectors.
\ingroup gfx_func_draw
*/
AF_DEPRECATED("Use af_draw_plot_nd or af_draw_plot_2d instead")
AFAPI af_err af_draw_plot(const af_window wind, const af_array X, const af_array Y, const af_cell* const props);
#if AF_API_VERSION >= 32
/**
C Interface wrapper for drawing an array as a plot
\param[in] wind is the window handle
\param[in] P is an \ref af_array or matrix with the xyz-values of the points
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p P should be a 3n x 1 vector or one of a 3xn or nx3 matrices.
\ingroup gfx_func_draw
*/
AF_DEPRECATED("Use af_draw_plot_nd or af_draw_plot_3d instead")
AFAPI af_err af_draw_plot3(const af_window wind, const af_array P, const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing an array as a 2D or 3D plot
\param[in] wind is the window handle
\param[in] P is an \ref af_array or matrix with the xyz-values of the points
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p in must be 2d and of the form [n, order], where order is either 2 or 3.
If order is 2, then chart is 2D and if order is 3, then chart is 3D.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_plot_nd(const af_window wind, const af_array P, const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing an array as a 2D plot
\param[in] wind is the window handle
\param[in] X is an \ref af_array with the x-axis data points
\param[in] Y is an \ref af_array with the y-axis data points
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X and \p Y should be vectors.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_plot_2d(const af_window wind, const af_array X, const af_array Y,
const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing an array as a 3D plot
\param[in] wind is the window handle
\param[in] X is an \ref af_array with the x-axis data points
\param[in] Y is an \ref af_array with the y-axis data points
\param[in] Z is an \ref af_array with the z-axis data points
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X, \p Y and \p Z should be vectors.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_plot_3d(const af_window wind,
const af_array X, const af_array Y, const af_array Z,
const af_cell* const props);
#endif
#if AF_API_VERSION >= 33
/**
C Interface wrapper for drawing an array as a plot
\param[in] wind is the window handle
\param[in] X is an \ref af_array with the x-axis data points
\param[in] Y is an \ref af_array with the y-axis data points
\param[in] marker is an \ref af_marker_type enum specifying which marker to use in the scatter plot
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X and \p Y should be vectors.
\ingroup gfx_func_draw
*/
AF_DEPRECATED("Use af_draw_scatter_nd or af_draw_scatter_2d instead")
AFAPI af_err af_draw_scatter(const af_window wind, const af_array X, const af_array Y,
const af_marker_type marker, const af_cell* const props);
#endif
#if AF_API_VERSION >= 33
/**
C Interface wrapper for drawing an array as a plot
\param[in] wind is the window handle
\param[in] P is an \ref af_array or matrix with the xyz-values of the points
\param[in] marker is an \ref af_marker_type enum specifying which marker to use in the scatter plot
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_draw
*/
AF_DEPRECATED("Use af_draw_scatter_nd or af_draw_scatter_3d instead")
AFAPI af_err af_draw_scatter3(const af_window wind, const af_array P,
const af_marker_type marker, const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing an array as a plot
\param[in] wind is the window handle
\param[in] P is an \ref af_array or matrix with the xyz-values of the points
\param[in] marker is an \ref af_marker_type enum specifying which marker to use in the scatter plot
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p in must be 2d and of the form [n, order], where order is either 2 or 3.
If order is 2, then chart is 2D and if order is 3, then chart is 3D.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_scatter_nd(const af_window wind, const af_array P,
const af_marker_type marker, const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing an array as a 2D plot
\param[in] wind is the window handle
\param[in] X is an \ref af_array with the x-axis data points
\param[in] Y is an \ref af_array with the y-axis data points
\param[in] marker is an \ref af_marker_type enum specifying which marker to use in the scatter plot
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X and \p Y should be vectors.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_scatter_2d(const af_window wind, const af_array X, const af_array Y,
const af_marker_type marker, const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing an array as a 3D plot
\param[in] wind is the window handle
\param[in] X is an \ref af_array with the x-axis data points
\param[in] Y is an \ref af_array with the y-axis data points
\param[in] Z is an \ref af_array with the z-axis data points
\param[in] marker is an \ref af_marker_type enum specifying which marker to use in the scatter plot
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X, \p Y and \p Z should be vectors.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_scatter_3d(const af_window wind,
const af_array X, const af_array Y, const af_array Z,
const af_marker_type marker, const af_cell* const props);
#endif
/**
C Interface wrapper for drawing an array as a histogram
\param[in] wind is the window handle
\param[in] X is the data frequency \ref af_array
\param[in] minval is the value of the minimum data point of the array whose histogram(\p X) is going to be rendered.
\param[in] maxval is the value of the maximum data point of the array whose histogram(\p X) is going to be rendered.
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X should be a vector.
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_hist(const af_window wind, const af_array X, const double minval, const double maxval, const af_cell* const props);
#if AF_API_VERSION >= 32
/**
C Interface wrapper for drawing array's as a surface
\param[in] wind is the window handle
\param[in] xVals is an \ref af_array with the x-axis data points
\param[in] yVals is an \ref af_array with the y-axis data points
\param[in] S is an \ref af_array with the z-axis data points
\param[in] props is structure \ref af_cell that has the properties that are used
for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p X and \p Y should be vectors. \p S should be a 2D array
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_surface(const af_window wind, const af_array xVals, const af_array yVals, const af_array S, const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing array's as a 2D or 3D vector field
\param[in] wind is the window handle
\param[in] points is an \ref af_array with the points
\param[in] directions is an \ref af_array with the directions
\param[in] props is structure \ref af_cell that has the properties that
are used for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note \p points and \p directions should have the same size and must
be 2D.
The number of rows (dim 0) determines are number of points and the
number columns determines the type of plot. If the number of columns
are 2, then the plot is 2D and if there are 3 columns, then the plot
is 3D.
\note all the \ref af_array inputs should be vectors and the same size
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_vector_field_nd(const af_window wind,
const af_array points, const af_array directions,
const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing array's as a 3D vector field
\param[in] wind is the window handle
\param[in] xPoints is an \ref af_array with the x-axis points
\param[in] yPoints is an \ref af_array with the y-axis points
\param[in] zPoints is an \ref af_array with the z-axis points
\param[in] xDirs is an \ref af_array with the x-axis directions
\param[in] yDirs is an \ref af_array with the y-axis directions
\param[in] zDirs is an \ref af_array with the z-axis directions
\param[in] props is structure \ref af_cell that has the properties that
are used for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note all the \ref af_array inputs should be vectors and the same size
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_vector_field_3d(
const af_window wind,
const af_array xPoints, const af_array yPoints, const af_array zPoints,
const af_array xDirs, const af_array yDirs, const af_array zDirs,
const af_cell* const props);
#endif
#if AF_API_VERSION >= 34
/**
C Interface wrapper for drawing array's as a 2D vector field
\param[in] wind is the window handle
\param[in] xPoints is an \ref af_array with the x-axis points
\param[in] yPoints is an \ref af_array with the y-axis points
\param[in] xDirs is an \ref af_array with the x-axis directions
\param[in] yDirs is an \ref af_array with the y-axis directions
\param[in] props is structure \ref af_cell that has the properties that
are used for the current rendering.
\return \ref AF_SUCCESS if rendering is successful, otherwise an appropriate error code
is returned.
\note all the \ref af_array inputs should be vectors and the same size
\ingroup gfx_func_draw
*/
AFAPI af_err af_draw_vector_field_2d(
const af_window wind,
const af_array xPoints, const af_array yPoints,
const af_array xDirs, const af_array yDirs,
const af_cell* const props);
#endif
/**
C Interface wrapper for grid setup in a window
\param[in] wind is the window handle
\param[in] rows is number of rows you want to show in a window
\param[in] cols is number of coloumns you want to show in a window
\return \ref AF_SUCCESS if grid setup for window is successful, otherwise an appropriate error code
is returned.
\ingroup gfx_func_window
*/
AFAPI af_err af_grid(const af_window wind, const int rows, const int cols);
#if AF_API_VERSION >= 34
/**
C Interface for setting axes limits for a histogram/plot/surface/vector field