1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
|
/**
*
*/
package test;
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.lang.ref.*;
import java.text.*;
import javax.swing.*;
import composite.*;
/**
* @author fabriceb
*
*/
public class DefaultLensRenderer<T extends JComponent> extends JComponent {
private static final long serialVersionUID = 1L;
public static final float MIN_ZOOM_FACTOR = 0.125f;
public static final float MAX_ZOOM_FACTOR = 64;
private static Stroke SOLID_STROKE_1 = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
private static Stroke SOLID_STROKE_1_5 = new BasicStroke(1.5f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
private static Stroke SOLID_STROKE_3 = new BasicStroke(3f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
private static Font FONT_DIALOG_BOLD_12 = new Font("Dialog", Font.BOLD, 12);
private static Font FONT_DIALOG_BOLD_31 = FONT_DIALOG_BOLD_12.deriveFont(31f);
private Shape lensShape;
private Paint lensBackground;
private Paint lensForeground1;
private Paint lensForeground2;
private Paint buttonEnabledBackground;
private Paint buttonEnabledForeground1;
private Paint buttonEnabledForeground2;
private Paint buttonDisabledBackground;
private Paint buttonDisabledForeground1;
private Paint buttonDisabledForeground2;
private Paint lensLightBackground;
private Paint buttonLightBackground;
private Paint buttonEnabledLightBackground;
private Paint labelEnabledBackground;
private Paint labelEnabledForeground;
private Paint labelDisabledBackground;
private Paint labelDisabledForeground;
private int lensSize = 150;
private int lensInset = 8;
float lensCenterX = lensSize / 2f;
float lensCenterY = lensCenterX;
float lensRadius = 0.9f * lensSize / 2f;
float button1CenterX = (float) (lensCenterX + (1.1 * lensRadius) * Math.cos(Math.PI / 4f));
float button1CenterY = (float) (lensCenterY - (1.1 * lensRadius) * Math.sin(Math.PI / 4f));
float button2CenterX = button1CenterX;
float button2CenterY = (float) (lensCenterY + (1.1 * lensRadius) * Math.sin(Math.PI / 4f));
float buttonShapeRadius = 15;
float buttonRadius = 3f / 4f * buttonShapeRadius;
private Ellipse2D.Float ellipse = new Ellipse2D.Float();
private Shape buttonShape;
private Shape plusSign;
private Shape minusSign;
private BufferedImage lensImage;
private BufferedImage zoomedImage;
private BlendComposite dodgeComposite = BlendComposite.ColorDodge;
private Corner corner = Corner.BOTTOM_RIGHT;
private float zoomFactor = 8f;
private int currentX;
private int currentY;
private WeakReference<T> target;
NumberFormat format;
public DefaultLensRenderer(T target) {
this.target = new WeakReference<T>(target);
format = NumberFormat.getPercentInstance();
format.setMinimumFractionDigits(0);
format.setMaximumFractionDigits(1);
System.out.println("Radius is " + lensRadius);
setMinimumSize(new Dimension(lensSize, lensSize));
setSize(new Dimension(lensSize, lensSize));
setPreferredSize(new Dimension(lensSize, lensSize));
}
private void createPaints() {
float dist[] = { 0f, 0.4999f, 0.5f, 1f };
Color[] lensBackgroundColors = { new Color(98, 108, 136), new Color(63, 71, 86), new Color(21, 21, 22), new Color(60, 71, 111) };
Color[] lensForegroundColors = { new Color(123, 130, 150), new Color(91, 95, 105), new Color(64, 64, 63), new Color(100, 108, 137) };
lensBackground = new LinearGradientPaint(0, lensCenterY - lensRadius, 0, lensCenterY + lensRadius, dist, lensBackgroundColors);
lensForeground1 = new LinearGradientPaint(0, lensCenterY - lensRadius, 0, lensCenterY + lensRadius, dist, lensForegroundColors);
lensForeground2 = Color.BLACK;
Color[] buttonEnabledBackgroundColors = { new Color(168, 181, 228), new Color(92, 117, 198), new Color(0, 29, 145), new Color(83, 215, 255) };
Color[] buttonEnabledForegroundColors = { new Color(191, 206, 243), new Color(129, 163, 242), new Color(27, 47, 185), new Color(141, 255, 255) };
buttonEnabledBackground = new LinearGradientPaint(0, 0, 0, 2 * buttonRadius, dist, buttonEnabledBackgroundColors);
buttonEnabledForeground1 = new LinearGradientPaint(0, 0, 0, 2 * buttonRadius, dist, buttonEnabledForegroundColors);
buttonEnabledForeground2 = Color.BLUE;
Color[] buttonDisabledBackgroundColors = lensBackgroundColors;
Color[] buttonDisabledForegroundColors = lensForegroundColors;
buttonDisabledBackground = new LinearGradientPaint(0, 0, 0, 2 * buttonRadius, dist, buttonDisabledBackgroundColors);
buttonDisabledForeground1 = new LinearGradientPaint(0, 0, 0, 2 * buttonRadius, dist, buttonDisabledForegroundColors);
buttonDisabledForeground2 = lensForeground2;
//Color[] labelEnabledBackgroundColors = { new Color(254, 254, 255), new Color(249, 251, 255), new Color(211, 216, 223), new Color(230, 235, 242) };
Color[] labelEnabledBackgroundColors = { new Color(254, 254, 255), new Color(249, 251, 255), new Color(141, 146, 153), new Color(160, 165, 172) };
Color[] labeldDisabledBackgroundColors = { new Color(156, 161, 168), new Color(146, 151, 158), new Color(98, 103, 110), new Color(94, 99, 106) };
labelEnabledBackground = new LinearGradientPaint(0, 0, 0, 2 * buttonRadius, dist, labelEnabledBackgroundColors);
labelEnabledForeground = buttonDisabledForeground1;
labelDisabledBackground = new LinearGradientPaint(0, 0, 0, 2 * buttonRadius, dist, labeldDisabledBackgroundColors);
labelDisabledForeground = buttonDisabledForeground1;
dist = new float[] { 0f, 0.02f, 0.95f, 1f };
Color[] lightColor = { new Color(127, 127, 127, 127), new Color(127, 127, 127, 0), new Color(127, 127, 127, 0), new Color(127, 127, 127, 127) };
lensLightBackground = new LinearGradientPaint(0, lensCenterY - lensRadius, 0, lensCenterY + lensRadius, dist, lightColor);
dist = new float[] { 0.5f, 0.95f };
lightColor = new Color[] { new Color(0, 0, 0, 0), new Color(100, 100, 100, 100) };
buttonLightBackground = new RadialGradientPaint(buttonRadius, buttonRadius, buttonRadius, dist, lightColor);
dist = new float[] { 0f, 0.75f };
lightColor = new Color[] { new Color(0, 0, 0, 0), new Color(127, 127, 127, 127) };
buttonEnabledLightBackground = new RadialGradientPaint(buttonRadius, 2 / 3f * buttonRadius, 4 / 3f * buttonRadius, dist, lightColor);
}
private void createShapes(Graphics2D g2d) {
// Lens.
RoundRectangle2D.Float rectangle = new RoundRectangle2D.Float();
switch (corner) {
case TOP_LEFT: {
rectangle.setRoundRect(lensCenterX, lensCenterY, lensRadius, lensRadius, lensInset, lensInset);
}
break;
case TOP_RIGHT: {
rectangle.setRoundRect(lensCenterX - lensRadius, lensCenterY, lensRadius, lensRadius, lensInset, lensInset);
}
break;
case BOTTOM_LEFT: {
rectangle.setRoundRect(lensCenterX, lensCenterY - lensRadius, lensRadius, lensRadius, lensInset, lensInset);
}
break;
case BOTTOM_RIGHT:
default: {
rectangle.setRoundRect(lensCenterX - lensRadius, lensCenterY - lensRadius, lensRadius, lensRadius, lensInset, lensInset);
}
}
Area area = new Area(rectangle);
switch (corner) {
case TOP_LEFT: {
rectangle.setRoundRect(lensCenterX + lensInset, lensCenterY + lensInset, lensRadius - 2 * lensInset, lensRadius - 2 * lensInset, lensInset / 2f, lensInset / 2f);
}
break;
case TOP_RIGHT: {
rectangle.setRoundRect(lensCenterX - lensRadius + lensInset, lensCenterY + lensInset, lensRadius - 2 * lensInset, lensRadius - 2 * lensInset, lensInset / 2f, lensInset / 2f);
}
break;
case BOTTOM_LEFT: {
rectangle.setRoundRect(lensCenterX + lensInset, lensCenterY - lensRadius + lensInset, lensRadius - 2 * lensInset, lensRadius - 2 * lensInset, lensInset / 2f, lensInset / 2f);
}
break;
case BOTTOM_RIGHT:
default: {
rectangle.setRoundRect(lensCenterX - lensRadius + lensInset, lensCenterY - lensRadius + lensInset, lensRadius - 2 * lensInset, lensRadius - 2 * lensInset, lensInset / 2f, lensInset / 2f);
}
}
area.subtract(new Area(rectangle));
rectangle.setRoundRect(lensCenterX - lensRadius, lensCenterY + lensRadius - 20, lensRadius, 20, lensInset / 2f, lensInset / 2f);
area.add(new Area(rectangle));
ellipse.setFrameFromCenter(lensCenterX, lensCenterY, lensCenterX + lensRadius, lensCenterY + lensRadius);
area.add(new Area(ellipse));
ellipse.setFrameFromCenter(button1CenterX, button1CenterY, button1CenterX + 15, button1CenterY + 15);
area.add(new Area(ellipse));
ellipse.setFrameFromCenter(button2CenterX, button2CenterY, button2CenterX + 15, button2CenterY + 15);
area.add(new Area(ellipse));
area.subtract(new Area(getZoomAreaShape()));
lensShape = area;
// Button shape
buttonShape = new Ellipse2D.Float(0, 0, buttonRadius * 2, buttonRadius * 2);
Font font = FONT_DIALOG_BOLD_31;
// Plus sign.
plusSign = font.createGlyphVector(g2d.getFontRenderContext(), "+").getGlyphOutline(0);
Rectangle2D plusBounds = plusSign.getBounds();
plusSign = AffineTransform.getTranslateInstance(buttonRadius - plusBounds.getX() - plusBounds.getWidth() / 2f, buttonRadius - plusBounds.getY() - plusBounds.getHeight() / 2f).createTransformedShape(plusSign);
// Minus sign.
minusSign = font.createGlyphVector(g2d.getFontRenderContext(), "-").getGlyphOutline(0);
Rectangle2D minusBounds = minusSign.getBounds();
minusSign = AffineTransform.getTranslateInstance(buttonRadius - minusBounds.getX() - minusBounds.getWidth() / 2f, buttonRadius - minusBounds.getY() - minusBounds.getHeight() / 2f).createTransformedShape(minusSign);
}
/** Clear the content of the image (all pixels are made fully transparent).
* @param image The image to be cleared.
*/
private void clearImageContent(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
Graphics2D g2d = image.createGraphics();
try {
//g2d.fillRect(0, 0, width, height);
//g2d.setColor(Color.BLACK);
//g2d.setComposite(AlphaComposite.SrcIn);
g2d.setComposite(AlphaComposite.Src);
g2d.setColor(new Color(0, 0, 0, 0));
g2d.fillRect(0, 0, width, height);
//g2d.setComposite(AlphaComposite.SrcOver);
}
finally {
g2d.dispose();
}
}
protected BufferedImage createLensDodgeImage(BufferedImage image) {
if (image == null) {
image = getGraphicsConfiguration().createCompatibleImage(lensSize, lensSize, Transparency.TRANSLUCENT);
}
clearImageContent(image);
Graphics2D g2d = image.createGraphics();
try {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// Render Lens.
g2d.setPaint(lensLightBackground);
g2d.fill(lensShape);
}
finally {
g2d.dispose();
}
// Blur.
BufferedImageOp filter = BlurUtils.getGaussianBlurFilter(8, true);
image = filter.filter(image, null);
filter = BlurUtils.getGaussianBlurFilter(8, false);
image = filter.filter(image, null);
return image;
}
protected BufferedImage createButtonDodgeImage(BufferedImage image, boolean enabled) {
if (image == null) {
image = getGraphicsConfiguration().createCompatibleImage((int) (2 * buttonRadius), (int) (2 * buttonRadius), Transparency.TRANSLUCENT);
}
clearImageContent(image);
Graphics2D g2d = image.createGraphics();
try {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// Render Lens.
g2d.setPaint(buttonLightBackground);
g2d.fill(buttonShape);
if (enabled) {
ellipse.setFrame(0.5f * buttonRadius, 2 / 3f * buttonRadius, buttonRadius, 4 / 3f * buttonRadius);
g2d.setPaint(buttonEnabledLightBackground);
g2d.fill(ellipse);
}
}
finally {
g2d.dispose();
}
//Blur
BufferedImageOp filter = BlurUtils.getGaussianBlurFilter(4, true);
image = filter.filter(image, null);
filter = BlurUtils.getGaussianBlurFilter(4, false);
image = filter.filter(image, null);
return image;
}
protected BufferedImage createLensImage(BufferedImage image) {
if (image == null) {
image = getGraphicsConfiguration().createCompatibleImage(lensSize, lensSize, Transparency.TRANSLUCENT);
}
clearImageContent(image);
Graphics2D g2d = image.createGraphics();
try {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
if (lensShape == null) {
createShapes(g2d);
createPaints();
}
// Draw guides (debug).
/*
g2d.setStroke(SOLID_STROKE_1);
g2d.setColor(Color.CYAN);
RoundRectangle2D.Float rectangle = new RoundRectangle2D.Float(lensCenterX - lensRadius, lensCenterY - lensRadius, lensRadius * 2, lensRadius * 2, lensInset, lensInset);
g2d.draw(rectangle);
rectangle.setRoundRect(lensCenterX - lensRadius + lensInset, lensCenterY - lensRadius + lensInset, 2 * lensRadius - 2 * lensInset, 2 * lensRadius - 2 * lensInset, lensInset / 2f, lensInset / 2f);
g2d.draw(rectangle);
*/
// Draw axis.
g2d.setColor(Color.BLACK);
g2d.drawLine((int) (lensCenterX), (int) (lensCenterY - lensRadius + lensInset), (int) (lensCenterX), (int) (lensCenterY + lensRadius - lensInset));
g2d.drawLine((int) (lensCenterX - lensRadius + lensInset), (int) (lensCenterY), (int) (lensCenterX + lensRadius - lensInset), (int) (lensCenterY));
// Render Lens.
g2d.setStroke(SOLID_STROKE_3);
g2d.setPaint(lensForeground2);
g2d.draw(lensShape);
g2d.setPaint(lensBackground);
g2d.fill(lensShape);
// Apply dodge image.
BufferedImage lensDodgeImage = createLensDodgeImage(null);
g2d.setComposite(dodgeComposite);
g2d.drawImage(lensDodgeImage, 0, 0, null);
g2d.setComposite(AlphaComposite.SrcOver);
g2d.setStroke(SOLID_STROKE_1_5);
g2d.setPaint(lensForeground1);
g2d.draw(lensShape);
// Render buttons.
/** @todo Delegate to buttons. */
// Top button.
{
float dx = button1CenterX - buttonRadius;
float dy = button1CenterY - buttonRadius;
g2d.translate(dx, dy);
g2d.setStroke(SOLID_STROKE_3);
g2d.setPaint(buttonEnabledForeground2);
g2d.draw(buttonShape);
g2d.setPaint(buttonEnabledBackground);
g2d.fill(buttonShape);
g2d.setPaint(labelEnabledBackground);
g2d.fill(plusSign);
g2d.setStroke(SOLID_STROKE_1);
g2d.setPaint(labelEnabledForeground);
g2d.draw(plusSign);
// Apply dodge image.
BufferedImage buttonDodgeImage = createButtonDodgeImage(null, true);
g2d.setComposite(dodgeComposite);
g2d.drawImage(buttonDodgeImage, 0, 0, null);
g2d.setComposite(AlphaComposite.SrcOver);
g2d.setStroke(SOLID_STROKE_1_5);
g2d.setPaint(buttonEnabledForeground1);
g2d.draw(buttonShape);
g2d.translate(-dx, -dy);
}
// Bottom button.
{
float dx = button2CenterX - buttonRadius;
float dy = button2CenterY - buttonRadius;
g2d.translate(dx, dy);
g2d.setStroke(SOLID_STROKE_3);
g2d.setPaint(buttonDisabledForeground2);
g2d.draw(buttonShape);
g2d.setPaint(buttonDisabledBackground);
g2d.fill(buttonShape);
g2d.setPaint(labelDisabledBackground);
g2d.fill(minusSign);
g2d.setStroke(SOLID_STROKE_1);
g2d.setPaint(labelDisabledForeground);
g2d.draw(minusSign);
// Apply dodge image.
BufferedImage buttonDodgeImage = createButtonDodgeImage(null, false);
g2d.setComposite(dodgeComposite);
g2d.drawImage(buttonDodgeImage, 0, 0, null);
g2d.setComposite(AlphaComposite.SrcOver);
g2d.setStroke(SOLID_STROKE_1_5);
g2d.setPaint(buttonDisabledForeground1);
g2d.draw(buttonShape);
g2d.translate(-dx, -dy);
}
}
finally {
g2d.dispose();
}
return image;
}
public void refreshDisplay() {
renderZoomedImage();
repaint();
}
private void renderZoomedImage() {
T target = getTarget();
if (target != null) {
if (zoomedImage == null) {
zoomedImage = getGraphicsConfiguration().createCompatibleImage(lensSize, lensSize, Transparency.TRANSLUCENT);
}
clearImageContent(zoomedImage);
Graphics2D g2d = zoomedImage.createGraphics();
try {
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
// Render image.
g2d.setColor(Color.BLACK);
Shape lensShape = getZoomAreaShape();
g2d.fill(lensShape);
float dx = -currentX;
float dy = -currentY;
float sx = zoomFactor;
g2d.translate(lensCenterX, lensCenterY);
g2d.scale(sx, sx);
g2d.translate(dx, dy);
g2d.setComposite(AlphaComposite.SrcIn);
target.paint(g2d);
}
finally {
g2d.dispose();
}
}
}
@Override protected void paintComponent(Graphics graphics) {
Graphics2D g2d = (Graphics2D) graphics.create();
try {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
if (zoomedImage == null) {
renderZoomedImage();
}
g2d.drawImage(zoomedImage, 0, 0, null);
if (lensImage == null) {
lensImage = createLensImage(lensImage);
}
g2d.drawImage(lensImage, 0, 0, null);
g2d.setColor(Color.WHITE);
String label = format.format(getZoomFactor());
Font font = FONT_DIALOG_BOLD_12;
LineMetrics lineMetrics = font.getLineMetrics(label, g2d.getFontRenderContext());
g2d.setFont(font);
g2d.drawString(label, lensCenterX - lensRadius + 2, lensCenterY + lensRadius - 20 + 3 + lineMetrics.getAscent());
}
finally {
g2d.dispose();
}
}
/** Self-test main.
* @param args Arguments from the command-line.
*/
public static void main(String... args) {
// TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() {
public void run() {
DefaultLensRenderer<JComponent> test = new DefaultLensRenderer<JComponent>(null);
JFrame frame = new JFrame("Test ");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(test, BorderLayout.CENTER);
frame.setSize(700, 700);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
///////////////////////
// Gettters/Setters. //
///////////////////////
public T getTarget() {
return target.get();
}
/** Gets the shape of the zoomed area.
* @return A <code>Shape</code>.
*/
public Shape getZoomAreaShape() {
Ellipse2D.Float result = new Ellipse2D.Float();
result.setFrameFromCenter(lensCenterX, lensCenterY, lensCenterX + lensRadius - lensInset, lensCenterY + lensRadius - lensInset);
return result;
}
/* {@inheritDoc}
*/
public void setCorner(Corner value) {
if (value != null && !corner.equals(value)) {
corner = value;
lensShape = null;
lensImage = null;
repaint();
}
}
/* {@inheritDoc}
*/
public Corner getCorner() {
return corner;
}
public void zoomIn() {
setZoomFactor(getZoomFactor() * 2f);
}
public void zoomOut() {
setZoomFactor(getZoomFactor() / 2f);
}
public void setZoomFactor(float value) {
value = Math.max(value, MIN_ZOOM_FACTOR);
value = Math.min(value, MAX_ZOOM_FACTOR);
if (value != zoomFactor) {
zoomFactor = value;
renderZoomedImage();
repaint();
}
}
public float getZoomFactor() {
return zoomFactor;
}
public void setCurrentPosition(int x, int y) {
if ((x != currentX) || (y != currentY)) {
currentX = x;
currentY = y;
renderZoomedImage();
repaint();
}
}
} |
Partager