Forge

surface.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 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
37 FGAPI fg_err fg_create_surface(fg_surface *pSurface,
38 const unsigned pXPoints, const unsigned pYPoints,
39 const fg_dtype pType,
40 const fg_plot_type pPlotType,
41 const fg_marker_type pMarkerType);
42
51 FGAPI fg_err fg_retain_surface(fg_surface *pOut, fg_surface pIn);
52
60 FGAPI fg_err fg_release_surface(fg_surface pSurface);
61
73 FGAPI fg_err fg_set_surface_color(fg_surface pSurface,
74 const float pRed, const float pGreen,
75 const float pBlue, const float pAlpha);
76
85 FGAPI fg_err fg_set_surface_legend(fg_surface pSurface, const char* pLegend);
86
95 FGAPI fg_err fg_get_surface_vertex_buffer(unsigned* pOut, const fg_surface pSurface);
96
105 FGAPI fg_err fg_get_surface_color_buffer(unsigned* pOut, const fg_surface pSurface);
106
115 FGAPI fg_err fg_get_surface_alpha_buffer(unsigned* pOut, const fg_surface pSurface);
116
125 FGAPI fg_err fg_get_surface_vertex_buffer_size(unsigned* pOut, const fg_surface pSurface);
126
135 FGAPI fg_err fg_get_surface_color_buffer_size(unsigned* pOut, const fg_surface pSurface);
136
145 FGAPI fg_err fg_get_surface_alpha_buffer_size(unsigned* pOut, const fg_surface pSurface);
146
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #ifdef __cplusplus
154
155 namespace forge
156 {
157
163 class Surface {
164 private:
165 fg_surface mValue;
166
167 public:
179 FGAPI Surface(const unsigned pNumXPoints, const unsigned pNumYPoints, const dtype pDataType,
180 const PlotType pPlotType=FG_PLOT_SURFACE, const MarkerType pMarkerType=FG_MARKER_NONE);
181
187 FGAPI Surface(const Surface& pOther);
188
197 FGAPI explicit Surface(const fg_surface pHandle);
198
202 FGAPI ~Surface();
203
209 FGAPI void setColor(const forge::Color pColor);
210
219 FGAPI void setColor(const float pRed, const float pGreen,
220 const float pBlue, const float pAlpha);
221
227 FGAPI void setLegend(const char* pLegend);
228
234 FGAPI unsigned vertices() const;
235
241 FGAPI unsigned colors() const;
242
248 FGAPI unsigned alphas() const;
249
255 FGAPI unsigned verticesSize() const;
256
262 FGAPI unsigned colorsSize() const;
263
269 FGAPI unsigned alphasSize() const;
270
271
275 FGAPI fg_surface get() const;
276 };
277
278 }
279
280 #endif
fg_get_surface_vertex_buffer
FGAPI fg_err fg_get_surface_vertex_buffer(unsigned *pOut, const fg_surface pSurface)
Get the resource identifier for vertices buffer.
forge::Surface::Surface
FGAPI Surface(const unsigned pNumXPoints, const unsigned pNumYPoints, const dtype pDataType, const PlotType pPlotType=FG_PLOT_SURFACE, const MarkerType pMarkerType=FG_MARKER_NONE)
Creates a Surface object.
fg_get_surface_alpha_buffer
FGAPI fg_err fg_get_surface_alpha_buffer(unsigned *pOut, const fg_surface pSurface)
Get the resource identifier for alpha values buffer.
fg_get_surface_alpha_buffer_size
FGAPI fg_err fg_get_surface_alpha_buffer_size(unsigned *pOut, const fg_surface pSurface)
Get the alpha values buffer size in bytes.
fg_release_surface
FGAPI fg_err fg_release_surface(fg_surface pSurface)
Destroy surface object.
fg_marker_type
fg_marker_type
Definition: defines.h:166
FG_MARKER_NONE
No marker.
Definition: defines.h:167
forge
Definition: chart.h:304
fg_color
fg_color
Definition: defines.h:139
fg_get_surface_color_buffer_size
FGAPI fg_err fg_get_surface_color_buffer_size(unsigned *pOut, const fg_surface pSurface)
Get the colors buffer size in bytes.
forge::Surface::verticesSize
FGAPI unsigned verticesSize() const
Get the vertex buffer size in bytes.
fg_plot_type
fg_plot_type
Definition: defines.h:160
forge::dtype
dtype
Definition: defines.h:188
forge::Surface::colors
FGAPI unsigned colors() const
Get the buffer identifier for color values per vertex.
fg_set_surface_color
FGAPI fg_err fg_set_surface_color(fg_surface pSurface, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of surface.
FGAPI
#define FGAPI
Definition: defines.h:28
fg_surface
void * fg_surface
Definition: defines.h:46
defines.h
fg_get_surface_color_buffer
FGAPI fg_err fg_get_surface_color_buffer(unsigned *pOut, const fg_surface pSurface)
Get the resource identifier for colors buffer.
forge::Surface::setColor
FGAPI void setColor(const forge::Color pColor)
Set the color of line graph(surface)
fg_retain_surface
FGAPI fg_err fg_retain_surface(fg_surface *pOut, fg_surface pIn)
Increase reference count of the resource.
forge::Surface::setLegend
FGAPI void setLegend(const char *pLegend)
Set surface legend.
fg_err
fg_err
Definition: defines.h:49
FG_PLOT_SURFACE
Surface plot.
Definition: defines.h:163
forge::Surface::colorsSize
FGAPI unsigned colorsSize() const
Get the colors buffer size in bytes.
fg_set_surface_legend
FGAPI fg_err fg_set_surface_legend(fg_surface pSurface, const char *pLegend)
Set surface legend.
forge::Surface
Surface is a graph to display three dimensional data.
Definition: surface.h:163
forge::Surface::~Surface
FGAPI ~Surface()
surface Destructor
forge::Surface::alphas
FGAPI unsigned alphas() const
Get the buffer identifier for alpha values per vertex.
forge::Surface::vertices
FGAPI unsigned vertices() const
Get the buffer identifier for vertices.
fg_create_surface
FGAPI fg_err fg_create_surface(fg_surface *pSurface, const unsigned pXPoints, const unsigned pYPoints, const fg_dtype pType, const fg_plot_type pPlotType, const fg_marker_type pMarkerType)
Create a Surface object.
fg_get_surface_vertex_buffer_size
FGAPI fg_err fg_get_surface_vertex_buffer_size(unsigned *pOut, const fg_surface pSurface)
Get the vertices buffer size in bytes.
forge::Surface::alphasSize
FGAPI unsigned alphasSize() const
Get the alpha values buffer size in bytes.
fg_dtype
fg_dtype
Definition: defines.h:150