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<()> { ... }
}
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_Attributes(&self) -> HrResult<PICTURE>
fn get_Attributes(&self) -> HrResult<PICTURE>
IPicture::get_Attributes
method.
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 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);
Sourcefn get_hPal(&self) -> HrResult<HPALETTE>
fn get_hPal(&self) -> HrResult<HPALETTE>
IPicture::get_hPal
method.
Sourcefn get_KeepOriginalFormat(&self) -> HrResult<bool>
fn get_KeepOriginalFormat(&self) -> HrResult<bool>
IPicture::get_KeepOriginalFormat
method.
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 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);
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 SaveAsFile(&self, stream: &IStream, save_mem_copy: bool) -> HrResult<u32>
fn SaveAsFile(&self, stream: &IStream, save_mem_copy: bool) -> HrResult<u32>
IPicture::SaveAsFile
method.
Returns the number of bytes written into the stream.
Sourcefn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)>
fn SelectPicture(&self, hdc: &HDC) -> HrResult<(HDC, HBITMAP)>
IPicture::SelectPicture
method.
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.