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)> { ... }
}
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§
sourcefn get_CurDC(&self) -> HrResult<HDC>
fn get_CurDC(&self) -> HrResult<HDC>
IPicture::get_CurDC
method.
sourcefn get_Height(&self) -> HrResult<i32>
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);
sourcefn get_Type(&self) -> HrResult<PICTYPE>
fn get_Type(&self) -> HrResult<PICTYPE>
IPicture::get_Type
method.
sourcefn get_Width(&self) -> HrResult<i32>
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);
sourcefn PictureChanged(&self) -> HrResult<()>
fn PictureChanged(&self) -> HrResult<()>
IPicture::PictureChanged
method.
sourcefn put_KeepOriginalFormat(&self, keep: bool) -> HrResult<()>
fn put_KeepOriginalFormat(&self, keep: bool) -> HrResult<()>
IPicture::put_KeepOriginalFormat
method.
sourcefn 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 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:
Parameter | Default value |
---|---|
dest_pt | 0 , 0 |
dest_sz | HDC client rect |
src_offset_himetric | 0 , 0 |
src_extent_himetric | image size from get_Width , get_Height |
sourcefn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)>
fn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)>
IPicture::SelectPicture
method.