diff --git a/src/pixie/common.nim b/src/pixie/common.nim index 7441461..e289bb3 100644 --- a/src/pixie/common.nim +++ b/src/pixie/common.nim @@ -31,6 +31,16 @@ type ImageDimensions* = object width*, height*: int + Image* = ref object + ## Image object that holds bitmap data in premultiplied alpha RGBA format. + width*, height*: int + data*: seq[ColorRGBX] + + Mask* = ref object + ## Mask object that holds mask opacity data. + width*, height*: int + data*: seq[uint8] + proc mix*(a, b: uint8, t: float32): uint8 {.inline, raises: [].} = ## Linearly interpolate between a and b using t. let t = round(t * 255).uint32 diff --git a/src/pixie/images.nim b/src/pixie/images.nim index a094545..35d8fbd 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -8,13 +8,7 @@ when allowSimd: const h = 0.5.float32 -type - Image* = ref object - ## Image object that holds bitmap data in RGBA format. - width*, height*: int - data*: seq[ColorRGBX] - - UnsafeImage = distinct Image +type UnsafeImage = distinct Image when defined(release): {.push checks: off.} diff --git a/src/pixie/masks.nim b/src/pixie/masks.nim index 9797ff0..7efc04e 100644 --- a/src/pixie/masks.nim +++ b/src/pixie/masks.nim @@ -6,13 +6,7 @@ when allowSimd: when defined(amd64): import nimsimd/sse2 -type - Mask* = ref object - ## Mask object that holds mask opacity data. - width*, height*: int - data*: seq[uint8] - - UnsafeMask = distinct Mask +type UnsafeMask = distinct Mask when defined(release): {.push checks: off.}