@@ -263,6 +263,56 @@ pub fn draw_sub_image(sub_image : SubImage, point : Point) -> Unit {
263263 sub_image.image |> @memory.keep
264264}
265265
266+ ///|
267+ /// Tile the given screen area with the provided sub-image.
268+ pub fn draw_sub_tile(sub_image : SubImage , point : Point , size : Size ) -> Unit {
269+ @ffi.draw_sub_tile(
270+ @memory.fixedbytes_addr(sub_image.image.0),
271+ @memory.fixedbytes_size(sub_image.image.0),
272+ point.x,
273+ point.y,
274+ size.w,
275+ size.h,
276+ sub_image.point_x,
277+ sub_image.point_y,
278+ sub_image.size_w,
279+ sub_image.size_h,
280+ )
281+ sub_image.image |> @memory.keep
282+ }
283+
284+ ///|
285+ /// Fill the given area with the given 9-slice.
286+ ///
287+ /// A 9-slice is used to tile an area with 9 sub-images: 4 corners,
288+ /// 4 edges, and 1 middle segment. It is useful for speech bubbles
289+ /// and other stylish boxes.
290+ ///
291+ /// The whole image is the 9-slice. The sub-image is the center area of the 9-slice.
292+ ///
293+ /// If the target area is bigger than the 9-slice segments,
294+ /// all the segments (except corners) are repeated ("tiled")
295+ /// without stretching or mirroring.
296+ pub fn draw_nine_slice(
297+ sub_image : SubImage ,
298+ point : Point ,
299+ size : Size ,
300+ ) -> Unit {
301+ @ffi.draw_nine_slice(
302+ @memory.fixedbytes_addr(sub_image.image.0),
303+ @memory.fixedbytes_size(sub_image.image.0),
304+ point.x,
305+ point.y,
306+ size.w,
307+ size.h,
308+ sub_image.point_x,
309+ sub_image.point_y,
310+ sub_image.size_w,
311+ sub_image.size_h,
312+ )
313+ sub_image.image |> @memory.keep
314+ }
315+
266316///|
267317/// Reference to the current image. Kept to make sure the image doesn't
268318/// get garbage collected.
0 commit comments