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.uint
9 specialized-arrays.ushort strings summary ;
12 : write2 ( n -- ) 2 >le write ;
13 : write4 ( n -- ) 4 >le write ;
15 : save-bitmap ( image path -- )
17 B{ CHAR: B CHAR: M } write
19 bitmap>> length 14 + 40 + write4
26 [ dim>> first2 [ write4 ] bi@ ]
38 [ bitmap>> length write4 ]