Skip to content

Conversation

@longmathemagician
Copy link
Contributor

@longmathemagician longmathemagician commented Jul 26, 2022

This is a draft implementation of a quick-ish blur effect. It was written to support overlay UI elements in druid, but could in theory be used anywhere you want to blur a PietImage. As an example, this is what I'm using it for:

Example image showing the a blurred toolbar

Backend implementation status & notes:

  • Direct2D (hardware accelerated). The device context should probably be cached instead of recreated each time the method is called, and it would be nice if the unsafe block wasn't so large.
  • Cairo (software implementation, very approximate dual-kawase-inspired algorithm). Not as efficient as it could be, currently creates a duplicate surface and render context to get around Cairo's surface data reference count limit.
  • CoreGraphics (software implementation, same algorithm as Cairo). It would be better to use a filter from coreimage for hardware acceleration but the rust bindings for that are not currently available.
  • SVG
  • Web
  • Handles common image formats
  • Snapshots

@richard-uk1
Copy link
Collaborator

Note to self: this should also be possible for piet-svg using filters. I should look at this if/when this PR lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants