/*
* 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.
*/
/**
* This class converts calls to the basic pixel rendering methods
* into calls to the methods on a ParallelogramPipe.
* Most calls are transformed into calls to the fill(Shape) method
* by the parent PixelToShapeConverter class, but some calls are
* transformed into calls to fill/drawParallelogram().
*/
implements ShapeDrawPipe
{
double minPenSize;
double normPosition;
double normRoundingBias;
boolean adjustfill;
/**
* @param shapepipe pipeline to forward shape calls to
* @param pgrampipe pipeline to forward parallelogram calls to
* (and drawLine calls if possible)
* @param minPenSize minimum pen size for dropout control
* @param normPosition sub-pixel location to normalize endpoints
* for STROKE_NORMALIZE cases
* @param adjustFill boolean to control whethere normalization
* constants are also applied to fill operations
* (normally true for non-AA, false for AA)
*/
double minPenSize,
double normPosition,
boolean adjustfill)
{
super(shapepipe);
this.minPenSize = minPenSize;
this.normPosition = normPosition;
this.adjustfill = adjustfill;
}
{
}
}
int x, int y, int w, int h)
{
if (w >= 0 && h >= 0) {
if (w > 0 && h > 0) {
{
return;
}
} else {
// Note: This calls the integer version which
// will verify that the local drawLine optimizations
// work and call super.drawLine(), if not.
return;
}
}
}
}
int x, int y, int w, int h)
{
if (w > 0 && h > 0) {
fillRectangle(sg2d, x, y, w, h);
}
}
if (s instanceof Rectangle2D) {
{
if (w >= 0 && h >= 0) {
}
return;
}
} else if (s instanceof Line2D) {
if (drawGeneralLine(sg2d,
{
return;
}
}
}
}
if (s instanceof Rectangle2D) {
if (w > 0 && h > 0) {
fillRectangle(sg2d, x, y, w, h);
}
return;
}
}
static double len(double x, double y) {
}
double normalize(double v) {
}
{
{
return false;
}
// TODO: we could construct the GeneralPath directly
// for CAP_ROUND and save a lot of processing in that case...
// And again, we would need to deal with dropout control...
return false;
}
// Save the original dx, dy in case we need it to transform
// the linewidth as a perpendicular vector below
switch (sg2d.transformState) {
{
}
break;
{
}
break;
break;
default:
throw new InternalError("unknown TRANSFORM state...");
}
outrenderer instanceof PixelDrawPipe)
{
// PixelDrawPipes will add sg2d.transXY so we need to factor
// that out...
return true;
}
}
// Transform the linewidth...
// calculate the scaling factor for a unit vector
// perpendicular to the original user space line.
if (len == 0) {
// dy = 0; already
}
// delta transform the transposed (90 degree rotated) unit vector
}
if (len == 0) {
return true;
}
udy = 0;
} else {
}
}
return true;
}
{
if (adjustfill &&
{
}
}
double lw)
{
// lw along dx1,dy1 scale by transformed length of dx2,dy2 vectors
// and vice versa
{
}
// The line widths are large enough to consume the
// entire hole in the middle of the parallelogram
// so we can just fill the outer parallelogram.
} else {
}
}
/**
* This utility function handles the case where a drawRectangle
* operation discovered that the interior hole in the rectangle
* or parallelogram has been completely filled in by the stroke
* width. It calculates the outer parallelogram of the stroke
* and issues a single fillParallelogram request to fill it.
*/
{
if (len1 == 0) {
// len1 is 0, replace udxy1 with perpendicular of udxy2
if (len2 == 0) {
// both are 0, use a unit Y vector for udxy2
udx2 = 0;
udy2 = 1;
}
} else if (len2 == 0) {
// len2 is 0, replace udxy2 with perpendicular of udxy1
}
}
}