usercode / wpf.imageeffects Goto Github PK
View Code? Open in Web Editor NEWGPU-based image effects (brightness, contrast) for WPF
License: MIT License
GPU-based image effects (brightness, contrast) for WPF
License: MIT License
This shader appears to deal only in floating-point pixels. I know next to nothing about DirectX and how the image pipeline works. If I were showing a bitmap created as 8-bit grayscale, would this shader work for that? Or would I need to try to learn how to write my own shader.
I have an application which allows the user to browse folders containing hundreds of images. I show them all in a ListBox and apply this effect to each of them as a StaticResource. It works wonderfully -- I really love this -- but after many hours tracking down a big memory leak, I narrowed it down to this effect alone.
Literally this is my XAML
First in a resource dictionary
<imageeffects:BrightnessContrastEffect x:Key="SettingsImageBrightnessEffect"
Brightness="{Binding Source={svc:ViewSettings}, Path=BrightnessOffset}" />
And then later in my page -- this is the DataTemplate for each thumbnail I show. There can be hundreds of these in a folder
<Image Grid.Row="0" Grid.RowSpan="2"
Source="{Binding ThumbnailSource}"
Effect="{StaticResource SettingsImageBrightnessEffect}"
/>
As long as this effect is applied to an image, the image source memory is apparently never released. I've profiled it in Resharper's Dot Memory. IT is like looking at a staircase; Navigate to one folder, watch the memory go way up. Navigate to another folder, watch that happen again. It never goes back down. Even repeatedly resizing the one folder I'm in (so that more or fewer images appear) makes the memory used go way up.
But as soon as I remove the one line that applies the effect to the image,
Effect="{StaticResource SettingsImageBrightnessEffect}"
The memory usage goes all the way back down with every page navigate
Is there any thing I can do to turn this off? I love your project (and would love to learn how to do it myself) but I am unfortunately forced to cut out that line for now
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.