From 12148618707735f20197ce3640dc6355fb897b0d Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Mon, 13 Dec 2021 01:23:14 -0600 Subject: [PATCH] move blendMode dont export blends --- src/pixie.nim | 11 +++++------ src/pixie/blends.nim | 25 ------------------------- src/pixie/common.nim | 25 +++++++++++++++++++++++++ src/pixie/contexts.nim | 4 ++-- src/pixie/paints.nim | 2 +- 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/pixie.nim b/src/pixie.nim index 00b9190..a9fac34 100644 --- a/src/pixie.nim +++ b/src/pixie.nim @@ -1,10 +1,9 @@ -import bumpy, chroma, flatty/binny, os, pixie/blends, pixie/common, - pixie/contexts, pixie/fileformats/bmp, pixie/fileformats/gif, - pixie/fileformats/jpg, pixie/fileformats/png, pixie/fileformats/svg, - pixie/fonts, pixie/images, pixie/masks, pixie/paints, pixie/paths, strutils, vmath +import bumpy, chroma, flatty/binny, os, pixie/common, pixie/contexts, + pixie/fileformats/bmp, pixie/fileformats/gif, pixie/fileformats/jpg, + pixie/fileformats/png, pixie/fileformats/svg, pixie/fonts, pixie/images, + pixie/masks, pixie/paints, pixie/paths, strutils, vmath -export blends, bumpy, chroma, common, contexts, fonts, images, masks, paints, - paths, vmath +export bumpy, chroma, common, contexts, fonts, images, masks, paints, paths, vmath type FileFormat* = enum diff --git a/src/pixie/blends.nim b/src/pixie/blends.nim index d2f927e..b9f148b 100644 --- a/src/pixie/blends.nim +++ b/src/pixie/blends.nim @@ -9,31 +9,6 @@ when defined(amd64) and not defined(pixieNoSimd): # See https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_blend_equation_advanced.txt type - BlendMode* = enum - bmNormal - bmDarken - bmMultiply - # bmLinearBurn - bmColorBurn - bmLighten - bmScreen - # bmLinearDodge - bmColorDodge - bmOverlay - bmSoftLight - bmHardLight - bmDifference - bmExclusion - bmHue - bmSaturation - bmColor - bmLuminosity - - bmMask ## Special blend mode that is used for masking - bmOverwrite ## Special blend mode that just copies pixels - bmSubtractMask ## Inverse mask - bmExcludeMask - Blender* = proc(backdrop, source: ColorRGBX): ColorRGBX {.gcsafe, raises: [].} ## Function signature returned by blender. Masker* = proc(backdrop, source: uint8): uint8 {.gcsafe, raises: [].} diff --git a/src/pixie/common.nim b/src/pixie/common.nim index 4e11656..a3f7eea 100644 --- a/src/pixie/common.nim +++ b/src/pixie/common.nim @@ -3,6 +3,31 @@ import bumpy, chroma, vmath type PixieError* = object of ValueError ## Raised if an operation fails. + BlendMode* = enum + bmNormal + bmDarken + bmMultiply + # bmLinearBurn + bmColorBurn + bmLighten + bmScreen + # bmLinearDodge + bmColorDodge + bmOverlay + bmSoftLight + bmHardLight + bmDifference + bmExclusion + bmHue + bmSaturation + bmColor + bmLuminosity + + bmMask ## Special blend mode that is used for masking + bmOverwrite ## Special blend mode that just copies pixels + bmSubtractMask ## Inverse mask + bmExcludeMask + 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/contexts.nim b/src/pixie/contexts.nim index 133d57c..268558c 100644 --- a/src/pixie/contexts.nim +++ b/src/pixie/contexts.nim @@ -1,5 +1,5 @@ -import bumpy, chroma, pixie/blends, pixie/common, pixie/fonts, pixie/images, - pixie/masks, pixie/paints, pixie/paths, tables, vmath +import bumpy, chroma, pixie/common, pixie/fonts, pixie/images, pixie/masks, + pixie/paints, pixie/paths, tables, vmath ## This file provides a Nim version of the Canvas 2D API commonly used on the ## web. The goal is to make picking up Pixie easy for developers familiar with diff --git a/src/pixie/paints.nim b/src/pixie/paints.nim index ba81df6..6e2c247 100644 --- a/src/pixie/paints.nim +++ b/src/pixie/paints.nim @@ -1,4 +1,4 @@ -import blends, chroma, common, images, vmath +import chroma, common, images, vmath when defined(amd64) and not defined(pixieNoSimd): import nimsimd/sse2