         bit-count>> {
             ! { 32 [ GL_BGRA GL_UNSIGNED_INT_8_8_8_8 ] } ! broken
             { 24 [ GL_BGR GL_UNSIGNED_BYTE ] }
+            { 8 [ GL_BGR GL_UNSIGNED_BYTE ] }
+            { 4 [ GL_BGR GL_UNSIGNED_BYTE ] }
         } case
     ] keep array>> glDrawPixels ;
 

io.backend graphics.viewer io io.binary io.files kernel libc
math math.functions namespaces opengl opengl.gl prettyprint
sequences strings ui ui.gadgets.panes io.encodings.binary
accessors ;
IN: graphics.bitmap

! Currently can only handle 24bit bitmaps.


: load-bitmap ( path -- bitmap )
    normalize-path binary [
        bitmap new
            dup parse-file-header
            dup parse-bitmap-header
            dup parse-bitmap
    ] with-file-reader
    dup raw-bitmap>array >>array ;

: save-bitmap ( bitmap path -- )
    binary [
