uwerat / qskinny

A lightweight framework on top of the Qt scene graph and only few classes from Qt/Quick. It is usable from C++ and/or QML.
1.34k stars 283 forks source link

simplified shaders for gradients with less than 2 colors #257

Open uwerat opened 1 year ago

uwerat commented 1 year ago

It might be good to have specific shaders for gradients made of 2 colors or less - a very common use case. These shaders do not need precalculated color ramps ( -> textures ) as such an interpolation ( https://registry.khronos.org/OpenGL-Refpages/gl4/html/mix.xhtml ) can be done easily in the shader code.

uwerat commented 7 months ago

For shapes/strokes with linear gradients it would be enough to use a QSGGeometry::ColoredPoint2D geometry. The color parameter can be calculated in QskShapeNode/QskStrokeNode using a QskBox::ColorMap.