1 ! Copyright (C) 2007, 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien alien.c-types arrays byte-arrays columns
4 combinators compression.run-length endian fry grouping images
5 images.bitmap.loading images.loader io io.binary
6 io.encodings.binary io.encodings.string io.files
7 io.streams.limited kernel locals macros math math.bitwise
8 math.functions namespaces sequences specialized-arrays
10 SPECIALIZED-ARRAY: uint
11 SPECIALIZED-ARRAY: ushort
14 : write2 ( n -- ) 2 >le write ;
15 : write4 ( n -- ) 4 >le write ;
17 : save-bitmap ( image path -- )
19 B{ CHAR: B CHAR: M } write
21 bitmap>> length 14 + 40 + write4
28 [ dim>> first2 [ write4 ] bi@ ]
40 [ bitmap>> length write4 ]