464 |
|
|
465 |
private final void updateImagePixels (int[] pixels) |
private final void updateImagePixels (int[] pixels) |
466 |
{ |
{ |
467 |
|
|
468 |
// This function can only be used if |
// This function can only be used if |
469 |
// this graphics object is used to draw into |
// this graphics object is used to draw into |
470 |
// buffered image |
// buffered image |
496 |
} |
} |
497 |
} |
} |
498 |
|
|
499 |
|
|
500 |
private final boolean drawImage(Image img, |
private final boolean drawImage(Image img, |
501 |
AffineTransform xform, |
AffineTransform xform, |
502 |
Color bgcolor, |
Color bgcolor, |
503 |
ImageObserver obs) |
ImageObserver obs) |
504 |
{ |
{ |
505 |
if (img instanceof GtkOffScreenImage && |
if (img instanceof GtkOffScreenImage && |
506 |
img.getGraphics () instanceof GdkGraphics2D && |
img.getGraphics () instanceof GdkGraphics2D && |
520 |
} |
} |
521 |
else |
else |
522 |
{ |
{ |
523 |
|
|
524 |
// In this case, xform is an AffineTransform that transforms bounding |
// In this case, xform is an AffineTransform that transforms bounding |
525 |
// box of the specified image from image space to user space. However |
// box of the specified image from image space to user space. However |
526 |
// when we pass this transform to cairo, cairo will use this transform |
// when we pass this transform to cairo, cairo will use this transform |
533 |
|
|
534 |
try |
try |
535 |
{ |
{ |
536 |
invertedXform = xform.createInverse(); |
invertedXform = xform.createInverse(); |
537 |
if (img instanceof BufferedImage) |
if (img instanceof BufferedImage) |
538 |
{ |
{ |
539 |
// draw an image which has actually been loaded |
// draw an image which has actually been loaded |
540 |
// into memory fully |
// into memory fully |
541 |
|
|
542 |
BufferedImage b = (BufferedImage) img; |
BufferedImage b = (BufferedImage) img; |
543 |
return drawRaster (b.getColorModel (), |
return drawRaster (b.getColorModel (), |
544 |
b.getData (), |
b.getData (), |
545 |
invertedXform, |
invertedXform, |
546 |
bgcolor); |
bgcolor); |
547 |
} |
} |
548 |
else |
else |
549 |
{ |
{ |
575 |
} |
} |
576 |
|
|
577 |
cairoNewPath (); |
cairoNewPath (); |
578 |
|
|
579 |
if (s instanceof Rectangle2D) |
if (s instanceof Rectangle2D) |
580 |
{ |
{ |
581 |
Rectangle2D r = (Rectangle2D)s; |
Rectangle2D r = (Rectangle2D)s; |
848 |
return clip.getBounds (); |
return clip.getBounds (); |
849 |
} |
} |
850 |
|
|
851 |
protected Rectangle2D getClipInDevSpace () |
protected Rectangle2D getClipInDevSpace () |
852 |
{ |
{ |
853 |
Rectangle2D uclip = clip.getBounds2D (); |
Rectangle2D uclip = clip.getBounds2D (); |
854 |
if (transform == null) |
if (transform == null) |
855 |
return uclip; |
return uclip; |
856 |
else |
else |
857 |
{ |
{ |
858 |
Point2D pos = transform.transform (new Point2D.Double(uclip.getX (), |
Point2D pos = transform.transform (new Point2D.Double(uclip.getX (), |
859 |
uclip.getY ()), |
uclip.getY ()), |
860 |
(Point2D)null); |
(Point2D)null); |
861 |
Point2D extent = transform.deltaTransform (new Point2D.Double(uclip.getWidth (), |
Point2D extent = transform.deltaTransform (new Point2D.Double(uclip.getWidth (), |
862 |
uclip.getHeight ()), |
uclip.getHeight ()), |
863 |
(Point2D)null); |
(Point2D)null); |
864 |
return new Rectangle2D.Double (pos.getX (), pos.getY (), |
return new Rectangle2D.Double (pos.getX (), pos.getY (), |
865 |
extent.getX (), extent.getY ()); |
extent.getX (), extent.getY ()); |
866 |
} |
} |
867 |
} |
} |
868 |
|
|
869 |
public void setClip (int x, int y, int width, int height) |
public void setClip (int x, int y, int width, int height) |
870 |
{ |
{ |
955 |
} |
} |
956 |
|
|
957 |
private final void doPolygon(int[] xPoints, int[] yPoints, int nPoints, |
private final void doPolygon(int[] xPoints, int[] yPoints, int nPoints, |
958 |
boolean close, boolean fill) |
boolean close, boolean fill) |
959 |
{ |
{ |
960 |
if (nPoints < 1) |
if (nPoints < 1) |
961 |
return; |
return; |
1011 |
} |
} |
1012 |
|
|
1013 |
private final boolean drawRaster (ColorModel cm, Raster r, |
private final boolean drawRaster (ColorModel cm, Raster r, |
1014 |
AffineTransform imageToUser, |
AffineTransform imageToUser, |
1015 |
Color bgcolor) |
Color bgcolor) |
1016 |
{ |
{ |
1017 |
if (r == null) |
if (r == null) |
1018 |
return false; |
return false; |
1173 |
else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT)) |
else if (hintValue.equals(RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT)) |
1174 |
cairoSurfaceSetFilter(4); |
cairoSurfaceSetFilter(4); |
1175 |
|
|
1176 |
} |
} |
1177 |
|
|
1178 |
shiftDrawCalls = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE) |
shiftDrawCalls = hints.containsValue (RenderingHints.VALUE_STROKE_NORMALIZE) |
1179 |
|| hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT); |
|| hints.containsValue (RenderingHints.VALUE_STROKE_DEFAULT); |
1492 |
else |
else |
1493 |
font = |
font = |
1494 |
((ClasspathToolkit)(Toolkit.getDefaultToolkit ())) |
((ClasspathToolkit)(Toolkit.getDefaultToolkit ())) |
1495 |
.getFont (f.getName(), f.getAttributes ()); |
.getFont (f.getName(), f.getAttributes ()); |
1496 |
} |
} |
1497 |
|
|
1498 |
public String toString() |
public String toString() |
1499 |
{ |
{ |
1500 |
return getClass ().getName () + |
return getClass ().getName () + |