[devdocsgjs/main: 887/1867] Add transparent background to doc icon on favicon
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 887/1867] Add transparent background to doc icon on favicon
- Date: Fri, 19 Nov 2021 23:47:34 +0000 (UTC)
commit 6efad323ff55edd81e72a699f55ae5e4d7c80c73
Author: Jasper van Merle <jaspervmerle gmail com>
Date: Sat Aug 24 01:06:50 2019 +0200
Add transparent background to doc icon on favicon
assets/javascripts/lib/favicon.coffee | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/assets/javascripts/lib/favicon.coffee b/assets/javascripts/lib/favicon.coffee
index 2f2d9f93..c2da3300 100644
--- a/assets/javascripts/lib/favicon.coffee
+++ b/assets/javascripts/lib/favicon.coffee
@@ -49,6 +49,12 @@ withImage = (url, action) ->
docIconPercentage = 65
destinationCoords = size / 100 * (100 - docIconPercentage)
destinationSize = size / 100 * docIconPercentage
+ paddingSize = destinationSize + 1
+
+ imageData = ctx.getImageData(destinationCoords, destinationCoords, paddingSize, paddingSize)
+ transparentImageData = new ImageData(new Uint8ClampedArray(imageData.data.length), paddingSize,
paddingSize)
+ ctx.putImageData(transparentImageData, destinationCoords, destinationCoords)
+
ctx.drawImage(docImg, sourceX, sourceY, sourceSize, sourceSize, destinationCoords, destinationCoords,
destinationSize, destinationSize)
urlCache[doc.slug] = canvas.toDataURL()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]