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

Function af_draw_hist

src/api/c/hist.cpp:103–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103af_err af_draw_hist(const af_window window, const af_array X,
104 const double minval, const double maxval,
105 const af_cell* const props) {
106 try {
107 if (window == 0) { AF_ERROR("Not a valid window", AF_ERR_INTERNAL); }
108
109 const ArrayInfo& Xinfo = getInfo(X);
110 af_dtype Xtype = Xinfo.getType();
111
112 ARG_ASSERT(0, Xinfo.isVector());
113
114 makeContextCurrent(window);
115
116 fg_chart chart = NULL;
117
118 switch (Xtype) {
119 case f32:
120 chart =
121 setup_histogram<float>(window, X, minval, maxval, props);
122 break;
123 case s32:
124 chart = setup_histogram<int>(window, X, minval, maxval, props);
125 break;
126 case u32:
127 chart = setup_histogram<uint>(window, X, minval, maxval, props);
128 break;
129 case s16:
130 chart =
131 setup_histogram<short>(window, X, minval, maxval, props);
132 break;
133 case u16:
134 chart =
135 setup_histogram<ushort>(window, X, minval, maxval, props);
136 break;
137 case s8:
138 chart =
139 setup_histogram<schar>(window, X, minval, maxval, props);
140 break;
141 case u8:
142 chart =
143 setup_histogram<uchar>(window, X, minval, maxval, props);
144 break;
145 default: TYPE_ERROR(1, Xtype);
146 }
147 auto gridDims = forgeManager().getWindowGrid(window);
148
149 ForgeModule& _ = forgePlugin();
150 if (props->col > -1 && props->row > -1) {
151 FG_CHECK(_.fg_draw_chart_to_cell(
152 window, gridDims.first, gridDims.second,
153 props->row * gridDims.second + props->col, chart,
154 props->title));
155 } else {
156 FG_CHECK(_.fg_draw_chart(window, chart));
157 }
158 }
159 CATCHALL;
160 return AF_SUCCESS;

Callers 1

histMethod · 0.50

Calls 4

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

Tested by

no test coverage detected