Spade-Editor / Spade

Cross-platform raster graphics editor inspired by Paint.NET
GNU General Public License v3.0
41 stars 10 forks source link

Custom blending with matrices #65

Open HeroesGrave opened 10 years ago

HeroesGrave commented 10 years ago

For people that want advanced blending and understand matrices, why don't we supply the ability to have custom layer blending.

Matrices are just perfect for this task, and if we allow already existing blend modes to be edited as matrices, it will make it accessible too. (And unknowingly teach them matrix math)

Just pop up a dialog that allows them to fill in a 4x4 matrix, have a few buttons for enter, cancel, and use existing blend mode, and that should be it.

Seems like a fun project for someone to work on. (I'd even love to do it myself if someone doesn't beat me to it)

BurntPizza commented 10 years ago

Another idea: poor man's fragment shader-esque DSL? EDIT for clarity: basically some simple scripty way to say output color = someFunction(inputColor)

Would both/either of these (matrix/'shader') be applicable to plugins, or a core feature?

HeroesGrave commented 10 years ago

Core feature.

I want the core to be as powerful as possible, but to avoid bloat, I'll try to move other things out into plugins.

Nice idea. I'll create another issue.

BurntPizza commented 10 years ago

About the matrices, I say go for it if you think it's 1.0 material and you have a solid idea for it already. Not entirely sure how you're thinking of this, but consider other approaches to matrices too. If you haven't seen it yet: the wikipedia on blend modes is good stuff

HeroesGrave commented 10 years ago

Core feature, but not 1.0

Maybe I should've used a different word.

HeroesGrave commented 10 years ago

After thinking about this again I realised the we will probably need a 5x5 matrix to allow for channel 'translation'.

The issue is of course that to translate, you need a constant value that can be multiplied to have any result. The 'w' coordinate in 3D graphics (should always be 1). Since colours are '4D', we need a 5D matrix to handle them properly.

Or we could just disable offsetting the channels and only allow direct multiplication. Then a 4x4 matrix would work fine.