/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Paint9Painter is used for painting images for both Synth and GTK's
*
*/
/**
* Enumeration for the types of painting this class can handle.
*/
public enum PaintType {
/**
* Painting type indicating the image should be centered in
* the space provided. When used the <code>mask</code> is ignored.
*/
/**
* Painting type indicating the image should be tiled across the
* specified width and height. When used the <code>mask</code> is
* ignored.
*/
TILE,
/**
* Painting type indicating the image should be split into nine
* regions with the top, left, bottom and right areas stretched.
*/
/**
* Painting type indicating the image should be split into nine
* regions with the top, left, bottom and right areas tiled.
*/
};
/**
* Specifies that all regions should be painted. If this is set any
* other regions specified will not be painted. For example
* PAINT_ALL | PAINT_CENTER will paint all but the center.
*/
/**
* Conveniance method for testing the validity of an image.
*
* @param image Image to check.
* @return true if <code>image</code> is non-null and has a positive
* size.
*/
}
super(cacheCount);
}
/**
* Paints using the algorightm specified by <code>paintType</code>.
* NOTE that this just invokes super.paint(...) with the same
* argument ordering as this method.
*
* @param c Component rendering to
* @param g Graphics to render to
* @param x X-coordinate
* @param y Y-coordinate
* @param w Width to render to
* @param h Height to render to
* @param source Image to render from, if <code>null</code> this method
* will do nothing
* @param sInsets Insets specifying the portion of the image that
* will be stretched or tiled, if <code>null</code> empty
* <code>Insets</code> will be used.
* @param dInsets Destination insets specifying the portion of the image
* will be stretched or tiled, if <code>null</code> empty
* <code>Insets</code> will be used.
* @param paintType Specifies what type of algorithm to use in painting
* @param mask Specifies portion of image to render, if
* <code>PAINT_ALL</code> is specified, any other regions
* specified will not be painted, for example
* PAINT_ALL | PAINT_CENTER paints everything but the center.
*/
return;
}
}
int argIndex = 0;
}
}
if (!validImage(image)) {
return;
}
}
}
// Center the image
}
// Tile the image
int lastIY = 0;
int lastIX = 0;
}
}
}
else {
// Constrain the insets to the size of the image
}
}
// Constrain the insets to the size of the region we're painting
// in.
}
}
}
}
}
}
}
}
}
}
}
}
}
}
// PENDING: is this necessary, will G2D do it for me?
// Bogus location, nothing to paint
return;
}
}
/**
* Draws a portion of an image, stretched or tiled.
*
* @param image Image to render.
* @param g Graphics to render to
* @param stretch Whether the image should be stretched or timed in the
* provided space.
* @param dx1 X origin to draw to
* @param dy1 Y origin to draw to
* @param dx2 End x location to draw to
* @param dy2 End y location to draw to
* @param sx1 X origin to draw from
* @param sy1 Y origin to draw from
* @param sx2 Max x location to draw from
* @param sy2 Max y location to draw from
* @param xDirection Used if the image is not stretched. If true it
* indicates the image should be tiled along the x axis.
*/
boolean xDirection) {
// Bogus location, nothing to paint
return;
}
if (stretch) {
}
else {
int deltaX;
int deltaY;
if (xDirection) {
deltaY = 0;
}
else {
deltaX = 0;
}
}
}
}
/**
* Subclassed to always create a translucent image.
*/
}
}
}