ini.trakem2.display
Class DisplayCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by ij.gui.ImageCanvas
              extended by ini.trakem2.display.DisplayCanvas
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.accessibility.Accessible

public final class DisplayCanvas
extends ij.gui.ImageCanvas
implements java.awt.event.KeyListener, java.awt.event.MouseWheelListener

See Also:
Serialized Form

Nested Class Summary
protected  class DisplayCanvas.RepaintProperties
           
 class DisplayCanvas.Screenshot
           
protected  class DisplayCanvas.ScreenshotProperties
           
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static java.awt.geom.AffineTransform DEFAULT_AFFINE
           
protected static java.awt.BasicStroke DEFAULT_STROKE
          Paints a handle on the offscreen x,y.
protected  java.awt.Point last_popup
          In world coordinates.
 
Fields inherited from class ij.gui.ImageCanvas
crosshairCursor, defaultCursor, dstHeight, dstWidth, flags, handCursor, ij, imageHeight, imageUpdated, imageWidth, imp, magnification, moveCursor, srcRect, usePointer, xMouse, xMouseStart, xSrcStart, yMouse, yMouseStart, ySrcStart
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DisplayCanvas(Display display, int width, int height)
           
 
Method Summary
 void adjustDimensions()
          Adjust srcRect and internal variables to the canvas' bounds.
 void adjustSrcRect(int new_width, int new_height)
          Adjust srcRect to new dimensions.
protected  void animateBrowsing(int dx, int dy)
          Smoothly move the canvas from x0,y0,layer0 to x1,y1,layer1
 boolean animateBrowsing(java.awt.Rectangle target_, Layer target_layer)
          Smoothly move the canvas from its current position until the given rectangle is included within the srcRect.
 boolean applyTransform()
           
 void cancelTransform()
           
 void center(java.awt.Rectangle r, double magn)
          Show the given r as the srcRect (or as much of it as possible) at the given magnification.
protected  java.awt.Point consumeLastPopupPoint()
           
 void destroy()
           
static void drawHandle(java.awt.Graphics2D g, double x, double y, java.awt.Rectangle srcRect, double magnification)
           
static void drawHandle(java.awt.Graphics g, int x, int y, double magnification)
          Paints a handle on the screen coords.
static void drawScreenHandle(java.awt.Graphics g, int x, int y)
          Paints a handle at x,y screen coords.
 void exportXML(java.lang.StringBuilder sb_body, java.lang.String indent, java.lang.Object any)
           
 void flush()
          Release offscreen images and stop threads.
 Display getDisplay()
           
 ij.ImagePlus getFakeImagePlus()
          CAREFUL: the ImageProcessor of the returned ImagePlus is fake, that is, a 4x4 byte array; but the dimensions that it returns are those of the host LayerSet.
protected  double getHigherZoomLevel2(double currentMag)
           
protected  double getLowerZoomLevel2(double currentMag)
          Enable zooming out up to the point where the display becomes 10 pixels in width or height.
 void handlePopupMenu()
          Overriding to disable it.
protected  void invalidateVolatile()
           
 boolean isDragging()
           
 boolean isInputEnabled()
           
 boolean isTransforming()
           
 void keyPressed(java.awt.event.KeyEvent ke)
           
 void keyReleased(java.awt.event.KeyEvent ke)
           
 void keyTyped(java.awt.event.KeyEvent ke)
           
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseEntered(java.awt.event.MouseEvent me)
           
 void mouseExited(java.awt.event.MouseEvent me)
           
 void mouseMoved(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
           
 void mouseReleased(java.awt.event.MouseEvent me)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent mwe)
          Key/Mouse bindings like: - ij.gui.StackWindow: wheel to scroll slices (in this case Layers) - Inkscape: control+wheel to zoom (apple+wheel in macosx, since control+wheel zooms desktop)
 void paint(java.awt.Graphics g)
           
 java.awt.image.BufferedImage paintOffscreen(Layer active_layer, int g_width, int g_height, java.awt.Rectangle srcRect, double magnification, Displayable active, int c_alphas, java.awt.Rectangle clipRect, Loader loader, java.util.HashMap<java.awt.Color,Layer> hm, java.util.ArrayList<LayerPanel> blending_list, int mode, GraphicsSource graphics_source, boolean prepaint, java.util.ArrayList<Displayable> al_top)
          Deprecated. 
 java.awt.image.BufferedImage paintOffscreen(Layer active_layer, java.util.List<Layer> layers, java.util.ArrayList<Displayable> al_paint, Displayable active, int g_width, int g_height, int c_alphas, Loader loader, java.util.HashMap<java.awt.Color,Layer> hm, java.util.ArrayList<LayerPanel> blending_list, int mode, GraphicsSource graphics_source, boolean prepaint, int first_non_patch)
           
 java.awt.image.BufferedImage paintOffscreen(Layer active_layer, java.util.List<Layer> layers, int g_width, int g_height, java.awt.Rectangle srcRect, double magnification, Displayable active, int c_alphas, java.awt.Rectangle clipRect, Loader loader, java.util.HashMap<java.awt.Color,Layer> hm, java.util.ArrayList<LayerPanel> blending_list, int mode, GraphicsSource graphics_source, boolean prepaint, java.util.ArrayList<Displayable> al_top, boolean preload)
          This method uses data only from the arguments, and changes none.
 void repaint()
          Overridden to multithread.
 void repaint(boolean update_graphics)
          Repaint everything, updating offscreen graphics if so specified.
 void repaint(Displayable d)
          Repaint as much as the bounding box around the given Displayable.
 void repaint(Displayable displ, int extra)
          Repaint as much as the bounding box around the given Displayable plus the extra padding.
 void repaint(Displayable displ, int extra, boolean update_graphics)
           
 void repaint(java.util.HashSet<Displayable> hs)
          Repaint the clip corresponding to the sum of all boundingboxes of Displayable objects in the hashset.
 void repaint(int x, int y, int width, int height)
          Overridden to multithread.
 void repaint(java.awt.Rectangle r, int extra)
          Repaint the given offscreen Rectangle after transforming its data on the fly to the srcRect and magnification of this DisplayCanvas.
 void repaint(java.awt.Rectangle box, int extra, boolean update_graphics)
          Repaint the given Rectangle after transforming its data on the fly to the srcRect and magnification of this DisplayCanvas.
protected  void scroll(int sx, int sy)
           
 void setCursor(int sx, int sy, int ox, int oy)
          Sets the cursor based on the current tool and cursor location.
 void setDimensions(double width, double height)
          Does not repaint.
protected  void setDrawingColor(int ox, int oy, boolean setBackground)
           
 void setDrawingSize(int new_width, int new_height)
           
protected  void setInitialMagnification(double mag)
          Used to constrain magnification so that only snapshots are used for painting when opening a new, large and filled Display.
 void setMagnification(double mag)
           
 void setReceivesInput(boolean b)
           
protected  void setSrcRect(int x, int y, int width, int height)
          Set the srcRect - used by the DisplayNavigator.
 void setup(double mag, java.awt.Rectangle srcRect)
          Used for restoring properties from the database.
 void setUpdateGraphics(boolean b)
           
 void showCentered(java.awt.Rectangle r)
          Center the srcRect around the given object(s) bounding box, zooming if necessary, so that the given r becomes a rectangle centered in the srcRect and zoomed out by a factor of 2.
 void update(java.awt.Graphics g)
           
 void waitForRepaint()
           
 void zoomIn()
          Zoom in using the current mouse position, or the center if the mouse is out.
 void zoomIn(int x, int y)
          Overriding to repaint the DisplayNavigator as well.
 void zoomOut()
          Zoom out using the current mouse position, or the center if the mouse is out.
 void zoomOut(int x, int y)
          Overriding to repaint the DisplayNavigator as well.
 void zoomToFit()
           
 
Methods inherited from class ij.gui.ImageCanvas
canEnlarge, cursorOverImage, disablePopupMenu, fitToWindow, getCursorLoc, getCustomRoi, getDisplayList, getHigherZoomLevel, getImage, getLowerZoomLevel, getMagnification, getModifiers, getOverlay, getPreferredSize, getShowAllColor, getShowAllList, getShowAllROIs, getSliceNumber, getSrcRect, handlePopupMenu, handleRoiMouseDown, mouseClicked, offScreenX, offScreenXD, offScreenY, offScreenYD, resetDoubleBuffer, screenX, screenXD, screenY, screenYD, setCustomRoi, setDisplayList, setDisplayList, setDisplayList, setImageUpdated, setOverlay, setShowAllColor, setShowAllROIs, setShowCursorStatus, setSourceRect, setupScroll, stackLabels, unzoom, zoom100Percent
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_STROKE

protected static java.awt.BasicStroke DEFAULT_STROKE
Paints a handle on the offscreen x,y. Adapted from ij.gui.Roi class.


DEFAULT_AFFINE

protected static java.awt.geom.AffineTransform DEFAULT_AFFINE

last_popup

protected java.awt.Point last_popup
In world coordinates.

Constructor Detail

DisplayCanvas

public DisplayCanvas(Display display,
                     int width,
                     int height)
Method Detail

invalidateVolatile

protected void invalidateVolatile()

getDisplay

public Display getDisplay()

setInitialMagnification

protected void setInitialMagnification(double mag)
Used to constrain magnification so that only snapshots are used for painting when opening a new, large and filled Display.


setup

public void setup(double mag,
                  java.awt.Rectangle srcRect)
Used for restoring properties from the database.


setDimensions

public void setDimensions(double width,
                          double height)
Does not repaint.


handlePopupMenu

public void handlePopupMenu()
Overriding to disable it.


update

public final void update(java.awt.Graphics g)
Overrides:
update in class ij.gui.ImageCanvas

setMagnification

public void setMagnification(double mag)
Overrides:
setMagnification in class ij.gui.ImageCanvas

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class ij.gui.ImageCanvas

waitForRepaint

public void waitForRepaint()

drawHandle

public static void drawHandle(java.awt.Graphics g,
                              int x,
                              int y,
                              double magnification)
Paints a handle on the screen coords. Adapted from ij.gui.Roi class.


drawScreenHandle

public static void drawScreenHandle(java.awt.Graphics g,
                                    int x,
                                    int y)
Paints a handle at x,y screen coords.


drawHandle

public static void drawHandle(java.awt.Graphics2D g,
                              double x,
                              double y,
                              java.awt.Rectangle srcRect,
                              double magnification)

setDrawingColor

protected void setDrawingColor(int ox,
                               int oy,
                               boolean setBackground)
Overrides:
setDrawingColor in class ij.gui.ImageCanvas

consumeLastPopupPoint

protected java.awt.Point consumeLastPopupPoint()

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class ij.gui.ImageCanvas

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class ij.gui.ImageCanvas

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class ij.gui.ImageCanvas

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)
Specified by:
mouseEntered in interface java.awt.event.MouseListener
Overrides:
mouseEntered in class ij.gui.ImageCanvas

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)
Specified by:
mouseExited in interface java.awt.event.MouseListener
Overrides:
mouseExited in class ij.gui.ImageCanvas

setCursor

public void setCursor(int sx,
                      int sy,
                      int ox,
                      int oy)
Sets the cursor based on the current tool and cursor location.

Overrides:
setCursor in class ij.gui.ImageCanvas

setSrcRect

protected void setSrcRect(int x,
                          int y,
                          int width,
                          int height)
Set the srcRect - used by the DisplayNavigator.


setDrawingSize

public void setDrawingSize(int new_width,
                           int new_height)
Overrides:
setDrawingSize in class ij.gui.ImageCanvas

adjustDimensions

public void adjustDimensions()
Adjust srcRect and internal variables to the canvas' bounds.


adjustSrcRect

public void adjustSrcRect(int new_width,
                          int new_height)
Adjust srcRect to new dimensions.


getLowerZoomLevel2

protected double getLowerZoomLevel2(double currentMag)
Enable zooming out up to the point where the display becomes 10 pixels in width or height.


getHigherZoomLevel2

protected double getHigherZoomLevel2(double currentMag)

isDragging

public boolean isDragging()

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class ij.gui.ImageCanvas

zoomIn

public void zoomIn()
Zoom in using the current mouse position, or the center if the mouse is out.


zoomIn

public void zoomIn(int x,
                   int y)
Overriding to repaint the DisplayNavigator as well.

Overrides:
zoomIn in class ij.gui.ImageCanvas

zoomOut

public void zoomOut()
Zoom out using the current mouse position, or the center if the mouse is out.


zoomOut

public void zoomOut(int x,
                    int y)
Overriding to repaint the DisplayNavigator as well.

Overrides:
zoomOut in class ij.gui.ImageCanvas

showCentered

public void showCentered(java.awt.Rectangle r)
Center the srcRect around the given object(s) bounding box, zooming if necessary, so that the given r becomes a rectangle centered in the srcRect and zoomed out by a factor of 2.


center

public void center(java.awt.Rectangle r,
                   double magn)
Show the given r as the srcRect (or as much of it as possible) at the given magnification.


repaint

public void repaint(Displayable d)
Repaint as much as the bounding box around the given Displayable. If the Displayable is null, the entire canvas is repainted, remaking the offscreen images.


repaint

public void repaint(Displayable displ,
                    int extra)
Repaint as much as the bounding box around the given Displayable plus the extra padding. If the Displayable is null, the entire canvas is repainted, remaking the offscreen images.


repaint

public void repaint(Displayable displ,
                    int extra,
                    boolean update_graphics)

repaint

public void repaint(java.util.HashSet<Displayable> hs)
Repaint the clip corresponding to the sum of all boundingboxes of Displayable objects in the hashset.


repaint

public void repaint(java.awt.Rectangle r,
                    int extra)
Repaint the given offscreen Rectangle after transforming its data on the fly to the srcRect and magnification of this DisplayCanvas. The Rectangle is not modified.


repaint

public void repaint(java.awt.Rectangle box,
                    int extra,
                    boolean update_graphics)
Repaint the given Rectangle after transforming its data on the fly to the srcRect and magnification of this DisplayCanvas. The Rectangle is not modified.

Parameters:
box - The rectangle to repaint
extra - The extra outbound padding to add to the rectangle
update_graphics - Whether to recreate the offscreen images or not

repaint

public void repaint(boolean update_graphics)
Repaint everything, updating offscreen graphics if so specified.


repaint

public void repaint()
Overridden to multithread. This method is here basically to enable calls to the FakeImagePlus.draw from the HAND and other tools to repaint properly.

Overrides:
repaint in class java.awt.Component

repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height)
Overridden to multithread.

Overrides:
repaint in class java.awt.Component

setUpdateGraphics

public void setUpdateGraphics(boolean b)

flush

public void flush()
Release offscreen images and stop threads.


destroy

public void destroy()

applyTransform

public boolean applyTransform()

isTransforming

public boolean isTransforming()

cancelTransform

public void cancelTransform()

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent ke)
Specified by:
keyReleased in interface java.awt.event.KeyListener

zoomToFit

public void zoomToFit()

setReceivesInput

public void setReceivesInput(boolean b)

isInputEnabled

public boolean isInputEnabled()

exportXML

public void exportXML(java.lang.StringBuilder sb_body,
                      java.lang.String indent,
                      java.lang.Object any)

getFakeImagePlus

public ij.ImagePlus getFakeImagePlus()
CAREFUL: the ImageProcessor of the returned ImagePlus is fake, that is, a 4x4 byte array; but the dimensions that it returns are those of the host LayerSet. Used to retrieve ROIs for example.


mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent mwe)
Key/Mouse bindings like: - ij.gui.StackWindow: wheel to scroll slices (in this case Layers) - Inkscape: control+wheel to zoom (apple+wheel in macosx, since control+wheel zooms desktop)

Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener

paintOffscreen

@Deprecated
public java.awt.image.BufferedImage paintOffscreen(Layer active_layer,
                                                              int g_width,
                                                              int g_height,
                                                              java.awt.Rectangle srcRect,
                                                              double magnification,
                                                              Displayable active,
                                                              int c_alphas,
                                                              java.awt.Rectangle clipRect,
                                                              Loader loader,
                                                              java.util.HashMap<java.awt.Color,Layer> hm,
                                                              java.util.ArrayList<LayerPanel> blending_list,
                                                              int mode,
                                                              GraphicsSource graphics_source,
                                                              boolean prepaint,
                                                              java.util.ArrayList<Displayable> al_top)
Deprecated. 


paintOffscreen

public java.awt.image.BufferedImage paintOffscreen(Layer active_layer,
                                                   java.util.List<Layer> layers,
                                                   int g_width,
                                                   int g_height,
                                                   java.awt.Rectangle srcRect,
                                                   double magnification,
                                                   Displayable active,
                                                   int c_alphas,
                                                   java.awt.Rectangle clipRect,
                                                   Loader loader,
                                                   java.util.HashMap<java.awt.Color,Layer> hm,
                                                   java.util.ArrayList<LayerPanel> blending_list,
                                                   int mode,
                                                   GraphicsSource graphics_source,
                                                   boolean prepaint,
                                                   java.util.ArrayList<Displayable> al_top,
                                                   boolean preload)
This method uses data only from the arguments, and changes none. Will fill @param al_top with proper Displayable objects, or none when none are selected.


paintOffscreen

public java.awt.image.BufferedImage paintOffscreen(Layer active_layer,
                                                   java.util.List<Layer> layers,
                                                   java.util.ArrayList<Displayable> al_paint,
                                                   Displayable active,
                                                   int g_width,
                                                   int g_height,
                                                   int c_alphas,
                                                   Loader loader,
                                                   java.util.HashMap<java.awt.Color,Layer> hm,
                                                   java.util.ArrayList<LayerPanel> blending_list,
                                                   int mode,
                                                   GraphicsSource graphics_source,
                                                   boolean prepaint,
                                                   int first_non_patch)

scroll

protected void scroll(int sx,
                      int sy)
Overrides:
scroll in class ij.gui.ImageCanvas

animateBrowsing

protected void animateBrowsing(int dx,
                               int dy)
Smoothly move the canvas from x0,y0,layer0 to x1,y1,layer1


animateBrowsing

public boolean animateBrowsing(java.awt.Rectangle target_,
                               Layer target_layer)
Smoothly move the canvas from its current position until the given rectangle is included within the srcRect. If the given rectangle is larger than the srcRect, it will refuse to work (for now).