Skip to content

Commit

Permalink
core-graphics: add binding for CGColorCreateSRGB (#716)
Browse files Browse the repository at this point in the history
Signed-off-by: Jay Madden <25359755+Jay-Madden@users.noreply.github.com>
  • Loading branch information
Jay-Madden authored Jan 7, 2025
1 parent 8c71d0f commit 9437381
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core-graphics/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ impl CGColor {
CGColor::wrap_under_create_rule(ptr)
}
}

pub fn srgb(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) -> Self {
unsafe {
let ptr = CGColorCreateSRGB(red, green, blue, alpha);
CGColor::wrap_under_create_rule(ptr)
}
}
}

#[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))]
Expand All @@ -37,5 +44,13 @@ extern "C" {
blue: CGFloat,
alpha: CGFloat,
) -> crate::sys::CGColorRef;

fn CGColorCreateSRGB(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> crate::sys::CGColorRef;

fn CGColorGetTypeID() -> CFTypeID;
}

0 comments on commit 9437381

Please sign in to comment.