1 | use crate::{prelude::*, EncodedOrigin, ImageInfo, Pixmap}; |
2 | use skia_bindings as sb; |
3 | |
4 | /// Copy the pixels in src into dst, applying the orientation transformations specified |
5 | /// by origin. If the inputs are invalid, this returns `false` and no copy is made. |
6 | /// # Safety |
7 | /// Unsafe in that it modifies the underlying pixels of `dst`. |
8 | pub unsafe fn orient(dst: &mut Pixmap, src: &Pixmap, origin: EncodedOrigin) -> bool { |
9 | sb::C_SkPixmapUtils_Orient(dst:dst.native_mut(), src:src.native(), origin:origin.into_native()) |
10 | } |
11 | |
12 | /// Return a copy of the provided ImageInfo with the width and height swapped. |
13 | pub fn swap_width_height(info: &ImageInfo) -> ImageInfo { |
14 | ImageInfo::construct(|ii: *mut SkImageInfo| unsafe { sb::C_SkPixmapUtils_SwapWidthHeight(uninitialized:ii, info:info.native()) }) |
15 | } |
16 | |