Skip to main content

GenericDC

Struct GenericDC 

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

A generic device context that can wrap any raw DC pointer.

Implementations§

Source§

impl GenericDC

Source

pub unsafe fn from_ffi_ptr(ptr: *mut wxd_DC_t) -> Self

Create a GenericDC from a raw FFI pointer, taking ownership.

§Safety

The pointer must be valid and should be destroyed by calling wxd_DC_Destroy.

Source

pub unsafe fn from_ffi_ptr_unowned(ptr: *mut wxd_DC_t) -> Self

Create a GenericDC from a raw FFI pointer without taking ownership.

§Safety

The pointer must be valid for the duration of the GenericDC’s lifetime.

Trait Implementations§

Source§

impl DeviceContext for GenericDC

Source§

fn dc_ptr(&self) -> *mut wxd_DC_t

Get a pointer to the underlying DC
Source§

fn clear(&self)

Clear the device context
Source§

fn set_background(&self, colour: Colour)

Set the background color of the device context
Source§

fn set_background_mode(&self, mode: BackgroundMode)

Set the background mode of the device context
Source§

fn set_text_background(&self, colour: Colour)

Set the text background color
Source§

fn set_text_foreground(&self, colour: Colour)

Set the text foreground color
Source§

fn set_font(&self, font: &Font)

Set the font for text drawing
Source§

fn set_pen(&self, colour: Colour, width: i32, style: PenStyle)

Set the pen for drawing outlines
Source§

fn set_brush(&self, colour: Colour, style: BrushStyle)

Set the brush for filling shapes
Source§

fn draw_point(&self, x: i32, y: i32)

Draw a point at the specified coordinates
Source§

fn draw_line(&self, x1: i32, y1: i32, x2: i32, y2: i32)

Draw a line from (x1, y1) to (x2, y2)
Source§

fn draw_rectangle(&self, x: i32, y: i32, width: i32, height: i32)

Draw a rectangle with the specified dimensions
Source§

fn draw_circle(&self, x: i32, y: i32, radius: i32)

Draw a circle with the specified center and radius
Source§

fn draw_ellipse(&self, x: i32, y: i32, width: i32, height: i32)

Draw an ellipse inside the specified rectangle
Source§

fn draw_rounded_rectangle( &self, x: i32, y: i32, width: i32, height: i32, radius: f64, )

Draw a rounded rectangle with the specified dimensions and corner radius
Source§

fn draw_text(&self, text: &str, x: i32, y: i32)

Draw text at the specified position
Source§

fn draw_bitmap(&self, bitmap: &Bitmap, x: i32, y: i32, transparent: bool)

Draw a bitmap at the specified position
Source§

fn get_size(&self) -> (i32, i32)

Get the size of the device context
Source§

fn get_text_extent(&self, text: &str) -> (i32, i32)

Get the text extent (width and height) for the specified string
Source§

fn set_clipping_region(&self, x: i32, y: i32, width: i32, height: i32)

Set a clipping region to restrict drawing operations
Source§

fn destroy_clipping_region(&self)

Remove the current clipping region
Source§

fn draw_polygon( &self, points: &[Point], x_offset: i32, y_offset: i32, fill_mode: PolygonFillMode, )

Draw a polygon using the specified points
Source§

fn draw_elliptic_arc( &self, x: i32, y: i32, width: i32, height: i32, start_angle: f64, end_angle: f64, )

Draw an elliptic arc
Source§

fn draw_lines(&self, points: &[Point], x_offset: i32, y_offset: i32)

Draw multiple connected lines
Source§

fn draw_arc(&self, x1: i32, y1: i32, x2: i32, y2: i32, xc: i32, yc: i32)

Draw an arc from (x1, y1) to (x2, y2) with center at (xc, yc)
Source§

fn draw_spline(&self, points: &[Point])

Draw a smooth spline through the given points
Source§

fn draw_rotated_text(&self, text: &str, x: i32, y: i32, angle: f64)

Draw rotated text at the specified position
Source§

fn draw_label( &self, text: &str, rect: Rect, alignment: TextAlignment, index_accel: i32, )

Draw text with alignment within a rectangle
Source§

fn blit(&self, source: &dyn DeviceContext, config: BlitConfig) -> bool

Copy a portion of one DC to another using configuration struct
Source§

fn stretch_blit( &self, source: &dyn DeviceContext, config: StretchBlitConfig, ) -> bool

Copy and stretch a portion of one DC to another using configuration struct
Source§

fn set_clipping_region_from_points(&self, points: &[Point])

Set clipping region from a set of points
Source§

fn get_clipping_box(&self) -> Rect

Get the clipping box coordinates
Source§

fn set_device_origin(&self, x: i32, y: i32)

Set the device origin
Source§

fn set_logical_origin(&self, x: i32, y: i32)

Set the logical origin
Source§

fn set_user_scale(&self, x_scale: f64, y_scale: f64)

Set the user scale factors
Source§

fn set_logical_scale(&self, x_scale: f64, y_scale: f64)

Set the logical scale factors
Source§

fn set_map_mode(&self, mode: MapMode)

Set the mapping mode
Source§

fn get_device_origin(&self) -> Point

Get the device origin
Source§

fn get_logical_origin(&self) -> Point

Get the logical origin
Source§

fn get_user_scale(&self) -> (f64, f64)

Get the user scale factors
Source§

fn get_logical_scale(&self) -> (f64, f64)

Get the logical scale factors
Source§

fn get_map_mode(&self) -> MapMode

Get the current mapping mode
Source§

fn device_to_logical_x(&self, x: i32) -> i32

Convert device coordinates to logical coordinates (X)
Source§

fn device_to_logical_y(&self, y: i32) -> i32

Convert device coordinates to logical coordinates (Y)
Source§

fn logical_to_device_x(&self, x: i32) -> i32

Convert logical coordinates to device coordinates (X)
Source§

fn logical_to_device_y(&self, y: i32) -> i32

Convert logical coordinates to device coordinates (Y)
Source§

fn get_size_mm(&self) -> (i32, i32)

Get the size in millimeters
Source§

fn get_full_text_extent( &self, text: &str, font: Option<&Font>, ) -> (i32, i32, i32, i32)

Get full text extent including descent and external leading
Source§

fn get_multi_line_text_extent( &self, text: &str, font: Option<&Font>, ) -> (i32, i32, i32)

Get text extent for multi-line text
Source§

fn get_char_height(&self) -> i32

Get the character height for the current font
Source§

fn get_char_width(&self) -> i32

Get the character width for the current font
Source§

fn get_background(&self) -> Colour

Get the current background color
Source§

fn get_background_mode(&self) -> BackgroundMode

Get the current background mode
Source§

fn get_text_background(&self) -> Colour

Get the current text background color
Source§

fn get_text_foreground(&self) -> Colour

Get the current text foreground color
Source§

fn get_ppi(&self) -> (i32, i32)

Get the pixels per inch (DPI)
Source§

fn get_content_scale_factor(&self) -> f64

Get the content scale factor (for high-DPI displays)
Source§

fn gradient_fill_linear( &self, rect: Rect, initial_colour: Colour, dest_colour: Colour, direction: GradientDirection, )

Fill a rectangle with a linear gradient
Source§

fn gradient_fill_concentric( &self, rect: Rect, initial_colour: Colour, dest_colour: Colour, circle_center: Point, )

Fill a rectangle with a concentric gradient
Source§

fn flood_fill( &self, x: i32, y: i32, colour: Colour, style: FloodFillMode, ) -> bool

Flood fill starting from a point
Source§

fn set_logical_function(&self, function: LogicalFunction)

Set the logical function for drawing operations
Source§

fn get_logical_function(&self) -> LogicalFunction

Get the current logical function
Source§

impl Drop for GenericDC

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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