@@ -161,4 +161,151 @@ void in_texture_flip_vertically(in_texture_t* obj) {
161161*/
162162void * in_texture_get_pixels (in_texture_t* obj) {
163163 return (cast (Texture)obj).pixels.ptr;
164+ }
165+
166+ //
167+ // DRAWLIST
168+ //
169+
170+ /**
171+ DrawState flags
172+ */
173+ alias in_drawstate_t = uint ;
174+ enum in_drawstate_t
175+ IN_DRAW_STATE_NORMAL = 0 ,
176+ IN_DRAW_STATE_DEFINE_MASK = 1 ,
177+ IN_DRAW_STATE_MASKED_DRAW = 2 ,
178+ IN_DRAW_STATE_COMPOSITE_BEGIN = 3 ,
179+ IN_DRAW_STATE_COMPOSITE_END = 4 ,
180+ IN_DRAW_STATE_COMPOSITE_BLIT = 5 ;
181+
182+ /**
183+ Masking modes
184+ */
185+ alias in_mask_mode_t = uint ;
186+ enum in_mask_mode_t
187+ IN_MASK_MODE_MASK = 0 ,
188+ IN_MASK_MODE_DODGE = 1 ;
189+
190+ /**
191+ Blending modes
192+ */
193+ alias in_blend_mode_t = uint ;
194+ enum in_blend_mode_t
195+ IN_BLEND_MODE_NORMAL = 0x00 ,
196+ IN_BLEND_MODE_MULTIPLY = 0x01 ,
197+ IN_BLEND_MODE_SCREEN = 0x02 ,
198+ IN_BLEND_MODE_OVERLAY = 0x03 ,
199+ IN_BLEND_MODE_DARKEN = 0x04 ,
200+ IN_BLEND_MODE_LIGHTEN = 0x05 ,
201+ IN_BLEND_MODE_COLOR_DODGE = 0x06 ,
202+ IN_BLEND_MODE_LINEAR_DODGE = 0x07 ,
203+ IN_BLEND_MODE_ADD_GLOW = 0x08 ,
204+ IN_BLEND_MODE_COLOR_BURN = 0x09 ,
205+ IN_BLEND_MODE_HARD_LIGHT = 0x0A ,
206+ IN_BLEND_MODE_SOFT_LIGHT = 0x0B ,
207+ IN_BLEND_MODE_DIFFERENCE = 0x0C ,
208+ IN_BLEND_MODE_EXCLUSION = 0x0D ,
209+ IN_BLEND_MODE_SUBTRACT = 0x0E ,
210+ IN_BLEND_MODE_INVERSE = 0x0F ,
211+ IN_BLEND_MODE_DESTINATION_IN = 0x10 ,
212+ IN_BLEND_MODE_CLIP_TO_LOWER = 0x11 ,
213+ IN_BLEND_MODE_SLICE_FROM_LOWER = 0x12 ;
214+
215+ /**
216+ A drawing command from the Inochi2D draw list
217+ */
218+ struct in_drawcmd_t {
219+ in_texture_t[IN_MAX_ATTACHMENTS ] sources;
220+ in_drawstate_t state;
221+ float opacity;
222+ in_blend_mode_t blendMode;
223+ in_mask_mode_t maskMode;
224+ uint vtxOffset;
225+ uint idxOffset;
226+ uint elemCount;
227+ }
228+
229+ /**
230+ A drawlist instance
231+ */
232+ struct in_drawlist_t ;
233+
234+ /**
235+ Gets whether the draw list uses base vertex offsets.
236+
237+ Params:
238+ obj = The drawlist
239+
240+ Returns:
241+ $(D true) if base vertex offsets are being generated,
242+ $(D false) otherwise.
243+ */
244+ bool in_drawlist_get_use_base_vertex (in_drawlist_t* obj) {
245+ return (cast (DrawList)obj).useBaseVertex;
246+ }
247+
248+ /**
249+ Sets whether the draw list uses base vertex offsets.
250+
251+ Params:
252+ obj = The drawlist
253+ value = The value to set.
254+ */
255+ void in_drawlist_set_use_base_vertex (in_drawlist_t* obj, bool value) {
256+ (cast (DrawList)obj).useBaseVertex = value;
257+ }
258+
259+ /**
260+ Gets all of the commands stored in the draw list for iteration.
261+
262+ This memory is owned by the draw list and should not be freed
263+ by you.
264+
265+ Params:
266+ obj = The drawlist
267+ count = Where to store the command count
268+
269+ Returns:
270+ A pointer to an array of draw commands
271+ */
272+ in_draw_cmd_t* in_drawlist_get_commands (in_drawlist_t* obj, ref uint count) {
273+ count = cast (uint )(cast (DrawList)obj).commands.length;
274+ return cast (in_draw_cmd_t* )(cast (DrawList)obj).commands.ptr;
275+ }
276+
277+ /**
278+ Gets all of the vertex data stored in the draw list.
279+
280+ This memory is owned by the draw list and should not be freed
281+ by you.
282+
283+ Params:
284+ obj = The drawlist
285+ bytes = Where to store the byte count of the data.
286+
287+ Returns:
288+ A pointer to the data
289+ */
290+ void * in_drawlist_get_vertex_data (in_drawlist_t* obj, ref uint bytes) {
291+ bytes = cast (uint )(cast (DrawList)obj).vertices.length* VtxData.sizeof;
292+ return cast (void * )(cast (DrawList)obj).vertices.ptr;
293+ }
294+
295+ /**
296+ Gets all of the index data stored in the draw list.
297+
298+ This memory is owned by the draw list and should not be freed
299+ by you.
300+
301+ Params:
302+ obj = The drawlist
303+ bytes = Where to store the byte count of the data.
304+
305+ Returns:
306+ A pointer to the data
307+ */
308+ void * in_drawlist_get_index_data (in_drawlist_t* obj, ref uint bytes) {
309+ bytes = cast (uint )(cast (DrawList)obj).indices.length* uint .sizeof;
310+ return cast (void * )(cast (DrawList)obj).indices.ptr;
164311}
0 commit comments