You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by hi...@apache.org on 2001/03/13 17:36:56 UTC
cvs commit: xml-batik/sources/org/apache/batik/css/value DefaultSystemColorResolver.java SystemColorResolver.java
hillion 01/03/13 08:36:56
Added: samples/tests systemColors.svg
sources/org/apache/batik/css/value
DefaultSystemColorResolver.java
SystemColorResolver.java
Log:
Revision Changes Path
1.1 xml-batik/samples/tests/systemColors.svg
Index: systemColors.svg
===================================================================
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
"http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
<!-- ========================================================================= -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software License -->
<!-- version 1.1, a copy of which has been included with this distribution in -->
<!-- the LICENSE file. -->
<!-- ========================================================================= -->
<!-- ========================================================================= -->
<!-- This document tests CSS system colors. -->
<!-- -->
<!-- @author stephane@hillion.org -->
<!-- @version $Id: systemColors.svg,v 1.1 2001/03/13 16:36:55 hillion Exp $ -->
<!-- ========================================================================= -->
<svg width="450" height="500" viewBox="0 0 450 500">
<defs>
<filter id="blur" filterRes="200" x="-.1" y="-0.4" width="1.2" height="2.0">
<feGaussianBlur stdDeviation="10 10" result="blurred"/>
<feMerge>
<feMergeNode in="blurred" />
<feMergeNode in="blurred" />
<feMergeNode in="blurred" />
</feMerge>
</filter>
</defs>
<!-- ============================================================= -->
<!-- Test content -->
<!-- ============================================================= -->
<g id="testContent" style="stroke-linecap: square">
<rect x="0" y="0" width="100%" height="100%"
style="fill: Background"/>
<text x="50%" y="38" font-size="28" text-anchor="middle"
style="fill:white; font-weight: bold; filter:url(#blur)">
System Colors
</text>
<text x="50%" y="38" font-size="28" text-anchor="middle"
style="font-weight: bold">
System Colors
</text>
<!-- Inactive Window -->
<g transform="translate(100 70)">
<rect x="0" y="0" width="300" height="350"
style="fill: ButtonFace; stroke: WindowFrame"/>
<rect x="3" y="3" width="294" height="20"
style="fill: InactiveCaption"/>
<text x="150" y="18" style="fill: InactiveCaptionText; text-anchor: middle">
Inactive Caption
</text>
</g>
<!-- Active Window -->
<g transform="translate(50 120)">
<rect x="0" y="0" width="300" height="350"
style="fill: ButtonFace; stroke: WindowFrame"/>
<rect x="3" y="3" width="294" height="20"
style="fill: ActiveCaption"/>
<text x="150" y="18" style="fill: CaptionText; text-anchor: middle;
font-weight: bold">
Active Caption
</text>
<!-- Menu -->
<rect x="3" y="26" width="295" height="16"
style="fill: Menu"/>
<text x="10" y="38" style="fill: MenuText">
Menu
</text>
<rect x="45" y="26" width="60" height="16" style="fill: Highlight"/>
<text x="50" y="38" style="fill: HighlightText">
Selected
</text>
<rect x="4" y="43" width="292" height="304" style="fill: white"/>
<rect x="280" y="43" width="16" height="304" style="fill: Scrollbar"/>
<!-- bevel border -->
<line x1="3" y1="42" x2="296" y2="42" style="stroke: ThreeDDarkShadow"/>
<line x1="4" y1="43" x2="295" y2="43" style="stroke: ThreeDShadow"/>
<line x1="3" y1="43" x2="3" y2="347" style="stroke: ThreeDDarkShadow"/>
<line x1="4" y1="44" x2="4" y2="346" style="stroke: ThreeDShadow"/>
<line x1="296" y1="43" x2="296" y2="346" style="stroke: ThreeDHighlight"/>
<line x1="297" y1="42" x2="297" y2="347" style="stroke: ThreeDLightShadow"/>
<line x1="4" y1="346" x2="296" y2="346" style="stroke: ThreeDHighlight"/>
<line x1="3" y1="347" x2="297" y2="347" style="stroke: ThreeDLightShadow"/>
<!-- Scrollbar -->
<rect x="280" y="45" width="14" height="14" style="fill: ButtonFace"/>
<line x1="281" y1="44" x2="295" y2="44" style="stroke: ThreeDLightShadow"/>
<line x1="282" y1="45" x2="294" y2="45" style="stroke: ThreeDHighlight"/>
<line x1="281" y1="45" x2="281" y2="58" style="stroke: ThreeDLightShadow"/>
<line x1="282" y1="46" x2="282" y2="57" style="stroke: ThreeDHighlight"/>
<line x1="294" y1="46" x2="294" y2="57" style="stroke: ThreeDShadow"/>
<line x1="295" y1="45" x2="295" y2="58" style="stroke: ThreeDDarkShadow"/>
<line x1="282" y1="57" x2="294" y2="57" style="stroke: ThreeDShadow"/>
<line x1="281" y1="58" x2="295" y2="58" style="stroke: ThreeDDarkShadow"/>
<rect x="280" y="294" width="14" height="14" style="fill: ButtonFace"/>
<line x1="281" y1="331" x2="295" y2="331" style="stroke: ThreeDLightShadow"/>
<line x1="282" y1="332" x2="294" y2="332" style="stroke: ThreeDHighlight"/>
<line x1="281" y1="331" x2="281" y2="344" style="stroke: ThreeDLightShadow"/>
<line x1="282" y1="332" x2="282" y2="345" style="stroke: ThreeDHighlight"/>
<line x1="294" y1="333" x2="294" y2="344" style="stroke: ThreeDShadow"/>
<line x1="295" y1="332" x2="295" y2="345" style="stroke: ThreeDDarkShadow"/>
<line x1="282" y1="344" x2="294" y2="344" style="stroke: ThreeDShadow"/>
<line x1="281" y1="345" x2="295" y2="345" style="stroke: ThreeDDarkShadow"/>
<path d="M288 49L285 52L291 52Z"/>
<path d="M288 340L285 337L291 337Z"/>
<!-- bevel border -->
<rect x="41" y="43" width="80" height="62" style="fill: Menu"/>
<line x1="40" y1="42" x2="120" y2="42" style="stroke: ThreeDLightShadow"/>
<line x1="41" y1="43" x2="121" y2="43" style="stroke: ThreeDHighlight"/>
<line x1="40" y1="43" x2="40" y2="106" style="stroke: ThreeDLightShadow"/>
<line x1="41" y1="44" x2="41" y2="105" style="stroke: ThreeDHighlight"/>
<line x1="120" y1="43" x2="120" y2="105" style="stroke: ThreeDShadow"/>
<line x1="121" y1="42" x2="121" y2="106" style="stroke: ThreeDDarkShadow"/>
<line x1="41" y1="105" x2="120" y2="105" style="stroke: ThreeDShadow"/>
<line x1="40" y1="106" x2="121" y2="106" style="stroke: ThreeDDarkShadow"/>
<text x="50" y="58" style="fill: MenuText">
Item 1
</text>
<text x="50" y="76" style="fill: MenuText">
Item 2
</text>
<text x="50" y="94" style="fill: MenuText">
Item 3
</text>
</g>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
</svg>
1.1 xml-batik/sources/org/apache/batik/css/value/DefaultSystemColorResolver.java
Index: DefaultSystemColorResolver.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.css.value;
import java.awt.SystemColor;
/**
* This class provides a default implementation of a SystemColorResolver.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @version $Id: DefaultSystemColorResolver.java,v 1.1 2001/03/13 16:36:56 hillion Exp $
*/
public class DefaultSystemColorResolver implements SystemColorResolver {
/**
* Returns the active border color.
*/
public Color activeBorder() {
return new SystemColorWrapper(SystemColor.windowBorder);
}
/**
* Returns the active caption color.
*/
public Color activeCaption() {
return new SystemColorWrapper(SystemColor.activeCaption);
}
/**
* Returns the application workspace color.
*/
public Color appWorkspace() {
return new SystemColorWrapper(SystemColor.desktop);
}
/**
* Returns the desktop color.
*/
public Color background() {
return new SystemColorWrapper(SystemColor.desktop);
}
/**
* Returns the buttons color.
*/
public Color buttonFace() {
return new SystemColorWrapper(SystemColor.control);
}
/**
* Returns the button highlight color.
*/
public Color buttonHighlight() {
return new SystemColorWrapper(SystemColor.controlLtHighlight);
}
/**
* Returns the button shadow color.
*/
public Color buttonShadow() {
return new SystemColorWrapper(SystemColor.controlDkShadow);
}
/**
* Returns the button text color.
*/
public Color buttonText() {
return new SystemColorWrapper(SystemColor.controlText);
}
/**
* Returns the caption text color.
*/
public Color captionText() {
return new SystemColorWrapper(SystemColor.activeCaptionText);
}
/**
* Returns the gray text color.
*/
public Color grayText() {
return new SystemColorWrapper(SystemColor.textInactiveText);
}
/**
* Returns the highlight color.
*/
public Color highlight() {
return new SystemColorWrapper(SystemColor.textHighlight);
}
/**
* Returns the highlight text color.
*/
public Color highlightText() {
return new SystemColorWrapper(SystemColor.textHighlightText);
}
/**
* Returns the inactive border color.
*/
public Color inactiveBorder() {
return new SystemColorWrapper(SystemColor.windowBorder);
}
/**
* Returns the inactive caption color.
*/
public Color inactiveCaption() {
return new SystemColorWrapper(SystemColor.inactiveCaption);
}
/**
* Returns the inactive caption text color.
*/
public Color inactiveCaptionText() {
return new SystemColorWrapper(SystemColor.inactiveCaptionText);
}
/**
* Returns the info background color.
*/
public Color infoBackground() {
return new SystemColorWrapper(SystemColor.info);
}
/**
* Returns the info text color.
*/
public Color infoText() {
return new SystemColorWrapper(SystemColor.infoText);
}
/**
* Returns the menu background color.
*/
public Color menu() {
return new SystemColorWrapper(SystemColor.menu);
}
/**
* Returns the menu text color.
*/
public Color menuText() {
return new SystemColorWrapper(SystemColor.menuText);
}
/**
* Returns the scrollbar background color.
*/
public Color scrollbar() {
return new SystemColorWrapper(SystemColor.scrollbar);
}
/**
* Returns the 3D dark shadow color.
*/
public Color threeDDarkShadow() {
return new SystemColorWrapper(SystemColor.controlDkShadow);
}
/**
* Returns the 3D face color.
*/
public Color threeDFace() {
return new SystemColorWrapper(SystemColor.control);
}
/**
* Returns the 3D highlight color.
*/
public Color threeDHighlight() {
return new SystemColorWrapper(SystemColor.controlHighlight);
}
/**
* Returns the 3D light shadow color.
*/
public Color threeDLightShadow() {
return new SystemColorWrapper(SystemColor.controlLtHighlight);
}
/**
* Returns the 3D shadow color.
*/
public Color threeDShadow() {
return new SystemColorWrapper(SystemColor.controlShadow);
}
/**
* Returns the window's color.
*/
public Color window() {
return new SystemColorWrapper(SystemColor.window);
}
/**
* Returns the window frame color.
*/
public Color windowFrame() {
return new SystemColorWrapper(SystemColor.windowBorder);
}
/**
* Returns the window text color.
*/
public Color windowText() {
return new SystemColorWrapper(SystemColor.windowText);
}
/**
* To encapsulate a SystemColor.
*/
protected static class SystemColorWrapper implements Color {
/**
* The wrapped color.
*/
protected SystemColor systemColor;
/**
* Creates a new SystemColorWrapper.
*/
public SystemColorWrapper(SystemColor c) {
systemColor = c;
}
/**
* Returns the red component.
*/
public int getRed() {
return systemColor.getRed();
}
/**
* Returns the green component.
*/
public int getGreen() {
return systemColor.getGreen();
}
/**
* Returns the blue component.
*/
public int getBlue() {
return systemColor.getBlue();
}
}
}
1.1 xml-batik/sources/org/apache/batik/css/value/SystemColorResolver.java
Index: SystemColorResolver.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.css.value;
/**
* This interface represents an object which can query system colors.
*
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
* @version $Id: SystemColorResolver.java,v 1.1 2001/03/13 16:36:56 hillion Exp $
*/
public interface SystemColorResolver {
/**
* Returns the active border color.
*/
Color activeBorder();
/**
* Returns the active caption color.
*/
Color activeCaption();
/**
* Returns the application workspace color.
*/
Color appWorkspace();
/**
* Returns the desktop color.
*/
Color background();
/**
* Returns the buttons color.
*/
Color buttonFace();
/**
* Returns the button highlight color.
*/
Color buttonHighlight();
/**
* Returns the button shadow color.
*/
Color buttonShadow();
/**
* Returns the button text color.
*/
Color buttonText();
/**
* Returns the caption text color.
*/
Color captionText();
/**
* Returns the gray text color.
*/
Color grayText();
/**
* Returns the highlight color.
*/
Color highlight();
/**
* Returns the text color.
*/
Color highlightText();
/**
* Returns the inactive border color.
*/
Color inactiveBorder();
/**
* Returns the inactive caption color.
*/
Color inactiveCaption();
/**
* Returns the inactive caption text color.
*/
Color inactiveCaptionText();
/**
* Returns the info background color.
*/
Color infoBackground();
/**
* Returns the info text color.
*/
Color infoText();
/**
* Returns the menu background color.
*/
Color menu();
/**
* Returns the menu text color.
*/
Color menuText();
/**
* Returns the scrollbar background color.
*/
Color scrollbar();
/**
* Returns the 3D dark shadow color.
*/
Color threeDDarkShadow();
/**
* Returns the 3D face color.
*/
Color threeDFace();
/**
* Returns the 3D highlight color.
*/
Color threeDHighlight();
/**
* Returns the 3D light shadow color.
*/
Color threeDLightShadow();
/**
* Returns the 3D shadow color.
*/
Color threeDShadow();
/**
* Returns window's color.
*/
Color window();
/**
* Returns window frame color.
*/
Color windowFrame();
/**
* Returns window text color.
*/
Color windowText();
/**
* To Store a CSS RGB color.
*/
public interface Color {
/**
* Returns the red component.
*/
int getRed();
/**
* Returns the green component.
*/
int getGreen();
/**
* Returns the blue component.
*/
int getBlue();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org