Skip to content
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

Blur methods for PietImages #527

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

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