Struct graphics::DrawState []

#[must_use]
pub struct DrawState {
    pub primitive: Primitive,
    pub multi_sample: Option<MultiSample>,
    pub scissor: Option<Rect>,
    pub stencil: Option<Stencil>,
    pub depth: Option<Depth>,
    pub blend: Option<Blend>,
    pub color_mask: ColorMask,
}

An assembly of states that affect regular draw calls

Fields

primitive: Primitive

How to rasterize geometric primitives.

multi_sample: Option<MultiSample>

Multi-sampling mode

scissor: Option<Rect>

Scissor mask to use. If set, no pixel outside of this rectangle (in screen space) will be written to as a result of rendering.

stencil: Option<Stencil>

Stencil test to use. If None, no stencil testing is done.

depth: Option<Depth>

Depth test to use. If None, no depth testing is done.

blend: Option<Blend>

Blend function to use. If None, no blending is done.

color_mask: ColorMask

Color mask to use. Each flag indicates that the given color channel can be written to, and they can be OR'd together.

Methods

impl DrawState

fn new() -> DrawState

Create a default DrawState. Uses counter-clockwise winding, culls the backface of each primitive, and does no scissor/stencil/depth/blend/color masking.

fn get_target_mask(&self) -> Mask

Return a target mask that contains all the planes required by this state.

fn multi_sample(self) -> DrawState

Enable multi-sampled rasterization

fn stencil(self, fun: Comparison, value: u8) -> DrawState

Set the stencil test to a simple expression

fn depth(self, fun: Comparison, write: bool) -> DrawState

Set the depth test with the mask

fn scissor(self, x: u16, y: u16, w: u16, h: u16) -> DrawState

Set the scissor

fn blend(self, preset: BlendPreset) -> DrawState

Set the blend mode to one of the presets

Trait Implementations

impl PartialOrd<DrawState> for DrawState

fn partial_cmp(&self, __arg_0: &DrawState) -> Option<Ordering>

fn lt(&self, __arg_0: &DrawState) -> bool

fn le(&self, __arg_0: &DrawState) -> bool

fn gt(&self, __arg_0: &DrawState) -> bool

fn ge(&self, __arg_0: &DrawState) -> bool

impl Debug for DrawState

fn fmt(&self, __arg_0: &mut Formatter) -> Result<()Error>

impl PartialEq<DrawState> for DrawState

fn eq(&self, __arg_0: &DrawState) -> bool

fn ne(&self, __arg_0: &DrawState) -> bool

impl Clone for DrawState

fn clone(&self) -> DrawState

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl Copy for DrawState