use Into<Vector> for specifying deltas of the OffsetImageFilter
use crate::prelude::*;
-use crate::{scalar, ImageFilter, ImageFilterCropRect};
+use crate::{ImageFilter, ImageFilterCropRect, Vector};
use skia_bindings::{C_SkOffsetImageFilter_Make, SkImageFilter};
pub enum OffsetImageFilter {}
impl OffsetImageFilter {
#[allow(clippy::new_ret_no_self)]
- pub fn new<'a, CR: Into<Option<&'a ImageFilterCropRect>>>(
- (dx, dy): (scalar, scalar),
+ pub fn new<'a, IV: Into<Vector>, CR: Into<Option<&'a ImageFilterCropRect>>>(
+ delta: IV,
input: &ImageFilter,
crop_rect: CR,
) -> Option<ImageFilter> {
+ let delta = delta.into();
ImageFilter::from_ptr(unsafe {
C_SkOffsetImageFilter_Make(
- dx,
- dy,
+ delta.x,
+ delta.y,
input.shared_native(),
crop_rect.into().native_ptr_or_null(),
)
@@ -23,10 +24,10 @@ impl OffsetImageFilter {
}
impl RCHandle<SkImageFilter> {
- pub fn offset<'a, CR: Into<Option<&'a ImageFilterCropRect>>>(
+ pub fn offset<'a, IV: Into<Vector>, CR: Into<Option<&'a ImageFilterCropRect>>>(
&self,
crop_rect: CR,
- delta: (scalar, scalar),
+ delta: IV,
) -> Option<Self> {
OffsetImageFilter::new(delta, self, crop_rect)
}
