-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathsurface.cpp
More file actions
149 lines (113 loc) · 3.52 KB
/
Copy pathsurface.cpp
File metadata and controls
149 lines (113 loc) · 3.52 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
/*******************************************************
* Copyright (c) 2015-2019, 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
********************************************************/
#include <common/chart_renderables.hpp>
#include <common/handle.hpp>
#include <fg/surface.h>
using namespace forge;
using forge::common::getSurface;
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) {
try {
ARG_ASSERT(1, (pXPoints > 0));
ARG_ASSERT(2, (pYPoints > 0));
*pSurface = getHandle(new common::Surface(
pXPoints, pYPoints, (forge::dtype)pType, pPlotType, pMarkerType));
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_retain_surface(fg_surface* pOut, fg_surface pIn) {
try {
ARG_ASSERT(1, (pIn != 0));
common::Surface* temp = new common::Surface(getSurface(pIn));
*pOut = getHandle(temp);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_release_surface(fg_surface pSurface) {
try {
ARG_ASSERT(0, (pSurface != 0));
delete getSurface(pSurface);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_set_surface_color(fg_surface pSurface, const float pRed,
const float pGreen, const float pBlue,
const float pAlpha) {
try {
ARG_ASSERT(0, (pSurface != 0));
getSurface(pSurface)->setColor(pRed, pGreen, pBlue, pAlpha);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_set_surface_legend(fg_surface pSurface, const char* pLegend) {
try {
ARG_ASSERT(0, (pSurface != 0));
ARG_ASSERT(1, (pLegend != 0));
getSurface(pSurface)->setLegend(pLegend);
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_surface_vertex_buffer(unsigned* pOut, const fg_surface pSurface) {
try {
ARG_ASSERT(1, (pSurface != 0));
*pOut = getSurface(pSurface)->vbo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_surface_color_buffer(unsigned* pOut, const fg_surface pSurface) {
try {
ARG_ASSERT(1, (pSurface != 0));
*pOut = getSurface(pSurface)->cbo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_surface_alpha_buffer(unsigned* pOut, const fg_surface pSurface) {
try {
ARG_ASSERT(1, (pSurface != 0));
*pOut = getSurface(pSurface)->abo();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_surface_vertex_buffer_size(unsigned* pOut,
const fg_surface pSurface) {
try {
ARG_ASSERT(1, (pSurface != 0));
*pOut = (unsigned)getSurface(pSurface)->vboSize();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_surface_color_buffer_size(unsigned* pOut,
const fg_surface pSurface) {
try {
ARG_ASSERT(1, (pSurface != 0));
*pOut = (unsigned)getSurface(pSurface)->cboSize();
}
CATCHALL
return FG_ERR_NONE;
}
fg_err fg_get_surface_alpha_buffer_size(unsigned* pOut,
const fg_surface pSurface) {
try {
ARG_ASSERT(1, (pSurface != 0));
*pOut = (unsigned)getSurface(pSurface)->aboSize();
}
CATCHALL
return FG_ERR_NONE;
}