Skip to content

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Aug 7, 2025

This PR shifts our support for Windows image attachments onto WIC (Windows Imaging Component) instead of GDI+, which is an older API that supports fewer types of image object.

This change also removes the dependency on C++ interop from the WinSDK overlay module, which could have prevented it from being used by modules that don't have C++ interop enabled.

Yes, obj.pointee.lpVtbl.pointee.Release(obj) is how you spell it.

Checklist:

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

This PR shifts our support for Windows image attachments onto WIC
(Windows Imaging Component) instead of GDI+, which is an older API
that supports fewer types of image object.
@grynspan grynspan added this to the Swift 6.x (main) milestone Aug 7, 2025
@grynspan grynspan requested a review from compnerd August 7, 2025 20:12
@grynspan grynspan self-assigned this Aug 7, 2025
@grynspan grynspan added windows 🪟 Windows support attachments/activities 🖇️ Work related to attachments and/or activities cross-import-overlays 🍰 Cross-import overlays (Foundation, Core Graphics, etc.) labels Aug 7, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Aug 7, 2025

@swift-ci test

@grynspan grynspan added the less-c++ 🐀 Work to reduce the size of our C++ codebase and/or dependencies label Aug 7, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Aug 7, 2025

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Aug 7, 2025

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Aug 7, 2025

I've asked @compnerd to review as well before I merge this PR.

@grynspan
Copy link
Contributor Author

grynspan commented Aug 8, 2025

Note to self: copy HBITMAP/HICON instead of risking UAF—use https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-copyimage

@grynspan
Copy link
Contributor Author

grynspan commented Aug 8, 2025

@swift-ci test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a lot cleaner!


// Create the frame into which the bitmap will be composited.
var frame: UnsafeMutablePointer<IWICBitmapFrameEncode>?
var propertyBag: UnsafeMutablePointer<IPropertyBag2>?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

properties might be a better name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you feel strongly about it?

@grynspan
Copy link
Contributor Author

grynspan commented Aug 8, 2025

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Aug 8, 2025

@swift-ci test

…leValue', conditionally expose an imageFormat property on Attachment
@grynspan
Copy link
Contributor Author

grynspan commented Aug 8, 2025

@swift-ci test

@grynspan grynspan merged commit 8ed3dff into main Aug 8, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/wic-image-attachments branch August 8, 2025 18:41
@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 cross-import-overlays 🍰 Cross-import overlays (Foundation, Core Graphics, etc.) image-attachments 📸 Work related to image attachments less-c++ 🐀 Work to reduce the size of our C++ codebase and/or dependencies windows 🪟 Windows support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants