Skip to main content

Graphics

Struct Graphics 

Source
pub struct Graphics<'g, 'p, 'f, S: Surface> {
    pub graphics2d: &'g Graphics2D,
    pub draw_parameters: DrawParameters<'p>,
    pub frame: &'f mut S,
}
Expand description

Простой интерфейс для связи кадра и графических функций. Simple interface to connect graphics fuctions to the frame.

Fields§

§graphics2d: &'g Graphics2D§draw_parameters: DrawParameters<'p>§frame: &'f mut S

Implementations§

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

Source

pub fn clear_colour(&mut self, [r, g, b, a]: [f32; 4])

Заполняет окно данным цветом.

Fills a window with the given colour.

Source

pub fn draw_object( &mut self, index: usize, object_type: ObjectType, draw_type: DrawType, ) -> Result<(), DrawError>

Рисует сохранённый объект.

Draws an object.

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

§Функции для работы с простыми объектами. Functions to work with simple objects.

Source

pub fn draw_simple<O, V, I>(&mut self, object: &O) -> Result<(), DrawError>
where O: DependentObject<Vertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[Vertex2D]>, I: AsRef<[u8]>,

Рисует простой объект.

Draws a simple object.

Source

pub fn draw_shift_simple<O, V, I>( &mut self, object: &O, shift: [f32; 2], ) -> Result<(), DrawError>
where O: DependentObject<Vertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[Vertex2D]>, I: AsRef<[u8]>,

Рисует сдвинутый простой объект.

Draws a shifted simple object.

Source

pub fn draw_rotate_simple<O, V, I>( &mut self, object: &O, rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>
where O: DependentObject<Vertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[Vertex2D]>, I: AsRef<[u8]>,

Рисует повёрнутый простой объект.

Draws a rotated simple object.

Source

pub fn draw_simple_general<O, V, I>( &mut self, object: &O, draw_type: DrawType, ) -> Result<(), DrawError>
where O: DependentObject<Vertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[Vertex2D]>, I: AsRef<[u8]>,

Рисует простой объект.

Draws a simple object.

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

§Функции для отрисовки текстур. Texture rendering functions.

Source

pub fn draw_texture<O, V, I>( &mut self, base: &O, texture: &Texture, ) -> Result<(), DrawError>
where O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[TexturedVertex2D]>, I: AsRef<[u8]>,

Рисует изображение.

Draws a texture.

Source

pub fn draw_shift_texture<O, V, I>( &mut self, base: &O, texture: &Texture, shift: [f32; 2], ) -> Result<(), DrawError>
where O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[TexturedVertex2D]>, I: AsRef<[u8]>,

Рисует сдвинутую текстуру.

Draws a shifted texture.

Source

pub fn draw_rotate_texture<O, V, I>( &mut self, base: &O, texture: &Texture, rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>
where O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[TexturedVertex2D]>, I: AsRef<[u8]>,

Рисует повёрнутую текстуру.

Draws a rotated texture.

angle - radians

Source

pub fn draw_texture_general<O, V, I>( &mut self, base: &O, texture: &Texture, draw_type: DrawType, ) -> Result<(), DrawError>
where O: DependentObject<TexturedVertex2D, u8, Vertices = V, Indices = I>, V: AsRef<[TexturedVertex2D]>, I: AsRef<[u8]>,

Рисует текстуру.

Draws a texture.

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

§Фукнции для отрисовки глифов. Glyph rendering functions.

Source

pub fn draw_glyph( &mut self, glyph: &OutlinedGlyph, colour: Colour, [x, y]: [f32; 2], ) -> Result<(), DrawError>

Строит и выводит глиф.

Builds and draws a glyph.

Source

pub fn draw_shift_glyph( &mut self, glyph: &OutlinedGlyph, colour: Colour, [x, y]: [f32; 2], shift: [f32; 2], ) -> Result<(), DrawError>

Строит и выводит сдвинутый глиф.

Builds and draws a shifted glyph.

Source

pub fn draw_rotate_glyph( &mut self, glyph: &OutlinedGlyph, colour: Colour, [x, y]: [f32; 2], rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>

Строит и выводит повёрнутый глиф.

Builds and draws a rotated glyph.

Source

pub fn draw_glyph_cache( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], ) -> Result<(), DrawError>

Выводит уже построенный глиф.

Draws an already built glyph.

Source

pub fn draw_shift_glyph_cache( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], shift: [f32; 2], ) -> Result<(), DrawError>

Выводит сдвинутый уже построенный глиф.

Draws a shifted already built glyph.

Source

pub fn draw_rotate_glyph_cache( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>

Выводит повёрнутый уже построенный глиф.

Draws a rotated already built glyph.

Source

pub fn draw_glyph_cache_general( &mut self, glyph: &TexturedGlyph<'_>, colour: Colour, [x, y]: [f32; 2], draw_type: DrawType, ) -> Result<(), DrawError>

Выводит уже построенный глиф.

Draws a already built glyph.

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

§Функции для работы с сохранёнными простыми объектами. Functions to work with saved simple objects.

Source

pub fn draw_simple_object(&mut self, index: usize) -> Result<(), DrawError>

Рисует простой объект.

Draws the saved simple object.

Source

pub fn draw_shift_simple_object( &mut self, index: usize, shift: [f32; 2], ) -> Result<(), DrawError>

Рисует сдвинутый простой объект.

Draws the shifted saved simple object.

Source

pub fn draw_rotate_simple_object( &mut self, index: usize, rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>

Рисует повёрнутый простой объект.

Draws the rotated saved simple object.

Source

pub fn draw_simple_object_general( &mut self, index: usize, draw_type: DrawType, ) -> Result<(), DrawError>

Рисует простой объект.

Draws the saved simple object.

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

§Функции для работы с сохранёнными текстурными объектами. Functions to work with saved textured objects.

Source

pub fn draw_textured_object(&mut self, index: usize) -> Result<(), DrawError>

Рисует сохранённый текстурный объект.

Draws a saved textured object.

Source

pub fn draw_shift_textured_object( &mut self, index: usize, shift: [f32; 2], ) -> Result<(), DrawError>

Рисует сдвинутый сохранённый текстурный объект.

Draws a shifted saved textured object.

Source

pub fn draw_rotate_textured_object( &mut self, index: usize, rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>

Рисует повёрнутый сохранённый текстурный объект.

Draws a rotated saved textured object.

rotation_center - [x, y] angle - radians

Source

pub fn draw_textured_object_general( &mut self, index: usize, draw_type: DrawType, ) -> Result<(), DrawError>

Рисует текстурный объект.

Draws a textured object.

Source§

impl<'g, 'p, 'f, S: Surface> Graphics<'g, 'p, 'f, S>

§Функции для работы с сохранёнными текстовыми объектами. Functions to work with saved text objects.

Source

pub fn draw_text_object(&mut self, index: usize) -> Result<(), DrawError>

Рисует сохранённый текстовой объект.

Draws a saved text object.

Source

pub fn draw_shift_text_object( &mut self, index: usize, shift: [f32; 2], ) -> Result<(), DrawError>

Рисует сохранённый текстовой объект.

Draws a saved text object.

Source

pub fn draw_rotate_text_object( &mut self, index: usize, rotation_center: [f32; 2], angle: f32, ) -> Result<(), DrawError>

Рисует сохранённый текстовой объект.

Draws a saved text object.

Source

pub fn draw_text_object_general( &mut self, index: usize, draw_type: DrawType, ) -> Result<(), DrawError>

Рисует сохранённый текстовой объект.

Draws a saved text object.

Auto Trait Implementations§

§

impl<'g, 'p, 'f, S> Freeze for Graphics<'g, 'p, 'f, S>

§

impl<'g, 'p, 'f, S> !RefUnwindSafe for Graphics<'g, 'p, 'f, S>

§

impl<'g, 'p, 'f, S> !Send for Graphics<'g, 'p, 'f, S>

§

impl<'g, 'p, 'f, S> !Sync for Graphics<'g, 'p, 'f, S>

§

impl<'g, 'p, 'f, S> Unpin for Graphics<'g, 'p, 'f, S>

§

impl<'g, 'p, 'f, S> UnsafeUnpin for Graphics<'g, 'p, 'f, S>

§

impl<'g, 'p, 'f, S> !UnwindSafe for Graphics<'g, 'p, 'f, S>

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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, 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.