Trait winsafe::prelude::ole_IPicture

source ·
pub trait ole_IPicture: ole_IUnknown {
    // Provided methods
    fn get_CurDC(&self) -> HrResult<HDC> { ... }
    fn get_Height(&self) -> HrResult<i32> { ... }
    fn get_Type(&self) -> HrResult<PICTYPE> { ... }
    fn get_Width(&self) -> HrResult<i32> { ... }
    fn PictureChanged(&self) -> HrResult<()> { ... }
    fn put_KeepOriginalFormat(&self, keep: bool) -> HrResult<()> { ... }
    fn Render(
        &self,
        hdc: &HDC,
        dest_pt: Option<POINT>,
        dest_sz: Option<SIZE>,
        src_offset_himetric: Option<POINT>,
        src_extent_himetric: Option<SIZE>,
        metafile_bounds: Option<&RECT>
    ) -> AnyResult<()> { ... }
    fn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)> { ... }
}
Available on crate features kernel and ole only.
Expand description

This trait is enabled with the ole feature, and provides methods for IPicture.

Prefer importing this trait through the prelude:

use winsafe::prelude::*;

Provided Methods§

source

fn get_CurDC(&self) -> HrResult<HDC>

source

fn get_Height(&self) -> HrResult<i32>

IPicture::get_Height method.

Returns a value in HIMETRIC units. To convert it to pixels, use HDC::HiMetricToPixel.

§Examples

Converting height from HIMETRIC to pixels:

use winsafe::{self as w, prelude::*};

let pic: w::IPicture; // initialized somewhere

let hdc = w::HWND::NULL.GetDC()?;

let (_, height) = hdc.HiMetricToPixel(0, pic.get_Height()?);
println!("Height: {} px", height);
source

fn get_Type(&self) -> HrResult<PICTYPE>

source

fn get_Width(&self) -> HrResult<i32>

IPicture::get_Width method.

Returns a value in HIMETRIC units. To convert it to pixels, use HDC::HiMetricToPixel.

§Examples

Converting width from HIMETRIC to pixels:

use winsafe::{self as w, prelude::*};

let pic: w::IPicture; // initialized somewhere

let hdc = w::HWND::NULL.GetDC()?;

let (width, _) = hdc.HiMetricToPixel(pic.get_Width()?, 0);
println!("Width: {} px", width);
source

fn PictureChanged(&self) -> HrResult<()>

source

fn put_KeepOriginalFormat(&self, keep: bool) -> HrResult<()>

source

fn Render( &self, hdc: &HDC, dest_pt: Option<POINT>, dest_sz: Option<SIZE>, src_offset_himetric: Option<POINT>, src_extent_himetric: Option<SIZE>, metafile_bounds: Option<&RECT> ) -> AnyResult<()>

IPicture::Render method.

This method will automatically perform the inverse height calculations – convert src_extent_himetric.cy to a negative value and compensate src_offset_himetric.y. This is necessary because HIMETRIC height is rendered in reverse order (bottom to top) when compared to HDC height.

Default values:

ParameterDefault value
dest_pt0, 0
dest_szHDC client rect
src_offset_himetric0, 0
src_extent_himetricimage size from get_Width, get_Height
source

fn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)>

Object Safety§

This trait is not object safe.

Implementors§