kopia lustrzana https://github.com/backface/turtlestitch
revert #956 - restore smoothing in the paint editor
rodzic
ee19e66ea9
commit
cada9be942
|
@ -2585,4 +2585,3 @@ ______
|
||||||
* GUI, Blocks, BYOB: New “Export Project Summary” Feature, also: exporting script pics now includes attached comments
|
* GUI, Blocks, BYOB: New “Export Project Summary” Feature, also: exporting script pics now includes attached comments
|
||||||
* Blocks, Objects, Threads: Key hat block and key sensor support for “any” key
|
* Blocks, Objects, Threads: Key hat block and key sensor support for “any” key
|
||||||
* German translation update
|
* German translation update
|
||||||
* Suppress antialiasing when scaling things in the paint editor. Thanks, Kartik!
|
|
||||||
|
|
18
paint.js
18
paint.js
|
@ -58,6 +58,7 @@
|
||||||
Aug 24 - floodfill alpha-integer issue (Kartik)
|
Aug 24 - floodfill alpha-integer issue (Kartik)
|
||||||
Sep 29 - tweaks (Jens)
|
Sep 29 - tweaks (Jens)
|
||||||
Sep 28 [of the following year :)] - Try to prevent antialiasing (Kartik)
|
Sep 28 [of the following year :)] - Try to prevent antialiasing (Kartik)
|
||||||
|
Oct 02 - revert disable smoothing (Jens)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*global Point, Rectangle, DialogBoxMorph, fontHeight, AlignmentMorph,
|
/*global Point, Rectangle, DialogBoxMorph, fontHeight, AlignmentMorph,
|
||||||
|
@ -596,7 +597,6 @@ PaintCanvasMorph.prototype.scale = function (x, y) {
|
||||||
this.rotationCenter.y
|
this.rotationCenter.y
|
||||||
);
|
);
|
||||||
c.getContext("2d").scale(1 + x, 1 + y);
|
c.getContext("2d").scale(1 + x, 1 + y);
|
||||||
this.disableSmoothing(c.getContext("2d"));
|
|
||||||
c.getContext("2d").drawImage(
|
c.getContext("2d").drawImage(
|
||||||
this.paper,
|
this.paper,
|
||||||
-this.rotationCenter.x,
|
-this.rotationCenter.x,
|
||||||
|
@ -624,24 +624,11 @@ PaintCanvasMorph.prototype.undo = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PaintCanvasMorph.prototype.disableSmoothing = function (ctx) {
|
|
||||||
ctx.imageSmoothingEnabled = false; /* standard */
|
|
||||||
|
|
||||||
// we oughta keep checking whether the following ones
|
|
||||||
// are still needed
|
|
||||||
ctx.mozImageSmoothingEnabled = false; /* Firefox */
|
|
||||||
ctx.oImageSmoothingEnabled = false; /* Opera */
|
|
||||||
ctx.webkitImageSmoothingEnabled = false; /* Safari */
|
|
||||||
ctx.msImageSmoothingEnabled = false; /* IE */
|
|
||||||
};
|
|
||||||
|
|
||||||
PaintCanvasMorph.prototype.merge = function (a, b) {
|
PaintCanvasMorph.prototype.merge = function (a, b) {
|
||||||
this.disableSmoothing(b.getContext("2d"));
|
|
||||||
b.getContext("2d").drawImage(a, 0, 0);
|
b.getContext("2d").drawImage(a, 0, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
PaintCanvasMorph.prototype.centermerge = function (a, b) {
|
PaintCanvasMorph.prototype.centermerge = function (a, b) {
|
||||||
this.disableSmoothing(b.getContext("2d"));
|
|
||||||
b.getContext("2d").drawImage(
|
b.getContext("2d").drawImage(
|
||||||
a,
|
a,
|
||||||
(b.width - a.width) / 2,
|
(b.width - a.width) / 2,
|
||||||
|
@ -829,9 +816,6 @@ PaintCanvasMorph.prototype.mouseMove = function (pos) {
|
||||||
mctx.lineWidth = this.settings.linewidth;
|
mctx.lineWidth = this.settings.linewidth;
|
||||||
mctx.clearRect(0, 0, this.bounds.width(), this.bounds.height()); // mask
|
mctx.clearRect(0, 0, this.bounds.width(), this.bounds.height()); // mask
|
||||||
|
|
||||||
// Antialiasing trick.
|
|
||||||
mctx.translate(0.5, 0.5);
|
|
||||||
|
|
||||||
this.dragRect.corner = relpos.subtract(this.dragRect.origin); // reset crn
|
this.dragRect.corner = relpos.subtract(this.dragRect.origin); // reset crn
|
||||||
|
|
||||||
if (this.settings.primarycolor === "transparent" &&
|
if (this.settings.primarycolor === "transparent" &&
|
||||||
|
|
Ładowanie…
Reference in New Issue