: validate-truecolor-alpha ( loading-png -- loading-png )
{ 8 16 } validate-bit-depth ;
-: pad-bitmap ( image -- image )
- dup dim>> second 4 divisor? [
- dup [ bytes-per-pixel ]
- [ dim>> first * ]
- [ dim>> first 4 mod ] tri
- '[ _ group [ _ 0 <array> append ] map B{ } concat-as ] change-bitmap
- ] unless ;
-
: loading-png>bitmap ( loading-png -- bytes component-order )
dup color-type>> {
{ greyscale [
[ loading-png>bitmap [ >>bitmap ] [ >>component-order ] bi* ]
[ [ width>> ] [ height>> ] bi 2array >>dim ]
[ png-component >>component-type ]
- } cleave pad-bitmap ;
+ } cleave ;
: load-png ( stream -- loading-png )
[
GL_BLEND glEnable
GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
GL_VERTEX_ARRAY glEnableClientState
+ GL_PACK_ALIGNMENT 1 glPixelStorei
+ GL_UNPACK_ALIGNMENT 1 glPixelStorei
init-matrices
[ init-clip ]
[