-
Notifications
You must be signed in to change notification settings - Fork 117
Windows image attachments #1245
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
Conversation
Proper support for GDI+ is blocked by swiftlang/swift#83408. |
@swift-ci test |
@swift-ci test Windows |
…usImage so that not all attachable images are forced to be UnsafeMutablePointer
Sources/Overlays/_Testing_WinSDK/Attachments/AttachableAsGDIPlusImage.swift
Outdated
Show resolved
Hide resolved
@swift-ci test |
@swift-ci test |
…an be referenced directly from Swift
@swift-ci test |
@swift-ci test Linux |
@swift-ci test macOS |
… and letting the library call delete
…he documentation)
@swift-ci test |
I don't see Windows CI listed here, any idea why that would be missing? 🤔 |
@swift-ci test Windows |
…g/swift-testing into jgrynspan/gdiplus-image-overlay
@swift-ci test |
@swift-ci test Linux |
@swift-ci test macOS |
Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper.swift
Show resolved
Hide resolved
public init?(pathExtension: String, encodingQuality: Float = 1.0) { | ||
let pathExtension = pathExtension.drop { $0 == "." } | ||
let clsid = Self._computeCLSID(forPathExtension: String(pathExtension)) | ||
if let clsid { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a guard
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make a huge difference. I can change it if you feel strongly.
Add support for attaching images on Windows if they are instances of types we can convert to
Gdiplus::Image
. Due to current limitations on Swift/C++ interop, it's not possible to attach aGdiplus::Image
directly (they get brought in as the nefariousOpaquePointer
type) but you can attach anHBITMAP
orHICON
.Direct support for WIC and Direct2D types first requires Swift support for COM interfaces/types.
Checklist: