Trait ole_IPicture

Source
pub trait ole_IPicture: ole_IUnknown {
Show 13 methods // Provided methods fn get_Attributes(&self) -> HrResult<PICTURE> { ... } fn get_CurDC(&self) -> HrResult<HDC> { ... } fn get_Height(&self) -> HrResult<i32> { ... } fn get_hPal(&self) -> HrResult<HPALETTE> { ... } fn get_KeepOriginalFormat(&self) -> HrResult<bool> { ... } 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 SaveAsFile(&self, stream: &IStream, save_mem_copy: bool) -> HrResult<u32> { ... } fn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)> { ... } fn set_hPal(&self, hpal: &HPALETTE) -> HrResult<()> { ... }
}
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_Attributes(&self) -> HrResult<PICTURE>

Source

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

Source

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

IPicture::get_Height method.

Returns the value in HIMETRIC units.

§Examples

Converting height from HIMETRIC to pixels:

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

let pic: w::IPicture; // initialized somewhere
let pic = unsafe { w::IPicture::null() };

let cy_hm = pic.get_Height()?;
let hdc_screen = w::HWND::NULL.GetDC()?;
let (_, cy_px) = hdc_screen.HiMetricToPixel(0, cy_hm);
Source

fn get_hPal(&self) -> HrResult<HPALETTE>

Source

fn get_KeepOriginalFormat(&self) -> HrResult<bool>

Source

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

Source

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

IPicture::get_Width method.

Returns the value in HIMETRIC units.

§Examples

Converting width from HIMETRIC to pixels:

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

let pic: w::IPicture; // initialized somewhere
let pic = unsafe { w::IPicture::null() };

let cx_hm = pic.get_Width()?;
let hdc_screen = w::HWND::NULL.GetDC()?;
let (cx_px, _) = hdc_screen.HiMetricToPixel(cx_hm, 0);
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 SaveAsFile(&self, stream: &IStream, save_mem_copy: bool) -> HrResult<u32>

IPicture::SaveAsFile method.

Returns the number of bytes written into the stream.

Source

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

Source

fn set_hPal(&self, hpal: &HPALETTE) -> HrResult<()>

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.

Implementors§