Jump to content

Loading multiple icons


RonShortt
 Share

Recommended Posts

SVG files are XML vector files, so they can easily be stored in source code. The default SVG icons the interface uses are stored and loaded like this:

auto buffer = CreateBuffer();
auto stream = CreateBufferStream(buffer);
		
String s = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\"> <svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\" enable-root=\"new 0 0 16 16\" xml:space=\"preserve\"> <polygon fill=\"#FFFFFF\" points=\"14.223,5.228 12.689,3.694 6.333,10.051 3.31,7.027 1.777,8.561 6.319,13.102 6.333,13.088 6.348,13.102 \"/> </svg>";

buffer->Resize(s.length() + 1);
buffer->PokeString(0,s);

auto icon_button_checkmark = LoadIcon(stream);

 

  • Like 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...