forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Automatic corners AKA why I needed the colors in skinconf
Date Thu, 08 Jan 2004 17:23:52 GMT

Now Forrest can generate borders automatically, using skin colors and 
naming convention.

Rounded and straight 45 degrees corners are supplied, and it's easy to 
make your own. It works in all skins, as it's in the common skin.

For example, to generate a 'r'ounded corner for 't'op 'l'eft the size of 
'5' pixels of background 'header', foreground 'tab-selected' and border 
of 'tab-unselected' I can just ask for:

   skin/images/rc-t-l-5-1header-2tab-selected-3-tab-unselected.png

and I get my 'rounded''corner'-'top'-'left'-'5'pixels-1,2,3colored image.

To show how it's easy to make your own corner, here is the rounded 
corner template (rc.svg.xslt):

   <xsl:import href = "corner-imports.svg.xslt" />
   <xsl:template name="figure">
     <g transform="translate(0.5 0.5)">
       <ellipse cx="{$smallersize}"
                cy="{$smallersize}"
                rx="{$smallersize}"
                ry="{$smallersize}"
                style="{$fill}{$stroke}stroke-width:1"/>
         </g>
   </xsl:template>

Forrest takes care automatically in doing the needed transformations and 
supplying the correct values.

Here is the diagonal corner (dc.svg.xslt):

   <xsl:import href = "corner-imports.svg.xslt" />

   <xsl:template name="figure">
     <xsl:variable name="biggersize"
                   select="number($size)+number($size)"/>
       <g transform="translate(0 0.5)">
         <polygon points="0,{$size} {$size},0 {$biggersize},0
                          {$biggersize},{$biggersize} 0,{$biggersize}"
                  style="{$fill}{$stroke}stroke-width:1"/>
      </g>
   </xsl:template>


There is a catch though ATM: if the user does not specify the colors 
that the requested corner needs, the corner is generated by default of 
size 0, and the corners show straight.

To fix this, I'm working on skinconf inheritance, so that a skinconf put 
in each skin can supply default values for the ones using it.

For example, we could have an apache-sites skin that already contains 
the license indications, the colors, the layout of a generic standard 
Apache site. The same can be done with krysalis or other groups, all for 
the sake of consistency.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Mime
View raw message