summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2015-09-01 15:05:27 +0100
committerVincent Sanders <vince@kyllikki.org>2015-09-01 15:05:27 +0100
commitf2d8f433391919bc13041fe850aefb502fa6f348 (patch)
tree017f5c657746b5ecf28aad956a594e667b2c2ec2 /examples
parenta9eb97707b3960c052d05bb85a41fdb5c9ef777c (diff)
downloadlibnsbmp-f2d8f433391919bc13041fe850aefb502fa6f348.tar.gz
libnsbmp-f2d8f433391919bc13041fe850aefb502fa6f348.tar.bz2
add decode test suite
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/bmp_display3
-rw-r--r--examples/bmpsuite/g01bg.bmpbin1086 -> 0 bytes
-rw-r--r--examples/bmpsuite/g01bw.bmpbin1086 -> 0 bytes
-rw-r--r--examples/bmpsuite/g01p1.bmpbin1082 -> 0 bytes
-rw-r--r--examples/bmpsuite/g01wb.bmpbin1086 -> 0 bytes
-rw-r--r--examples/bmpsuite/g04.bmpbin4214 -> 0 bytes
-rw-r--r--examples/bmpsuite/g04p4.bmpbin4166 -> 0 bytes
-rw-r--r--examples/bmpsuite/g04rle.bmpbin922 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08offs.bmpbin9370 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08os2.bmpbin8986 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08p256.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08p64.bmpbin8502 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08pi256.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08pi64.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08res11.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08res21.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08res22.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08rle.bmpbin1820 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08s0.bmpbin9270 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08w124.bmpbin8642 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08w125.bmpbin9014 -> 0 bytes
-rw-r--r--examples/bmpsuite/g08w126.bmpbin9142 -> 0 bytes
-rw-r--r--examples/bmpsuite/g16bf555.bmpbin16450 -> 0 bytes
-rw-r--r--examples/bmpsuite/g16bf565.bmpbin16450 -> 0 bytes
-rw-r--r--examples/bmpsuite/g16def555.bmpbin16438 -> 0 bytes
-rw-r--r--examples/bmpsuite/g24.bmpbin24630 -> 0 bytes
-rw-r--r--examples/bmpsuite/g32bf.bmpbin32578 -> 0 bytes
-rw-r--r--examples/bmpsuite/g32def.bmpbin32566 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/01bg.pngbin281 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/01bw.pngbin281 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/01p1.pngbin139 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/04.pngbin280 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/04p4.pngbin223 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/08.pngbin1447 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/08p64.pngbin694 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/08w124.pngbin1434 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/08w125.pngbin1450 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/08w126.pngbin1461 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/16bf555.pngbin525 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/16bf565.pngbin580 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/24.pngbin433 -> 0 bytes
-rw-r--r--examples/bmpsuite/png/reference.html54
-rw-r--r--examples/bmpsuite/readme.txt38
-rw-r--r--examples/bmpsuite/test.html54
-rw-r--r--examples/decode_bmp.c192
-rw-r--r--examples/decode_ico.c203
-rwxr-xr-xexamples/ico_display3
-rw-r--r--examples/monitor.icobin102758 -> 0 bytes
49 files changed, 6 insertions, 541 deletions
diff --git a/examples/bmp_display b/examples/bmp_display
new file mode 100755
index 0000000..dd0458c
--- /dev/null
+++ b/examples/bmp_display
@@ -0,0 +1,3 @@
+set -e
+make
+bin/decode_bmp $1 | display
diff --git a/examples/bmpsuite/g01bg.bmp b/examples/bmpsuite/g01bg.bmp
deleted file mode 100644
index a720347..0000000
--- a/examples/bmpsuite/g01bg.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g01bw.bmp b/examples/bmpsuite/g01bw.bmp
deleted file mode 100644
index 06189a6..0000000
--- a/examples/bmpsuite/g01bw.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g01p1.bmp b/examples/bmpsuite/g01p1.bmp
deleted file mode 100644
index 706b4a1..0000000
--- a/examples/bmpsuite/g01p1.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g01wb.bmp b/examples/bmpsuite/g01wb.bmp
deleted file mode 100644
index 2f05b43..0000000
--- a/examples/bmpsuite/g01wb.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g04.bmp b/examples/bmpsuite/g04.bmp
deleted file mode 100644
index a064f66..0000000
--- a/examples/bmpsuite/g04.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g04p4.bmp b/examples/bmpsuite/g04p4.bmp
deleted file mode 100644
index 4c1096b..0000000
--- a/examples/bmpsuite/g04p4.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g04rle.bmp b/examples/bmpsuite/g04rle.bmp
deleted file mode 100644
index 7239fa6..0000000
--- a/examples/bmpsuite/g04rle.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08.bmp b/examples/bmpsuite/g08.bmp
deleted file mode 100644
index 3be9a20..0000000
--- a/examples/bmpsuite/g08.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08offs.bmp b/examples/bmpsuite/g08offs.bmp
deleted file mode 100644
index 71def41..0000000
--- a/examples/bmpsuite/g08offs.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08os2.bmp b/examples/bmpsuite/g08os2.bmp
deleted file mode 100644
index f7f9f57..0000000
--- a/examples/bmpsuite/g08os2.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08p256.bmp b/examples/bmpsuite/g08p256.bmp
deleted file mode 100644
index a129bbc..0000000
--- a/examples/bmpsuite/g08p256.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08p64.bmp b/examples/bmpsuite/g08p64.bmp
deleted file mode 100644
index 9d3affd..0000000
--- a/examples/bmpsuite/g08p64.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08pi256.bmp b/examples/bmpsuite/g08pi256.bmp
deleted file mode 100644
index 45df3f8..0000000
--- a/examples/bmpsuite/g08pi256.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08pi64.bmp b/examples/bmpsuite/g08pi64.bmp
deleted file mode 100644
index 52baf91..0000000
--- a/examples/bmpsuite/g08pi64.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08res11.bmp b/examples/bmpsuite/g08res11.bmp
deleted file mode 100644
index f03d0f3..0000000
--- a/examples/bmpsuite/g08res11.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08res21.bmp b/examples/bmpsuite/g08res21.bmp
deleted file mode 100644
index 61198e5..0000000
--- a/examples/bmpsuite/g08res21.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08res22.bmp b/examples/bmpsuite/g08res22.bmp
deleted file mode 100644
index 1af0ecc..0000000
--- a/examples/bmpsuite/g08res22.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08rle.bmp b/examples/bmpsuite/g08rle.bmp
deleted file mode 100644
index 082f7f4..0000000
--- a/examples/bmpsuite/g08rle.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08s0.bmp b/examples/bmpsuite/g08s0.bmp
deleted file mode 100644
index 4b2c521..0000000
--- a/examples/bmpsuite/g08s0.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08w124.bmp b/examples/bmpsuite/g08w124.bmp
deleted file mode 100644
index 1896035..0000000
--- a/examples/bmpsuite/g08w124.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08w125.bmp b/examples/bmpsuite/g08w125.bmp
deleted file mode 100644
index b348a7c..0000000
--- a/examples/bmpsuite/g08w125.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g08w126.bmp b/examples/bmpsuite/g08w126.bmp
deleted file mode 100644
index 3628d66..0000000
--- a/examples/bmpsuite/g08w126.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g16bf555.bmp b/examples/bmpsuite/g16bf555.bmp
deleted file mode 100644
index 639a57f..0000000
--- a/examples/bmpsuite/g16bf555.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g16bf565.bmp b/examples/bmpsuite/g16bf565.bmp
deleted file mode 100644
index cb0ea24..0000000
--- a/examples/bmpsuite/g16bf565.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g16def555.bmp b/examples/bmpsuite/g16def555.bmp
deleted file mode 100644
index a5a3195..0000000
--- a/examples/bmpsuite/g16def555.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g24.bmp b/examples/bmpsuite/g24.bmp
deleted file mode 100644
index d6d9e6a..0000000
--- a/examples/bmpsuite/g24.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g32bf.bmp b/examples/bmpsuite/g32bf.bmp
deleted file mode 100644
index 0f41534..0000000
--- a/examples/bmpsuite/g32bf.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/g32def.bmp b/examples/bmpsuite/g32def.bmp
deleted file mode 100644
index 9524f76..0000000
--- a/examples/bmpsuite/g32def.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/01bg.png b/examples/bmpsuite/png/01bg.png
deleted file mode 100644
index 0b9cf9a..0000000
--- a/examples/bmpsuite/png/01bg.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/01bw.png b/examples/bmpsuite/png/01bw.png
deleted file mode 100644
index 9f2e57a..0000000
--- a/examples/bmpsuite/png/01bw.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/01p1.png b/examples/bmpsuite/png/01p1.png
deleted file mode 100644
index 0103e79..0000000
--- a/examples/bmpsuite/png/01p1.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/04.png b/examples/bmpsuite/png/04.png
deleted file mode 100644
index 14beb91..0000000
--- a/examples/bmpsuite/png/04.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/04p4.png b/examples/bmpsuite/png/04p4.png
deleted file mode 100644
index 8dbcafa..0000000
--- a/examples/bmpsuite/png/04p4.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/08.png b/examples/bmpsuite/png/08.png
deleted file mode 100644
index 06545a0..0000000
--- a/examples/bmpsuite/png/08.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/08p64.png b/examples/bmpsuite/png/08p64.png
deleted file mode 100644
index 49f0802..0000000
--- a/examples/bmpsuite/png/08p64.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/08w124.png b/examples/bmpsuite/png/08w124.png
deleted file mode 100644
index 8da58fb..0000000
--- a/examples/bmpsuite/png/08w124.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/08w125.png b/examples/bmpsuite/png/08w125.png
deleted file mode 100644
index 6ebb4f8..0000000
--- a/examples/bmpsuite/png/08w125.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/08w126.png b/examples/bmpsuite/png/08w126.png
deleted file mode 100644
index ca9c9b9..0000000
--- a/examples/bmpsuite/png/08w126.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/16bf555.png b/examples/bmpsuite/png/16bf555.png
deleted file mode 100644
index aaa0dff..0000000
--- a/examples/bmpsuite/png/16bf555.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/16bf565.png b/examples/bmpsuite/png/16bf565.png
deleted file mode 100644
index 52d90e3..0000000
--- a/examples/bmpsuite/png/16bf565.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/24.png b/examples/bmpsuite/png/24.png
deleted file mode 100644
index e9fc4db..0000000
--- a/examples/bmpsuite/png/24.png
+++ /dev/null
Binary files differ
diff --git a/examples/bmpsuite/png/reference.html b/examples/bmpsuite/png/reference.html
deleted file mode 100644
index 7117b6c..0000000
--- a/examples/bmpsuite/png/reference.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html>
-
-<head>
-<title>BMP Suite Reference Images</title>
-</head>
-
-<body>
-<h1>BMP Suite Reference Images</h1>
-
-<table border=1>
-<tr><th>File</th><th>bpp</th><th>Comments</th><th>Reference</th></tr>
-
-<tr><td>g01bw.bmp</td><td>1</td><td>black and white palette (#000000,#FFFFFF)</td><td><img src=01bw.png></td></tr>
-<tr><td>g01wb.bmp</td><td>1</td><td>white and black palette (#FFFFFF,#000000). Should look the same as g01bw, not inverted.</td><td><img src=01bw.png></td></tr>
-<tr><td>g01bg.bmp</td><td>1</td><td>blue and green palette (#4040FF,#40FF40)</td><td><img src=01bg.png></td></tr>
-<tr><td>g01p1.bmp</td><td>1</td><td>1-color (blue) palette (#4040FF)</td><td><img src=01p1.png></td></tr>
-
-<tr><td>g04.bmp</td><td>4</td><td>basic 4bpp (16 color) image</td><td><img src=04.png></td></tr>
-<tr><td>g04rle.bmp</td><td>4</td><td>RLE compressed.</td><td><img src=04.png></td></tr>
-<tr><td>g04p4.bmp</td><td>4</td><td>4-color grayscale palette</td><td><img src=04p4.png></td></tr>
-
-<tr><td>g08.bmp</td><td>8</td><td>basic 8bpp (256 color) image</td><td><img src=08.png></td></tr>
-<tr><td>g08p256.bmp</td><td>8</td><td>biClrUsed=256, biClrImportant=0 [=256]</td><td><img src=08.png></td></tr>
-<tr><td>g08pi256.bmp</td><td>8</td><td>biClrUsed=256, biClrImportant=256</td><td><img src=08.png></td></tr>
-<tr><td>g08pi64.bmp</td><td>8</td><td>biClrUsed=256, biClrImportant=64. It's barely possible that some sophisticated viewers may display this image in grayscale, if there are a limited number of colors available.</td><td><img src=08.png></td></tr>
-<tr><td>g08rle.bmp</td><td>8</td><td>RLE compressed.</td><td><img src=08.png></td></tr>
-<tr><td>g08os2.bmp</td><td>8</td><td>OS/2-style bitmap. This is an obsolete variety of BMP that is still encountered sometimes. It has 3-byte palette entries (instead of 4), and 16-bit width/height fields (instead of 32).</td><td><img src=08.png></td></tr>
-<tr><td>g08res22.bmp</td><td>8</td><td>resolution 7874x7874 pixels/meter (200x200 dpi)</td><td><img src=08.png></td></tr>
-<tr><td>g08res11.bmp</td><td>8</td><td>resolution 3937x3937 pixels/meter (100x100 dpi)</td><td><img src=08.png></td></tr>
-<tr><td>g08res21.bmp</td><td>8</td><td>resolution 7874x3937 pixels/meter (200x100 dpi). Some programs (e.g. Imaging for Windows) may display this image stretched vertically, which is the optimal thing to do if the program is primarily a viewer, rather than an editor.</td><td><img src=08.png></td></tr>
-<tr><td>g08s0.bmp</td><td>8</td><td>bits size not given (set to 0). This is legal for uncompressed bitmaps.</td><td><img src=08.png></td></tr>
-<tr><td>g08offs.bmp</td><td>8</td><td>bfOffBits in header not set to the usual value. There are 100 extra unused bytes between palette and bits.</td><td><img src=08.png></td></tr>
-<tr><td>g08w126.bmp</td><td>8</td><td>size 126x63 (right and bottom slightly clipped)</td><td><img src=08w126.png></td></tr>
-<tr><td>g08w125.bmp</td><td>8</td><td>size 125x62</td><td><img src=08w125.png></td></tr>
-<tr><td>g08w124.bmp</td><td>8</td><td>size 124x61</td><td><img src=08w124.png></td></tr>
-<tr><td>g08p64.bmp</td><td>8</td><td>64-color grayscale palette</td><td><img src=08p64.png></td></tr>
-
-<tr><td>g16def555.bmp</td><td>16</td><td>15-bit color (1 bit wasted), biCompression=BI_RGB (no bitfields, defaults to 5-5-5)</td><td><img src=16bf555.png></td></tr>
-<tr><td>g16bf555.bmp</td><td>16</td><td>15-bit color, biCompression=BI_BITFIELDS (bitfields indicate 5-5-5)</td><td><img src=16bf555.png></td></tr>
-<tr><td>g16bf565.bmp</td><td>16</td><td>16-bit color, biCompression=BI_BITFIELDS (bitfields indicate 5-6-5)</td><td><img src=16bf565.png></td></tr>
-
-<tr><td>g24.bmp</td><td>24</td><td>24-bit color (BGR)</td><td><img src=24.png></td></tr>
-<tr><td>g32def.bmp</td><td>32</td><td>24-bit color (8 bits wasted), biCompression=BI_RGB (no bitfields, defaults to BGRx)</td><td><img src=24.png></td></tr>
-<tr><td>g32bf.bmp</td><td>32</td><td>24-bit color (8 bits wasted), biCompression=BI_BITFIELDS (bitfields indicate BGRx)</td><td><img src=24.png></td></tr>
-
-
-</table>
-
-<hr>
-<p><small><i>By <a href="http://pobox.com/%7Ejason1/">Jason Summers</a>,
-4/2001</i></small></p>
-
-</body>
-</html>
diff --git a/examples/bmpsuite/readme.txt b/examples/bmpsuite/readme.txt
deleted file mode 100644
index 347aded..0000000
--- a/examples/bmpsuite/readme.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-BMP Suite - sample BMP image files
-By Jason Summers <jason1@pobox.com>
-
-Version: 2001.04.27
-
-For more information: http://pobox.com/~jason1/bmpsuite/
-
-Contents
---------
-
-g01bw.bmp
-g01wb.bmp
-g01bg.bmp
-g01p1.bmp
-g04.bmp
-g04p4.bmp
-g08.bmp
-g08offs.bmp
-g08os2.bmp
-g08w126.bmp
-g08w125.bmp
-g08w124.bmp
-g08p256.bmp
-g08pi256.bmp
-g08pi64.bmp
-g08res22.bmp
-g08res21.bmp
-g08res11.bmp
-g08p64.bmp
-g08s0.bmp
-g16def555.bmp
-g16bf555.bmp
-g16bf565.bmp
-g024.bmp
-g32def.bmp
-g32bf.bmp
-
--- end --
diff --git a/examples/bmpsuite/test.html b/examples/bmpsuite/test.html
deleted file mode 100644
index 8abb614..0000000
--- a/examples/bmpsuite/test.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html>
-
-<head>
-<title>BMP Suite Images</title>
-</head>
-
-<body>
-<h1>BMP Suite Images</h1>
-
-<table border=1>
-<tr><th>File</th><th>bpp</th><th>Comments</th><th>Image</th></tr>
-
-<tr><td>g01bw.bmp</td><td>1</td><td>black and white palette (#000000,#FFFFFF)</td><td><img src=g01bw.bmp></td></tr>
-<tr><td>g01wb.bmp</td><td>1</td><td>white and black palette (#FFFFFF,#000000). Should look the same as g01bw, not inverted.</td><td><img src=g01wb.bmp></td></tr>
-<tr><td>g01bg.bmp</td><td>1</td><td>blue and green palette (#4040FF,#40FF40)</td><td><img src=g01bg.bmp></td></tr>
-<tr><td>g01p1.bmp</td><td>1</td><td>1-color (blue) palette (#4040FF)</td><td><img src=g01p1.bmp></td></tr>
-
-<tr><td>g04.bmp</td><td>4</td><td>basic 4bpp (16 color) image</td><td><img src=g04.bmp></td></tr>
-<tr><td>g04rle.bmp</td><td>4</td><td>RLE compressed.</td><td><img src=g04rle.bmp></td></tr>
-<tr><td>g04p4.bmp</td><td>4</td><td>4-color grayscale palette</td><td><img src=g04p4.bmp></td></tr>
-
-<tr><td>g08.bmp</td><td>8</td><td>basic 8bpp (256 color) image</td><td><img src=g08.bmp></td></tr>
-<tr><td>g08p256.bmp</td><td>8</td><td>biClrUsed=256, biClrImportant=0 [=256]</td><td><img src=g08p256.bmp></td></tr>
-<tr><td>g08pi256.bmp</td><td>8</td><td>biClrUsed=256, biClrImportant=256</td><td><img src=g08pi256.bmp></td></tr>
-<tr><td>g08pi64.bmp</td><td>8</td><td>biClrUsed=256, biClrImportant=64. It's barely possible that some sophisticated viewers may display this image in grayscale, if there are a limited number of colors available.</td><td><img src=g08pi64.bmp></td></tr>
-<tr><td>g08rle.bmp</td><td>8</td><td>RLE compressed.</td><td><img src=g08rle.bmp></td></tr>
-<tr><td>g08os2.bmp</td><td>8</td><td>OS/2-style bitmap. This is an obsolete variety of BMP that is still encountered sometimes. It has 3-byte palette entries (instead of 4), and 16-bit width/height fields (instead of 32).</td><td><img src=g08os2.bmp></td></tr>
-<tr><td>g08res22.bmp</td><td>8</td><td>resolution 7874x7874 pixels/meter (200x200 dpi)</td><td><img src=g08res22.bmp></td></tr>
-<tr><td>g08res11.bmp</td><td>8</td><td>resolution 3937x3937 pixels/meter (100x100 dpi)</td><td><img src=g08res11.bmp></td></tr>
-<tr><td>g08res21.bmp</td><td>8</td><td>resolution 7874x3937 pixels/meter (200x100 dpi). Some programs (e.g. Imaging for Windows) may display this image stretched vertically, which is the optimal thing to do if the program is primarily a viewer, rather than an editor.</td><td><img src=g08res21.bmp></td></tr>
-<tr><td>g08s0.bmp</td><td>8</td><td>bits size not given (set to 0). This is legal for uncompressed bitmaps.</td><td><img src=g08s0.bmp></td></tr>
-<tr><td>g08offs.bmp</td><td>8</td><td>bfOffBits in header not set to the usual value. There are 100 extra unused bytes between palette and bits.</td><td><img src=g08offs.bmp></td></tr>
-<tr><td>g08w126.bmp</td><td>8</td><td>size 126x63 (right and bottom slightly clipped)</td><td><img src=g08w126.bmp></td></tr>
-<tr><td>g08w125.bmp</td><td>8</td><td>size 125x62</td><td><img src=g08w125.bmp></td></tr>
-<tr><td>g08w124.bmp</td><td>8</td><td>size 124x61</td><td><img src=g08w124.bmp></td></tr>
-<tr><td>g08p64.bmp</td><td>8</td><td>64-color grayscale palette</td><td><img src=g08p64.bmp></td></tr>
-
-<tr><td>g16def555.bmp</td><td>16</td><td>15-bit color (1 bit wasted), biCompression=BI_RGB (no bitfields, defaults to 5-5-5)</td><td><img src=g16def555.bmp></td></tr>
-<tr><td>g16bf555.bmp</td><td>16</td><td>15-bit color, biCompression=BI_BITFIELDS (bitfields indicate 5-5-5)</td><td><img src=g16bf555.bmp></td></tr>
-<tr><td>g16bf565.bmp</td><td>16</td><td>16-bit color, biCompression=BI_BITFIELDS (bitfields indicate 5-6-5)</td><td><img src=g16bf565.bmp></td></tr>
-
-<tr><td>g24.bmp</td><td>24</td><td>24-bit color (BGR)</td><td><img src=g24.bmp></td></tr>
-<tr><td>g32def.bmp</td><td>32</td><td>24-bit color (8 bits wasted), biCompression=BI_RGB (no bitfields, defaults to BGRx)</td><td><img src=g32def.bmp></tr>
-<tr><td>g32bf.bmp</td><td>32</td><td>24-bit color (8 bits wasted), biCompression=BI_BITFIELDS (bitfields indicate BGRx)</td><td><img src=g32bf.bmp></tr>
-
-
-</table>
-
-<hr>
-<p><small><i>By <a href="http://pobox.com/%7Ejason1/">Jason Summers</a>,
-4/2001</i></small></p>
-
-</body>
-</html>
diff --git a/examples/decode_bmp.c b/examples/decode_bmp.c
deleted file mode 100644
index e5dc572..0000000
--- a/examples/decode_bmp.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2008 Sean Fox <dyntryx@gmail.com>
- * Copyright 2008 James Bursa <james@netsurf-browser.org>
- *
- * This file is part of NetSurf's libnsbmp, http://www.netsurf-browser.org/
- * Licenced under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include "../include/libnsbmp.h"
-
-#define BYTES_PER_PIXEL 4
-#define TRANSPARENT_COLOR 0xffffffff
-
-unsigned char *load_file(const char *path, size_t *data_size);
-void warning(const char *context, bmp_result code);
-void *bitmap_create(int width, int height, unsigned int state);
-unsigned char *bitmap_get_buffer(void *bitmap);
-size_t bitmap_get_bpp(void *bitmap);
-void bitmap_destroy(void *bitmap);
-
-
-int main(int argc, char *argv[])
-{
- bmp_bitmap_callback_vt bitmap_callbacks = {
- bitmap_create,
- bitmap_destroy,
- bitmap_get_buffer,
- bitmap_get_bpp
- };
- bmp_result code;
- bmp_image bmp;
- size_t size;
- unsigned short res = 0;
-
- if (argc != 2) {
- fprintf(stderr, "Usage: %s image.bmp\n", argv[0]);
- return 1;
- }
-
- /* create our bmp image */
- bmp_create(&bmp, &bitmap_callbacks);
-
- /* load file into memory */
- unsigned char *data = load_file(argv[1], &size);
-
- /* analyse the BMP */
- code = bmp_analyse(&bmp, size, data);
- if (code != BMP_OK) {
- warning("bmp_analyse", code);
- res = 1;
- goto cleanup;
- }
-
- /* decode the image */
- code = bmp_decode(&bmp);
- /* code = bmp_decode_trans(&bmp, TRANSPARENT_COLOR); */
- if (code != BMP_OK) {
- warning("bmp_decode", code);
- /* allow partially decoded images */
- if (code != BMP_INSUFFICIENT_DATA) {
- res = 1;
- goto cleanup;
- }
- }
-
- printf("P3\n");
- printf("# %s\n", argv[1]);
- printf("# width %u \n", bmp.width);
- printf("# height %u \n", bmp.height);
- printf("%u %u 256\n", bmp.width, bmp.height);
-
- {
- uint16_t row, col;
- uint8_t *image;
- image = (uint8_t *) bmp.bitmap;
- for (row = 0; row != bmp.height; row++) {
- for (col = 0; col != bmp.width; col++) {
- size_t z = (row * bmp.width + col) * BYTES_PER_PIXEL;
- printf("%u %u %u ", image[z],
- image[z + 1],
- image[z + 2]);
- }
- printf("\n");
- }
- }
-
-cleanup:
- /* clean up */
- bmp_finalise(&bmp);
- free(data);
-
- return res;
-}
-
-
-unsigned char *load_file(const char *path, size_t *data_size)
-{
- FILE *fd;
- struct stat sb;
- unsigned char *buffer;
- size_t size;
- size_t n;
-
- fd = fopen(path, "rb");
- if (!fd) {
- perror(path);
- exit(EXIT_FAILURE);
- }
-
- if (stat(path, &sb)) {
- perror(path);
- exit(EXIT_FAILURE);
- }
- size = sb.st_size;
-
- buffer = malloc(size);
- if (!buffer) {
- fprintf(stderr, "Unable to allocate %lld bytes\n",
- (long long) size);
- exit(EXIT_FAILURE);
- }
-
- n = fread(buffer, 1, size, fd);
- if (n != size) {
- perror(path);
- exit(EXIT_FAILURE);
- }
-
- fclose(fd);
-
- *data_size = size;
- return buffer;
-}
-
-
-void warning(const char *context, bmp_result code)
-{
- fprintf(stderr, "%s failed: ", context);
- switch (code) {
- case BMP_INSUFFICIENT_MEMORY:
- fprintf(stderr, "BMP_INSUFFICIENT_MEMORY");
- break;
- case BMP_INSUFFICIENT_DATA:
- fprintf(stderr, "BMP_INSUFFICIENT_DATA");
- break;
- case BMP_DATA_ERROR:
- fprintf(stderr, "BMP_DATA_ERROR");
- break;
- default:
- fprintf(stderr, "unknown code %i", code);
- break;
- }
- fprintf(stderr, "\n");
-}
-
-
-void *bitmap_create(int width, int height, unsigned int state)
-{
- (void) state; /* unused */
- return calloc(width * height, BYTES_PER_PIXEL);
-}
-
-
-unsigned char *bitmap_get_buffer(void *bitmap)
-{
- assert(bitmap);
- return bitmap;
-}
-
-
-size_t bitmap_get_bpp(void *bitmap)
-{
- (void) bitmap; /* unused */
- return BYTES_PER_PIXEL;
-}
-
-
-void bitmap_destroy(void *bitmap)
-{
- assert(bitmap);
- free(bitmap);
-}
-
diff --git a/examples/decode_ico.c b/examples/decode_ico.c
deleted file mode 100644
index 935001c..0000000
--- a/examples/decode_ico.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2008 Sean Fox <dyntryx@gmail.com>
- * Copyright 2008 James Bursa <james@netsurf-browser.org>
- *
- * This file is part of NetSurf's libnsbmp, http://www.netsurf-browser.org/
- * Licenced under the MIT License,
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include "../include/libnsbmp.h"
-
-/* Currently the library returns the data in RGBA format,
- * so there are 4 bytes per pixel */
-#define BYTES_PER_PIXEL 4
-
-/* White with alpha masking. */
-#define TRANSPARENT_COLOR 0xffffffff
-
-unsigned char *load_file(const char *path, size_t *data_size);
-void warning(const char *context, bmp_result code);
-void *bitmap_create(int width, int height, unsigned int state);
-unsigned char *bitmap_get_buffer(void *bitmap);
-size_t bitmap_get_bpp(void *bitmap);
-void bitmap_destroy(void *bitmap);
-
-
-int main(int argc, char *argv[])
-{
- bmp_bitmap_callback_vt bitmap_callbacks = {
- bitmap_create,
- bitmap_destroy,
- bitmap_get_buffer,
- bitmap_get_bpp
- };
- uint16_t width, height;
- ico_collection ico;
- bmp_result code;
- struct bmp_image *bmp;
- size_t size;
- unsigned short res = 0;
-
- if ((argc < 2) || (argc > 4)) {
- fprintf(stderr, "Usage: %s collection.ico [width=255] [height=255]\n", argv[0]);
- return 1;
- }
- width = (argc >= 3) ? atoi(argv[2]) : 255;
- height = (argc == 4) ? atoi(argv[3]) : 255;
-
- /* create our bmp image */
- ico_collection_create(&ico, &bitmap_callbacks);
-
- /* load file into memory */
- unsigned char *data = load_file(argv[1], &size);
-
- /* analyse the BMP */
- code = ico_analyse(&ico, size, data);
- if (code != BMP_OK) {
- warning("ico_analyse", code);
- res = 1;
- goto cleanup;
- }
-
- /* decode the image */
- bmp = ico_find(&ico, width, height);
- assert(bmp);
-
- code = bmp_decode(bmp);
- /* code = bmp_decode_trans(bmp, TRANSPARENT_COLOR); */
- if (code != BMP_OK) {
- warning("bmp_decode", code);
- /* allow partially decoded images */
- if (code != BMP_INSUFFICIENT_DATA) {
- res = 1;
- goto cleanup;
- }
- }
-
- printf("P3\n");
- printf("# %s\n", argv[1]);
- printf("# width %u \n", bmp->width);
- printf("# height %u \n", bmp->height);
- printf("%u %u 256\n", bmp->width, bmp->height);
-
- {
- uint16_t row, col;
- uint8_t *image;
- image = (uint8_t *) bmp->bitmap;
- for (row = 0; row != bmp->height; row++) {
- for (col = 0; col != bmp->width; col++) {
- size_t z = (row * bmp->width + col) * BYTES_PER_PIXEL;
- printf("%u %u %u ", image[z],
- image[z + 1],
- image[z + 2]);
- }
- printf("\n");
- }
- }
-
-cleanup:
- /* clean up */
- ico_finalise(&ico);
- free(data);
-
- return res;
-}
-
-
-unsigned char *load_file(const char *path, size_t *data_size)
-{
- FILE *fd;
- struct stat sb;
- unsigned char *buffer;
- size_t size;
- size_t n;
-
- fd = fopen(path, "rb");
- if (!fd) {
- perror(path);
- exit(EXIT_FAILURE);
- }
-
- if (stat(path, &sb)) {
- perror(path);
- exit(EXIT_FAILURE);
- }
- size = sb.st_size;
-
- buffer = malloc(size);
- if (!buffer) {
- fprintf(stderr, "Unable to allocate %lld bytes\n",
- (long long) size);
- exit(EXIT_FAILURE);
- }
-
- n = fread(buffer, 1, size, fd);
- if (n != size) {
- perror(path);
- exit(EXIT_FAILURE);
- }
-
- fclose(fd);
-
- *data_size = size;
- return buffer;
-}
-
-
-void warning(const char *context, bmp_result code)
-{
- fprintf(stderr, "%s failed: ", context);
- switch (code) {
- case BMP_INSUFFICIENT_MEMORY:
- fprintf(stderr, "BMP_INSUFFICIENT_MEMORY");
- break;
- case BMP_INSUFFICIENT_DATA:
- fprintf(stderr, "BMP_INSUFFICIENT_DATA");
- break;
- case BMP_DATA_ERROR:
- fprintf(stderr, "BMP_DATA_ERROR");
- break;
- default:
- fprintf(stderr, "unknown code %i", code);
- break;
- }
- fprintf(stderr, "\n");
-}
-
-
-void *bitmap_create(int width, int height, unsigned int state)
-{
- (void) state; /* unused */
- return calloc(width * height, BYTES_PER_PIXEL);
-}
-
-
-unsigned char *bitmap_get_buffer(void *bitmap)
-{
- assert(bitmap);
- return bitmap;
-}
-
-
-size_t bitmap_get_bpp(void *bitmap)
-{
- (void) bitmap; /* unused */
- return BYTES_PER_PIXEL;
-}
-
-
-void bitmap_destroy(void *bitmap)
-{
- assert(bitmap);
- free(bitmap);
-}
-
diff --git a/examples/ico_display b/examples/ico_display
new file mode 100755
index 0000000..ff5cd3c
--- /dev/null
+++ b/examples/ico_display
@@ -0,0 +1,3 @@
+set -e
+make
+bin/decode_ico $1 | display
diff --git a/examples/monitor.ico b/examples/monitor.ico
deleted file mode 100644
index 2997dc3..0000000
--- a/examples/monitor.ico
+++ /dev/null
Binary files differ