Skip to main content

Renderer

Struct Renderer 

Source
pub struct Renderer<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Renderer<'a>

Source

pub fn new(framebuffer: Framebuffer<'a>) -> Self

Source

pub unsafe fn set_pixel_raw_unchecked(&mut self, x: u64, y: u64, color: &Color)

绘制像素到后台缓冲区

Source

pub fn set_pixel_raw(&mut self, x: u64, y: u64, color: &Color)

Source

pub fn set_pixel(&mut self, pixel: Pixel, color: &Color)

设置像素

Source

pub fn get_pixel(&self, pixel: Pixel) -> Color

获取像素

Source

pub fn set_clear_color(&mut self, color: Color)

Source

pub fn get_clear_color(&self) -> Color

Source

pub fn clear(&mut self)

Source

pub fn draw_line(&mut self, p1: Pixel, p2: Pixel, color: Color)

绘制线

Source

pub fn draw_triangle(&mut self, p1: Pixel, p2: Pixel, p3: Pixel, color: Color)

绘制三角形

Source

pub fn fill_triangle(&mut self, p1: Pixel, p2: Pixel, p3: Pixel, color: Color)

填充三角形

Source

pub fn width(&self) -> u64

Source

pub fn height(&self) -> u64

Source

pub fn draw_rect(&mut self, pixel: Pixel, width: u64, height: u64, color: Color)

绘制矩形

Source

pub fn fill_rect(&mut self, pixel: Pixel, width: u64, height: u64, color: Color)

填充矩形

Source

pub fn draw_polygon(&mut self, points: &[Pixel], color: Color)

绘制任意多边形(轮廓)

Source

pub fn fill_convex_polygon(&mut self, points: &[Pixel], color: Color)

填充任意凸多边形(扫描线算法)

Source

pub fn fill_polygon(&mut self, points: &[Pixel], color: Color)

填充任意多边形(使用奇偶规则)

Source

pub fn draw_bmp(&mut self, pos: Pixel, bmp: &BmpImage)

绘制BMP图像

Source

pub fn draw_bmp_scaled( &mut self, pos: Pixel, bmp: &BmpImage, scale_x: f32, scale_y: f32, )

绘制BMP图像 (带缩放)

Source

pub fn draw_bmp_distorted(&mut self, corners: [Pixel; 4], bmp: &BmpImage)

绘制BMP图像 (扭曲变形)

Source

pub fn draw_bmp_from_bytes( &mut self, pos: Pixel, data: &[u8], ) -> Result<(), BmpError>

从字节加载并绘制BMP图像

Source

pub fn draw_circle(&mut self, center: Pixel, radius: u64, color: Color)

绘制圆形

Source

pub fn scroll_y(&mut self, offset: i64)

Source

pub fn present(&mut self)

将后台缓冲区的内容复制到前台帧缓冲区,从而显示绘制结果。

Auto Trait Implementations§

§

impl<'a> Freeze for Renderer<'a>

§

impl<'a> RefUnwindSafe for Renderer<'a>

§

impl<'a> Send for Renderer<'a>

§

impl<'a> Sync for Renderer<'a>

§

impl<'a> Unpin for Renderer<'a>

§

impl<'a> UnwindSafe for Renderer<'a>

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, 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.