Forge

plot.h
Go to the documentation of this file.
1 /*******************************************************
2 * Copyright (c) 2015-2019, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10 #pragma once
11
12 #include <fg/defines.h>
13
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
38 FGAPI fg_err fg_create_plot(fg_plot *pPlot,
39 const unsigned pNPoints, const fg_dtype pType,
40 const fg_chart_type pChartType,
41 const fg_plot_type pPlotType,
42 const fg_marker_type pMarkerType);
43
51 FGAPI fg_err fg_destroy_plot(fg_plot pPlot);
52
64 FGAPI fg_err fg_set_plot_color(fg_plot pPlot,
65 const float pRed, const float pGreen,
66 const float pBlue, const float pAlpha);
67
76 FGAPI fg_err fg_set_plot_legend(fg_plot pPlot, const char* pLegend);
77
89 FGAPI fg_err fg_set_plot_marker_size(fg_plot pPlot, const float pMarkerSize);
90
99 FGAPI fg_err fg_get_plot_vertex_buffer(unsigned* pOut, const fg_plot pPlot);
100
109 FGAPI fg_err fg_get_plot_color_buffer(unsigned* pOut, const fg_plot pPlot);
110
119 FGAPI fg_err fg_get_plot_alpha_buffer(unsigned* pOut, const fg_plot pPlot);
120
129 FGAPI fg_err fg_get_plot_radii_buffer(unsigned* pOut, const fg_plot pPlot);
130
139 FGAPI fg_err fg_get_plot_vertex_buffer_size(unsigned* pOut, const fg_plot pPlot);
140
149 FGAPI fg_err fg_get_plot_color_buffer_size(unsigned* pOut, const fg_plot pPlot);
150
159 FGAPI fg_err fg_get_plot_alpha_buffer_size(unsigned* pOut, const fg_plot pPlot);
160
169 FGAPI fg_err fg_get_plot_radii_buffer_size(unsigned* pOut, const fg_plot pPlot);
170
173 #ifdef __cplusplus
174 }
175 #endif
176
177
178 #ifdef __cplusplus
179
180 namespace forge
181 {
182
188 class Plot {
189 private:
190 fg_plot mValue;
191
192 public:
205 FGAPI Plot(const unsigned pNumPoints, const dtype pDataType, const ChartType pChartType,
206 const PlotType pPlotType=FG_PLOT_LINE, const MarkerType pMarkerType=FG_MARKER_NONE);
207
213 FGAPI Plot(const Plot& pOther);
214
218 FGAPI ~Plot();
219
225 FGAPI void setColor(const forge::Color pColor);
226
235 FGAPI void setColor(const float pRed, const float pGreen,
236 const float pBlue, const float pAlpha);
237
243 FGAPI void setLegend(const char* pLegend);
244
253 FGAPI void setMarkerSize(const float pMarkerSize);
254
260 FGAPI unsigned vertices() const;
261
267 FGAPI unsigned colors() const;
268
274 FGAPI unsigned alphas() const;
275
281 FGAPI unsigned radii() const;
282
288 FGAPI unsigned verticesSize() const;
289
295 FGAPI unsigned colorsSize() const;
296
302 FGAPI unsigned alphasSize() const;
303
309 FGAPI unsigned radiiSize() const;
310
314 FGAPI fg_plot get() const;
315 };
316
317 }
318
319 #endif
forge::Plot::Plot
FGAPI Plot(const unsigned pNumPoints, const dtype pDataType, const ChartType pChartType, const PlotType pPlotType=FG_PLOT_LINE, const MarkerType pMarkerType=FG_MARKER_NONE)
Creates a Plot object.
fg_get_plot_color_buffer_size
FGAPI fg_err fg_get_plot_color_buffer_size(unsigned *pOut, const fg_plot pPlot)
Get the colors buffer size in bytes.
forge::Plot::colors
FGAPI unsigned colors() const
Get the buffer identifier for color values per vertex.
fg_get_plot_radii_buffer
FGAPI fg_err fg_get_plot_radii_buffer(unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for markers radii buffer.
fg_get_plot_alpha_buffer
FGAPI fg_err fg_get_plot_alpha_buffer(unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for alpha values buffer.
fg_marker_type
fg_marker_type
Definition: defines.h:164
FG_MARKER_NONE
No marker.
Definition: defines.h:165
forge
Definition: chart.h:214
fg_color
fg_color
Definition: defines.h:137
fg_set_plot_color
FGAPI fg_err fg_set_plot_color(fg_plot pPlot, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of line graph(plot)
forge::Plot::colorsSize
FGAPI unsigned colorsSize() const
Get the colors buffer size in bytes.
fg_get_plot_color_buffer
FGAPI fg_err fg_get_plot_color_buffer(unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for colors buffer.
fg_plot_type
fg_plot_type
Definition: defines.h:158
forge::Plot::~Plot
FGAPI ~Plot()
Plot Destructor.
forge::Plot::radii
FGAPI unsigned radii() const
Get the buffer identifier for per vertex marker sizes.
forge::dtype
dtype
Definition: defines.h:187
fg_get_plot_alpha_buffer_size
FGAPI fg_err fg_get_plot_alpha_buffer_size(unsigned *pOut, const fg_plot pPlot)
Get the alpha values buffer size in bytes.
forge::Plot
Plot is a line graph to display two dimensional data.
Definition: plot.h:188
forge::Plot::alphasSize
FGAPI unsigned alphasSize() const
Get the alpha values buffer size in bytes.
fg_chart_type
fg_chart_type
Definition: defines.h:117
fg_set_plot_legend
FGAPI fg_err fg_set_plot_legend(fg_plot pPlot, const char *pLegend)
Set plot legend.
forge::Plot::setMarkerSize
FGAPI void setMarkerSize(const float pMarkerSize)
Set global marker size.
FGAPI
#define FGAPI
Definition: defines.h:28
forge::Plot::setColor
FGAPI void setColor(const forge::Color pColor)
Set the color of line graph(plot)
forge::Plot::vertices
FGAPI unsigned vertices() const
Get the buffer identifier for vertices.
defines.h
forge::Plot::radiiSize
FGAPI unsigned radiiSize() const
Get the marker sizes buffer size in bytes.
forge::Plot::verticesSize
FGAPI unsigned verticesSize() const
Get the vertex buffer size in bytes.
fg_set_plot_marker_size
FGAPI fg_err fg_set_plot_marker_size(fg_plot pPlot, const float pMarkerSize)
Set global marker size.
fg_plot
void * fg_plot
Definition: defines.h:45
forge::Plot::alphas
FGAPI unsigned alphas() const
Get the buffer identifier for alpha values per vertex.
fg_get_plot_vertex_buffer_size
FGAPI fg_err fg_get_plot_vertex_buffer_size(unsigned *pOut, const fg_plot pPlot)
Get the vertices buffer size in bytes.
fg_err
fg_err
Definition: defines.h:49
fg_get_plot_radii_buffer_size
FGAPI fg_err fg_get_plot_radii_buffer_size(unsigned *pOut, const fg_plot pPlot)
Get the markers buffer size in bytes.
fg_destroy_plot
FGAPI fg_err fg_destroy_plot(fg_plot pPlot)
Destroy plot object.
fg_create_plot
FGAPI fg_err fg_create_plot(fg_plot *pPlot, const unsigned pNPoints, const fg_dtype pType, const fg_chart_type pChartType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create a Plot object.
FG_PLOT_LINE
Line plot.
Definition: defines.h:159
forge::Plot::setLegend
FGAPI void setLegend(const char *pLegend)
Set plot legend.
fg_dtype
fg_dtype
Definition: defines.h:148
fg_get_plot_vertex_buffer
FGAPI fg_err fg_get_plot_vertex_buffer(unsigned *pOut, const fg_plot pPlot)
Get the resource identifier for vertices buffer.