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!
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!
Copy link to clipboard
Copied
It turns out that in the Windows .rc file, it does need a four-character type, which is SVG_ with an underscore.