提交 7d835a46 编写于 作者: D dlila

6967436: lines longer than 2^15 can fill window.

6967433: dashed lines broken when using scaling transforms.
Summary: converted pisces to floating point. Also, using better AA algorithm
Reviewed-by: flar
上级 2787aeb2
...@@ -36,117 +36,71 @@ package sun.java2d.pisces; ...@@ -36,117 +36,71 @@ package sun.java2d.pisces;
* semantics are unclear. * semantics are unclear.
* *
*/ */
public class Dasher extends LineSink { public class Dasher implements LineSink {
private final LineSink output;
private final float[] dash;
private final float startPhase;
private final boolean startDashOn;
private final int startIdx;
LineSink output; private final float m00, m10, m01, m11;
int[] dash; private final float det;
int startPhase;
boolean startDashOn;
int startIdx;
int idx; private boolean firstDashOn;
boolean dashOn; private boolean starting;
int phase;
int sx, sy; private int idx;
int x0, y0; private boolean dashOn;
private float phase;
int m00, m01; private float sx, sy;
int m10, m11; private float x0, y0;
private float sx1, sy1;
Transform4 transform;
boolean symmetric;
long ldet;
boolean firstDashOn;
boolean starting;
int sx1, sy1;
/**
* Empty constructor. <code>setOutput</code> and
* <code>setParameters</code> must be called prior to calling any
* other methods.
*/
public Dasher() {}
/** /**
* Constructs a <code>Dasher</code>. * Constructs a <code>Dasher</code>.
* *
* @param output an output <code>LineSink</code>. * @param output an output <code>LineSink</code>.
* @param dash an array of <code>int</code>s containing the dash * @param dash an array of <code>int</code>s containing the dash pattern
* pattern in S15.16 format. * @param phase an <code>int</code> containing the dash phase
* @param phase an <code>int</code> containing the dash phase in
* S15.16 format.
* @param transform a <code>Transform4</code> object indicating * @param transform a <code>Transform4</code> object indicating
* the transform that has been previously applied to all incoming * the transform that has been previously applied to all incoming
* coordinates. This is required in order to compute dash lengths * coordinates. This is required in order to compute dash lengths
* properly. * properly.
*/ */
public Dasher(LineSink output, public Dasher(LineSink output,
int[] dash, int phase, float[] dash, float phase,
Transform4 transform) { float a00, float a01, float a10, float a11) {
setOutput(output);
setParameters(dash, phase, transform);
}
/**
* Sets the output <code>LineSink</code> of this
* <code>Dasher</code>.
*
* @param output an output <code>LineSink</code>.
*/
public void setOutput(LineSink output) {
this.output = output;
}
/**
* Sets the parameters of this <code>Dasher</code>.
*
* @param dash an array of <code>int</code>s containing the dash
* pattern in S15.16 format.
* @param phase an <code>int</code> containing the dash phase in
* S15.16 format.
* @param transform a <code>Transform4</code> object indicating
* the transform that has been previously applied to all incoming
* coordinates. This is required in order to compute dash lengths
* properly.
*/
public void setParameters(int[] dash, int phase,
Transform4 transform) {
if (phase < 0) { if (phase < 0) {
throw new IllegalArgumentException("phase < 0 !"); throw new IllegalArgumentException("phase < 0 !");
} }
this.output = output;
// Normalize so 0 <= phase < dash[0] // Normalize so 0 <= phase < dash[0]
int idx = 0; int idx = 0;
dashOn = true; dashOn = true;
int d; float d;
while (phase >= (d = dash[idx])) { while (phase >= (d = dash[idx])) {
phase -= d; phase -= d;
idx = (idx + 1) % dash.length; idx = (idx + 1) % dash.length;
dashOn = !dashOn; dashOn = !dashOn;
} }
this.dash = new int[dash.length]; this.dash = dash;
for (int i = 0; i < dash.length; i++) {
this.dash[i] = dash[i];
}
this.startPhase = this.phase = phase; this.startPhase = this.phase = phase;
this.startDashOn = dashOn; this.startDashOn = dashOn;
this.startIdx = idx; this.startIdx = idx;
this.transform = transform; m00 = a00;
m01 = a01;
this.m00 = transform.m00; m10 = a10;
this.m01 = transform.m01; m11 = a11;
this.m10 = transform.m10; det = m00 * m11 - m01 * m10;
this.m11 = transform.m11;
this.ldet = ((long)m00*m11 - (long)m01*m10) >> 16;
this.symmetric = (m00 == m11 && m10 == -m01);
} }
public void moveTo(int x0, int y0) { public void moveTo(float x0, float y0) {
output.moveTo(x0, y0); output.moveTo(x0, y0);
this.idx = startIdx; this.idx = startIdx;
this.dashOn = this.startDashOn; this.dashOn = this.startDashOn;
...@@ -160,7 +114,7 @@ public class Dasher extends LineSink { ...@@ -160,7 +114,7 @@ public class Dasher extends LineSink {
output.lineJoin(); output.lineJoin();
} }
private void goTo(int x1, int y1) { private void goTo(float x1, float y1) {
if (dashOn) { if (dashOn) {
if (starting) { if (starting) {
this.sx1 = x1; this.sx1 = x1;
...@@ -180,52 +134,64 @@ public class Dasher extends LineSink { ...@@ -180,52 +134,64 @@ public class Dasher extends LineSink {
this.y0 = y1; this.y0 = y1;
} }
public void lineTo(int x1, int y1) { public void lineTo(float x1, float y1) {
while (true) { // The widened line is squished to a 0 width one, so no drawing is done
int d = dash[idx] - phase; if (det == 0) {
int lx = x1 - x0; goTo(x1, y1);
int ly = y1 - y0; return;
}
// Compute segment length in the untransformed float dx = x1 - x0;
// coordinate system float dy = y1 - y0;
// IMPL NOTE - use fixed point
int l; // Compute segment length in the untransformed
if (symmetric) { // coordinate system
l = (int)((PiscesMath.hypot(lx, ly)*65536L)/ldet);
} else{
long la = ((long)ly*m00 - (long)lx*m10)/ldet;
long lb = ((long)ly*m01 - (long)lx*m11)/ldet;
l = (int)PiscesMath.hypot(la, lb);
}
if (l < d) { float la = (dy*m00 - dx*m10)/det;
float lb = (dy*m01 - dx*m11)/det;
float origLen = (float) Math.hypot(la, lb);
if (origLen == 0) {
// Let the output LineSink deal with cases where dx, dy are 0.
goTo(x1, y1);
return;
}
// The scaling factors needed to get the dx and dy of the
// transformed dash segments.
float cx = dx / origLen;
float cy = dy / origLen;
while (true) {
float leftInThisDashSegment = dash[idx] - phase;
if (origLen < leftInThisDashSegment) {
goTo(x1, y1); goTo(x1, y1);
// Advance phase within current dash segment // Advance phase within current dash segment
phase += l; phase += origLen;
return;
} else if (origLen == leftInThisDashSegment) {
goTo(x1, y1);
phase = 0f;
idx = (idx + 1) % dash.length;
dashOn = !dashOn;
return; return;
} }
long t; float dashx, dashy;
int xsplit, ysplit; float dashdx = dash[idx] * cx;
// // For zero length dashses, SE appears to move 1/8 unit float dashdy = dash[idx] * cy;
// // in device space if (phase == 0) {
// if (d == 0) { dashx = x0 + dashdx;
// double dlx = lx/65536.0; dashy = y0 + dashdy;
// double dly = ly/65536.0; } else {
// len = PiscesMath.hypot(dlx, dly); float p = (leftInThisDashSegment) / dash[idx];
// double dt = 1.0/(8*len); dashx = x0 + p * dashdx;
// double dxsplit = (x0/65536.0) + dt*dlx; dashy = y0 + p * dashdy;
// double dysplit = (y0/65536.0) + dt*dly; }
// xsplit = (int)(dxsplit*65536.0);
// ysplit = (int)(dysplit*65536.0);
// } else {
t = ((long)d << 16)/l;
xsplit = x0 + (int)(t*(x1 - x0) >> 16);
ysplit = y0 + (int)(t*(y1 - y0) >> 16);
// }
goTo(xsplit, ysplit);
goTo(dashx, dashy);
origLen -= (dash[idx] - phase);
// Advance to next dash segment // Advance to next dash segment
idx = (idx + 1) % dash.length; idx = (idx + 1) % dash.length;
dashOn = !dashOn; dashOn = !dashOn;
...@@ -233,6 +199,7 @@ public class Dasher extends LineSink { ...@@ -233,6 +199,7 @@ public class Dasher extends LineSink {
} }
} }
public void close() { public void close() {
lineTo(sx, sy); lineTo(sx, sy);
if (firstDashOn) { if (firstDashOn) {
......
...@@ -39,16 +39,16 @@ package sun.java2d.pisces; ...@@ -39,16 +39,16 @@ package sun.java2d.pisces;
* <code>LineSink</code> interface. * <code>LineSink</code> interface.
* *
*/ */
public abstract class LineSink { public interface LineSink {
/** /**
* Moves the current drawing position to the point <code>(x0, * Moves the current drawing position to the point <code>(x0,
* y0)</code>. * y0)</code>.
* *
* @param x0 the X coordinate in S15.16 format * @param x0 the X coordinate
* @param y0 the Y coordinate in S15.16 format * @param y0 the Y coordinate
*/ */
public abstract void moveTo(int x0, int y0); public void moveTo(float x0, float y0);
/** /**
* Provides a hint that the current segment should be joined to * Provides a hint that the current segment should be joined to
...@@ -65,29 +65,29 @@ public abstract class LineSink { ...@@ -65,29 +65,29 @@ public abstract class LineSink {
* <p> Other <code>LineSink</code> classes should simply pass this * <p> Other <code>LineSink</code> classes should simply pass this
* hint to their output sink as needed. * hint to their output sink as needed.
*/ */
public abstract void lineJoin(); public void lineJoin();
/** /**
* Draws a line from the current drawing position to the point * Draws a line from the current drawing position to the point
* <code>(x1, y1)</code> and sets the current drawing position to * <code>(x1, y1)</code> and sets the current drawing position to
* <code>(x1, y1)</code>. * <code>(x1, y1)</code>.
* *
* @param x1 the X coordinate in S15.16 format * @param x1 the X coordinate
* @param y1 the Y coordinate in S15.16 format * @param y1 the Y coordinate
*/ */
public abstract void lineTo(int x1, int y1); public void lineTo(float x1, float y1);
/** /**
* Closes the current path by drawing a line from the current * Closes the current path by drawing a line from the current
* drawing position to the point specified by the moset recent * drawing position to the point specified by the moset recent
* <code>moveTo</code> command. * <code>moveTo</code> command.
*/ */
public abstract void close(); public void close();
/** /**
* Ends the current path. It may be necessary to end a path in * Ends the current path. It may be necessary to end a path in
* order to allow end caps to be drawn. * order to allow end caps to be drawn.
*/ */
public abstract void end(); public void end();
} }
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
package sun.java2d.pisces;
public class PiscesMath {
private PiscesMath() {}
private static final int SINTAB_LG_ENTRIES = 10;
private static final int SINTAB_ENTRIES = 1 << SINTAB_LG_ENTRIES;
private static int[] sintab;
public static final int PI = (int)(Math.PI*65536.0);
public static final int TWO_PI = (int)(2.0*Math.PI*65536.0);
public static final int PI_OVER_TWO = (int)((Math.PI/2.0)*65536.0);
public static final int SQRT_TWO = (int)(Math.sqrt(2.0)*65536.0);
static {
sintab = new int[SINTAB_ENTRIES + 1];
for (int i = 0; i < SINTAB_ENTRIES + 1; i++) {
double theta = i*(Math.PI/2.0)/SINTAB_ENTRIES;
sintab[i] = (int)(Math.sin(theta)*65536.0);
}
}
public static int sin(int theta) {
int sign = 1;
if (theta < 0) {
theta = -theta;
sign = -1;
}
// 0 <= theta
while (theta >= TWO_PI) {
theta -= TWO_PI;
}
// 0 <= theta < 2*PI
if (theta >= PI) {
theta = TWO_PI - theta;
sign = -sign;
}
// 0 <= theta < PI
if (theta > PI_OVER_TWO) {
theta = PI - theta;
}
// 0 <= theta <= PI/2
int itheta = (int)((long)theta*SINTAB_ENTRIES/(PI_OVER_TWO));
return sign*sintab[itheta];
}
public static int cos(int theta) {
return sin(PI_OVER_TWO - theta);
}
// public static double sqrt(double x) {
// double dsqrt = Math.sqrt(x);
// int ix = (int)(x*65536.0);
// Int Isqrt = Isqrt(Ix);
// Long Lx = (Long)(X*65536.0);
// Long Lsqrt = Lsqrt(Lx);
// System.Out.Println();
// System.Out.Println("X = " + X);
// System.Out.Println("Dsqrt = " + Dsqrt);
// System.Out.Println("Ix = " + Ix);
// System.Out.Println("Isqrt = " + Isqrt/65536.0);
// System.Out.Println("Lx = " + Lx);
// System.Out.Println("Lsqrt = " + Lsqrt/65536.0);
// Return Dsqrt;
// }
// From Ken Turkowski, _Fixed-Point Square Root_, In Graphics Gems V
public static int isqrt(int x) {
int fracbits = 16;
int root = 0;
int remHi = 0;
int remLo = x;
int count = 15 + fracbits/2;
do {
remHi = (remHi << 2) | (remLo >>> 30); // N.B. - unsigned shift R
remLo <<= 2;
root <<= 1;
int testdiv = (root << 1) + 1;
if (remHi >= testdiv) {
remHi -= testdiv;
root++;
}
} while (count-- != 0);
return root;
}
public static long lsqrt(long x) {
int fracbits = 16;
long root = 0;
long remHi = 0;
long remLo = x;
int count = 31 + fracbits/2;
do {
remHi = (remHi << 2) | (remLo >>> 62); // N.B. - unsigned shift R
remLo <<= 2;
root <<= 1;
long testDiv = (root << 1) + 1;
if (remHi >= testDiv) {
remHi -= testDiv;
root++;
}
} while (count-- != 0);
return root;
}
public static double hypot(double x, double y) {
// new RuntimeException().printStackTrace();
return Math.sqrt(x*x + y*y);
}
public static int hypot(int x, int y) {
return (int)((lsqrt((long)x*x + (long)y*y) + 128) >> 8);
}
public static long hypot(long x, long y) {
return (lsqrt(x*x + y*y) + 128) >> 8;
}
}
...@@ -37,24 +37,8 @@ import sun.java2d.pipe.RenderingEngine; ...@@ -37,24 +37,8 @@ import sun.java2d.pipe.RenderingEngine;
import sun.java2d.pipe.AATileGenerator; import sun.java2d.pipe.AATileGenerator;
public class PiscesRenderingEngine extends RenderingEngine { public class PiscesRenderingEngine extends RenderingEngine {
public static Transform4 IdentT4 = new Transform4();
public static double defaultFlat = 0.1; public static double defaultFlat = 0.1;
static int FloatToS15_16(float flt) {
flt = flt * 65536f + 0.5f;
if (flt <= -(65536f * 65536f)) {
return Integer.MIN_VALUE;
} else if (flt >= (65536f * 65536f)) {
return Integer.MAX_VALUE;
} else {
return (int) Math.floor(flt);
}
}
static float S15_16ToFloat(int fix) {
return (fix / 65536f);
}
/** /**
* Create a widened path as specified by the parameters. * Create a widened path as specified by the parameters.
* <p> * <p>
...@@ -85,18 +69,19 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -85,18 +69,19 @@ public class PiscesRenderingEngine extends RenderingEngine {
strokeTo(src, strokeTo(src,
null, null,
width, width,
false,
caps, caps,
join, join,
miterlimit, miterlimit,
dashes, dashes,
dashphase, dashphase,
new LineSink() { new LineSink() {
public void moveTo(int x0, int y0) { public void moveTo(float x0, float y0) {
p2d.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0)); p2d.moveTo(x0, y0);
} }
public void lineJoin() {} public void lineJoin() {}
public void lineTo(int x1, int y1) { public void lineTo(float x1, float y1) {
p2d.lineTo(S15_16ToFloat(x1), S15_16ToFloat(y1)); p2d.lineTo(x1, y1);
} }
public void close() { public void close() {
p2d.closePath(); p2d.closePath();
...@@ -144,12 +129,12 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -144,12 +129,12 @@ public class PiscesRenderingEngine extends RenderingEngine {
{ {
strokeTo(src, at, bs, thin, normalize, antialias, strokeTo(src, at, bs, thin, normalize, antialias,
new LineSink() { new LineSink() {
public void moveTo(int x0, int y0) { public void moveTo(float x0, float y0) {
consumer.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0)); consumer.moveTo(x0, y0);
} }
public void lineJoin() {} public void lineJoin() {}
public void lineTo(int x1, int y1) { public void lineTo(float x1, float y1) {
consumer.lineTo(S15_16ToFloat(x1), S15_16ToFloat(y1)); consumer.lineTo(x1, y1);
} }
public void close() { public void close() {
consumer.closePath(); consumer.closePath();
...@@ -181,6 +166,7 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -181,6 +166,7 @@ public class PiscesRenderingEngine extends RenderingEngine {
strokeTo(src, strokeTo(src,
at, at,
lw, lw,
normalize,
bs.getEndCap(), bs.getEndCap(),
bs.getLineJoin(), bs.getLineJoin(),
bs.getMiterLimit(), bs.getMiterLimit(),
...@@ -258,6 +244,7 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -258,6 +244,7 @@ public class PiscesRenderingEngine extends RenderingEngine {
void strokeTo(Shape src, void strokeTo(Shape src,
AffineTransform at, AffineTransform at,
float width, float width,
boolean normalize,
int caps, int caps,
int join, int join,
float miterlimit, float miterlimit,
...@@ -265,32 +252,16 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -265,32 +252,16 @@ public class PiscesRenderingEngine extends RenderingEngine {
float dashphase, float dashphase,
LineSink lsink) LineSink lsink)
{ {
Transform4 t4; float a00 = 1f, a01 = 0f, a10 = 0f, a11 = 1f;
if (at != null && !at.isIdentity()) {
if (at == null || at.isIdentity()) { a00 = (float)at.getScaleX();
t4 = IdentT4; a01 = (float)at.getShearX();
} else { a10 = (float)at.getShearY();
t4 = new Transform4(FloatToS15_16((float) at.getScaleX()), a11 = (float)at.getScaleY();
FloatToS15_16((float) at.getShearX()),
FloatToS15_16((float) at.getShearY()),
FloatToS15_16((float) at.getScaleY()));
} }
lsink = new Stroker(lsink, width, caps, join, miterlimit, a00, a01, a10, a11);
lsink = new Stroker(lsink,
FloatToS15_16(width),
caps,
join,
FloatToS15_16(miterlimit),
t4);
if (dashes != null) { if (dashes != null) {
int fdashes[] = new int[dashes.length]; lsink = new Dasher(lsink, dashes, dashphase, a00, a01, a10, a11);
for (int i = 0; i < dashes.length; i++) {
fdashes[i] = FloatToS15_16(dashes[i]);
}
lsink = new Dasher(lsink,
fdashes,
FloatToS15_16(dashphase),
t4);
} }
PathIterator pi = src.getPathIterator(at, defaultFlat); PathIterator pi = src.getPathIterator(at, defaultFlat);
...@@ -302,13 +273,11 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -302,13 +273,11 @@ public class PiscesRenderingEngine extends RenderingEngine {
while (!pi.isDone()) { while (!pi.isDone()) {
switch (pi.currentSegment(coords)) { switch (pi.currentSegment(coords)) {
case PathIterator.SEG_MOVETO: case PathIterator.SEG_MOVETO:
lsink.moveTo(FloatToS15_16(coords[0]), lsink.moveTo(coords[0], coords[1]);
FloatToS15_16(coords[1]));
break; break;
case PathIterator.SEG_LINETO: case PathIterator.SEG_LINETO:
lsink.lineJoin(); lsink.lineJoin();
lsink.lineTo(FloatToS15_16(coords[0]), lsink.lineTo(coords[0], coords[1]);
FloatToS15_16(coords[1]));
break; break;
case PathIterator.SEG_CLOSE: case PathIterator.SEG_CLOSE:
lsink.lineJoin(); lsink.lineJoin();
...@@ -378,17 +347,19 @@ public class PiscesRenderingEngine extends RenderingEngine { ...@@ -378,17 +347,19 @@ public class PiscesRenderingEngine extends RenderingEngine {
int bbox[]) int bbox[])
{ {
PiscesCache pc = PiscesCache.createInstance(); PiscesCache pc = PiscesCache.createInstance();
Renderer r = new Renderer(); Renderer r;
r.setCache(pc);
r.setAntialiasing(3, 3);
r.beginRendering(clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight());
if (bs == null) { if (bs == null) {
PathIterator pi = s.getPathIterator(at, defaultFlat); PathIterator pi = s.getPathIterator(at, defaultFlat);
r.setWindingRule(pi.getWindingRule()); r = new Renderer(3, 3,
clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
pi.getWindingRule(), pc);
pathTo(pi, r); pathTo(pi, r);
} else { } else {
r.setWindingRule(PathIterator.WIND_NON_ZERO); r = new Renderer(3, 3,
clip.getLoX(), clip.getLoY(),
clip.getWidth(), clip.getHeight(),
PathIterator.WIND_NON_ZERO, pc);
strokeTo(s, at, bs, thin, normalize, true, r); strokeTo(s, at, bs, thin, normalize, true, r);
} }
r.endRendering(); r.endRendering();
......
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
package sun.java2d.pisces;
public class Transform4 {
public int m00, m01, m10, m11;
// double det; // det*65536
public Transform4() {
this(1 << 16, 0, 0, 1 << 16);
}
public Transform4(int m00, int m01,
int m10, int m11) {
this.m00 = m00;
this.m01 = m01;
this.m10 = m10;
this.m11 = m11;
// this.det = (double)m00*m11 - (double)m01*m10;
}
// public Transform4 createInverse() {
// double dm00 = m00/65536.0;
// double dm01 = m01/65536.0;
// double dm10 = m10/65536.0;
// double dm11 = m11/65536.0;
// double invdet = 65536.0/(dm00*dm11 - dm01*dm10);
// int im00 = (int)( dm11*invdet);
// int im01 = (int)(-dm01*invdet);
// int im10 = (int)(-dm10*invdet);
// int im11 = (int)( dm00*invdet);
// return new Transform4(im00, im01, im10, im11);
// }
// public void transform(int[] point) {
// }
// /**
// * Returns the length of the line segment obtained by inverse
// * transforming the points <code>(x0, y0)</code> and <code>(x1,
// * y1)</code>.
// */
// public int getTransformedLength(int x0, int x1, int y0, int y1) {
// int lx = x1 - x0;
// int ly = y1 - y0;
// double a = (double)m00*ly - (double)m10*lx;
// double b = (double)m01*ly - (double)m11*lx;
// double len = PiscesMath.sqrt((a*a + b*b)/(det*det));
// return (int)(len*65536.0);
// }
// public int getType() {
// }
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册