Fix fillRect alpha on canvas-based image (close #638)
This commit is contained in:
@@ -283,9 +283,19 @@ class ImageCanvasUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (a < 255) {
|
||||||
|
|
||||||
|
image.buffer.__srcContext.clearRect (rect.x + image.offsetX, rect.y + image.offsetY, rect.width + image.offsetX, rect.height + image.offsetY);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a > 0) {
|
||||||
|
|
||||||
image.buffer.__srcContext.fillStyle = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + (a / 255) + ')';
|
image.buffer.__srcContext.fillStyle = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + (a / 255) + ')';
|
||||||
image.buffer.__srcContext.fillRect (rect.x + image.offsetX, rect.y + image.offsetY, rect.width + image.offsetX, rect.height + image.offsetY);
|
image.buffer.__srcContext.fillRect (rect.x + image.offsetX, rect.y + image.offsetY, rect.width + image.offsetX, rect.height + image.offsetY);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
image.dirty = true;
|
image.dirty = true;
|
||||||
image.version++;
|
image.version++;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user