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 
34  const unsigned pNBins, const fg_dtype pDataType);
35 
45 
54 
73  const float pRed, const float pGreen,
74  const float pBlue, const float pAlpha);
75 
84 FGAPI fg_err fg_set_histogram_legend(fg_histogram pHistogram, const char* pLegend);
85 
94 FGAPI fg_err fg_get_histogram_vertex_buffer(unsigned* pOut, const fg_histogram pHistogram);
95 
104 FGAPI fg_err fg_get_histogram_color_buffer(unsigned* pOut, const fg_histogram pHistogram);
105 
114 FGAPI fg_err fg_get_histogram_alpha_buffer(unsigned* pOut, const fg_histogram pHistogram);
115 
124 FGAPI fg_err fg_get_histogram_vertex_buffer_size(unsigned* pOut, const fg_histogram pHistogram);
125 
134 FGAPI fg_err fg_get_histogram_color_buffer_size(unsigned* pOut, const fg_histogram pHistogram);
135 
144 FGAPI fg_err fg_get_histogram_alpha_buffer_size(unsigned* pOut, const fg_histogram pHistogram);
145 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 
153 #ifdef __cplusplus
154 
155 namespace forge
156 {
157 
163 class Histogram {
164  private:
165  fg_histogram mValue;
166 
167  public:
175  FGAPI Histogram(const unsigned pNBins, const dtype pDataType);
176 
182  FGAPI Histogram(const Histogram& pOther);
183 
192  FGAPI explicit Histogram(const fg_histogram pHandle);
193 
197  FGAPI ~Histogram();
198 
204  FGAPI void setColor(const Color pColor);
205 
220  FGAPI void setColor(const float pRed, const float pGreen,
221  const float pBlue, const float pAlpha);
222 
228  FGAPI void setLegend(const char* pLegend);
229 
235  FGAPI unsigned vertices() const;
236 
242  FGAPI unsigned colors() const;
243 
249  FGAPI unsigned alphas() const;
250 
256  FGAPI unsigned verticesSize() const;
257 
263  FGAPI unsigned colorsSize() const;
264 
270  FGAPI unsigned alphasSize() const;
271 
275  FGAPI fg_histogram get() const;
276 };
277 
278 }
279 
280 #endif
FGAPI fg_err fg_create_histogram(fg_histogram *pHistogram, const unsigned pNBins, const fg_dtype pDataType)
Creates a Histogram object.
FGAPI fg_err fg_get_histogram_vertex_buffer(unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for vertices buffer.
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)
FGAPI fg_err fg_get_histogram_color_buffer_size(unsigned *pOut, const fg_histogram pHistogram)
Get the colors buffer size in bytes.
FGAPI unsigned colorsSize() const
Get the colors buffer size in bytes.
Definition: chart.h:304
fg_color
Definition: defines.h:139
FGAPI Histogram(const unsigned pNBins, const dtype pDataType)
Creates a Histogram object.
FGAPI fg_err fg_get_histogram_vertex_buffer_size(unsigned *pOut, const fg_histogram pHistogram)
Get the vertices buffer size in bytes.
FGAPI unsigned vertices() const
Get the buffer identifier for vertices.
FGAPI fg_err fg_get_histogram_alpha_buffer(unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for alpha values buffer.
FGAPI void setLegend(const char *pLegend)
Set legend for histogram plot.
dtype
Definition: defines.h:188
FGAPI unsigned colors() const
Get the buffer identifier for color values per vertex.
FGAPI fg_err fg_release_histogram(fg_histogram pHistogram)
Destroy Histogram object.
FGAPI fg_histogram get() const
Get the handle to internal implementation of Histogram.
#define FGAPI
Definition: defines.h:28
FGAPI unsigned verticesSize() const
Get the vertex buffer size in bytes.
FGAPI ~Histogram()
Histogram Destructor.
FGAPI fg_err fg_retain_histogram(fg_histogram *pOut, fg_histogram pIn)
Increase reference count of the resource.
FGAPI unsigned alphas() const
Get the buffer identifier for alpha values per vertex.
FGAPI unsigned alphasSize() const
Get the alpha values buffer size in bytes.
FGAPI fg_err fg_set_histogram_legend(fg_histogram pHistogram, const char *pLegend)
Set legend for histogram plot.
fg_err
Definition: defines.h:49
FGAPI void setColor(const Color pColor)
Set the color of bar in the bar graph(histogram)
FGAPI fg_err fg_get_histogram_alpha_buffer_size(unsigned *pOut, const fg_histogram pHistogram)
Get the alpha values buffer size in bytes.
void * fg_histogram
Definition: defines.h:44
fg_dtype
Definition: defines.h:150
FGAPI fg_err fg_get_histogram_color_buffer(unsigned *pOut, const fg_histogram pHistogram)
Get the resource identifier for colors buffer.
Histogram is a bar graph to display data frequencey.
Definition: histogram.h:163