No, but you can easily render such thing.
I'll explain how to do it if you tag your question: what do you use: WPF or
System.Drawing
(with
System.Windows.Forms
or not)? Don't just answer my question, tag it! (You want to attract other experts to your question, so always tag very accurately.)
[EDIT: providing more detail after OP's clarifications]
With
System.Windows.Forms
and
System.Drawing
, you first need to get an array of pixels. This is done using
System.Drawing.Bitmap.LockBits
. You can use it with either
System.Runtime.InteropServices.Marshal.Copy
or pointers in
unsafe
mode. You can find the code sample using
Marshal
here:
http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx[
^].
Now, you scale it by an integer factor N (only integer). It means each pixel should be represented by a square N×N pixel or the uniform color. You need to render all those squares side by side &msash; as many as pixels in the original picture. You can do it using two ways:
- Use the same code sample as before and see how to write to a bitmap using
LockBits
and Marshal
. The main difference is: you need to create another bitmap for rendering, N time bigger and set all pixels in it using the pixel array read from the original bitmap You can create a new bitmap N times bigger, create an instance of it System.Drawing.Graphics
using the static method System.Drawing.Graphics.FromImage
and render all those rectangles using this instance and the instance method System.Drawing.Graphics.FillRectangle
.
Hard to say which method will be faster; it may also depends on your scaling factor. Please experiment. Would be nice if you share your results.
[EDIT]
Scaling via re-sampling is completely wrong approach anyway.
You need to use vector graphics and nothing else. There are several options: using your own data layer (collection of vector primitive, scale-free, scalable) and rendering on the fly for each scale, rendering based on metafile. I don't really want to discuss this because WPF beats all. It already has fully-fledged vector graphics with objects of any complexity, design-time or run-time, fully implemented scaling and more. Almost no low-level programming. No rendering at all. I would not even play with the idea of using Forms. They are getting obsolete anyway, I hope.
[END EDIT]
—SA