-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display steep hills on the map (#408)
Arindam made the icons. Co-authored-by: arindam1993 <[email protected]>
- Loading branch information
1 parent
248441a
commit d46b4e8
Showing
9 changed files
with
191 additions
and
51 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# This script requires ImageMagick to be installed, and also the | ||
# npm package image-sdf, globally. | ||
|
||
for svg in *.svg; do | ||
echo Generating SDF for $svg... | ||
i=`basename $svg .svg` | ||
convert -density 10000 -fill white -background black -resize 256x256 \ | ||
-gravity center -extent 280x280 \ | ||
$i.svg ${i}_intermediate.png && \ | ||
image-sdf ${i}_intermediate.png --spread 19 --downscale 1 --color black \ | ||
>${i}_sdf.png && \ | ||
rm ${i}_intermediate.png || echo Failed to convert $i | ||
done |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export default function downloadImageData(url: string): Promise<ImageData> { | ||
return new Promise((resolve, reject) => { | ||
const img = document.createElement('img'); | ||
|
||
img.addEventListener('load', () => { | ||
const canvas = document.createElement('canvas'); | ||
const ctx = canvas.getContext('2d'); | ||
if (!ctx) { | ||
reject(new Error("can't create 2D draw context")); | ||
return; | ||
} | ||
canvas.width = img.naturalWidth; | ||
canvas.height = img.naturalHeight; | ||
try { | ||
ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight); | ||
resolve(ctx.getImageData(0, 0, img.naturalWidth, img.naturalHeight)); | ||
} catch (err) { | ||
reject(err); | ||
} | ||
}); | ||
|
||
img.addEventListener('error', (evt) => { | ||
URL.revokeObjectURL(url); | ||
reject(evt); | ||
}); | ||
|
||
img.src = url; | ||
}); | ||
} |
Oops, something went wrong.