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

Change Image Pixel Color #38

Open
kinju4374 opened this issue Jul 25, 2016 · 2 comments
Open

Change Image Pixel Color #38

kinju4374 opened this issue Jul 25, 2016 · 2 comments

Comments

@kinju4374
Copy link

Hi,

Can you please suggest does this API has any Image Extensions that will me to change Image pixel color and it will not affect performance of my app?

If yes, please let me know which one to use and if you have any sample it would be a great help.

Thanks

@xyzzer
Copy link
Owner

xyzzer commented Jul 25, 2016

Every instruction affects performance in some way, so it all depends on what you're trying to achieve and how much you're willing to invest in the code.

Accessing pixels of a WriteableBitmap isn't too expensive unless you would like to redraw them many times per second. Possibly using C++ would be faster than in C#.
Using Direct2D, perhaps with Win2D or SharpDX wrappers should let you achieve 60FPS easily. Check my code here for a sample: https://github.com/xyzzer/Win2DChartSample
If you'd like to calculate the color of each pixel of a frame many times per second - you might want to look into lower level Direct3D/DXGI texture manipulation. I think you might be able to map a CPU texture if you'd like to use your CPU to set pixel colors or better yet - use a pixel shader to render the texture fully on the GPU (if available).
If you really only want to set a color of one pixel - you could just have 1x1 XAML Grid element of a specific color laid out at a specific position on the screen.

@kinju4374
Copy link
Author

Thanks will give it a try.

Actually, I am using some icons which I download from the server. So, what I want to do is download the icon, change it pixel color and then store the new colored image in the local storage of app.

I tried WriteableBitmapEx API but it is taking more than 3 minutes for 10-15 icons. I have attached my CS file.
ChangeImageColor.zip

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

No branches or pull requests

2 participants