pub trait GraphicsContextMethods: GraphicsObjectMethods {
Show 54 methods
// Provided methods
fn create_window<W: WindowMethods>(
window: Option<&W>,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_windowdc<W: WindowDCMethods>(
window_dc: &W,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_memorydc<M: MemoryDCMethods>(
memory_dc: &M,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_enhmetafiledc(
meta_file_dc: *const c_void,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_from_unknown_dc<D: DCMethods>(
dc: &D,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_image<I: ImageMethods>(
image: &I,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_from_native(
context: *mut c_void,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create_from_native_window(
window: *mut c_void,
) -> Option<GraphicsContextIsOwned<false>> { ... }
fn create() -> Option<GraphicsContextIsOwned<false>> { ... }
fn reset_clip(&self) { ... }
fn clip<R: RegionMethods>(&self, region: &R) { ... }
fn get_clip_box(
&self,
x: *mut c_void,
y: *mut c_void,
w: *mut c_void,
h: *mut c_void,
) { ... }
fn create_matrix<A: AffineMatrix2DBaseMethods>(
&self,
mat: &A,
) -> GraphicsMatrix { ... }
fn concat_transform<G: GraphicsMatrixMethods>(&self, matrix: &G) { ... }
fn get_transform(&self) -> GraphicsMatrix { ... }
fn set_transform<G: GraphicsMatrixMethods>(&self, matrix: &G) { ... }
fn create_brush<B: BrushMethods>(&self, brush: &B) -> GraphicsBrush { ... }
fn set_brush_brush<B: BrushMethods>(&self, brush: &B) { ... }
fn set_brush_graphicsbrush<G: GraphicsBrushMethods>(&self, brush: &G) { ... }
fn create_pen_pen<P: PenMethods>(&self, pen: &P) -> GraphicsPen { ... }
fn create_pen_graphicspeninfo(&self, info: *const c_void) -> GraphicsPen { ... }
fn set_pen_pen<P: PenMethods>(&self, pen: &P) { ... }
fn set_pen_graphicspen<G: GraphicsPenMethods>(&self, pen: &G) { ... }
fn create_path(&self) -> GraphicsPath { ... }
fn stroke_lines_point2ddouble(
&self,
n: usize,
begin_points: *const c_void,
end_points: *const c_void,
) { ... }
fn stroke_lines(&self, n: usize, points: *const c_void) { ... }
fn stroke_path<G: GraphicsPathMethods>(&self, path: &G) { ... }
fn create_font_font<F: FontMethods, C: ColourMethods>(
&self,
font: &F,
col: &C,
) -> GraphicsFont { ... }
fn create_font_double<C: ColourMethods>(
&self,
size_in_pixels: c_double,
facename: &str,
flags: c_int,
col: &C,
) -> GraphicsFont { ... }
fn set_font_font<F: FontMethods, C: ColourMethods>(
&self,
font: &F,
colour: &C,
) { ... }
fn set_font_graphicsfont<G: GraphicsFontMethods>(&self, font: &G) { ... }
fn get_partial_text_extents(&self, text: &str, widths: *mut c_void) { ... }
fn get_text_extent(
&self,
text: &str,
width: *mut c_void,
height: *mut c_void,
descent: *mut c_void,
external_leading: *mut c_void,
) { ... }
fn start_doc(&self, message: &str) -> bool { ... }
fn end_doc(&self) { ... }
fn end_page(&self) { ... }
fn end_layer(&self) { ... }
fn push_state(&self) { ... }
fn pop_state(&self) { ... }
fn flush(&self) { ... }
fn get_native_context(&self) -> *mut c_void { ... }
fn get_size(&self, width: *mut c_void, height: *mut c_void) { ... }
fn get_dpi(&self, dpi_x: *mut c_void, dpi_y: *mut c_void) { ... }
fn get_window(&self) -> WeakRef<Window> { ... }
fn should_offset(&self) -> bool { ... }
fn enable_offset(&self, enable: bool) { ... }
fn disable_offset(&self) { ... }
fn offset_enabled(&self) -> bool { ... }
fn from_dip_size<S: SizeMethods>(&self, sz: &S) -> Size { ... }
fn from_dip_point<P: PointMethods>(&self, pt: &P) -> Point { ... }
fn from_dip_int(&self, d: c_int) -> c_int { ... }
fn to_dip_size<S: SizeMethods>(&self, sz: &S) -> Size { ... }
fn to_dip_point<P: PointMethods>(&self, pt: &P) -> Point { ... }
fn to_dip_int(&self, d: c_int) -> c_int { ... }
}
Expand description
This trait represents C++ wxGraphicsContext
class’s methods and inheritance.
See GraphicsContextIsOwned
documentation for the class usage.
Provided Methods§
Sourcefn create_window<W: WindowMethods>(
window: Option<&W>,
) -> Option<GraphicsContextIsOwned<false>>
fn create_window<W: WindowMethods>( window: Option<&W>, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a wxWindow.
Sourcefn create_windowdc<W: WindowDCMethods>(
window_dc: &W,
) -> Option<GraphicsContextIsOwned<false>>
fn create_windowdc<W: WindowDCMethods>( window_dc: &W, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a wxWindowDC.
Sourcefn create_memorydc<M: MemoryDCMethods>(
memory_dc: &M,
) -> Option<GraphicsContextIsOwned<false>>
fn create_memorydc<M: MemoryDCMethods>( memory_dc: &M, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a wxMemoryDC.
Sourcefn create_enhmetafiledc(
meta_file_dc: *const c_void,
) -> Option<GraphicsContextIsOwned<false>>
fn create_enhmetafiledc( meta_file_dc: *const c_void, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a wxEnhMetaFileDC.
Sourcefn create_from_unknown_dc<D: DCMethods>(
dc: &D,
) -> Option<GraphicsContextIsOwned<false>>
fn create_from_unknown_dc<D: DCMethods>( dc: &D, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a DC of unknown specific type.
See C++ wxGraphicsContext::CreateFromUnknownDC()
’s documentation.
Sourcefn create_image<I: ImageMethods>(
image: &I,
) -> Option<GraphicsContextIsOwned<false>>
fn create_image<I: ImageMethods>( image: &I, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext associated with a wxImage.
Sourcefn create_from_native(
context: *mut c_void,
) -> Option<GraphicsContextIsOwned<false>>
fn create_from_native( context: *mut c_void, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a native context.
See C++ wxGraphicsContext::CreateFromNative()
’s documentation.
Sourcefn create_from_native_window(
window: *mut c_void,
) -> Option<GraphicsContextIsOwned<false>>
fn create_from_native_window( window: *mut c_void, ) -> Option<GraphicsContextIsOwned<false>>
Creates a wxGraphicsContext from a native window.
See C++ wxGraphicsContext::CreateFromNativeWindow()
’s documentation.
Sourcefn create() -> Option<GraphicsContextIsOwned<false>>
fn create() -> Option<GraphicsContextIsOwned<false>>
Create a lightweight context that can be used only for measuring text.
Sourcefn reset_clip(&self)
fn reset_clip(&self)
Resets the clipping to original shape.
Sourcefn clip<R: RegionMethods>(&self, region: &R)
fn clip<R: RegionMethods>(&self, region: &R)
Sets the clipping region to the intersection of the given region and the previously set clipping region.
Sourcefn get_clip_box(
&self,
x: *mut c_void,
y: *mut c_void,
w: *mut c_void,
h: *mut c_void,
)
fn get_clip_box( &self, x: *mut c_void, y: *mut c_void, w: *mut c_void, h: *mut c_void, )
Returns bounding box of the current clipping region.
Sourcefn create_matrix<A: AffineMatrix2DBaseMethods>(&self, mat: &A) -> GraphicsMatrix
fn create_matrix<A: AffineMatrix2DBaseMethods>(&self, mat: &A) -> GraphicsMatrix
Creates a native affine transformation matrix from the passed generic one.
Sourcefn concat_transform<G: GraphicsMatrixMethods>(&self, matrix: &G)
fn concat_transform<G: GraphicsMatrixMethods>(&self, matrix: &G)
Concatenates the passed in transform with the current transform of this context.
See C++ wxGraphicsContext::ConcatTransform()
’s documentation.
Sourcefn get_transform(&self) -> GraphicsMatrix
fn get_transform(&self) -> GraphicsMatrix
Gets the current transformation matrix of this context.
Sourcefn set_transform<G: GraphicsMatrixMethods>(&self, matrix: &G)
fn set_transform<G: GraphicsMatrixMethods>(&self, matrix: &G)
Sets the current transformation matrix of this context.
Sourcefn create_brush<B: BrushMethods>(&self, brush: &B) -> GraphicsBrush
fn create_brush<B: BrushMethods>(&self, brush: &B) -> GraphicsBrush
Creates a native brush from a wxBrush.
Sourcefn set_brush_brush<B: BrushMethods>(&self, brush: &B)
fn set_brush_brush<B: BrushMethods>(&self, brush: &B)
Sets the brush for filling paths.
Sourcefn set_brush_graphicsbrush<G: GraphicsBrushMethods>(&self, brush: &G)
fn set_brush_graphicsbrush<G: GraphicsBrushMethods>(&self, brush: &G)
Sets the brush for filling paths.
Sourcefn create_pen_pen<P: PenMethods>(&self, pen: &P) -> GraphicsPen
fn create_pen_pen<P: PenMethods>(&self, pen: &P) -> GraphicsPen
Creates a native pen from a wxPen.
Sourcefn create_pen_graphicspeninfo(&self, info: *const c_void) -> GraphicsPen
fn create_pen_graphicspeninfo(&self, info: *const c_void) -> GraphicsPen
Creates a native pen from a wxGraphicsPenInfo.
Sourcefn set_pen_pen<P: PenMethods>(&self, pen: &P)
fn set_pen_pen<P: PenMethods>(&self, pen: &P)
Sets the pen used for stroking.
Sourcefn set_pen_graphicspen<G: GraphicsPenMethods>(&self, pen: &G)
fn set_pen_graphicspen<G: GraphicsPenMethods>(&self, pen: &G)
Sets the pen used for stroking.
Sourcefn create_path(&self) -> GraphicsPath
fn create_path(&self) -> GraphicsPath
Creates a native graphics path which is initially empty.
Sourcefn stroke_lines_point2ddouble(
&self,
n: usize,
begin_points: *const c_void,
end_points: *const c_void,
)
fn stroke_lines_point2ddouble( &self, n: usize, begin_points: *const c_void, end_points: *const c_void, )
Stroke disconnected lines from begin to end points, fastest method available for this purpose.
Sourcefn stroke_lines(&self, n: usize, points: *const c_void)
fn stroke_lines(&self, n: usize, points: *const c_void)
Stroke lines connecting all the points.
Sourcefn stroke_path<G: GraphicsPathMethods>(&self, path: &G)
fn stroke_path<G: GraphicsPathMethods>(&self, path: &G)
Strokes along a path with the current pen.
Sourcefn create_font_font<F: FontMethods, C: ColourMethods>(
&self,
font: &F,
col: &C,
) -> GraphicsFont
fn create_font_font<F: FontMethods, C: ColourMethods>( &self, font: &F, col: &C, ) -> GraphicsFont
Creates a native graphics font from a wxFont and a text colour.
Sourcefn create_font_double<C: ColourMethods>(
&self,
size_in_pixels: c_double,
facename: &str,
flags: c_int,
col: &C,
) -> GraphicsFont
fn create_font_double<C: ColourMethods>( &self, size_in_pixels: c_double, facename: &str, flags: c_int, col: &C, ) -> GraphicsFont
Creates a font object with the specified attributes.
Sourcefn set_font_font<F: FontMethods, C: ColourMethods>(&self, font: &F, colour: &C)
fn set_font_font<F: FontMethods, C: ColourMethods>(&self, font: &F, colour: &C)
Sets the font for drawing text.
Sourcefn set_font_graphicsfont<G: GraphicsFontMethods>(&self, font: &G)
fn set_font_graphicsfont<G: GraphicsFontMethods>(&self, font: &G)
Sets the font for drawing text.
Sourcefn get_partial_text_extents(&self, text: &str, widths: *mut c_void)
fn get_partial_text_extents(&self, text: &str, widths: *mut c_void)
Fills the widths array with the widths from the beginning of text to the corresponding character of text.
See C++ wxGraphicsContext::GetPartialTextExtents()
’s documentation.
Sourcefn get_text_extent(
&self,
text: &str,
width: *mut c_void,
height: *mut c_void,
descent: *mut c_void,
external_leading: *mut c_void,
)
fn get_text_extent( &self, text: &str, width: *mut c_void, height: *mut c_void, descent: *mut c_void, external_leading: *mut c_void, )
Gets the dimensions of the string using the currently selected font.
Sourcefn start_doc(&self, message: &str) -> bool
fn start_doc(&self, message: &str) -> bool
Begin a new document (relevant only for printing / pdf etc.) If there is a progress dialog, message will be shown.
Sourcefn end_layer(&self)
fn end_layer(&self)
Composites back the drawings into the context with the opacity given at the BeginLayer() call.
Sourcefn push_state(&self)
fn push_state(&self)
Push the current state (like transformations, clipping region and quality settings) of the context on a stack.
Sourcefn pop_state(&self)
fn pop_state(&self)
Sets current state of the context to the state saved by a preceding call to PushState() and removes that state from the stack of saved states.
Sourcefn get_native_context(&self) -> *mut c_void
fn get_native_context(&self) -> *mut c_void
Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo_t pointer for cairo).
See C++ wxGraphicsContext::GetNativeContext()
’s documentation.
Sourcefn get_size(&self, width: *mut c_void, height: *mut c_void)
fn get_size(&self, width: *mut c_void, height: *mut c_void)
Returns the size of the graphics context in device coordinates.
Sourcefn get_dpi(&self, dpi_x: *mut c_void, dpi_y: *mut c_void)
fn get_dpi(&self, dpi_x: *mut c_void, dpi_y: *mut c_void)
Returns the resolution of the graphics context in device points per inch.
Sourcefn get_window(&self) -> WeakRef<Window>
fn get_window(&self) -> WeakRef<Window>
Returns the associated window if any.
Sourcefn should_offset(&self) -> bool
fn should_offset(&self) -> bool
Helper to determine if a 0.5 offset should be applied for the drawing operation.
Sourcefn enable_offset(&self, enable: bool)
fn enable_offset(&self, enable: bool)
Indicates whether the context should try to offset for pixel boundaries.
Sourcefn disable_offset(&self)
fn disable_offset(&self)
Helper to determine if a 0.5 offset should be applied for the drawing operation.
Sourcefn offset_enabled(&self) -> bool
fn offset_enabled(&self) -> bool
Helper to determine if a 0.5 offset should be applied for the drawing operation.
Sourcefn from_dip_size<S: SizeMethods>(&self, sz: &S) -> Size
fn from_dip_size<S: SizeMethods>(&self, sz: &S) -> Size
Convert DPI-independent pixel values to the value in pixels appropriate for the graphics context.
Sourcefn from_dip_point<P: PointMethods>(&self, pt: &P) -> Point
fn from_dip_point<P: PointMethods>(&self, pt: &P) -> Point
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sourcefn from_dip_int(&self, d: c_int) -> c_int
fn from_dip_int(&self, d: c_int) -> c_int
Convert DPI-independent value in pixels to the value in pixels appropriate for the graphics context.
Sourcefn to_dip_size<S: SizeMethods>(&self, sz: &S) -> Size
fn to_dip_size<S: SizeMethods>(&self, sz: &S) -> Size
Convert pixel values of the current graphics context to DPI-independent pixel values.
Sourcefn to_dip_point<P: PointMethods>(&self, pt: &P) -> Point
fn to_dip_point<P: PointMethods>(&self, pt: &P) -> Point
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sourcefn to_dip_int(&self, d: c_int) -> c_int
fn to_dip_int(&self, d: c_int) -> c_int
Convert pixel values of the current graphics context to DPI-independent pixel values.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.