kopia lustrzana https://github.com/backface/turtlestitch
use the selected pen color model (hsl or hsv) for graphic effects
rodzic
baee1e1561
commit
471f9fec00
|
@ -56,7 +56,8 @@
|
|||
* objects, store: new "penColorModel" setting, can e 'hsv' or 'hsl'
|
||||
* gui, objects: new (hidden) pen-color-model preference setting (per session)
|
||||
* objects: changed the scale of the graphics color effect from 0-200 to 0-100
|
||||
* objects: refactored graphics color effect to reuse Morphic's conversion methods
|
||||
* objects: refactored graphics color effect to reuse Morphic's conversion methods
|
||||
* objects: use the selected pen color model (hsl or hsv) for graphic effects
|
||||
|
||||
### 2021-11-09
|
||||
* objects, store: refactored block-migration mechanism
|
||||
|
|
|
@ -5162,7 +5162,7 @@ SpriteMorph.prototype.applyGraphicsEffects = function (canvas) {
|
|||
return imagedata;
|
||||
}
|
||||
|
||||
function transform_HSV(
|
||||
function transform_colorDimensions(
|
||||
imagedata,
|
||||
hueShift,
|
||||
saturationShift,
|
||||
|
@ -5179,7 +5179,7 @@ SpriteMorph.prototype.applyGraphicsEffects = function (canvas) {
|
|||
clr.g = pixels[index + 1];
|
||||
clr.b = pixels[index + 2];
|
||||
|
||||
dim = clr.hsv();
|
||||
dim = clr[SpriteMorph.prototype.penColorModel]();
|
||||
dim[0] = dim[0] * 100 + hueShift;
|
||||
if (dim[0] < 0 || dim[0] > 100) { // wrap the hue
|
||||
dim[0] = (dim[0] < 0 ? 100 : 0) + dim[0] % 100;
|
||||
|
@ -5188,7 +5188,7 @@ SpriteMorph.prototype.applyGraphicsEffects = function (canvas) {
|
|||
dim[1] = dim[1] + saturationShift / 100;
|
||||
dim[2] = dim[2] + brightnessShift / 100;
|
||||
|
||||
clr.set_hsv.apply(clr, dim);
|
||||
clr['set_' + SpriteMorph.prototype.penColorModel].apply(clr, dim);
|
||||
pixels[index] = clr.r;
|
||||
pixels[index + 1] = clr.g;
|
||||
pixels[index + 2] = clr.b;
|
||||
|
@ -5286,7 +5286,7 @@ SpriteMorph.prototype.applyGraphicsEffects = function (canvas) {
|
|||
if (this.graphicsValues.color ||
|
||||
this.graphicsValues.saturation ||
|
||||
this.graphicsValues.brightness) {
|
||||
imagedata = transform_HSV(
|
||||
imagedata = transform_colorDimensions(
|
||||
imagedata,
|
||||
this.graphicsValues.color,
|
||||
this.graphicsValues.saturation,
|
||||
|
|
Ładowanie…
Reference in New Issue