• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to add SVG images for icons, etc., to a plugin project?

Engaged ,
Jul 05, 2020 Jul 05, 2020

Copy link to clipboard

Copied

I'd like to use SVG resources in my Hot Door CORE plugin project, but I cannot get them to work (PNG images work just fine, but I want the clarity of SVG at various sizes). There's no example to follow, so I'm adapting the technique for PNGI images. I know this isn't standard SDK procedure, but I hope the syntax is familiar enough to some that it makes sense.

in IDtoFile:

29001.svg imgCompass-01.svg
29011.svg imgCompassDark-01.svg

in ResourceIDs.rh:

#define AT_compass1_SVG_RSRC_ID 29001
#define AT_compass1_SVG_RSRC_NAME "imgCompass-01"
#define AT_compass1_SVG_RSRC_FILE "imgCompass-01.svg"

#define AT_compass1_DARK_SVG_RSRC_ID 29011
#define AT_compass1_DARK_SVG_RSRC_NAME "imgCompassDark-01"
#define AT_compass1_DARK_SVG_RSRC_FILE "imgCompassDark-01.svg"

in Resources.r:

read 'SVG' (AT_compass1_SVG_RSRC_ID, AT_compass1_SVG_RSRC_NAME)  AT_compass1_SVG_RSRC_FILE;
read 'SVG' (AT_compass1_DARK_SVG_RSRC_ID, AT_compass1_DARK_SVG_RSRC_NAME)  AT_compass1_DARK_SVG_RSRC_FILE;

in Resources.rc:

AT_compass1_SVG_RSRC_ID SVG AT_compass1_SVG_RSRC_FILE
AT_compass1_DARK_SVG_RSRC_ID SVG AT_compass1_DARK_SVG_RSRC_FILE

In my main cpp file:

hdi::core::Label labl = hdi::core::Label(hdi::core::Rect(20,36,26,24),hdi::core::SVGWithRolloverIDs(
    AT_compass1_SVG_RSRC_ID,
    AT_compass1_DARK_SVG_RSRC_ID));
this->myDlg.addWidget(labl);

The SVG images are exported from Illustrator 2020, size 26x24 px, using the default export settings. No image appears in Illustrator 2020 on either Mac or Windows. What am I doing wrong? Any suggestions would be very much appreciated!

TOPICS
SDK

Views

137

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Engaged ,
Jul 06, 2020 Jul 06, 2020

Copy link to clipboard

Copied

Well, I have partial success: On Mac, in Xcode, Project > Build Phases > Run Script, add these lines:

mkdir "$INSTALL_DIR/$FULL_PRODUCT_NAME/Contents/Resources/svg" 2> /dev/null
cp "$PROJECT_DIR/../../../Images/"*.svg "$INSTALL_DIR/$FULL_PRODUCT_NAME/Contents/Resources/svg/"

I can't find anything in the Windows Visual Studio project that specifies any resource types. I have a hunch the problem is in the .rc file. Is "SVG" correct or should it have a four-character descriptor like "PNGI" does? Any suggestions would be very much appreciated!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

LATEST

It turns out that in the Windows .rc file, it does need a four-character type, which is SVG_ with an underscore.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines