Skip to main content

RenderTargetBitmap

Struct RenderTargetBitmap 

Source
pub struct RenderTargetBitmap { /* private fields */ }
Expand description

A bitmap that holds the rendering of a visual.

Implementations§

Source§

impl RenderTargetBitmap

Source

pub fn new(pixel_size: PixelSize) -> RenderTargetBitmap

Creates a bitmap of the given size, in pixels, at 96 DPI.

Source

pub fn with_dpi(pixel_size: PixelSize, dpi: Vector) -> RenderTargetBitmap

Creates a bitmap of the given size, in pixels, and DPI.

Source

pub fn platform_impl(&self) -> &RefCounted<dyn IRenderTargetBitmapImpl>

The platform-specific bitmap implementation.

Source

pub fn render(&self, visual: &Ref<Visual>)

Renders a visual to the bitmap.

Source

pub fn create_drawing_context(&self) -> DrawingContext<'static>

Creates a drawing context that draws into the bitmap, after clearing the bitmap. Disposing (or dropping) the context finishes the drawing.

Source

pub fn create_drawing_context_with_clear( &self, clear: bool, ) -> DrawingContext<'static>

Creates a drawing context that draws into the bitmap, clearing the bitmap first when clear is set.

Source

pub fn create_platform_drawing_context( &self, clear: bool, ) -> Box<dyn IDrawingContextImpl>

Creates the platform drawing context that draws into the bitmap, clearing the bitmap first when clear is set.

Source

pub fn dispose(&self)

Releases the bitmap’s references to the platform bitmap.

Methods from Deref<Target = Bitmap>§

Source

pub fn create_scaled_bitmap( &self, destination_size: PixelSize, interpolation_mode: BitmapInterpolationMode, ) -> Bitmap

Creates a bitmap scaled to the specified size from the current bitmap.

Source

pub fn dispose(&self)

Releases the bitmap’s reference to the platform bitmap.

Source

pub fn dpi(&self) -> Vector

The dots per inch (DPI) of the image.

Source

pub fn size(&self) -> Size

The size of the image, in device independent pixels.

Source

pub fn pixel_size(&self) -> PixelSize

The size of the bitmap, in device pixels.

Source

pub fn platform_impl(&self) -> &RefCounted<SharedBitmapImpl>

The platform-specific bitmap implementation.

Source

pub fn save_to_file( &self, file_name: &str, options: &BitmapEncoderOptions, ) -> Result<()>

Saves the bitmap to a file.

Source

pub fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>

Saves the bitmap to a stream.

Source

pub fn format(&self) -> Option<PixelFormat>

The pixel format of the bitmap, if its pixels can be read.

Source

pub fn alpha_format(&self) -> Option<AlphaFormat>

The alpha format of the bitmap, if its pixels can be read.

Source

pub fn copy_pixels( &self, source_rect: PixelRect, buffer: &mut [u8], stride: i32, )

Copies the pixels of source_rect into buffer, whose rows are stride bytes apart. An empty source_rect selects the whole bitmap.

Panics when the pixels of the bitmap cannot be read, when the bitmap was converted from another pixel format on creation, or when the rectangle, stride or buffer are out of range.

Source

pub fn copy_pixels_to_framebuffer(&self, buffer: &dyn ILockedFramebuffer)

Copies the pixels of the bitmap into a locked framebuffer, converting them to its pixel and alpha formats.

Panics when the pixels of the bitmap cannot be read.

Trait Implementations§

Source§

impl Deref for RenderTargetBitmap

Source§

type Target = Bitmap

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Bitmap

Dereferences the value.
Source§

impl IBitmap for RenderTargetBitmap

Source§

fn dpi(&self) -> Vector

The dots per inch (DPI) of the image. Read more
Source§

fn pixel_size(&self) -> PixelSize

The size of the bitmap, in device pixels.
Source§

fn platform_impl(&self) -> &RefCounted<SharedBitmapImpl>

The platform-specific bitmap implementation.
Source§

fn save( &self, stream: &mut dyn Write, options: &BitmapEncoderOptions, ) -> Result<()>

Saves the bitmap to a stream.
Source§

fn dispose(&self)

Releases the bitmap.
Source§

impl IImage for RenderTargetBitmap

Source§

fn size(&self) -> Size

The size of the image, in device independent pixels.
Source§

fn draw( &self, context: &mut DrawingContext<'_>, source_rect: Rect, dest_rect: Rect, )

Draws the image to a drawing context: the part of the image inside source_rect is drawn into dest_rect.
Source§

fn as_any(&self) -> &dyn Any

The implementing value, for downcasts to concrete image types. For image classes use as_object.
Source§

fn as_bitmap(&self) -> Option<&dyn IBitmap>

The image viewed as a bitmap, when it is one.
Source§

fn as_object(&self) -> Option<&FerroObject>

The object behind the image when it is an image class.
Source§

fn as_affects_render(&self) -> Option<&dyn IAffectsRender>

The image viewed as IAffectsRender, when it can change.
Source§

impl IImageBrushSource for RenderTargetBitmap

Source§

fn bitmap(&self) -> Option<&RefCounted<SharedBitmapImpl>>

The counted reference to the platform bitmap, while it is alive.
Source§

fn get_bitmap(&self) -> Option<Arc<SharedBitmapImpl>>

The platform bitmap, while it is alive.

Auto Trait Implementations§

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.