How to show an svg image? - xamarin.forms

How to show an svg image in xamarin.forms? I have an cross platform project where png works great instead of svg. In my solution I have UWP,iOS,Android and I add macOs as well.

Related

QPixmap with .svg "couldn't create image from"?

i try to get an .svg to an QPixmap and i get the Error "couldn't create Image from".
Code:
QString test = "/home/ftp/DM262-WIF-269-0.svg";
QPixmap design(test);
ui->scan_bild->setPixmap(design);
ui->scan_bild->setScaledContents(true);
is there a Resolution for my Problem?
Thx
Felix
The SVG loader of Qt supports only a subset of SVG. It seems that embedding of raster graphics images in SVGs is not supported. (If I remember right embedding of SVGs in other SVGs doesn't work as well. – Too sad.)
To prove that I don't tell something wrong, I tested an icon of our software.
The following image shows how the Explorer Preview plug-in (based on Qt) shows the image:
The same image loaded into Firefox:
When I import this image in GIMP, the embedded image is considered as well.
So, if you don't want to re-design your SVG icon I see only one solution: render the SVGs into raster graphics images (e.g. PNG or JPEG) which are better supported in Qt – may be, with multi-resolution icons (QIcon – High DPI icons) for a better result.

Color SVG Sprites

I've been using icon-fonts created at IcoMoon and they are fantastic. For this I import an SVG Illistrator output (or use premade icons) and create font files that are attached using CSS #Font-Face. These are only ever one color.
I've been reading about SVG Sprites like here: http://css-tricks.com/svg-sprites-use-better-icon-fonts/
I've tried uploading illistrator SVG files with different colors into IcoMoon (as explained at the bottom of the link above) and then creating a SVG Sprite but the color never comes through (always just one color).
Am I doing something wrong with IcoMoon? How can I create a color SVG Sprite using a site like IcoMoon that can be used to display icons where required?
thankyou
Note: i need multiple colors in each image. (not just one color styled via CSS).

Using svg background images in Trigger.io and android 4.4

svg background images are not displayed in android 4.4.
This is only a problem when trying to load them from as local recourse. svgs are displayed when loaded from a remote url.
check out your css file and make sure you are calling backgound-size AFTER background.
More information is found here: http://developer.android.com/guide/webapps/migrating.html#BackgroundSize

Images in svg file doesn't show up in Qt

I'm trying to display a svg image with Qt and it works well except that any image (.gif, .bmp, ...) in the svg image doesn't show up (lines, circles, texts works OK).
If I open the svg in firefox the image displays correctly.
I have put qgif4.dll in a folder imageformats and QtSvg4.dll besides the executable but to no avail.
I'm displaying the svg with the help of svgview.h/.cpp and I'm running on a WinXP machine (Qt version 4.7.2).
Any help greatly appreciated!
If you are loading it via a QIcon, it should work without assistance.
If you are trying to load it using a QPixmap or QImage - you can't. You have to use QSvgRenderer (or the related classes) in the svg module to rasterise the data.

How to avoid cropped SVG on resizing windows

Is there a way to make the SVG version of an image not being cropped on windows resize?
You can try resizing the windows here:
http://demosthenes.info/blog/532/Convert-Images-To-Black--White-With-CSS
or
http://www.read-design.co.uk/css3-grey-scale-image-filters/
Note that the grayscale version of the image is not the same size as the color one when windows is smaller which is the SVG is cropped on smaller windows.
But those with JS seems to scale well:
http://james.padolsey.com/demos/grayscale/
Unfortunately, whenever possible, I am trying to avoid JS, and prefer simpler SVG file with some CSS.
I am trying to digest:
https://developer.mozilla.org/en/CSS/Scaling_of_SVG_backgrounds
But that is not what I need.
I need two states of images: color and greyscale as discussed here, only want the SVG to properly scale, if possible:
Convert an image to grayscale in HTML/CSS
But unfortunately the greyscale is cropped, not properly scaled.
I tried adding "vector-effect="non-scaling-stroke", to no use.
Anyone knows a resolution this issue?
Thanks
UPDATE:
I think I just noticed my own issue properly. It is not about the SVG version being smaller, but the SVG version is being cropped on resize. I have to update my whole question above as well.
The issue only happened when resizing is by pressing Ctrl + Mouse scroll.
I don't think its an issue, unless somebody suggest anything.

Resources