# imrectLite

## PURPOSE

A 'lite' version of imrect [OBSOLETE: use imrectRot].

## SYNOPSIS

function [hRect,api] = imrectLite( hParent, pos, lims, ar, varargin )

## DESCRIPTION

     A 'lite' version of imrect [OBSOLETE: use imrectRot].

     There are significant problems using imrect in a larger GUI, mostly
     due to the fact that imrect is such a heavy object.  This creates a
     simple, fast, and in some ways nicer version of imrect.

     The implementation uses two graphics object: a rectangle and a patch.
     The patch is just there to catch mouse clicks in case the rectangle does
     not have a face color.  Any valid property of the rectangle may be
     altered (such as 'FaceColor', 'Curvature', ... ), EXCEPT for its
     'ButtonDownFcn', 'DeleteFcn' and 'Position' properties.  To change the
     'Position' of the rectangle, use the output structure 'api' (described
     below).

     USAGE
      [hRect,api] = imrectLite( [hParent],[pos],[lims],[ar],[varargin] )

     INPUTS
      hParent    - [gca] object parent, typically an axes object (gca)
      pos        - [] initial pos vector [x y w h] or [] or [x0 y0]
      lims       - [] 2x2 matrix of [xMin xMax; yMin yMax]
      ar         - [0] aspect ratio (if positive w/h is constrained to ar)
      varargin   - [] parameters to RECTANGLE graphics object

     OUTPUTS
      hRect      - handle to rectangle, use to alter color etc.
      api        - interface allowing access to created object
      .getPos()       - get position - returns 4 elt pos
      .setPos(pos)    - set position (while respecting constraints)
      .setAr(ar)      - set aspect ratio to fixed value
      .setPosLock(b)  - if lock set (b==true), rectangle cannot change
      .setSizLock(b)  - if lock set (b==true), rectangle cannot change size
      .setPosChnCb(f) - whenever pos changes (even slightly), calls f(pos)
      .setPosSetCb(f) - whenever pos finished changing, calls f(pos)
      .uistack(...)   - calls 'uistack( [hRect hPatch], ... )', see uistack

     EXAMPLE
      figure(1), imshow cameraman.tif
      rectProp = {'EdgeColor','g','LineWidth',4,'Curvature',[.1 .1]};
      lims = [get(gca,'xLim'); get(gca,'yLim')];
      [h,api] = imrectLite( gca, [], lims, [],  rectProp{:} );
      api.setPosChnCb( @(pos) disp(['        ' num2str(pos)]) );
      api.setPosSetCb( @(pos) disp(['FINAL = ' num2str(pos)]) );

     See also IMRECT, RECTANGLE, PATCH

     Piotr's Image&Video Toolbox      Version 2.35
     Copyright 2009 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by: