Skip to content

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

Merged
merged 30 commits into from
Aug 1, 2025
Merged

Windows image attachments #1245

merged 30 commits into from
Aug 1, 2025

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Jul 30, 2025

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 a Gdiplus::Image directly (they get brought in as the nefarious OpaquePointer type) but you can attach an HBITMAP or HICON.

Direct support for WIC and Direct2D types first requires Swift support for COM interfaces/types.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

@grynspan grynspan added this to the Swift 6.x (main) milestone Jul 30, 2025
@grynspan grynspan added enhancement New feature or request windows 🪟 Windows support attachments/activities 🖇️ Work related to attachments and/or activities labels Jul 30, 2025
@grynspan
Copy link
Contributor Author

Proper support for GDI+ is blocked by swiftlang/swift#83408.

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Windows

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Linux

@grynspan
Copy link
Contributor Author

@swift-ci test macOS

@grynspan grynspan marked this pull request as ready for review July 31, 2025 17:03
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan requested a review from compnerd July 31, 2025 17:03
@grynspan grynspan changed the title [WIP, DNM] Windows image attachments Windows image attachments Jul 31, 2025
@stmontgomery
Copy link
Contributor

I don't see Windows CI listed here, any idea why that would be missing? 🤔

@grynspan
Copy link
Contributor Author

@swift-ci test Windows

@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan
Copy link
Contributor Author

@swift-ci test Linux

@grynspan
Copy link
Contributor Author

@swift-ci test macOS

public init?(pathExtension: String, encodingQuality: Float = 1.0) {
let pathExtension = pathExtension.drop { $0 == "." }
let clsid = Self._computeCLSID(forPathExtension: String(pathExtension))
if let clsid {
Copy link
Member

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?

Copy link
Contributor Author

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.

@grynspan grynspan merged commit 0d85d8b into main Aug 1, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/gdiplus-image-overlay branch August 1, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attachments/activities 🖇️ Work related to attachments and/or activities enhancement New feature or request windows 🪟 Windows support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants