MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_draw_surface

Function af_draw_surface

src/api/c/surface.cpp:146–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146af_err af_draw_surface(const af_window window, const af_array xVals,
147 const af_array yVals, const af_array S,
148 const af_cell* const props) {
149 try {
150 if (window == 0) { AF_ERROR("Not a valid window", AF_ERR_INTERNAL); }
151
152 const ArrayInfo& Xinfo = getInfo(xVals);
153 dim4 X_dims = Xinfo.dims();
154 af_dtype Xtype = Xinfo.getType();
155
156 const ArrayInfo& Yinfo = getInfo(yVals);
157 dim4 Y_dims = Yinfo.dims();
158 af_dtype Ytype = Yinfo.getType();
159
160 const ArrayInfo& Sinfo = getInfo(S);
161 const dim4& S_dims = Sinfo.dims();
162 af_dtype Stype = Sinfo.getType();
163
164 TYPE_ASSERT(Xtype == Ytype);
165 TYPE_ASSERT(Ytype == Stype);
166
167 if (!Yinfo.isVector()) {
168 DIM_ASSERT(1, X_dims == Y_dims);
169 DIM_ASSERT(3, Y_dims == S_dims);
170 } else {
171 DIM_ASSERT(3, (X_dims[0] * Y_dims[0] == (dim_t)Sinfo.elements()));
172 }
173
174 makeContextCurrent(window);
175
176 fg_chart chart = NULL;
177
178 switch (Xtype) {
179 case f32:
180 chart = setup_surface<float>(window, xVals, yVals, S, props);
181 break;
182 case s32:
183 chart = setup_surface<int>(window, xVals, yVals, S, props);
184 break;
185 case u32:
186 chart = setup_surface<uint>(window, xVals, yVals, S, props);
187 break;
188 case s16:
189 chart = setup_surface<short>(window, xVals, yVals, S, props);
190 break;
191 case u16:
192 chart = setup_surface<ushort>(window, xVals, yVals, S, props);
193 break;
194 case s8:
195 chart = setup_surface<schar>(window, xVals, yVals, S, props);
196 break;
197 case u8:
198 chart = setup_surface<uchar>(window, xVals, yVals, S, props);
199 break;
200 default: TYPE_ERROR(1, Xtype);
201 }
202 auto gridDims = forgeManager().getWindowGrid(window);
203

Callers 1

surfaceMethod · 0.50

Calls 6

makeContextCurrentFunction · 0.85
isVectorMethod · 0.80
getWindowGridMethod · 0.80
dimsMethod · 0.45
getTypeMethod · 0.45
elementsMethod · 0.45

Tested by

no test coverage detected