Struct sciter::graphics::Graphics[][src]

pub struct Graphics(_);

Graphics object. Represents graphic surface of the element.

Methods

impl Graphics
[src]

Save/restore graphics state.

Save the current graphics attributes on top of the internal state stack.

It will be restored automatically.

Example:

use sciter::graphics::{Image, rgb};

let mut image = Image::new((100, 100), false).unwrap();
image.paint(|gfx, size| {
  let mut gfx = gfx.save_state()?;
  gfx
    .line_width(6.0)?
    .line_color(rgb(0xD4, 0, 0))?
    .fill_color(rgb(0xD4, 0, 0))?
    .line((-30., 0.), (83., 0.))?
    ;
  Ok(())
}).unwrap();

impl Graphics
[src]

Primitives drawing operations.

All operations use the current fill and stroke brushes.

Draw a line from the start to the end.

Draw a rectangle.

Draw a rounded rectangle with the same corners.

Draw a rounded rectangle with different corners.

Draw an ellipse.

Draw a circle.

Draw a closed arc.

Draw a star.

Draw a closed polygon.

Draw a polyline.

impl Graphics
[src]

Drawing attributes.

Set the color for solid fills for subsequent drawings.

Set the even/odd rule of solid fills for subsequent drawings.

false means "fill non zero".

Disables fills for subsequent drawing operations.

Set the line color for subsequent drawings.

Set the line width for subsequent drawings.

Set the line cap mode (stroke dash ending style) for subsequent drawings.

It determines how the end points of every line are drawn. There are three possible values for this property and those are: BUTT, ROUND and SQUARE. By default this property is set to BUTT.

Set the line join mode for subsequent drawings.

It determines how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together (degenerate segments with zero lengths, whose specified endpoints and control points are exactly at the same position, are skipped).

Disable outline drawing.

Setup parameters of a linear gradient of lines.

Setup parameters of a linear gradient of lines using multiple colors and color stop positions (0.0 ... 1.0).

Setup parameters of linear gradient fills.

Setup parameters of linear gradient fills using multiple colors and color stop positions (0.0 ... 1.0).

Setup parameters of a radial gradient of lines.

Setup parameters of a radial gradient of lines using multiple colors and color stop positions (0.0 ... 1.0).

Setup parameters of radial gradient of fills.

Setup parameters of radial gradient of fills using multiple colors and color stop positions (0.0 ... 1.0).

impl Graphics
[src]

Affine transformations.

Rotate coordinate system on radians angle.

Rotate coordinate system on radians angle around the center.

Move origin of coordinate system to the (to_x, to_y) point.

Scale coordinate system.

(sc_x, sc_y) are the scale factors in the horizontal and vertical directions respectively.

Both parameters must be positive numbers. Values smaller than 1.0 reduce the unit size and values larger than 1.0 increase the unit size.

Setup a skewing (shearing) transformation.

Multiply the current transformation with the matrix described by the arguments.

It allows to scale, rotate, move and skew the context as described by:

   scale_x  skew_y   move_x
[  skew_x   scale_y  move_y  ]
   0        0        1

where

  • scale_x, scale_y: horizontal and vertical scaling,
  • skew_x, skew_y: horizontal and vertical shearing (skewing),
  • move_x, move_y: horizontal and vertical moving.

Multiply the current transformation with the matrix described by the arguments.

It allows to scale, rotate, move and skew the context as described by:

   m11   m21  dx
[  m12   m22  dy  ]
   0     0    1
  • m11 (scale_x): horizontal scaling
  • m12 (skew_x): horizontal skewing
  • m21 (skew_y): vertical skewing
  • m22 (scale_y): vertical scaling
  • dx (move_x): horizontal moving
  • dy (move_y): vertical moving

impl Graphics
[src]

Coordinate space.

Translate coordinates.

Translates coordinates from a coordinate system defined by rotate(), scale(), translate() and/or skew() to the screen coordinate system.

Translate coordinates.

Translates coordinates from a coordinate system defined by rotate(), scale(), translate() and/or skew() to the screen coordinate system.

Translate coordinates.

Translates coordinates from screen coordinate system to the one defined by rotate(), scale(), translate() and/or skew().

Translate coordinates.

Translates coordinates from screen coordinate system to the one defined by rotate(), scale(), translate() and/or skew().

impl Graphics
[src]

Clipping.

Push a clip layer defined by the specified rectangle bounds.

Push a clip layer defined by the specified path bounds.

Pop a clip layer set by previous push_clip_box() or push_clip_path() calls.

impl Graphics
[src]

Image and path rendering.

Draw the path object using current fill and stroke brushes.

Draw the whole image onto the graphics surface.

With the current transformation applied (scale, rotation).

Performance: expensive.

Draw a part of the image onto the graphics surface.

With the current transformation applied (scale, rotation).

Performance: expensive.

Blend the image with the graphics surface.

No affine transformations.

Performance: less expensive.

Blend a part of the image with the graphics surface.

No affine transformations.

Performance: less expensive.

Trait Implementations

impl Drop for Graphics
[src]

Destroy pointed graphics object.

Executes the destructor for this type. Read more

impl Clone for Graphics
[src]

Copies graphics object.

All allocated objects are reference counted so copying is just a matter of increasing reference counts.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl FromValue for Graphics
[src]

Get an Graphics object contained in the Value.

Converts value to specified type.

impl From<Graphics> for Value
[src]

Store the Graphics object as a Value.

Performs the conversion.

impl From<HGFX> for Graphics
[src]

Construct Graphics object from HGFX handle.

Performs the conversion.

Auto Trait Implementations

impl !Send for Graphics

impl !Sync for Graphics