I want image to be grayed in IE 9+ and when I hover mouse it show original
Everything is working fine but thing is that when I do hover it scales image
find code in below fiddle
Fiddle
The scaling is caused by your jpg being slightly larger (105×58) than your svg (96×53). When the jpg is referenced by <image> it is scaled to fit the dimensions of <image>. This works as expected for the grayed image, but fails for the hover effect. On hover you set opacity:0 for the <image> which renders the svg's background visible. The background image, however, is not scaled to fit the dimensions, but rather clipped to your svg's size. Hence the difference in scale.
To circumvent these problems I would prefer another approach getting rid of the background image. You could just place the original coloured image right underneath the grayed image. The grayed image will then obscure the coloured image until opacity is set to 0 on hover:
<image x="0" y="0" width="96" height="53" xlink:href="https://dl.dropboxusercontent.com/u/18190667/img.jpg" />
<image class="gray" filter="url('#filtersPicture')" x="0" y="0" width="96" height="53" xlink:href="https://dl.dropboxusercontent.com/u/18190667/img.jpg" />
Check the updated JSFiddle.
Related
See reproduced example here - https://codepen.io/canovice/pen/eYRmYKR - command + P to print, I've taken this screenshot of the print/pdf output:
Problem: On web, both images are sharp. On print and save to PDF, the logo in the <img> tag remains sharp, whereas the logo in the <svg> using <svg:pattern>, <svg:image>, <svg:rect> with the fill attribute, is blurry.
Purpose: Our web app has many SVG graphs (think scatterplots) that use the team logos in place of the scatterplot dots. We want users to be able to print these graphs, and save these graphs to PDF, with sharp images. Here's a screenshot of the graph on web, with the sharp logos. When we save this as PDF, we get blurry logos.
We are using react.js and d3.js to build our web app and create our svg graphs, although we are hoping for a solution specific to the html & css of SVG elements.
Wrapping a raster graphic image inside a svg name does not make it a true scalable vector graphic. The method used is a "gradient fill with image" thus not as efficient as using true SVG objects with true colour gradient fills.
To get png in svg wrapping keep it simple
<div>
<svg width="2000" height="2000" >
<rect x="0" y="0" height="1000" width="1000" style="fill: #f0fff0"/>
<image x="30" y="00" width="160" height="160" xlink:href="103735.png" />
<image x="300" y="50" width="160" height="160" xlink:href="103735.png" />
</svg>
</div>
<img width="80" height="90" src="/assets/images/shape.svg" />
I'm using a SVG inside a <img /> tag to display a shape with only a border.
On non-retina (left) the SVG image isn't sharp, but on retina it is (right):
I also tried putting the SVG image in a <object>, but the same pixel border appears.. (suggested in: Do I use <img>, <object>, or <embed> for SVG files?).
Anyone with an explanation or fix for this, please? :)
Good day, I want to have my canvas have rounded corners. i know you place the canvas inside a Border Tag and round from there like
<Border>
<Canvas>
</Canvas>
</Border>
Now the solutions i have seen, they have an element in their Xaml called ClipToBounds Which makes the canvas adjust to the border but it is not present for SilverLight. so is there a way i can have this feature or an alternative so that the Canvas clips correctly to the Border? Thanks in Advance.
P.S i know i can set the canvas to transparent and the border background to the background i want the canvas to take, but am still learning windows phone so am trying to know as much solutions as possible in case that always doesn't work. Thank you
You can use Canvas.Clip:
<Canvas Height="100" Width="100" Background="white">
<Canvas.Clip>
<EllipseGeometry Center="50, 50" RadiusX="68" RadiusY="68" />
</Canvas.Clip>
</Canvas>
Also, here's a handy tutorial if you wish to define your own ClipToBounds behaviour:
http://www.codeproject.com/Articles/36495/Silverlight-ClipToBounds-Can-I-Clip-It-Yes-You-Can
I want to embed some SVG into SVG.
Therefor I want to use the <image> element since I want to keep my SVG separated.
But when I include my SVG like that:
<image xlink:href="svgs/munitionsmangel.svg" width="20" height="20" x="120" y="70" />
It works, but does not scale the SVG up when I zoom with my browser, it just stays small.
But when I embed just the same SVG file as a symbol and include it like that:
<use xlink:href="#munitionsmangel" width="20" height="20" x="80" y="70" />
it just scales up like a charm.
What is the problem here?
Edit: Seems like this is a bug with Firefox, in the current version 21
Chrome scales up the image as well...
Even more strange, if I include a raster image with image, both Firefox and Chrome scale it...
Edit 2: Even IE 9 has the desired behaviour, although its rendering of background colors is a bit strange, so its only Firefox which sucks
Since this really seems like a bug in Firefox, I will use the <use />-tag instead, maybe in combination with XMLHttpRequest to insert the <symbol /> dynamically.
Or even only XMLHttpRequest with inserting the node directly.
I cannot think of a better solution, so if there is really a better answer, just post it!
I'm trying to resize a flash game inside a VGroup, no matter what configuration i try to set, some of my flash games are clipped out. i see only 80% of the actual flash screen.
this is my code:
<s:VGroup id="gameVGroup" clipAndEnableScrolling="true" height="480" maxHeight="480" width="540" maxWidth="540">
<mx:SWFLoader id="swfGameLoader" loadForCompatibility="true" scaleContent="true" maintainAspectRatio="true" width="100%" height="100%" maxWidth="540" maxHeight="480" />
</s:VGroup>
any ideas?
update
i still want to maintain aspect ratio.
so if the game is wider or taller then my application window, i want it to be resized properly.
maintainAspectRatio="false"