-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for GDI+ #1679
Initial support for GDI+ #1679
Conversation
Quick Rust sample use windows::{
core::w,
Win32::Graphics::GdiPlus::{
self, GdipCreateFontFamilyFromName, GdipNewInstalledFontCollection, GdiplusShutdown,
GdiplusStartup, GdiplusStartupInput, GpFontCollection, GpFontFamily,
},
};
fn main() -> windows::core::Result<()> {
unsafe {
let mut token = usize::default();
let input = GdiplusStartupInput {
GdiplusVersion: 1,
..Default::default()
};
assert_eq!(
GdiplusStartup(&mut token, &input, std::ptr::null_mut()),
GdiPlus::Ok
);
let mut collection: *mut GpFontCollection = std::ptr::null_mut();
assert_eq!(
GdipNewInstalledFontCollection(&mut collection as *mut *mut _),
GdiPlus::Ok
);
let mut family: *mut GpFontFamily = std::ptr::null_mut();
assert_eq!(
GdipCreateFontFamilyFromName(w!("Segoe UI"), collection, &mut family as *mut *mut _),
GdiPlus::Ok
);
assert_eq!(
GdipCreateFontFamilyFromName(
w!("Invalid Font Family"),
collection,
&mut family as *mut *mut _
),
GdiPlus::FontFamilyNotFound
);
GdiplusShutdown(token);
}
Ok(())
} |
@elachlan Which Gdi+ APIs are you using? I'd like to make sure we have coverage here. |
@JeremyKuhne will know better than myself. The only functions we are implementing ourselves at the moment are the ones from the linked issue. They are implemented here: |
Awesome. Thanks! |
@mikebattista You okay with the separate |
Yes that seemed reasonable. |
@riverar Most of them. WinForms owns System.Drawing which is mostly a wrap of GDI+. You can see some of them here: |
Thanks @JeremyKuhne @elachlan will take a look. Think we got them all covered. @mikebattista Looks like build validation didn't run in this PR and some tests failed that need fixes. Will clean that up today and submit another PR. |
@riverar could you implement the NativeTypedefs in autotypes.json? Or was there a reason you manually defined them? I believe definitions like below should amount to the same result, and I'd prefer to keep all NativeTypedefs defined in autotypes.json if we can.
|
@mikebattista Can do! |
@mikebattista Given the following:
I can move them to common areas but how do you then map to them via each partition? Or do we exclude them from both? Information on |
What do you mean by map to them via each partition? |
Ole and Gdiplus both need a PointF. Is the workflow: Create a common PointF, exclude PointF from each partition? |
Is just remapping in requiredNamespacesForNames not enough? |
This reverts commit 0c63f94.
Fixes #1287