[][src]Struct blend2d::context::Context

#[repr(transparent)]
pub struct Context { /* fields omitted */ }

Methods

impl Context[src]

pub fn new(target: &mut Image) -> Result<Context>[src]

Creates a new context that renders to the given Image.

pub fn new_with_options(
    target: &mut Image,
    info: Option<ContextCreateInfo>
) -> Result<Context>
[src]

Creates a new context with optional creation info that renders to the given Image.

pub fn target_size(&self) -> SizeD[src]

Retrieves the target Image's dimensions.

pub fn target_width(&self) -> f64[src]

Retrieves the target Image's width.

pub fn target_height(&self) -> f64[src]

Retrieves the target Image's height.

pub fn context_type(&self) -> ContextType[src]

The type of this context.

pub fn end(self) -> Result<()>[src]

Waits for completion of all render commands and detaches the rendering context from the rendering target.

Currently, end just calls reset. So it is fine to just drop the context without calling this, but this might change in the future.

pub fn saved_state_count(&self) -> usize[src]

Returns the number of saved states in the context (0 means no saved states).

pub fn save(&mut self)[src]

Saves the current rendering context state.

Saves the current rendering context state and creates a restoration ContextCookie.

pub fn restore(&mut self) -> Result<()>[src]

Restores the top-most saved context-state.

Restores to the point that matches the given cookie.

pub fn with_pushed_context<F>(&mut self, f: F) -> Result<()> where
    F: FnOnce(&mut Self) -> Result<()>, 
[src]

Runs a given closure while preserving the current context-state. This function basically saves the current context-state, executes the given closure and then restores it again.

pub fn meta_matrix(&self) -> &Matrix2D[src]

pub fn user_matrix(&self) -> &Matrix2D[src]

pub fn user_to_meta(&mut self)[src]

pub fn hints(&self) -> &ContextHints[src]

The rendering hints of this context.

pub fn set_hint(&mut self, hint: ContextHint, value: u32)[src]

Sets the specified hint to the given value.

pub fn approximation_options(&self) -> &ApproximationOptions[src]

The approximation options of this context.

pub fn flatten_mode(&self) -> FlattenMode[src]

The FlattenMode of this context, which describes how curves are flattened.

pub fn set_flatten_mode(&mut self, mode: FlattenMode)[src]

Sets the FlattenMode.

pub fn flatten_tolerance(&self) -> f64[src]

The flatten tolerance for curve flattening.

pub fn set_flatten_tolerance(&mut self, tolerance: f64)[src]

Sets the flatten tolerance.

pub fn comp_op(&self) -> CompOp[src]

The currently active composition operator(CompOp).

pub fn set_comp_op(&mut self, comp_op: CompOp)[src]

Sets the current composition operator(CompOp) for this context.

pub fn global_alpha(&self) -> f64[src]

The global alpha value used by this context.

pub fn set_global_alpha(&mut self, alpha: f64)[src]

Sets the global alpha value.

impl Context[src]

pub fn fill_rule(&self) -> FillRule[src]

pub fn set_fill_rule(&mut self, rule: FillRule)[src]

pub fn fill_style_type(&self) -> StyleType[src]

pub fn fill_alpha(&self) -> f64[src]

pub fn set_fill_alpha(&mut self, alpha: f64)[src]

pub fn set_fill_style_gradient<T: GradientType>(
    &mut self,
    gradient: &Gradient<T>
)
[src]

pub fn set_fill_style_pattern(&mut self, pattern: &Pattern)[src]

pub fn set_fill_style_rgba32(&mut self, color: u32)[src]

pub fn set_fill_style_rgba64(&mut self, color: u64)[src]

pub fn get_fill_style_rgba32(&self) -> Result<u32>[src]

pub fn get_fill_style_rgba64(&self) -> Result<u64>[src]

impl Context[src]

pub fn stroke_alpha(&self) -> f64[src]

pub fn set_stroke_alpha(&mut self, alpha: f64)[src]

pub fn stroke_style_type(&self) -> StyleType[src]

pub fn set_stroke_style_gradient<T: GradientType>(
    &mut self,
    gradient: &Gradient<T>
)
[src]

pub fn set_stroke_style_pattern(&mut self, pattern: &Pattern)[src]

pub fn set_stroke_style_rgba32(&mut self, color: u32)[src]

pub fn set_stroke_style_rgba64(&mut self, color: u64)[src]

pub fn get_stroke_style_rgba32(&self) -> Result<u32>[src]

pub fn get_stroke_style_rgba64(&self) -> Result<u64>[src]

pub fn stroke_options(&self) -> &StrokeOptions[src]

pub fn stroke_width(&self) -> f64[src]

pub fn stroke_miter_limit(&self) -> f64[src]

pub fn stroke_join(&self) -> StrokeJoin[src]

pub fn stroke_dash_offset(&self) -> f64[src]

pub fn start_cap(&self) -> StrokeCap[src]

pub fn end_cap(&self) -> StrokeCap[src]

Important traits for Array<u8>
pub fn stroke_dash_array(&self) -> &Array<f64>[src]

pub fn stroke_transform_order(&self) -> StrokeTransformOrder[src]

pub fn set_stroke_width(&mut self, width: f64)[src]

pub fn set_stroke_miter_limit(&mut self, limit: f64)[src]

pub fn set_stroke_join(&mut self, join: StrokeJoin)[src]

pub fn set_stroke_cap(&mut self, pos: StrokeCapPosition, cap: StrokeCap)[src]

pub fn set_stroke_start_cap(&mut self, cap: StrokeCap)[src]

pub fn set_stroke_end_cap(&mut self, cap: StrokeCap)[src]

pub fn set_stroke_caps(&mut self, cap: StrokeCap)[src]

pub fn set_stroke_dash_offset(&mut self, offset: f64)[src]

pub fn set_stroke_dash_array(&mut self, dash_array: &Array<f64>)[src]

pub fn set_stroke_transform_order(&mut self, order: StrokeTransformOrder)[src]

pub fn set_stroke_options(&mut self, opts: &StrokeOptions)[src]

impl Context[src]

Clip Operations

pub fn restore_clipping(&mut self)[src]

pub fn clip_to_rect<R: Rect>(&mut self, rect: &R)[src]

pub fn clip_to(&mut self, x: f64, y: f64, w: f64, h: f64)[src]

impl Context[src]

Clear Operations

pub fn clear_all(&mut self) -> Result<()>[src]

pub fn clear_rect<R: Rect>(&mut self, rect: &R) -> Result<()>[src]

pub fn clear(&mut self, x: f64, y: f64, w: f64, h: f64) -> Result<()>[src]

pub fn blit_image<P: Point>(
    &mut self,
    dst: &P,
    src: &Image,
    src_area: Option<&RectI>
) -> Result<()>
[src]

pub fn blit_scaled_image<R: Rect>(
    &mut self,
    dst: &R,
    src: &Image,
    src_area: Option<&RectI>
) -> Result<()>
[src]

impl Context[src]

Fill Operations

pub fn fill_geometry<T: Geometry + ?Sized>(&mut self, geo: &T) -> Result<()>[src]

pub fn fill_all(&mut self) -> Result<()>[src]

pub fn fill_box(&mut self, x0: f64, y0: f64, x1: f64, y1: f64) -> Result<()>[src]

pub fn fill_rect(&mut self, x: f64, y: f64, w: f64, h: f64) -> Result<()>[src]

pub fn fill_circle(&mut self, cx: f64, cy: f64, r: f64) -> Result<()>[src]

pub fn fill_ellipse(&mut self, cx: f64, cy: f64, rx: f64, ry: f64) -> Result<()>[src]

pub fn fill_round_rect(
    &mut self,
    x: f64,
    y: f64,
    w: f64,
    h: f64,
    rx: f64,
    ry: f64
) -> Result<()>
[src]

pub fn fill_arc(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64,
    start: f64,
    sweep: f64
) -> Result<()>
[src]

pub fn fill_chord(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64,
    start: f64,
    sweep: f64
) -> Result<()>
[src]

pub fn fill_pie(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64,
    start: f64,
    sweep: f64
) -> Result<()>
[src]

pub fn fill_triangle(
    &mut self,
    x0: f64,
    y0: f64,
    x1: f64,
    y1: f64,
    x2: f64,
    y2: f64
) -> Result<()>
[src]

pub fn fill_path(&mut self, p: &Path) -> Result<()>[src]

pub fn fill_polygon<R, P>(&mut self, poly: R) -> Result<()> where
    [P]: Geometry,
    R: AsRef<[P]>,
    P: Point
[src]

pub fn fill_slice<R, P>(&mut self, slice: R) -> Result<()> where
    [P]: Geometry,
    R: AsRef<[P]>,
    P: GeoViewArray
[src]

pub fn fill_utf8_text<P: Point>(
    &mut self,
    dst: P,
    font: &Font,
    text: &str
) -> Result<()>
[src]

pub fn fill_glyph_run<P: Point>(
    &mut self,
    dst: P,
    font: &Font,
    glyph_run: GlyphRun
) -> Result<()>
[src]

impl Context[src]

Stroke Operations

pub fn stroke_geometry<T: Geometry + ?Sized>(&mut self, geo: &T) -> Result<()>[src]

pub fn stroke_box(&mut self, x0: f64, y0: f64, x1: f64, y1: f64) -> Result<()>[src]

pub fn stroke_rect(&mut self, x: f64, y: f64, w: f64, h: f64) -> Result<()>[src]

pub fn stroke_line(&mut self, x0: f64, y0: f64, x1: f64, y1: f64) -> Result<()>[src]

pub fn stroke_circle(&mut self, cx: f64, cy: f64, r: f64) -> Result<()>[src]

pub fn stroke_ellipse(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64
) -> Result<()>
[src]

pub fn stroke_round_rect(
    &mut self,
    x: f64,
    y: f64,
    w: f64,
    h: f64,
    rx: f64,
    ry: f64
) -> Result<()>
[src]

pub fn stroke_arc(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64,
    start: f64,
    sweep: f64
) -> Result<()>
[src]

pub fn stroke_chord(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64,
    start: f64,
    sweep: f64
) -> Result<()>
[src]

pub fn stroke_pie(
    &mut self,
    cx: f64,
    cy: f64,
    rx: f64,
    ry: f64,
    start: f64,
    sweep: f64
) -> Result<()>
[src]

pub fn stroke_triangle(
    &mut self,
    x0: f64,
    y0: f64,
    x1: f64,
    y1: f64,
    x2: f64,
    y2: f64
) -> Result<()>
[src]

pub fn stroke_path(&mut self, p: &Path) -> Result<()>[src]

pub fn stroke_polygon<R, P>(&mut self, poly: R) -> Result<()> where
    [P]: Geometry,
    R: AsRef<[P]>,
    P: Point
[src]

pub fn stroke_polyline<R, P>(&mut self, poly: R) -> Result<()> where
    [P]: Geometry,
    R: AsRef<[P]>,
    P: Point
[src]

pub fn stroke_slice<R, P>(&mut self, slice: R) -> Result<()> where
    [P]: Geometry,
    R: AsRef<[P]>,
    P: GeoViewArray
[src]

pub fn stroke_utf8_text<P: Point>(
    &mut self,
    dst: P,
    font: &Font,
    text: &str
) -> Result<()>
[src]

pub fn stroke_glyph_run<P: Point>(
    &mut self,
    dst: P,
    font: &Font,
    glyph_run: GlyphRun
) -> Result<()>
[src]

Trait Implementations

impl MatrixTransform for Context[src]

fn set_matrix(&mut self, m: &Matrix2D)[src]

Set the transformation matrix of this type to m.

fn reset_matrix(&mut self)[src]

Reset the transformation matrix.

fn translate(&mut self, x: f64, y: f64)[src]

Translate the transformation matrix.

fn translate_point<P: Point>(&mut self, p: &P)[src]

Translate the transformation matrix.

fn scale(&mut self, x: f64, y: f64)[src]

Scale the transformation matrix.

fn scale_point<P: Point>(&mut self, p: &P)[src]

Scale the transformation matrix.

fn skew(&mut self, x: f64, y: f64)[src]

Skew the transformation matrix.

fn skew_point<P: Point>(&mut self, p: &P)[src]

Skew the transformation matrix.

fn rotate(&mut self, angle: f64)[src]

Rotate the transformation matrix.

fn rotate_around(&mut self, angle: f64, x: f64, y: f64)[src]

Rotate the transformation matrix around a point.

fn rotate_around_point<P: Point>(&mut self, angle: f64, p: &P)[src]

Rotate the transformation matrix around a point.

fn transform(&mut self, mat: &Matrix2D)[src]

Transform the transformation matrix.

fn post_translate(&mut self, x: f64, y: f64)[src]

Post-translate the transformation matrix.

fn post_translate_point<P: Point>(&mut self, p: &P)[src]

Post-translate the transformation matrix.

fn post_scale(&mut self, x: f64, y: f64)[src]

Post-scale the transformation matrix.

fn post_scale_point<P: Point>(&mut self, p: &P)[src]

Post-scale the transformation matrix.

fn post_skew(&mut self, x: f64, y: f64)[src]

Post-skew the transformation matrix.

fn post_skew_point<P: Point>(&mut self, p: &P)[src]

Post-skew the transformation matrix.

fn post_rotate(&mut self, angle: f64)[src]

Post-rotate the transformation matrix.

fn post_rotate_around(&mut self, angle: f64, x: f64, y: f64)[src]

Post-rotate the transformation matrix around a point.

fn post_rotate_around_point<P: Point>(&mut self, angle: f64, p: &P)[src]

Post-rotate the transformation matrix around a point.

fn post_transform(&mut self, mat: &Matrix2D)[src]

Post-transform the transformation matrix.

impl PartialEq<Context> for Context[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Drop for Context[src]

impl Debug for Context[src]

Auto Trait Implementations

impl Unpin for Context

impl !Sync for Context

impl !Send for Context

impl RefUnwindSafe for Context

impl UnwindSafe for Context

Blanket Implementations

impl<T> ArrayType for T where
    T: WrappedBlCore, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]