-
Notifications
You must be signed in to change notification settings - Fork 0
Opening PIXes
Ignacy edited this page Dec 27, 2024
·
2 revisions
PixReader allows PIX image files to be opened in 3 ways:
- Directly opening the file
- From the app itself
- Drag and dropping the file on top of the app
But how does it go from a text file to an image? The answer lies with the System.Drawing.Bitmap class in C#.
Using the first two lines of the PIX (the width and height definition), a bitmap is created. Then, each line of the PIX is looped through. Using the Bitmap.SetPixel() method, every color code of the PIX is set. When a nr arises, the followed pixels are placed on the next row of the bitmap.
Once the PIX is parsed into a bitmap, the bitmap is turned into a BitmapSource, which then can be displayed using an image control.