cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simeon Walker <sim...@sbs.bangor.ac.uk>
Subject Re: AW: AW: AW: SVG Transparency
Date Tue, 19 Mar 2002 12:11:29 GMT
ok, below is the stylesheet I use to generate curved corners menu items,
boxes etc on my website. If the $fg parameter is passed then a filled
rectangle of that colour is drawn, if not it's transparent.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="a" select="0"/>
<xsl:param name="bg" select="white"/>
<xsl:param name="fg" select="red"/>

<xsl:template match="something">
         <svg xml:space="preserve" width="6px" height="6px">
                 <desc>Corner of menu item</desc>
                 <xsl:if test="string($fg)">
                         <rect width="6" height="6" fill="{$fg}"/>
                 </xsl:if>
                 <path d="M0,0 v6 a6,6 0 0,1 6,-6 z" fill="{$bg}" transform="rotate({$a}
3 3)"/>
         </svg>
</xsl:template>

</xsl:stylesheet>

The actual svg code on its own would look something like this:

<svg xml:space="preserve" width="6px" height="6px">
	<desc>Corner of menu item</desc>
	<rect width="6" height="6" fill="green"/>
	<path d="M0,0 v6 a6,6 0 0,1 6,-6 z" fill="white" transform="rotate(0 3 3)"/>
</svg>

Omitting the <rect ../> means it's transparent.

Ignore the fact that it *looks* like I have my fg and bg mixed up...
(they are referring to menu colours, not the svg itself)

Sim

Michael Zehrer wrote:
> Hi Sim,
> 
> can you give an example?
> 
> Michael
> 
> -----Ursprüngliche Nachricht-----
> Von: Simeon Walker [mailto:simeon@sbs.bangor.ac.uk]
> Gesendet: Dienstag, 19. März 2002 10:42
> An: cocoon-users@xml.apache.org
> Betreff: Re: AW: AW: SVG Transparency
> 
> 
> I have found that if I don't draw over the whole area of the svg then
> bit where I don't draw will be transparent. If I want a background
> colour
> then I start by drawing a filled box. There may be other ways - I'm just
> starting with SVG's.
> 
> Sim
> 
> Michael Zehrer wrote:
> 
>>Hi,
>>
>>maybe my question was to svg specific. Does the svg2png serializer can
>>make images with transparent background? And what do I have to define
> 
> in
> 
>>my svg to do this?
>>
>>Michael
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Derek Hohls [mailto:dhohls@csir.co.za]
>>Gesendet: Dienstag, 19. März 2002 08:02
>>An: cocoon-users@xml.apache.org
>>Betreff: Re: AW: SVG Transparency
>>
>>
>>Michael
>>
>>There's an example on SVG clipping (which may be useful?)
>>at Adobe:
>>
>>http://www.adobe.com/svg/basics/jpgs.html
>>
>>Derek
>>
>>
>>
>>>>>Zehrer@optimal-systems.de 18/03/2002 05:50:04 >>>
>>>>
>>Hi Chris,
>>
>>thanks for the link, but excuse me this is a little bit too complex.
>>Can
>>you explain the concept?
>>
>>
>>Cheers Michael
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Chris Newland [mailto:chris.newland@emorphia.com] 
>>Gesendet: Montag, 18. März 2002 16:41
>>An: cocoon-users@xml.apache.org 
>>Betreff: RE: SVG Transparency
>>
>>
>>http://www.w3.org/TR/SVG/masking.html 
>>
>>HTH,
>>
>>Chris
>>
>>
>>
>>>-----Original Message-----
>>>From: Michael Zehrer [mailto:Zehrer@optimal-systems.de] 
>>>Sent: 18 March 2002 15:24
>>>To: Cocoon-Users (E-Mail)
>>>Subject: SVG Transparency
>>>
>>>
>>>Hi list,
>>>
>>>maybe a little offtopic, but how can I have svg images with
>>
>>transparent
>>
>>
>>>background in Cocoon?
>>>
>>>Cheers, Michael
>>>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>
>>
>>>Please check that your question has not already been answered in the
>>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>>
>>>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>>>For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>Please check that your question has not already been answered in the
>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>
>>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>>For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>>
>>
>>---------------------------------------------------------------------
>>Please check that your question has not already been answered in the
>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>
>>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>>For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>>
>>
>>---------------------------------------------------------------------
>>Please check that your question has not already been answered in the
>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>
>>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>>For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>>
>>
>>---------------------------------------------------------------------
>>Please check that your question has not already been answered in the
>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>
>>To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
>>For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>>
> 
> 


-- 
Simeon Walker,                      email: simeon@sbs.bangor.ac.uk
School of Biological Sciences,      phone: +44 (0)1248 383702
University of Wales, Bangor,        fax: +44 (0)1248 382569
Gwynedd, LL57 2UW, UK.              www: http://biology.bangor.ac.uk/


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message