You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0bec592
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@
5
5
### New
6
6
7
7
-**`image.dropShadow({ x, y, blur, spread, color, expand })`**: a shadow behind the image, shaped by its alpha. Without an offset it is a glow: `image.dropShadow({ blur: 8, spread: 2, color: 0xff2fb9ff })`. The image grows to fit it, unless `expand: false`.
8
+
-**`image.outline({ width, color, expand })`**: an outline around the image's shape, the sticker effect for cut-out images or an outline for rendered text. It follows the edge's antialiasing, like the `strokeWidth` of `renderText()` does.
8
9
-**`Image.linearGradient(width, height, { stops, angle })`** and **`Image.radialGradient(width, height, { stops, x, y, radius })`**: images with a gradient, with the angle like CSS' `linear-gradient()`. `stops` are positions and colors like `Colors.gradient()` takes them, or just the colors, evenly spaced.
9
10
-**`image.recolor(otherImage)`**: takes the colors from another image of the same size and keeps the alpha. With a gradient it fills a shape, e.g. gradient text: `text.recolor(Image.linearGradient(text.width, text.height, { stops: [0x22d3eeff, 0xfb923cff], angle: 90 }))`.
assert(hdrShadow.gainMap&&Math.abs(hdrShadow.gainMap.width/hdrShadow.width-0.5)<0.1&&Math.abs(hdrShadow.gainMap.height/hdrShadow.height-0.5)<0.1,'dropShadow keeps the gain map at its scale');
assert(outlined.width===14&&outlined.height===14,`outline({width}) grows by the width on every side: ${outlined.width}x${outlined.height}`);
723
+
assert(px(outlined,2+4,2+4).join()==='255,128,64,255','outline keeps the shape');
724
+
assert(px(outlined,2+2,2+4).join()==='255,0,0,255'&&px(outlined,2+1,2+4)[3]>100&&alphaAt(outlined,0,2+4)===0&&alphaAt(outlined,2+3,0)===0,`outline: the stroke is next to the shape and as wide as asked: ${px(outlined,4,6)}${px(outlined,3,6)}${px(outlined,0,6)}`);
725
+
assert(alphaAt(outlined,2+3-1,2+3-1)>200&&alphaAt(outlined,2+3-2,2+3-2)<128,'outline rounds the corners');
assert(clipped.width===10&&px(clipped,2,4).join()==='0,0,0,255'&&px(clipped,4,4).join()==='255,128,64,255','outline({expand: false}) keeps the size');
728
+
assert(square().outline({width: 0}).width===10&&Buffer.from(square().outline({width: 0}).bitmap).equals(Buffer.from(square().bitmap)),'outline({width: 0}) does nothing');
729
+
assert(px(square().outline({width: 1,color: 0x00ff0080}),2+2,2+4).slice(3).join()==='128'||Math.abs(alphaAt(square().outline({width: 1,color: 0x00ff0080}),3-1+1,3+2+1)-128)<=1,'outline with a translucent color');
assert(outlinedFrame.xOffset===0&&outlinedFrame.yOffset===1&&outlinedFrame.width===10+1+3&&outlinedFrame.height===10+3+3,`Frame.outline: ${outlinedFrame.width}x${outlinedFrame.height} at ${outlinedFrame.xOffset},${outlinedFrame.yOffset}`);
0 commit comments