Forge: histogram.h Source File

Forge

histogram.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
33 FGAPI fg_err fg_create_histogram(fg_histogram *pHistogram,
34 const unsigned pNBins, const fg_dtype pDataType);
35
43 FGAPI fg_err fg_destroy_histogram(fg_histogram pHistogram);
44
62 FGAPI fg_err fg_set_histogram_color(fg_histogram pHistogram,
63 const float pRed, const float pGreen,
64 const float pBlue, const float pAlpha);
65
74 FGAPI fg_err fg_set_histogram_legend(fg_histogram pHistogram, const char* pLegend);
75
84 FGAPI fg_err fg_get_histogram_vertex_buffer(unsigned* pOut, const fg_histogram pHistogram);
85
94 FGAPI fg_err fg_get_histogram_color_buffer(unsigned* pOut, const fg_histogram pHistogram);
95
104 FGAPI fg_err fg_get_histogram_alpha_buffer(unsigned* pOut, const fg_histogram pHistogram);
105
114 FGAPI fg_err fg_get_histogram_vertex_buffer_size(unsigned* pOut, const fg_histogram pHistogram);
115
124 FGAPI fg_err fg_get_histogram_color_buffer_size(unsigned* pOut, const fg_histogram pHistogram);
125
134 FGAPI fg_err fg_get_histogram_alpha_buffer_size(unsigned* pOut, const fg_histogram pHistogram);
135
138 #ifdef __cplusplus
139 }
140 #endif
141
142
143 #ifdef __cplusplus
144
145 namespace forge
146 {
147
153 class Histogram {
154 private:
155 fg_histogram mValue;
156
157 public:
165 FGAPI Histogram(const unsigned pNBins, const dtype pDataType);
166
172 FGAPI Histogram(const Histogram& pOther);
173
177 FGAPI ~Histogram();
178
184 FGAPI void setColor(const Color pColor);
185
200 FGAPI void setColor(const float pRed, const float pGreen,
201 const float pBlue, const float pAlpha);
202
208 FGAPI void setLegend(const char* pLegend);
209
215 FGAPI unsigned vertices() const;
216
222 FGAPI unsigned colors() const;
223
229 FGAPI unsigned alphas() const;
230
236 FGAPI unsigned verticesSize() const;
237
243 FGAPI unsigned colorsSize() const;
244
250 FGAPI unsigned alphasSize() const;
251
255 FGAPI fg_histogram get() const;
256 };
257
258 }
259
260 #endif
fg_create_histogram
FGAPI fg_err fg_create_histogram(fg_histogram *pHistogram, const unsigned pNBins, const fg_dtype pDataType)
Creates a Histogram object.
fg_get_histogram_vertex_buffer
FGAPI fg_err fg_get_histogram_vertex_buffer(unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for vertices buffer.
fg_set_histogram_color
FGAPI fg_err fg_set_histogram_color(fg_histogram pHistogram, const float pRed, const float pGreen, const float pBlue, const float pAlpha)
Set the color of bar in the bar graph(histogram)
fg_get_histogram_color_buffer_size
FGAPI fg_err fg_get_histogram_color_buffer_size(unsigned *pOut, const fg_histogram pHistogram)
Get the colors buffer size in bytes.
forge::Histogram::colorsSize
FGAPI unsigned colorsSize() const
Get the colors buffer size in bytes.
forge
Definition: chart.h:214
fg_color
fg_color
Definition: defines.h:137
forge::Histogram::Histogram
FGAPI Histogram(const unsigned pNBins, const dtype pDataType)
Creates a Histogram object.
fg_get_histogram_vertex_buffer_size
FGAPI fg_err fg_get_histogram_vertex_buffer_size(unsigned *pOut, const fg_histogram pHistogram)
Get the vertices buffer size in bytes.
forge::Histogram::vertices
FGAPI unsigned vertices() const
Get the buffer identifier for vertices.
fg_get_histogram_alpha_buffer
FGAPI fg_err fg_get_histogram_alpha_buffer(unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for alpha values buffer.
forge::Histogram::setLegend
FGAPI void setLegend(const char *pLegend)
Set legend for histogram plot.
forge::dtype
dtype
Definition: defines.h:187
forge::Histogram::colors
FGAPI unsigned colors() const
Get the buffer identifier for color values per vertex.
FGAPI
#define FGAPI
Definition: defines.h:28
forge::Histogram::verticesSize
FGAPI unsigned verticesSize() const
Get the vertex buffer size in bytes.
forge::Histogram::~Histogram
FGAPI ~Histogram()
Histogram Destructor.
defines.h
fg_destroy_histogram
FGAPI fg_err fg_destroy_histogram(fg_histogram pHistogram)
Destroy Histogram object.
forge::Histogram::alphas
FGAPI unsigned alphas() const
Get the buffer identifier for alpha values per vertex.
forge::Histogram::alphasSize
FGAPI unsigned alphasSize() const
Get the alpha values buffer size in bytes.
fg_set_histogram_legend
FGAPI fg_err fg_set_histogram_legend(fg_histogram pHistogram, const char *pLegend)
Set legend for histogram plot.
fg_err
fg_err
Definition: defines.h:49
forge::Histogram::setColor
FGAPI void setColor(const Color pColor)
Set the color of bar in the bar graph(histogram)
fg_get_histogram_alpha_buffer_size
FGAPI fg_err fg_get_histogram_alpha_buffer_size(unsigned *pOut, const fg_histogram pHistogram)
Get the alpha values buffer size in bytes.
fg_histogram
void * fg_histogram
Definition: defines.h:44
fg_dtype
fg_dtype
Definition: defines.h:148
fg_get_histogram_color_buffer
FGAPI fg_err fg_get_histogram_color_buffer(unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for colors buffer.
forge::Histogram
Histogram is a bar graph to display data frequencey.
Definition: histogram.h:153