pub struct PreviewGeometry {
pub content_width: f32,
pub content_height: f32,
pub viewport_width: f32,
pub viewport_height: f32,
pub dpi_scale: f32,
pub render_rect: PreviewRect,
pub mode: PreviewScaleMode,
}Expand description
Geometry uses physical pixels for the viewport/render rectangle and content-space pixels for
the OBS canvas/source. dpi_scale converts UI logical pointer coordinates to physical pixels.
Fields§
§content_width: f32§content_height: f32§viewport_width: f32§viewport_height: f32§dpi_scale: f32§render_rect: PreviewRect§mode: PreviewScaleModeImplementations§
Source§impl PreviewGeometry
impl PreviewGeometry
pub fn new( content_width: u32, content_height: u32, viewport_width: u32, viewport_height: u32, mode: PreviewScaleMode, dpi_scale: f32, ) -> Option<Self>
Sourcepub fn viewport_to_content(&self, point: PreviewPoint) -> Option<PreviewPoint>
pub fn viewport_to_content(&self, point: PreviewPoint) -> Option<PreviewPoint>
Converts a physical viewport point to content coordinates. Fit-mode letterbox areas return
None; fill-mode cropped viewport points remain valid and map into the visible crop.
Sourcepub fn logical_viewport_to_content(
&self,
point: PreviewPoint,
) -> Option<PreviewPoint>
pub fn logical_viewport_to_content( &self, point: PreviewPoint, ) -> Option<PreviewPoint>
Converts a UI logical point using this geometry’s DPI scale before mapping to content.
pub fn content_to_viewport(&self, point: PreviewPoint) -> PreviewPoint
pub fn content_to_logical_viewport(&self, point: PreviewPoint) -> PreviewPoint
Trait Implementations§
Source§impl Clone for PreviewGeometry
impl Clone for PreviewGeometry
impl Copy for PreviewGeometry
Source§impl Debug for PreviewGeometry
impl Debug for PreviewGeometry
Source§impl PartialEq for PreviewGeometry
impl PartialEq for PreviewGeometry
impl StructuralPartialEq for PreviewGeometry
Auto Trait Implementations§
impl Forget for PreviewGeometry
impl Freeze for PreviewGeometry
impl Move for PreviewGeometry
impl RefUnwindSafe for PreviewGeometry
impl Send for PreviewGeometry
impl Sync for PreviewGeometry
impl Unpin for PreviewGeometry
impl UnsafeUnpin for PreviewGeometry
impl UnwindSafe for PreviewGeometry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more