Skip to content

Windows image attachments#1245

Merged
grynspan merged 30 commits into
mainfrom
jgrynspan/gdiplus-image-overlay
Aug 1, 2025
Merged

Windows image attachments#1245
grynspan merged 30 commits into
mainfrom
jgrynspan/gdiplus-image-overlay

Conversation

@grynspan

@grynspan grynspan commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Windows

Comment thread Sources/Overlays/_Testing_WinSDK/Attachments/AttachableAsGDIPlusImage.swift Outdated
@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Linux

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test macOS

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

Copy link
Copy Markdown
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
Comment thread Package.swift
@stmontgomery

Copy link
Copy Markdown
Contributor

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

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Windows

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan

Copy link
Copy Markdown
Contributor Author

@swift-ci test Linux

@grynspan

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@grynspan grynspan added the image-attachments 📸 Work related to image attachments label Aug 28, 2025
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 image-attachments 📸 Work related to image attachments windows 🪟 Windows support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants