You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/04/15 06:07:06 UTC

svn commit: r765042 - in /incubator/pivot/trunk/wtk/src/pivot/wtk: content/ skin/ skin/terra/

Author: tvolkert
Date: Wed Apr 15 04:07:05 2009
New Revision: 765042

URL: http://svn.apache.org/viewvc?rev=765042&view=rev
Log:
Added pivot.wtk.skin.GraphicsUtilities, and changed all skins to use the methods therein, which should alleviate pixel rounding errors when scaling the display host

Added:
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/GraphicsUtilities.java
Modified:
    incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/BorderSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/LabelSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/TablePaneSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCheckboxSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMeterSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPaletteSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraScrollBarSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSheetSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSpinnerSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTabPaneSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTextInputSkin.java
    incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTreeViewSkin.java

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/content/ListViewColorRenderer.java Wed Apr 15 04:07:05 2009
@@ -18,10 +18,10 @@
 
 import java.awt.Color;
 import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.wtk.ListView;
 import pivot.wtk.media.Image;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * List view renderer for displaying color swatches.
@@ -60,7 +60,7 @@
             graphics.setColor(color);
             graphics.fillRect(2, 2, SIZE - 4, SIZE - 4);
             graphics.setColor(Color.GRAY);
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, SIZE - 1, SIZE - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, SIZE, SIZE);
         }
     }
 

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/BorderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/BorderSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/BorderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/BorderSkin.java Wed Apr 15 04:07:05 2009
@@ -211,10 +211,13 @@
         graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
             RenderingHints.VALUE_ANTIALIAS_ON);
 
-        int x = thickness / 2;
-        int y = topThickness / 2;
-        int width = Math.max(getWidth() - thickness, 0);
-        int height = Math.max(getHeight() - (int)Math.ceil((topThickness + thickness) * 0.5), 0);
+        int width = getWidth();
+        int height = getHeight();
+
+        int strokeX = thickness / 2;
+        int strokeY = topThickness / 2;
+        int strokeWidth = Math.max(width - thickness, 0);
+        int strokeHeight = Math.max(height - (int)Math.ceil((topThickness + thickness) * 0.5), 0);
 
         // Draw the background
         Color backgroundColor = getBackgroundColor();
@@ -222,9 +225,9 @@
             graphics.setPaint(backgroundColor);
 
             if (cornerRadius > 0) {
-                graphics.fillRoundRect(x, y, width, height, cornerRadius, cornerRadius);
+                graphics.fillRoundRect(strokeX, strokeY, strokeWidth, strokeHeight, cornerRadius, cornerRadius);
             } else {
-                graphics.fillRect(x, y, width, height);
+                graphics.fillRect(strokeX, strokeY, strokeWidth, strokeHeight);
             }
         }
 
@@ -259,16 +262,16 @@
         // Draw the border
         if (thickness > 0) {
             graphics.setPaint(color);
-            graphics.setStroke(new BasicStroke(thickness));
 
             if (cornerRadius > 0) {
-                graphics.draw(new RoundRectangle2D.Double(x + 0.5 * thickness, y + 0.5 * thickness,
-                    width, height, cornerRadius, cornerRadius));
+                graphics.setStroke(new BasicStroke(thickness));
+                graphics.draw(new RoundRectangle2D.Double(0.5 * thickness, 0.5 * topThickness,
+                    strokeWidth, strokeHeight, cornerRadius, cornerRadius));
             } else {
                 graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                     RenderingHints.VALUE_ANTIALIAS_OFF);
-                graphics.draw(new Rectangle2D.Double(x + 0.5 * thickness, y + 0.5 * thickness,
-                    width, height));
+                int y = (topThickness - thickness) / 2;
+                GraphicsUtilities.drawRect(graphics, 0, y, width, Math.max(height - y, 0), thickness);
             }
         }
     }

Added: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/GraphicsUtilities.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/GraphicsUtilities.java?rev=765042&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/GraphicsUtilities.java (added)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/GraphicsUtilities.java Wed Apr 15 04:07:05 2009
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pivot.wtk.skin;
+
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+
+import pivot.wtk.Orientation;
+
+/**
+ * Contains utility methods dealing with the Java2D API.
+ *
+ * @author tvolkert
+ */
+public final class GraphicsUtilities {
+    private GraphicsUtilities() {
+    }
+
+    public static final void drawLine(final Graphics2D graphics, final int x, final int y,
+        final int length, final Orientation orientation) {
+        drawLine(graphics, x, y, length, orientation, 1);
+    }
+
+    public static final void drawLine(final Graphics2D graphics, final int x, final int y,
+        final int length, final Orientation orientation, final int thickness) {
+        if (length > 0 && thickness > 0) {
+            switch (orientation) {
+            case HORIZONTAL:
+                graphics.fillRect(x, y, length, thickness);
+                break;
+
+            case VERTICAL:
+                graphics.fillRect(x, y, thickness, length);
+                break;
+            }
+        }
+    }
+
+    /**
+     * Draws a rectangle with a thickness of 1 pixel at the specified
+     * coordinates whose <u>outer border</u> is the specified width and height.
+     * In other words, the distance from the left edge of the leftmost pixel to
+     * the left edge of the rightmost pixel is <tt>width - 1</tt>.
+     * <p>
+     * This method provides more reliable pixel rounding behavior than
+     * <tt>java.awt.Graphics#drawRect</tt> when scaling is applied because this
+     * method does not stroke the shape but instead explicitly fills the
+     * desired pixels with the graphics context's paint. For this reason, and
+     * because Pivot supports scaling the display host, it is recommended that
+     * skins use this method over <tt>java.awt.Graphics#drawRect</tt>.
+     *
+     * @param graphics
+     * The graphics context that will be used to perform the operation.
+     *
+     * @param x
+     * The x-coordinate of the upper-left corner of the rectangle.
+     *
+     * @param y
+     * The y-coordinate of the upper-left corner of the rectangle.
+     *
+     * @param width
+     * The <i>outer width</i> of the rectangle.
+     *
+     * @param height
+     * The <i>outer height</i> of the rectangle.
+     */
+    public static final void drawRect(final Graphics2D graphics, final int x, final int y,
+        final int width, final int height) {
+        drawRect(graphics, x, y, width, height, 1);
+    }
+
+    /**
+     * Draws a rectangle with the specified thickness at the specified
+     * coordinates whose <u>outer border</u> is the specified width and height.
+     * In other words, the distance from the left edge of the leftmost pixel to
+     * the left edge of the rightmost pixel is <tt>width - thickness</tt>.
+     * <p>
+     * This method provides more reliable pixel rounding behavior than
+     * <tt>java.awt.Graphics#drawRect</tt> when scaling is applied because this
+     * method does not stroke the shape but instead explicitly fills the
+     * desired pixels with the graphics context's paint. For this reason, and
+     * because Pivot supports scaling the display host, it is recommended that
+     * skins use this method over <tt>java.awt.Graphics#drawRect</tt>.
+     *
+     * @param graphics
+     * The graphics context that will be used to perform the operation.
+     *
+     * @param x
+     * The x-coordinate of the upper-left corner of the rectangle.
+     *
+     * @param y
+     * The y-coordinate of the upper-left corner of the rectangle.
+     *
+     * @param width
+     * The <i>outer width</i> of the rectangle.
+     *
+     * @param height
+     * The <i>outer height</i> of the rectangle.
+     *
+     * @param thickness
+     * The thickness of each edge.
+     */
+    public static final void drawRect(final Graphics2D graphics, final int x, final int y,
+        final int width, final int height, final int thickness) {
+        Graphics2D rectGraphics = graphics;
+
+        if ((graphics.getTransform().getType() & AffineTransform.TYPE_MASK_SCALE) != 0) {
+            rectGraphics = (Graphics2D)graphics.create();
+            rectGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_ON);
+        }
+
+        if (width > 0 && height > 0 && thickness > 0) {
+            drawLine(rectGraphics, x, y, width, Orientation.HORIZONTAL, thickness);
+            drawLine(rectGraphics, x + width - thickness, y, height, Orientation.VERTICAL, thickness);
+            drawLine(rectGraphics, x, y + height - thickness, width, Orientation.HORIZONTAL, thickness);
+            drawLine(rectGraphics, x, y, height, Orientation.VERTICAL, thickness);
+        }
+
+        if (rectGraphics != graphics) {
+            rectGraphics.dispose();
+        }
+    }
+}

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/LabelSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/LabelSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/LabelSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/LabelSkin.java Wed Apr 15 04:07:05 2009
@@ -203,6 +203,8 @@
 
             graphics.setFont(font);
             graphics.setPaint(color);
+            graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_ON);
 
             float y = 0;
             switch (verticalAlignment) {

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/TablePaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/TablePaneSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/TablePaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/TablePaneSkin.java Wed Apr 15 04:07:05 2009
@@ -19,19 +19,21 @@
 import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Graphics2D;
+import java.awt.RenderingHints;
 import java.awt.geom.Area;
-import java.awt.geom.Line2D;
 import java.awt.geom.Rectangle2D;
 
 import pivot.collections.Dictionary;
 import pivot.collections.Sequence;
+import pivot.wtk.Bounds;
 import pivot.wtk.Component;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Insets;
-import pivot.wtk.Bounds;
+import pivot.wtk.Orientation;
 import pivot.wtk.TablePane;
 import pivot.wtk.TablePaneListener;
 import pivot.wtk.TablePaneAttributeListener;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Table pane skin.
@@ -526,6 +528,8 @@
 
             gridGraphics.setStroke(new BasicStroke());
             gridGraphics.setPaint(gridColor);
+            gridGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_ON);
 
             // Find any components that span multiple rows or columns, and
             // ensure that the grid lines don't get painted through their
@@ -592,9 +596,8 @@
 
                 for (int i = 1; i < rowCount; i++) {
                     int gridY = Math.max(rowY - (int)Math.ceil(verticalSpacing * 0.5f), 0);
-                    int gridWidth = Math.max(width - (padding.left + padding.right), 0);
-                    gridGraphics.draw(new Line2D.Double(padding.left + 0.5, gridY + 0.5,
-                        gridWidth - 1.5, gridY + 0.5));
+                    GraphicsUtilities.drawLine(gridGraphics, padding.left, gridY,
+                        width - (padding.left + padding.right), Orientation.HORIZONTAL);
 
                     rowY += (rowHeights[i] + verticalSpacing);
                 }
@@ -606,9 +609,8 @@
 
                 for (int j = 1; j < columnCount; j++) {
                     int gridX = Math.max(columnX - (int)Math.ceil(horizontalSpacing * 0.5), 0);
-                    int gridHeight = Math.max(height - (padding.top + padding.bottom), 0);
-                    gridGraphics.draw(new Line2D.Double(gridX + 0.5, padding.top + 0.5,
-                        gridX + 0.5, gridHeight - 1.5));
+                    GraphicsUtilities.drawLine(gridGraphics, gridX, padding.top,
+                        height - (padding.top + padding.bottom), Orientation.VERTICAL);
 
                     columnX += (columnWidths[j] + horizontalSpacing);
                 }

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraAccordionSkin.java Wed Apr 15 04:07:05 2009
@@ -16,12 +16,10 @@
  */
 package pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.collections.ArrayList;
 import pivot.collections.Dictionary;
@@ -49,6 +47,7 @@
 import pivot.wtk.media.Image;
 import pivot.wtk.skin.ButtonSkin;
 import pivot.wtk.skin.ContainerSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Accordion skin.
@@ -175,9 +174,8 @@
             graphics.fillRect(0, 0, width, height);
 
             // Paint the border
-            graphics.setStroke(new BasicStroke());
             graphics.setPaint(borderColor);
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 
             // Paint the content
             Button.DataRenderer dataRenderer = panelHeader.getDataRenderer();
@@ -507,9 +505,8 @@
         int width = getWidth();
         int height = getHeight();
 
-        graphics.setStroke(new BasicStroke());
         graphics.setPaint(borderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
     }
 
     public Color getBorderColor() {

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarButtonSkin.java Wed Apr 15 04:07:05 2009
@@ -41,6 +41,7 @@
 import pivot.wtk.effects.Transition;
 import pivot.wtk.effects.TransitionListener;
 import pivot.wtk.skin.CalendarButtonSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Terra calendar button skin.
@@ -230,13 +231,13 @@
 
         Bounds contentBounds = new Bounds(0, 0,
             Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(height - 1, 0));
-        graphics.draw(new Rectangle2D.Double(contentBounds.x + 0.5, contentBounds.y + 0.5,
-            contentBounds.width, contentBounds.height));
+        GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
+            contentBounds.width + 1, contentBounds.height + 1);
 
         Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 0), 0,
             TRIGGER_WIDTH, Math.max(height - 1, 0));
-        graphics.draw(new Rectangle2D.Double(triggerBounds.x + 0.5, triggerBounds.y + 0.5,
-            triggerBounds.width, triggerBounds.height));
+        GraphicsUtilities.drawRect(graphics, triggerBounds.x, triggerBounds.y,
+            triggerBounds.width + 1, triggerBounds.height + 1);
 
         // Paint the content
         Button.DataRenderer dataRenderer = calendarButton.getDataRenderer();

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCalendarSkin.java Wed Apr 15 04:07:05 2009
@@ -20,8 +20,6 @@
 import java.awt.Font;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
 import java.text.SimpleDateFormat;
 import java.util.GregorianCalendar;
 import java.util.Locale;
@@ -42,6 +40,7 @@
 import pivot.wtk.Keyboard;
 import pivot.wtk.Label;
 import pivot.wtk.Mouse;
+import pivot.wtk.Orientation;
 import pivot.wtk.Spinner;
 import pivot.wtk.SpinnerSelectionListener;
 import pivot.wtk.TablePane;
@@ -52,6 +51,7 @@
 import pivot.wtk.content.SpinnerItemRenderer;
 import pivot.wtk.skin.ButtonSkin;
 import pivot.wtk.skin.CalendarSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Terra calendar skin.
@@ -156,7 +156,7 @@
             CalendarDate date = (CalendarDate)dateButton.getButtonData();
             if (date.equals(today)) {
                 graphics.setColor(dividerColor);
-                graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+                GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
             }
 
             // Paint the content
@@ -549,7 +549,7 @@
 
         graphics.setColor(dividerColor);
         int dividerY = labelRowBounds.y + labelRowBounds.height - 2;
-        graphics.draw(new Line2D.Double(2.5, dividerY + 0.5, Math.max(0, width - 2.5), dividerY + 0.5));
+        GraphicsUtilities.drawLine(graphics, 2, dividerY, Math.max(0, width - 4), Orientation.HORIZONTAL);
     }
 
     private void updateLabels() {

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCheckboxSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCheckboxSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCheckboxSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraCheckboxSkin.java Wed Apr 15 04:07:05 2009
@@ -27,8 +27,10 @@
 import pivot.wtk.Button;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Checkbox;
+import pivot.wtk.Orientation;
 import pivot.wtk.Theme;
 import pivot.wtk.skin.CheckboxSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Terra checkbox skin.
@@ -199,13 +201,11 @@
 
         graphics.setPaint(new GradientPaint(buttonWidth / 2, 0, buttonBevelColor,
             buttonWidth / 2, buttonHeight, buttonColor));
-        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-            RenderingHints.VALUE_ANTIALIAS_OFF);
         graphics.fillRect(0, 0, buttonWidth, buttonHeight);
 
         // Paint the border
         graphics.setPaint(buttonBorderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, buttonWidth, buttonHeight));
+        GraphicsUtilities.drawRect(graphics, 0, 0, buttonWidth, buttonHeight);
 
         // Paint the checkmark
         Button.State state = checkbox.getState();
@@ -239,16 +239,8 @@
         } else {
             if (state == Button.State.MIXED) {
                 graphics.setColor(buttonSelectionColor);
-                graphics.setStroke(new BasicStroke(3f));
-
-                graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                    RenderingHints.VALUE_ANTIALIAS_ON);
-
-                int x0 = 4;
-                int x1 = CHECKBOX_SIZE - 5;
-                int y = CHECKBOX_SIZE / 2;
-
-                graphics.drawLine(x0, y, x1, y);
+                GraphicsUtilities.drawLine(graphics, 3, (CHECKBOX_SIZE - 3) / 2, CHECKBOX_SIZE - 7,
+                    Orientation.HORIZONTAL, 3);
             }
         }
     }

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraExpanderSkin.java Wed Apr 15 04:07:05 2009
@@ -22,8 +22,6 @@
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
-import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.collections.Dictionary;
 import pivot.util.Vote;
@@ -51,6 +49,7 @@
 import pivot.wtk.effects.easing.Quadratic;
 import pivot.wtk.media.Image;
 import pivot.wtk.skin.ContainerSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Expander skin.
@@ -435,14 +434,12 @@
         int width = getWidth();
         int height = getHeight();
 
-        graphics.setStroke(new BasicStroke());
-
         Expander expander = (Expander)getComponent();
         if (expander.isExpanded()) {
             int titleBarHeight = titleBarFlowPane.getPreferredHeight(-1);
 
             graphics.setPaint(titleBarBorderColor);
-            graphics.draw(new Line2D.Double(0.5, 1.5 + titleBarHeight, width - 0.5, 1.5 + titleBarHeight));
+            GraphicsUtilities.drawLine(graphics, 0, 1 + titleBarHeight, width, Orientation.HORIZONTAL);
         }
 
         int titleBarX = titleBarFlowPane.getX();
@@ -455,7 +452,7 @@
         graphics.fillRect(titleBarX, titleBarY, titleBarWidth, titleBarHeight);
 
         graphics.setPaint(borderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
     }
 
     public Font getTitleBarFont() {

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraFrameSkin.java Wed Apr 15 04:07:05 2009
@@ -22,7 +22,6 @@
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.collections.Dictionary;
 import pivot.wtk.Button;
@@ -37,6 +36,7 @@
 import pivot.wtk.Insets;
 import pivot.wtk.Label;
 import pivot.wtk.Mouse;
+import pivot.wtk.Orientation;
 import pivot.wtk.Point;
 import pivot.wtk.PushButton;
 import pivot.wtk.Bounds;
@@ -45,6 +45,7 @@
 import pivot.wtk.Window;
 import pivot.wtk.effects.DropShadowDecorator;
 import pivot.wtk.media.Image;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.WindowSkin;
 
 /**
@@ -113,7 +114,7 @@
         public void paint(Graphics2D graphics) {
             Window window = (Window)getComponent();
             graphics.setPaint(window.isActive() ? titleBarColor : inactiveTitleBarColor);
-            graphics.fill(new Rectangle2D.Double(0, 6, 8, 2));
+            graphics.fillRect(0, 6, 8, 2);
         }
     }
 
@@ -126,10 +127,10 @@
         public void paint(Graphics2D graphics) {
             Window window = (Window)getComponent();
             graphics.setPaint(window.isActive() ? titleBarColor : inactiveTitleBarColor);
-            graphics.fill(new Rectangle2D.Double(0, 0, 8, 8));
+            graphics.fillRect(0, 0, 8, 8);
 
             graphics.setPaint(window.isActive() ? titleBarBackgroundColor : inactiveTitleBarBackgroundColor);
-            graphics.fill(new Rectangle2D.Double(2, 2, 4, 4));
+            graphics.fillRect(2, 2, 4, 4);
         }
     }
 
@@ -143,11 +144,11 @@
             Window window = (Window)getComponent();
             graphics.setPaint(window.isActive() ?
                 titleBarColor : inactiveTitleBarColor);
-            graphics.fill(new Rectangle2D.Double(1, 1, 6, 6));
+            graphics.fillRect(1, 1, 6, 6);
 
             graphics.setPaint(window.isActive() ?
                 titleBarBackgroundColor : inactiveTitleBarBackgroundColor);
-            graphics.fill(new Rectangle2D.Double(3, 3, 2, 2));
+            graphics.fillRect(3, 3, 2, 2);
         }
     }
 
@@ -484,8 +485,6 @@
         int height = getHeight();
         int titleBarHeight = titleBarFlowPane.getHeight();
 
-        graphics.setStroke(new BasicStroke());
-
         // Draw the title area
         Color titleBarBackgroundColor = window.isActive() ?
             this.titleBarBackgroundColor : inactiveTitleBarBackgroundColor;
@@ -500,19 +499,18 @@
 
         // Draw the border
         graphics.setPaint(titleBarBorderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, titleBarHeight + 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, titleBarHeight + 2);
 
         // Draw the content area
         Bounds contentAreaRectangle = new Bounds(0, titleBarHeight + 2,
-            width - 1, height - (titleBarHeight + 3));
+            width, height - (titleBarHeight + 2));
         graphics.setPaint(contentBorderColor);
-        graphics.draw(new Rectangle2D.Double(contentAreaRectangle.x + 0.5, contentAreaRectangle.y + 0.5,
-            contentAreaRectangle.width, contentAreaRectangle.height));
+        GraphicsUtilities.drawRect(graphics, contentAreaRectangle.x, contentAreaRectangle.y,
+            contentAreaRectangle.width, contentAreaRectangle.height);
 
-        Line2D contentAreaBevelLine = new Line2D.Double(contentAreaRectangle.x + 1.5,
-            contentAreaRectangle.y + 1.5, contentAreaRectangle.width - 0.5, contentAreaRectangle.y + 1.5);
         graphics.setPaint(contentBevelColor);
-        graphics.draw(contentAreaBevelLine);
+        GraphicsUtilities.drawLine(graphics, contentAreaRectangle.x + 1,
+            contentAreaRectangle.y + 1, contentAreaRectangle.width - 2, Orientation.HORIZONTAL);
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraListButtonSkin.java Wed Apr 15 04:07:05 2009
@@ -43,6 +43,7 @@
 import pivot.wtk.effects.FadeTransition;
 import pivot.wtk.effects.Transition;
 import pivot.wtk.effects.TransitionListener;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.ListButtonSkin;
 
 /**
@@ -247,13 +248,13 @@
 
         Bounds contentBounds = new Bounds(0, 0,
             Math.max(width - TRIGGER_WIDTH - 1, 0), Math.max(height - 1, 0));
-        graphics.draw(new Rectangle2D.Double(contentBounds.x + 0.5, contentBounds.y + 0.5,
-            contentBounds.width, contentBounds.height));
+        GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
+            contentBounds.width + 1, contentBounds.height + 1);
 
         Bounds triggerBounds = new Bounds(Math.max(width - TRIGGER_WIDTH - 1, 0), 0,
             TRIGGER_WIDTH, Math.max(height - 1, 0));
-        graphics.draw(new Rectangle2D.Double(triggerBounds.x + 0.5, triggerBounds.y + 0.5,
-            triggerBounds.width, triggerBounds.height));
+        GraphicsUtilities.drawRect(graphics, triggerBounds.x, triggerBounds.y,
+            triggerBounds.width + 1, triggerBounds.height + 1);
 
         // Paint the content
         Button.DataRenderer dataRenderer = listButton.getDataRenderer();

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMenuButtonSkin.java Wed Apr 15 04:07:05 2009
@@ -33,6 +33,7 @@
 import pivot.wtk.Insets;
 import pivot.wtk.MenuButton;
 import pivot.wtk.Theme;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.MenuButtonSkin;
 
 /**
@@ -140,8 +141,6 @@
             }
         }
 
-        graphics.setStroke(new BasicStroke());
-
         // Paint the background
     	if (backgroundColor != null
 			&& bevelColor != null) {
@@ -153,7 +152,7 @@
         // Paint the border
         if (borderColor != null) {
             graphics.setPaint(borderColor);
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
         }
 
         Bounds contentBounds = new Bounds(padding.left + 1, padding.top + 1,

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMeterSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMeterSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMeterSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraMeterSkin.java Wed Apr 15 04:07:05 2009
@@ -16,18 +16,20 @@
  */
 package pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
+import java.awt.RenderingHints;
 import java.awt.geom.Rectangle2D;
 
 import pivot.wtk.Component;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Meter;
 import pivot.wtk.MeterListener;
+import pivot.wtk.Orientation;
 import pivot.wtk.Theme;
 import pivot.wtk.skin.ComponentSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Meter skin.
@@ -101,20 +103,20 @@
         int height = getHeight();
         int meterStop = (int)(meter.getPercentage() * width);
 
-        graphics.setStroke(new BasicStroke());
-
         graphics.setPaint(new GradientPaint(0, 0, TerraTheme.brighten(color),
             0, height, TerraTheme.darken(color)));
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
         graphics.fillRect(0, 0, meterStop - 1, height - 1);
 
         graphics.setPaint(gridColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 
         int nLines = (int)Math.ceil(1 / gridFrequency) - 1;
         float gridSeparation = width * gridFrequency;
         for (int i = 0; i < nLines; i++) {
             int gridX = (int)((i + 1) * gridSeparation);
-            graphics.drawLine(gridX, 0, gridX, height - 1);
+            GraphicsUtilities.drawLine(graphics, gridX, 0, height, Orientation.VERTICAL);
         }
     }
 

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPaletteSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPaletteSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPaletteSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPaletteSkin.java Wed Apr 15 04:07:05 2009
@@ -23,7 +23,6 @@
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.collections.Dictionary;
 import pivot.wtk.Bounds;
@@ -38,6 +37,7 @@
 import pivot.wtk.Label;
 import pivot.wtk.LinkButton;
 import pivot.wtk.Mouse;
+import pivot.wtk.Orientation;
 import pivot.wtk.Palette;
 import pivot.wtk.Point;
 import pivot.wtk.Theme;
@@ -46,6 +46,7 @@
 import pivot.wtk.WindowListener;
 import pivot.wtk.effects.DropShadowDecorator;
 import pivot.wtk.media.Image;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.WindowSkin;
 
 /**
@@ -331,17 +332,17 @@
 
         // Draw the border
         graphics.setPaint(titleBarBorderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, titleBarHeight + 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, titleBarHeight + 1);
         // Draw the content area
         Bounds contentAreaRectangle = new Bounds(0, titleBarHeight + 2,
-            width - 1, height - (titleBarHeight + 3));
+            width, height - (titleBarHeight + 2));
         graphics.setPaint(contentBorderColor);
-        graphics.draw(new Rectangle2D.Double(contentAreaRectangle.x + 0.5, contentAreaRectangle.y + 0.5,
-            contentAreaRectangle.width, contentAreaRectangle.height));
+        GraphicsUtilities.drawRect(graphics, contentAreaRectangle.x, contentAreaRectangle.y,
+            contentAreaRectangle.width, contentAreaRectangle.height);
 
         graphics.setPaint(contentBevelColor);
-        graphics.draw(new Line2D.Double(contentAreaRectangle.x + 1.5, contentAreaRectangle.y + 1.5,
-            contentAreaRectangle.width - 1.5, contentAreaRectangle.y + 1.5));
+        GraphicsUtilities.drawLine(graphics, contentAreaRectangle.x + 1,
+            contentAreaRectangle.y + 1, contentAreaRectangle.width - 2, Orientation.HORIZONTAL);
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraPushButtonSkin.java Wed Apr 15 04:07:05 2009
@@ -31,6 +31,7 @@
 import pivot.wtk.Insets;
 import pivot.wtk.PushButton;
 import pivot.wtk.Theme;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.PushButtonSkin;
 
 /**
@@ -193,8 +194,6 @@
             }
         }
 
-        graphics.setStroke(new BasicStroke());
-
         // Paint the background
     	if (backgroundColor != null
 			&& bevelColor != null) {
@@ -206,7 +205,7 @@
         // Paint the border
         if (borderColor != null) {
             graphics.setPaint(borderColor);
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
         }
 
         // Paint the content

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraScrollBarSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraScrollBarSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraScrollBarSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraScrollBarSkin.java Wed Apr 15 04:07:05 2009
@@ -37,6 +37,7 @@
 import pivot.wtk.media.Image;
 import pivot.wtk.skin.ComponentSkin;
 import pivot.wtk.skin.ContainerSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Scroll bar skin.
@@ -259,8 +260,7 @@
 
             // Paint the border
             graphics.setPaint(borderColor);
-            graphics.setStroke(new BasicStroke());
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 
             // Determine the button image size
             ScrollButtonImage buttonImage = scrollButton.getButtonImage();
@@ -484,7 +484,7 @@
             // Paint the border
             graphics.setPaint(borderColor);
             graphics.setStroke(new BasicStroke());
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 
             // Paint the hash marks
             if (orientation == Orientation.HORIZONTAL) {
@@ -788,7 +788,6 @@
         int width = getWidth();
         int height = getHeight();
 
-        graphics.setStroke(new BasicStroke());
         graphics.setPaint(borderColor);
 
         // Paint the scroll bar border lines
@@ -796,18 +795,18 @@
             int scrollUpButtonWidth = scrollUpButton.getWidth();
             int scrollDownButtonWidth = scrollDownButton.getWidth();
 
-            graphics.draw(new Line2D.Double(scrollUpButtonWidth + 0.5, 0.5,
-                width - scrollDownButtonWidth - 0.5, 0.5));
-            graphics.draw(new Line2D.Double(scrollUpButtonWidth + 0.5, height - 0.5,
-                width - scrollDownButtonWidth - 0.5, height - 0.5));
+            GraphicsUtilities.drawLine(graphics, scrollUpButtonWidth, 0,
+                width - scrollDownButtonWidth - scrollUpButtonWidth, Orientation.HORIZONTAL);
+            GraphicsUtilities.drawLine(graphics, scrollUpButtonWidth, height - 1,
+                width - scrollDownButtonWidth - scrollUpButtonWidth, Orientation.HORIZONTAL);
         } else {
             int scrollUpButtonHeight = scrollUpButton.getHeight();
             int scrollDownButtonHeight = scrollDownButton.getHeight();
 
-            graphics.draw(new Line2D.Double(0.5, scrollUpButtonHeight + 0.5, 0.5,
-                height - scrollDownButtonHeight - 0.5));
-            graphics.draw(new Line2D.Double(width - 0.5, scrollUpButtonHeight + 0.5, width - 0.5,
-                height - scrollDownButtonHeight - 0.5));
+            GraphicsUtilities.drawLine(graphics, 0, scrollUpButtonHeight,
+                height - scrollDownButtonHeight - scrollUpButtonHeight, Orientation.VERTICAL);
+            GraphicsUtilities.drawLine(graphics, width - 1, scrollUpButtonHeight,
+                height - scrollDownButtonHeight - scrollUpButtonHeight, Orientation.VERTICAL);
         }
     }
 

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSheetSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSheetSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSheetSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSheetSkin.java Wed Apr 15 04:07:05 2009
@@ -18,8 +18,6 @@
 
 import java.awt.Color;
 import java.awt.Graphics2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.collections.Dictionary;
 import pivot.util.Vote;
@@ -30,6 +28,7 @@
 import pivot.wtk.Insets;
 import pivot.wtk.Keyboard;
 import pivot.wtk.Mouse;
+import pivot.wtk.Orientation;
 import pivot.wtk.Sheet;
 import pivot.wtk.SheetStateListener;
 import pivot.wtk.Theme;
@@ -38,6 +37,7 @@
 import pivot.wtk.effects.SlideTransition;
 import pivot.wtk.effects.Transition;
 import pivot.wtk.effects.TransitionListener;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.WindowSkin;
 
 /**
@@ -216,10 +216,10 @@
         int height = getHeight();
 
         graphics.setPaint(borderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 
         graphics.setPaint(bevelColor);
-        graphics.draw(new Line2D.Double(1.5, height - 1.5, width - 1.5, height - 1.5));
+        GraphicsUtilities.drawLine(graphics, 1, height - 2, width - 2, Orientation.HORIZONTAL);
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSliderSkin.java Wed Apr 15 04:07:05 2009
@@ -16,19 +16,20 @@
  */
 package pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
-import java.awt.geom.Rectangle2D;
+import java.awt.RenderingHints;
 
 import pivot.wtk.Component;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Mouse;
+import pivot.wtk.Orientation;
 import pivot.wtk.Point;
 import pivot.wtk.Slider;
 import pivot.wtk.Theme;
 import pivot.wtk.skin.ComponentSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.skin.SliderSkin;
 
 /**
@@ -86,9 +87,8 @@
         	graphics.setPaint(new Color(0, 0, 0, alpha));
             graphics.fillRect(0, 0, width, height);
 
-            graphics.setStroke(new BasicStroke());
             graphics.setPaint(buttonBorderColor);
-            graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+            GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 		}
 
         @Override
@@ -259,9 +259,11 @@
 		int width = getWidth();
 		int height = getHeight();
 
-		graphics.setStroke(new BasicStroke(trackWidth));
 		graphics.setColor(trackColor);
-		graphics.drawLine(0, height / 2, width, height / 2);
+        graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+            RenderingHints.VALUE_ANTIALIAS_ON);
+        GraphicsUtilities.drawLine(graphics, 0, (height - trackWidth) / 2,
+            width, Orientation.HORIZONTAL, trackWidth);
 	}
 
 	public Color getTrackColor() {

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSpinnerSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSpinnerSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSpinnerSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraSpinnerSkin.java Wed Apr 15 04:07:05 2009
@@ -22,16 +22,16 @@
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
-import java.awt.geom.Line2D;
 import java.awt.geom.Rectangle2D;
 
 import pivot.collections.List;
 import pivot.wtk.ApplicationContext;
+import pivot.wtk.Bounds;
 import pivot.wtk.Component;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Keyboard;
 import pivot.wtk.Mouse;
-import pivot.wtk.Bounds;
+import pivot.wtk.Orientation;
 import pivot.wtk.Spinner;
 import pivot.wtk.SpinnerListener;
 import pivot.wtk.SpinnerSelectionListener;
@@ -39,6 +39,7 @@
 import pivot.wtk.media.Image;
 import pivot.wtk.skin.ComponentSkin;
 import pivot.wtk.skin.ContainerSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Spinner skin.
@@ -613,13 +614,12 @@
     		buttonX + buttonWidth / 2, buttonHeight, buttonBackgroundColor));
         graphics.fillRect(buttonX, 0, buttonWidth, height);
 
-        graphics.setStroke(new BasicStroke());
         graphics.setPaint(borderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
-        graphics.draw(new Line2D.Double(width - buttonWidth - 1.5, 0,
-            width - buttonWidth - 1.5, height - 1));
-        graphics.draw(new Line2D.Double(width - buttonWidth - 1.5, buttonHeight + 0.5,
-            width - 0.5, buttonHeight + 0.5));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
+        GraphicsUtilities.drawLine(graphics, width - buttonWidth - 2, 0,
+            height, Orientation.VERTICAL);
+        GraphicsUtilities.drawLine(graphics, width - buttonWidth - 2, buttonHeight,
+            buttonWidth + 1, Orientation.HORIZONTAL);
     }
 
     @Override

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTabPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTabPaneSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTabPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTabPaneSkin.java Wed Apr 15 04:07:05 2009
@@ -16,13 +16,10 @@
  */
 package pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.Rectangle2D;
 
 import pivot.collections.Dictionary;
 import pivot.collections.Sequence;
@@ -54,6 +51,7 @@
 import pivot.wtk.media.Image;
 import pivot.wtk.skin.ButtonSkin;
 import pivot.wtk.skin.ContainerSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Tab pane skin.
@@ -222,8 +220,6 @@
             int width = getWidth();
             int height = getHeight();
 
-            graphics.setStroke(new BasicStroke());
-
             // Draw the background
             graphics.setPaint(backgroundColor);
             graphics.fillRect(0, 0, width, height);
@@ -251,21 +247,21 @@
                 || tabButton.active) {
                 switch(tabOrientation) {
                     case HORIZONTAL: {
-                        graphics.draw(new Line2D.Double(0.5, height - 0.5, 0.5, 0.5));
-                        graphics.draw(new Line2D.Double(0.5, 0.5, width - 0.5, 0.5));
-                        graphics.draw(new Line2D.Double(width - 0.5, 0.5, width - 0.5, height - 0.5));
+                        GraphicsUtilities.drawLine(graphics, 0, 0, height, Orientation.VERTICAL);
+                        GraphicsUtilities.drawLine(graphics, 0, 0, width, Orientation.HORIZONTAL);
+                        GraphicsUtilities.drawLine(graphics, width - 1, 0, height, Orientation.VERTICAL);
                         break;
                     }
 
                     case VERTICAL: {
-                        graphics.draw(new Line2D.Double(width - 0.5, 0.5, 0.5, 0.5));
-                        graphics.draw(new Line2D.Double(0.5, 0.5, 0.5, height - 0.5));
-                        graphics.draw(new Line2D.Double(0.5, height - 0.5, width - 0.5, height - 0.5));
+                        GraphicsUtilities.drawLine(graphics, 0, 0, width, Orientation.HORIZONTAL);
+                        GraphicsUtilities.drawLine(graphics, 0, 0, height, Orientation.VERTICAL);
+                        GraphicsUtilities.drawLine(graphics, 0, height - 1, width, Orientation.HORIZONTAL);
                         break;
                     }
                 }
             } else {
-                graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+                GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
             }
 
             // Paint the content
@@ -830,8 +826,6 @@
         // Call the base class to paint the background
         super.paint(graphics);
 
-        graphics.setStroke(new BasicStroke());
-
         // Paint the content background and border
         int x = 0;
         int y = 0;
@@ -872,9 +866,8 @@
 
             // Draw the border
             graphics.setPaint(borderColor);
-            graphics.draw(new Rectangle2D.Double(contentBounds.x + 0.5, contentBounds.y + 0.5,
-                Math.max(contentBounds.width - 1, 0),
-                Math.max(contentBounds.height - 1, 0)));
+            GraphicsUtilities.drawRect(graphics, contentBounds.x, contentBounds.y,
+                contentBounds.width, contentBounds.height);
 
             // Draw the bevel for vertical tabs
             if (tabOrientation == Orientation.VERTICAL) {

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java Wed Apr 15 04:07:05 2009
@@ -23,14 +23,14 @@
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
-import java.awt.geom.Line2D;
 
 import pivot.collections.Sequence;
+import pivot.wtk.Bounds;
 import pivot.wtk.Component;
 import pivot.wtk.Cursor;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Mouse;
-import pivot.wtk.Bounds;
+import pivot.wtk.Orientation;
 import pivot.wtk.SortDirection;
 import pivot.wtk.TableView;
 import pivot.wtk.TableViewColumnListener;
@@ -39,6 +39,7 @@
 import pivot.wtk.Theme;
 import pivot.wtk.media.Image;
 import pivot.wtk.skin.ComponentSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Table view header skin.
@@ -248,15 +249,13 @@
             borderColor = disabledBorderColor;
         }
 
-        graphics.setStroke(new BasicStroke());
-
         graphics.setPaint(new GradientPaint(width / 2, 0, bevelColor,
             width / 2, height, backgroundColor));
         graphics.fillRect(0, 0, width, height);
 
         // Paint the border
         graphics.setPaint(borderColor);
-        graphics.draw(new Line2D.Double(0.5, height - 0.5, width - 0.5, height - 0.5));
+        GraphicsUtilities.drawLine(graphics, 0, height - 1, width, Orientation.HORIZONTAL);
 
         // Paint the content
         TableView tableView = tableViewHeader.getTableView();
@@ -325,9 +324,8 @@
                 // Draw the divider
                 cellX += columnWidth;
 
-                Line2D dividerLine = new Line2D.Double(cellX + 0.5, 0.5, cellX + 0.5, height - 0.5);
                 graphics.setPaint(borderColor);
-                graphics.draw(dividerLine);
+                GraphicsUtilities.drawLine(graphics, cellX, 0, height, Orientation.VERTICAL);
 
                 cellX++;
             }

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTableViewSkin.java Wed Apr 15 04:07:05 2009
@@ -21,16 +21,16 @@
 import java.awt.Font;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
-import java.awt.geom.Line2D;
 
 import pivot.collections.ArrayList;
 import pivot.collections.List;
 import pivot.collections.Sequence;
+import pivot.wtk.Bounds;
 import pivot.wtk.Component;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Keyboard;
 import pivot.wtk.Mouse;
-import pivot.wtk.Bounds;
+import pivot.wtk.Orientation;
 import pivot.wtk.SortDirection;
 import pivot.wtk.Span;
 import pivot.wtk.TableView;
@@ -41,6 +41,7 @@
 import pivot.wtk.TableViewSelectionListener;
 import pivot.wtk.Theme;
 import pivot.wtk.skin.ComponentSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Table view skin.
@@ -248,7 +249,6 @@
         }
 
         // Set the grid stroke and color
-        graphics.setStroke(new BasicStroke());
         graphics.setPaint(gridColor);
 
         // Paint the vertical grid lines
@@ -259,7 +259,7 @@
                 columnIndex < columnCount; columnIndex++) {
                 gridX += columnWidths.get(columnIndex);
 
-                graphics.draw(new Line2D.Double(gridX + 0.5, 0.5, gridX + 0.5, height - 0.5));
+                GraphicsUtilities.drawLine(graphics, gridX, 0, height, Orientation.VERTICAL);
                 gridX++;
             }
         }
@@ -269,7 +269,7 @@
             for (int rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {
                 if (rowIndex > 0) {
                     int gridY = rowIndex * rowHeight;
-                    graphics.draw(new Line2D.Double(0.5, gridY + 0.5, width - 0.5, gridY + 0.5));
+                    GraphicsUtilities.drawLine(graphics, 0, gridY, width, Orientation.HORIZONTAL);
                 }
             }
         }

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTextInputSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTextInputSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTextInputSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTextInputSkin.java Wed Apr 15 04:07:05 2009
@@ -26,7 +26,6 @@
 import java.awt.font.LineMetrics;
 import java.awt.font.TextHitInfo;
 import java.awt.font.TextLayout;
-import java.awt.geom.Line2D;
 import java.awt.geom.Rectangle2D;
 // import java.text.AttributedCharacterIterator;
 
@@ -39,6 +38,7 @@
 import pivot.wtk.Insets;
 import pivot.wtk.Keyboard;
 import pivot.wtk.Mouse;
+import pivot.wtk.Orientation;
 import pivot.wtk.Platform;
 import pivot.wtk.TextInput;
 import pivot.wtk.TextInputCharacterListener;
@@ -46,6 +46,7 @@
 import pivot.wtk.TextInputSelectionListener;
 import pivot.wtk.Theme;
 import pivot.wtk.skin.ComponentSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 import pivot.wtk.text.TextNode;
 import pivot.wtk.text.validation.Validator;
 
@@ -373,11 +374,11 @@
 
         // Paint the bevel
         graphics.setPaint(bevelColor);
-        graphics.draw(new Line2D.Double(1.5, 1.5, width - 1.5, 1.5));
+        GraphicsUtilities.drawLine(graphics, 1, 1, width - 2, Orientation.HORIZONTAL);
 
         // Paint the border
         graphics.setPaint(borderColor);
-        graphics.draw(new Rectangle2D.Double(0.5, 0.5, width - 1, height - 1));
+        GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
 
         // Paint the content
         String text = getText();

Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTreeViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTreeViewSkin.java?rev=765042&r1=765041&r2=765042&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTreeViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTreeViewSkin.java Wed Apr 15 04:07:05 2009
@@ -16,26 +16,25 @@
  */
 package pivot.wtk.skin.terra;
 
-import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.geom.GeneralPath;
-import java.awt.geom.Line2D;
 
 import pivot.collections.ArrayList;
 import pivot.collections.List;
 import pivot.collections.Sequence;
 import pivot.collections.Sequence.Tree.Path;
+import pivot.wtk.Bounds;
 import pivot.wtk.Button;
 import pivot.wtk.Checkbox;
 import pivot.wtk.Component;
 import pivot.wtk.Dimensions;
 import pivot.wtk.Keyboard;
 import pivot.wtk.Mouse;
-import pivot.wtk.Bounds;
+import pivot.wtk.Orientation;
 import pivot.wtk.Theme;
 import pivot.wtk.TreeView;
 import pivot.wtk.TreeViewListener;
@@ -44,6 +43,7 @@
 import pivot.wtk.TreeViewNodeStateListener;
 import pivot.wtk.TreeViewSelectionListener;
 import pivot.wtk.skin.ComponentSkin;
+import pivot.wtk.skin.GraphicsUtilities;
 
 /**
  * Tree view skin.
@@ -420,8 +420,6 @@
                 clipBounds.height) / (double)(nodeHeight + VERTICAL_SPACING)));
         }
 
-        BasicStroke gridStroke = new BasicStroke();
-
         int nodeY = nodeStart * (nodeHeight + VERTICAL_SPACING);
 
         for (int i = nodeStart; i <= nodeEnd; i++) {
@@ -544,11 +542,9 @@
 
             // Paint the grid line
             if (showGridLines) {
-                graphics.setStroke(gridStroke);
                 graphics.setPaint(gridColor);
 
-                graphics.draw(new Line2D.Double(0.5, nodeY + nodeHeight + 0.5,
-                    width - 0.5, nodeY + nodeHeight + 0.5));
+                GraphicsUtilities.drawLine(graphics, 0, nodeY + nodeHeight, width, Orientation.HORIZONTAL);
             }
 
             nodeY += nodeHeight + VERTICAL_SPACING;