move image, mask to common

This commit is contained in:
Ryan Oldenburg 2022-07-07 16:16:07 -05:00
parent 06005de85c
commit dabe456af9
3 changed files with 12 additions and 14 deletions

View file

@ -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

View file

@ -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.}

View file

@ -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.}