Recent

Author Topic: 6000+ Open Source Icon Tool and Git Repository  (Read 964 times)

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
6000+ Open Source Icon Tool and Git Repository
« on: June 30, 2022, 10:19:52 pm »
Hi guys. I just wanted to post some information to this board about a cross platform programming and designer tool I wrote using Lazarus.

This tool is called Material Design Icon Viewer, and in summary, it allows programmers and designers to quickly browse through over 6000 open source icons and copy and paste them into Lazarus or any code editor. It features incremental searching of icons, character and code point copying, as well as exporting icons to PNG images at any scale.

You can read more about it here, and the source code is available here.

Also, with the release of this tool I intend to release several new related tools and projects shortly. To that end, I've updated my cross platform class library for general purpose, custom control, and optionally opengl es rendering. To recompile the Material Design Icon Viewer you'll need to get a copy of the cross library, as it depends on it.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 486
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #1 on: June 30, 2022, 10:47:45 pm »
Thanks for the announcement. Great job

Upd: I have several wishes:
1. it is desirable that the name of the saved file by default matches the name of the glyph
2. it is desirable to add a list with standard icon sizes (16, 24, 32 etc.)
3. it is desirable that the "Save" button closes the dialog or becomes unavailable after saving the file once
« Last Edit: June 30, 2022, 11:12:48 pm by zoltanleo »
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

PeterEvans

  • New Member
  • *
  • Posts: 24
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #2 on: July 01, 2022, 12:34:48 am »
Regarding your Cross Platform Class Library.
What is the license for the library?
What platforms does the library work on? For example - Windows, Linux, Android, mac?

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #3 on: July 01, 2022, 12:41:29 am »
@zoltanleo

Thank you for your feedback and suggestions. I wanted you to know I considered each of those items during the development and decided not to include them specifically for a few reasons.

Regarding closing the dialog when pressing save, I omitted this because there might arise certain situations where you would want to export the same icon at several sizes, such as 96, 64, 48, 32, and 24px. Rather than force the user to continually reopen the dialog 5 times to do this, they can keep the dialog open and just change the size and press save. When you are done you can simply press `escape` on your keyboard to close the dialog.

Regarding standard icon sizes I think it's easy for someone to type 32 than it would be to click a combo box, find the item they want, then click the item. Also it would complicate things to have BOTH a list you can pick from in addition to a custom size field for instances where the size you wanted is not in the list.

Finally, regarding automatically naming the icon based on the material design icon name, I imagined many situations where the programmer might want to use a particular naming convention or a standard prefix or suffix in their exported PNG names. Rather than replacing the name each time a new icon is opened I thought it made more sense to preserve the name and allow the programmer or designer to alter the part of the name to fit their naming standards.

Of course I am open to making these changes based on a concensus.

sysrpl

  • Sr. Member
  • ****
  • Posts: 315
    • Get Lazarus
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #4 on: July 01, 2022, 12:46:29 am »
@PeterEvans

Thanks for noticing I forgot to add the GPL 3 license. It's added now.

Regaring plaforms, it works on Linux, Windows, and Mac (with some features not 100% implemented).
« Last Edit: July 01, 2022, 02:03:12 am by sysrpl »

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #5 on: July 01, 2022, 04:36:17 am »
Free offer!
If anyone needs icon pictures, you can contact me.
I can help you draw it, for free.
But limited for members on this forum only.

I like doing graphics as much as I like programming. I can use Blender, Gimp, Inkscape, Krita, MyPaint and LibreCAD. But as I said, drawing, I only help you draw pictures and you have to provide me the concept or draft. Because designing/concepting a design is not easy and very time consuming. I would rather save that time for programming.
« Last Edit: July 01, 2022, 05:29:27 am by Handoko »

cappe

  • Full Member
  • ***
  • Posts: 191
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #6 on: July 01, 2022, 09:33:07 am »
nice

Luc

  • Jr. Member
  • **
  • Posts: 59
Re: 6000+ Open Source Icon Tool and Git Repository
« Reply #7 on: July 01, 2022, 12:07:56 pm »
Thank you!

Another way to convert text to bmp is to use the code here: https://forum.lazarus.freepascal.org/index.php/topic,26426.msg243623.html#msg243623

You can store the font files anywhere you want so you don't need a specific installer.
Here is the same code with some more params to help with scaling when you need HighDPI :

Code: Pascal  [Select][+][-]
  1. Interface
  2. procedure FontToBitmap(aDestBmp: TBitmap; const aFontName: String; const aCode: String; const aFontSize: Byte = 20; const aHtmlColor: String = '#000000';
  3.                       const aBmpWidth: Integer = 20; const aBmpHeight: Integer = 20; const aTop: Integer = 0; const aLeft: Integer = 0);
  4.  
  5. implementation
  6.  
  7. // size set at runtime should be based on 96dpi
  8. function Scale(aSize: Integer): Integer;
  9. begin
  10.   Result := MulDiv(ASize, Screen.PixelsPerInch, 96);
  11. end;
  12.  
  13. // aFontName can be a fully qualified path: Application.location + 'fontawesome-free-5.15.1-web\webfonts\fa-solid-900.ttf'
  14. procedure FontToBitmap(aDestBmp: TBitmap; const aFontName: String;
  15.   const aCode: String; const aFontSize: Byte; const aHtmlColor: String;
  16.   const aBmpWidth: Integer; const aBmpHeight: Integer; const aTop: Integer; const aLeft: Integer);
  17. var
  18.   img: TLazIntfImage;
  19.   d: TIntfFreeTypeDrawer;
  20.   f: TFreeTypeFont;
  21.   c: TFPColor;
  22. begin
  23.   img := TLazIntfImage.Create(0,0, [riqfRGB, riqfAlpha]);
  24.   d := TIntfFreeTypeDrawer.Create(img);
  25.   f := TFreeTypeFont.Create;
  26.   try
  27.     f.Name := aFontName;
  28.     f.SizeInPixels := Scale(aFontSize);
  29.     f.Hinted := true;
  30.     f.ClearType := true;
  31.     f.Quality := grqHighQuality;
  32.     f.SmallLinePadding := false;
  33.     img.SetSize(Scale(aBmpWidth), Scale(aBmpHeight));
  34.     d.FillPixels(colTransparent);
  35.     c := TColorToFPColor(HtmlToColor(aHtmlColor, clBlack));
  36.     d.DrawText(aCode, f, Scale(aLeft + aBmpWidth), Scale(aTop + aBmpHeight), c, [ftaRight, ftaBottom]);
  37.     aDestBmp.LoadFromIntfImage(img);
  38.   finally
  39.     f.Free;
  40.     d.Free;
  41.     img.Free;
  42.   end;
  43. end;
  44.  
  45. //Usage example:
  46. // SbNext is a TSpeedButton but any component with Bitmap will do,
  47. // rsMaterialIcons is a const pointing to the font file name you want to use and stored in the AppAssetDir directory
  48. // HColor_Blue_Gray is a string with HTML encoded color
  49. // FontToBitmap(SbNext.Glyph, AppAssetDir + rsMaterialIcons, widechar(mi_navigate_next), 18, HColor_Blue_Gray, 16, 16, 3, 1);
  50.  
  51.  
Win 11 ARM (Running in Parallel VM - Mac OSX) - Lazarus 2.2.6 - i386-win32/win64

 

TinyPortal © 2005-2018