cairo

Struct Context

Source
pub struct Context(/* private fields */);

Implementations§

Source§

impl Context

Source

pub unsafe fn from_raw_none(ptr: *mut cairo_t) -> Context

Source

pub unsafe fn from_raw_borrow(ptr: *mut cairo_t) -> Borrowed<Context>

Source

pub unsafe fn from_raw_full(ptr: *mut cairo_t) -> Context

Source

pub fn to_raw_none(&self) -> *mut cairo_t

Source

pub fn status(&self) -> Result<(), Error>

Source

pub fn new(target: impl AsRef<Surface>) -> Result<Context, Error>

Source

pub fn save(&self) -> Result<(), Error>

Source

pub fn restore(&self) -> Result<(), Error>

Source

pub fn target(&self) -> Surface

Source

pub fn push_group(&self)

Source

pub fn push_group_with_content(&self, content: Content)

Source

pub fn pop_group(&self) -> Result<Pattern, Error>

Source

pub fn pop_group_to_source(&self) -> Result<(), Error>

Source

pub fn group_target(&self) -> Surface

Source

pub fn set_source_rgb(&self, red: f64, green: f64, blue: f64)

Source

pub fn set_source_rgba(&self, red: f64, green: f64, blue: f64, alpha: f64)

Source

pub fn set_source(&self, source: impl AsRef<Pattern>) -> Result<(), Error>

Source

pub fn source(&self) -> Pattern

Source

pub fn set_source_surface( &self, surface: impl AsRef<Surface>, x: f64, y: f64, ) -> Result<(), Error>

Source

pub fn set_antialias(&self, antialias: Antialias)

Source

pub fn antialias(&self) -> Antialias

Source

pub fn set_dash(&self, dashes: &[f64], offset: f64)

Source

pub fn dash_count(&self) -> i32

Source

pub fn dash(&self) -> (Vec<f64>, f64)

Source

pub fn dash_dashes(&self) -> Vec<f64>

Source

pub fn dash_offset(&self) -> f64

Source

pub fn set_fill_rule(&self, fill_rule: FillRule)

Source

pub fn fill_rule(&self) -> FillRule

Source

pub fn set_line_cap(&self, arg: LineCap)

Source

pub fn line_cap(&self) -> LineCap

Source

pub fn set_line_join(&self, arg: LineJoin)

Source

pub fn line_join(&self) -> LineJoin

Source

pub fn set_line_width(&self, arg: f64)

Source

pub fn line_width(&self) -> f64

Source

pub fn set_hairline(&self, set_hairline: bool)

Available on crate feature v1_18 only.
Source

pub fn hairline(&self) -> bool

Available on crate feature v1_18 only.
Source

pub fn set_miter_limit(&self, arg: f64)

Source

pub fn miter_limit(&self) -> f64

Source

pub fn set_operator(&self, op: Operator)

Source

pub fn operator(&self) -> Operator

Source

pub fn set_tolerance(&self, arg: f64)

Source

pub fn tolerance(&self) -> f64

Source

pub fn clip(&self)

Source

pub fn clip_preserve(&self)

Source

pub fn clip_extents(&self) -> Result<(f64, f64, f64, f64), Error>

Source

pub fn in_clip(&self, x: f64, y: f64) -> Result<bool, Error>

Source

pub fn reset_clip(&self)

Source

pub fn copy_clip_rectangle_list(&self) -> Result<RectangleList, Error>

Source

pub fn fill(&self) -> Result<(), Error>

Source

pub fn fill_preserve(&self) -> Result<(), Error>

Source

pub fn fill_extents(&self) -> Result<(f64, f64, f64, f64), Error>

Source

pub fn in_fill(&self, x: f64, y: f64) -> Result<bool, Error>

Source

pub fn mask(&self, pattern: impl AsRef<Pattern>) -> Result<(), Error>

Source

pub fn mask_surface( &self, surface: impl AsRef<Surface>, x: f64, y: f64, ) -> Result<(), Error>

Source

pub fn paint(&self) -> Result<(), Error>

Source

pub fn paint_with_alpha(&self, alpha: f64) -> Result<(), Error>

Source

pub fn stroke(&self) -> Result<(), Error>

Source

pub fn stroke_preserve(&self) -> Result<(), Error>

Source

pub fn stroke_extents(&self) -> Result<(f64, f64, f64, f64), Error>

Source

pub fn in_stroke(&self, x: f64, y: f64) -> Result<bool, Error>

Source

pub fn copy_page(&self) -> Result<(), Error>

Source

pub fn show_page(&self) -> Result<(), Error>

Source

pub fn reference_count(&self) -> u32

Source

pub fn translate(&self, tx: f64, ty: f64)

Source

pub fn scale(&self, sx: f64, sy: f64)

Source

pub fn rotate(&self, angle: f64)

Source

pub fn transform(&self, matrix: Matrix)

Source

pub fn set_matrix(&self, matrix: Matrix)

Source

pub fn matrix(&self) -> Matrix

Source

pub fn identity_matrix(&self)

Source

pub fn user_to_device(&self, x: f64, y: f64) -> (f64, f64)

Source

pub fn user_to_device_distance( &self, dx: f64, dy: f64, ) -> Result<(f64, f64), Error>

Source

pub fn device_to_user(&self, x: f64, y: f64) -> Result<(f64, f64), Error>

Source

pub fn device_to_user_distance( &self, dx: f64, dy: f64, ) -> Result<(f64, f64), Error>

Source

pub fn select_font_face( &self, family: &str, slant: FontSlant, weight: FontWeight, )

Source

pub fn set_font_size(&self, size: f64)

Source

pub fn set_font_matrix(&self, matrix: Matrix)

Source

pub fn font_matrix(&self) -> Matrix

Source

pub fn set_font_options(&self, options: &FontOptions)

Source

pub fn font_options(&self) -> Result<FontOptions, Error>

Source

pub fn set_font_face(&self, font_face: &FontFace)

Source

pub fn font_face(&self) -> FontFace

Source

pub fn set_scaled_font(&self, scaled_font: &ScaledFont)

Source

pub fn scaled_font(&self) -> ScaledFont

Source

pub fn show_text(&self, text: &str) -> Result<(), Error>

Source

pub fn show_glyphs(&self, glyphs: &[Glyph]) -> Result<(), Error>

Source

pub fn show_text_glyphs( &self, text: &str, glyphs: &[Glyph], clusters: &[TextCluster], cluster_flags: TextClusterFlags, ) -> Result<(), Error>

Source

pub fn font_extents(&self) -> Result<FontExtents, Error>

Source

pub fn text_extents(&self, text: &str) -> Result<TextExtents, Error>

Source

pub fn glyph_extents(&self, glyphs: &[Glyph]) -> Result<TextExtents, Error>

Source

pub fn copy_path(&self) -> Result<Path, Error>

Source

pub fn copy_path_flat(&self) -> Result<Path, Error>

Source

pub fn append_path(&self, path: &Path)

Source

pub fn has_current_point(&self) -> Result<bool, Error>

Source

pub fn current_point(&self) -> Result<(f64, f64), Error>

Source

pub fn new_path(&self)

Source

pub fn new_sub_path(&self)

Source

pub fn close_path(&self)

Source

pub fn arc(&self, xc: f64, yc: f64, radius: f64, angle1: f64, angle2: f64)

Source

pub fn arc_negative( &self, xc: f64, yc: f64, radius: f64, angle1: f64, angle2: f64, )

Source

pub fn curve_to(&self, x1: f64, y1: f64, x2: f64, y2: f64, x3: f64, y3: f64)

Source

pub fn line_to(&self, x: f64, y: f64)

Source

pub fn move_to(&self, x: f64, y: f64)

Source

pub fn rectangle(&self, x: f64, y: f64, width: f64, height: f64)

Source

pub fn text_path(&self, str_: &str)

Source

pub fn glyph_path(&self, glyphs: &[Glyph])

Source

pub fn rel_curve_to( &self, dx1: f64, dy1: f64, dx2: f64, dy2: f64, dx3: f64, dy3: f64, )

Source

pub fn rel_line_to(&self, dx: f64, dy: f64)

Source

pub fn rel_move_to(&self, dx: f64, dy: f64)

Source

pub fn path_extents(&self) -> Result<(f64, f64, f64, f64), Error>

Source

pub fn tag_begin(&self, tag_name: &str, attributes: &str)

Available on crate feature v1_16 only.
Source

pub fn tag_end(&self, tag_name: &str)

Available on crate feature v1_16 only.

Trait Implementations§

Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Context

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Context

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<Context> for Value

Source§

fn from(v: Context) -> Self

Converts to this type from the input type.
Source§

impl FromGlibPtrBorrow<*mut cairo_t> for Context

Available on crate feature use_glib only.
Source§

impl FromGlibPtrFull<*mut cairo_t> for Context

Available on crate feature use_glib only.
Source§

impl FromGlibPtrNone<*mut cairo_t> for Context

Available on crate feature use_glib only.
Source§

impl<'a> FromValue<'a> for &'a Context

Source§

type Checker = GenericValueTypeOrNoneChecker<&'a Context>

Value type checker.
Source§

unsafe fn from_value(value: &'a Value) -> Self

Get the contained value from a Value. Read more
Source§

impl<'a> FromValue<'a> for Context

Source§

type Checker = GenericValueTypeOrNoneChecker<Context>

Value type checker.
Source§

unsafe fn from_value(value: &'a Value) -> Self

Get the contained value from a Value. Read more
Source§

impl IntoGlibPtr<*mut cairo_t> for Context

Available on crate feature use_glib only.
Source§

unsafe fn into_glib_ptr(self) -> *mut cairo_t

Transfer: full.
Source§

impl StaticType for Context

Source§

fn static_type() -> Type

Returns the type identifier of Self.
Source§

impl<'a> ToGlibPtr<'a, *mut cairo_t> for &'a Context

Available on crate feature use_glib only.
Source§

type Storage = PhantomData<&'a Context>

Source§

fn to_glib_none(&self) -> Stash<'a, *mut cairo_t, &'a Context>

Transfer: none. Read more
Source§

fn to_glib_full(&self) -> *mut cairo_t

Transfer: full. Read more
Source§

fn to_glib_container(&'a self) -> Stash<'a, P, Self>

Transfer: container. Read more
Source§

impl ToValue for Context

Source§

fn to_value(&self) -> Value

Convert a value to a Value.
Source§

fn value_type(&self) -> Type

Returns the type identifier of self. Read more
Source§

impl ToValueOptional for Context

Source§

fn to_value_optional(s: Option<&Self>) -> Value

Convert an Option to a Value.
Source§

impl ValueType for Context

Source§

type Type = Context

Type to get the Type from. Read more
Source§

impl ValueTypeOptional for Context

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoClosureReturnValue for T
where T: Into<Value>,

Source§

impl<T> StaticTypeExt for T
where T: StaticType,

Source§

fn ensure_type()

Ensures that the type has been registered with the type system.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T> TryFromClosureReturnValue for T
where T: for<'a> FromValue<'a> + StaticType + 'static,

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, T, C, E> FromValueOptional<'a> for T
where T: FromValue<'a, Checker = C>, C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError<E>>, E: Error + Send + 'static,