[Cuis-dev] Vector icons?

Juan Vuletich juan at jvuletich.org
Tue Apr 27 12:20:31 PDT 2021


Hi Ken,

On 4/24/2021 12:00 PM, ken.dickey--- via Cuis-dev wrote:
> On 2021-04-24 12:39, Bernhard Pieber via Cuis-dev wrote:
> ..
>
>     Are there any examples of vector icons in some package? What ist the
>     general idea, will we be using SVG or lower level graphics 
> operations?
>
>
> This is uncached drawing yet (per-stroke SVG drawing), so expect 
> SLOW.  THIS IS PRTOTYPE CODE (expect breakage).
>

Wow! This is really impressive!

You can use the halo on the IconPallete to select and individual icon, 
and then the duplicate handle to drag a copy to the World. Then, the 
usual resize and rotate work as expected. This is JUST GREAT!

> But..
>
> A fairly good looking icon set is:
>
>  http://freshmeat.sourceforge.net/projects/svg-icons/
>
>
> Black & White (simpler) icons:
>
>   git clone https://github.com/matthaywardwebdesign/icon
>
> Look in 'svg' directory.  All MIT licenced.
>

They are all great. To be able to view them I had to:
- Raise a "safe limit" walkback from 1000 to around 1400 in SVGImagePallet
- Fix Number>>readFrom: . Just pushed the update to GitHub.
- Fix SVGRectangle creation to use default x=0 or y=0 if not provided. 
Updated version of SVG package in GitHub.


> Too many B&W Icons.  I split directory into android-* ios-* ie-* and 
> others.
>
> Android and IOS load fine, but both ie-* and others fail because:
>
>   Number readFrom: '.5'. --> error: at least 1 digit expected
>   ('0.5' works)
>
> Should be easy fix, but I have not done it.
>
> vvv===vvv===vvv
> Feature require: 'SVG'.
> Feature require: 'Morphic-Misc1'.
> "In a FileList
>   install 
> <where-ever>/4568-CuisCore-SVGReadSupport-2021Apr11-08h24m-KenD.001.cs.st
>   fileIn <wherever>/SVGImagePallet.st
> "
> SVGIconsPk := (ContentPack new loadContentFrom: 
> '/<where-ever>/SVGIcons' asDirectoryEntry ).
> SVGIconsPk size.
> "=================="
> SVGImagePallet fromDictionary: SVGIconsPk imageExtent: 32 at 32.
> "This last will open an icon picker. Slow; get a cup of coffee"
> ^^^===^^^===^^^
>
> Just for fun!
> -KenD
>
> [Code & ScreenShot separate;  This 100K limit really sucks!]

The idea, or at least my idea, is to store the path information in 
memory in the same way we do for TrueType. Then the display of an icon 
will be as fast as the display of a TrueType glyph. This forces some 
assumptions, that TrueType conforms, but I'm not sure about the SVG icons:
- Use a single stroke color. Same for fill color.
- Use a single stroke width (zero in the case of TrueType, but can be 
non zero for icons)
If these don't hold, then several calls to the plugin are needed, making 
display more expensive. So, at least, window controls and scrollbar 
buttons should only use these, at least for the default theme.

Ken, this is a great first step. Thanks!

Cheers,

-- 
Juan Vuletich
www.cuis-smalltalk.org
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev
https://github.com/jvuletich
https://www.linkedin.com/in/juan-vuletich-75611b3
@JuanVuletich



More information about the Cuis-dev mailing list