 : RGBA>ARGB ( bitmap -- bitmap' )
     4 <sliced-groups> [ unclip-last-slice prefix ] map concat ; inline
 
-! ARGB>
+: ARGB>ARGB ( bitmap -- bitmap' ) ;
 
 : ARGB>RGB ( bitmap -- bitmap' )
     4 <sliced-groups> [ rest-slice ] map concat ; inline


! TODO RGBX, XRGB, BGRX, XBGR conversions

! BGR>
: BGR>RGB ( bitmap -- bitmap' )
    3 <sliced-groups> [ <reversed> ] map concat ; inline


    4 <sliced-groups>
    [ unclip-slice [ <reversed> ] dip suffix ] map concat ; inline

: (reorder-colors) ( image src-order des-order -- image )
    [ name>> ] bi@ ">" glue "images.normalization.private" lookup
    [ '[ _ execute( image -- image' ) ] change-bitmap ]
    [ "No component-order conversion found." throw ]
    if* ;

PRIVATE>

: reorder-colors ( image component-order -- image )
    [
        [ component-type>> ubyte-components assert= ]
        [ dup component-order>> ] bi
    ] dip (reorder-colors) ;

<PRIVATE

