Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
4.67/5 (3 votes)
See more:
I love how simple the WPF zooming is (transform ability to zoom any control). However, I wanted to use it for an image and I require the pix-elation, i.e. no blending/smoothing.

So if I have an image of checkered Black and White pixels all through out, as I zoom further and further in I want to be able to zoom all of the way into a Black (or White Pixel).

Is this possible?
Posted
Updated 12-Dec-10 2:49am
v2

1 solution

This is an excellent question and -- I think -- a great idea of how to present pixel graphics -- my 5!
Fortunately, I know the exact answer.

The only way I can see it to model each pixel as a rectangle object (actually a square if you want square pixels). This will automatically give you the desired effect using same very zooming you already use.

To extract data about pixels from a WPF bitmap (I assume you already obtain one) use
C#
System.Windows.Media.Imaging.BitmapImage
and its method CopyPixels.

If you need to update picture (if this is a kind of editor), you may need to pack your "square" data back to real bitmap. Then use
C#
System.Windows.Media.Imaging.WriteableBitmap


Please feel free to ask any further questions (and certainly do that if you think something is wrong, before you vote :) )

Thank you.
 
Share this answer
 
v3
Comments
Espen Harlinn 26-Feb-11 10:47am    
Good effort - a 5
Sergey Alexandrovich Kryukov 26-Feb-11 21:55pm    
Thank you. I though zooming with pixellation was exactly was OP wanted, but never saw any reply; maybe the project was abandoned.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900