diff --git a/basis/images/images.factor b/basis/images/images.factor index 6cbcdb9508..4cea5f9f66 100644 --- a/basis/images/images.factor +++ b/basis/images/images.factor @@ -66,6 +66,11 @@ TUPLE: image dim component-order component-type upside-down? bitmap ; : ( -- image ) image new ; inline +: ( -- image ) + + RGB >>component-order + ubyte-components >>component-type ; inline + : has-alpha? ( image -- ? ) component-order>> alpha-channel? ; : bytes-per-component ( component-type -- n ) @@ -125,6 +130,9 @@ TUPLE: image dim component-order component-type upside-down? bitmap ; : bytes-per-pixel ( image -- n ) [ component-order>> ] [ component-type>> ] bi (bytes-per-pixel) ; + +: bytes-per-image ( image -- n ) + [ dim>> product ] [ bytes-per-pixel ] bi * ;