public class ScaleController extends Object
ScaleController makes it possible to control the scale of
the image in an EditableImageRenderer. In order to be used,
you just have to create a new instance passing the
EditableImageRenderer as a parameter:
EditableImageRenderer renderer = ...; ScaleController scaleController = new ScaleController(renderer); ... scaleController.setScale(2.5);
| Modifier and Type | Field and Description |
|---|---|
protected EditableImageRenderer |
imageRenderer
The attached renderer.
|
| Constructor and Description |
|---|
ScaleController(EditableImageRenderer imageRenderer)
Creates a new instance of this class, attached to the given renderer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fitToView()
Fits the image into the current view: the image is resized so it's not
clipped, and it's centered on the screen.
|
void |
fitToView(double factor) |
protected EditableImageRenderer |
getImageRenderer() |
double |
getScale()
Returns the current scale.
|
double |
getZoomFactor()
Returns the current zoom factor.
|
void |
setScale(double scale)
Sets the scale.
|
void |
setScale(double scale,
Point pivot)
Sets the scale using a pivot point.
|
void |
setZoomFactor(double zoomFactor)
Sets the zoom factor that is used by
zoomIn() and
zoomOut. |
void |
showActualPixels()
Sets the scale to 1:1.
|
void |
zoomIn()
Zooms in.
|
void |
zoomOut()
Zooms out.
|
protected final EditableImageRenderer imageRenderer
public ScaleController(EditableImageRenderer imageRenderer)
imageRenderer - the image rendererpublic final void setScale(double scale)
scale - the new scalepublic void setScale(double scale,
Point pivot)
scale - the new scalepivot - the pivot point (null means the center of the image)public double getScale()
public void setZoomFactor(double zoomFactor)
zoomIn() and
zoomOut.zoomFactor - the new zoom factorpublic double getZoomFactor()
public void fitToView()
public void fitToView(double factor)
public void zoomOut()
public void zoomIn()
public void showActualPixels()
protected EditableImageRenderer getImageRenderer()
Copyright © 2003–2014 Tidalwave s.a.s. (http://tidalwave.it). All rights reserved.