                 ! color-important
                 [ drop 0 write4 ]
 
-                ! rgb-quads
+                ! color-palette
                 [
                     [ bitmap>color-index ]
                     [ dim>> first 3 * ]


: loading-bitmap>bitmap-image ( bitmap-image loading-bitmap -- bitmap-image )
    {
        [ raw-bitmap>seq >>bitmap ]
        [ [ width>> ] [ height>> abs ] bi 2array >>dim ]
        [ height>> 0 < [ t >>upside-down? ] when ]
        [ bitmap>component-order >>component-order ]
    } cleave ;

M: bitmap-image load-image* ( path loading-bitmap -- bitmap )
    swap load-bitmap-data loading-bitmap>bitmap-image ;

"bmp" bitmap-image register-image-class


: reverse-lines ( byte-array width -- byte-array )
    <sliced-groups> <reversed> concat ; inline

: bitmap>bytes ( loading-bitmap -- array )
    dup bit-count>>
    {
        { 32 [ color-index>> ] }
