use crate::*;
use ae_sys::*;
define_suite!(
ColorCallbacksSuite,
PF_ColorCallbacksSuite1,
kPFColorCallbacksSuite,
kPFColorCallbacksSuiteVersion1
);
impl ColorCallbacksSuite {
pub fn new() -> Result<Self, Error> {
crate::Suite::new()
}
pub fn rgb_to_hls(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<HLSPixel, Error> {
let mut hls = HLSPixel::default();
call_suite_fn!(self, RGBtoHLS, effect_ref.as_ptr(), rgb as *const _ as *mut _, &mut hls as *mut _ as *mut _)?;
Ok(hls)
}
pub fn hls_to_rgb(&self, effect_ref: impl AsPtr<PF_ProgPtr>, hls: &HLSPixel) -> Result<Pixel8, Error> {
let mut rgb = unsafe { std::mem::zeroed() };
call_suite_fn!(self, HLStoRGB, effect_ref.as_ptr(), hls as *const _ as *mut _, &mut rgb)?;
Ok(rgb)
}
pub fn rgb_to_yiq(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<YIQPixel, Error> {
let mut yiq = YIQPixel::default();
call_suite_fn!(self, RGBtoYIQ, effect_ref.as_ptr(), rgb as *const _ as *mut _, &mut yiq as *mut _ as *mut _)?;
Ok(yiq)
}
pub fn yiq_to_rgb(&self, effect_ref: impl AsPtr<PF_ProgPtr>, yiq: &YIQPixel) -> Result<Pixel8, Error> {
let mut rgb = unsafe { std::mem::zeroed() };
call_suite_fn!(self, YIQtoRGB, effect_ref.as_ptr(), yiq as *const _ as *mut _, &mut rgb)?;
Ok(rgb)
}
pub fn luminance(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<i32, Error> {
call_suite_fn_single!(self, Luminance -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn hue(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<i32, Error> {
call_suite_fn_single!(self, Hue -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn lightness(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<i32, Error> {
call_suite_fn_single!(self, Lightness -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn saturation(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<i32, Error> {
call_suite_fn_single!(self, Saturation -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
}
define_suite!(
ColorCallbacks16Suite,
PF_ColorCallbacks16Suite1,
kPFColorCallbacks16Suite,
kPFColorCallbacks16SuiteVersion1
);
impl ColorCallbacks16Suite {
pub fn new() -> Result<Self, Error> {
crate::Suite::new()
}
pub fn rgb_to_hls(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel16) -> Result<HLSPixel, Error> {
let mut hls = HLSPixel::default();
call_suite_fn!(self, RGBtoHLS, effect_ref.as_ptr(), rgb as *const _ as *mut _, &mut hls as *mut _ as *mut _)?;
Ok(hls)
}
pub fn hls_to_rgb(&self, effect_ref: impl AsPtr<PF_ProgPtr>, hls: &HLSPixel) -> Result<Pixel16, Error> {
let mut rgb = unsafe { std::mem::zeroed() };
call_suite_fn!(self, HLStoRGB, effect_ref.as_ptr(), hls as *const _ as *mut _, &mut rgb)?;
Ok(rgb)
}
pub fn rgb_to_yiq(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<YIQPixel, Error> {
let mut yiq = YIQPixel::default();
call_suite_fn!(self, RGBtoYIQ, effect_ref.as_ptr(), rgb as *const _ as *mut _, &mut yiq as *mut _ as *mut _)?;
Ok(yiq)
}
pub fn yiq_to_rgb(&self, effect_ref: impl AsPtr<PF_ProgPtr>, yiq: &YIQPixel) -> Result<Pixel16, Error> {
let mut rgb = unsafe { std::mem::zeroed() };
call_suite_fn!(self, YIQtoRGB, effect_ref.as_ptr(), yiq as *const _ as *mut _, &mut rgb)?;
Ok(rgb)
}
pub fn luminance(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel16) -> Result<i32, Error> {
call_suite_fn_single!(self, Luminance -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn hue(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel16) -> Result<i32, Error> {
call_suite_fn_single!(self, Hue -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn lightness(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel16) -> Result<i32, Error> {
call_suite_fn_single!(self, Lightness -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn saturation(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel16) -> Result<i32, Error> {
call_suite_fn_single!(self, Saturation -> i32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
}
define_suite!(
ColorCallbacksFloatSuite,
PF_ColorCallbacksFloatSuite1,
kPFColorCallbacksFloatSuite,
kPFColorCallbacksFloatSuiteVersion1
);
impl ColorCallbacksFloatSuite {
pub fn new() -> Result<Self, Error> {
crate::Suite::new()
}
pub fn rgb_to_hls(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &PixelF32) -> Result<HLSPixel, Error> {
let mut hls = HLSPixel::default();
call_suite_fn!(self, RGBtoHLS, effect_ref.as_ptr(), rgb as *const _ as *mut _, &mut hls as *mut _ as *mut _)?;
Ok(hls)
}
pub fn hls_to_rgb(&self, effect_ref: impl AsPtr<PF_ProgPtr>, hls: &HLSPixel) -> Result<PixelF32, Error> {
let mut rgb = unsafe { std::mem::zeroed() };
call_suite_fn!(self, HLStoRGB, effect_ref.as_ptr(), hls as *const _ as *mut _, &mut rgb)?;
Ok(rgb)
}
pub fn rgb_to_yiq(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &Pixel8) -> Result<YIQPixel, Error> {
let mut yiq = YIQPixel::default();
call_suite_fn!(self, RGBtoYIQ, effect_ref.as_ptr(), rgb as *const _ as *mut _, &mut yiq as *mut _ as *mut _)?;
Ok(yiq)
}
pub fn yiq_to_rgb(&self, effect_ref: impl AsPtr<PF_ProgPtr>, yiq: &YIQPixel) -> Result<PixelF32, Error> {
let mut rgb = unsafe { std::mem::zeroed() };
call_suite_fn!(self, YIQtoRGB, effect_ref.as_ptr(), yiq as *const _ as *mut _, &mut rgb)?;
Ok(rgb)
}
pub fn luminance(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &PixelF32) -> Result<f32, Error> {
call_suite_fn_single!(self, Luminance -> f32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn hue(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &PixelF32) -> Result<f32, Error> {
call_suite_fn_single!(self, Hue -> f32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn lightness(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &PixelF32) -> Result<f32, Error> {
call_suite_fn_single!(self, Lightness -> f32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
pub fn saturation(&self, effect_ref: impl AsPtr<PF_ProgPtr>, rgb: &PixelF32) -> Result<f32, Error> {
call_suite_fn_single!(self, Saturation -> f32, effect_ref.as_ptr(), rgb as *const _ as *mut _)
}
}