Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CAUGuiCroppingImage Class Reference

CAUGuiCroppingImage performs value dependent shifting, cropping or scaling. More...

#include <CAUGuiMoreImages.h>

Inheritance diagram for CAUGuiCroppingImage:

CAUGuiGraphic CAUGuiItem List of all members.

Public Member Functions

 CAUGuiCroppingImage (char *pngFileName, SInt32 pivotOffsetX, SInt32 pivotOffsetY, SInt32 theOrientation, UInt32 theMode)
 constructor for a CAUGuiCroppingImage

virtual ~CAUGuiCroppingImage ()
 destructor

virtual void draw (CGContextRef context, UInt32 portHeight, eRect *rect, float value)
 letting Graphics draw themselves


Detailed Description

CAUGuiCroppingImage performs value dependent shifting, cropping or scaling.

This type of image can be used for faders, meters etc. It generally hides a part of itself according to value...

You have three different modes:

Again, a Pivot determines the center of action

An Orientation parameter determines either horizontal or vertical action, it is set up in binary flags:

Note: on scaling and cropping, the Orientation flags can be combined, but only one vertical and one horizontal make sense on shifting images.

example:

a simple image that works good for a vertical LED (meter) or a vertical Slider

assume ledchain.png to be an image of 10x100 pixels

CAUGuiGraphic* horizontal_handle = new CAUGuiCroppingImage ( "ledchain.png", 0, 50, 2, 0 );

Mode is 0, so this is a cropping image

Orientation is 2, so on lower values it displays less of it above the pivot

The pivot is set to 50 pixels down from center of the image, so at its very bottom. Hence, normalized values from 0.0f to 1.0f make the Image more and more visible from its bottom to its top.

If we now set Mode to 2 (scaling), the whole area of the image would be drawn, but it would be shrinked on lower values.

Accordingly, setting Mode to 1 (shifting), the image would behave like a drawbar and on lower values shift out of the bottom of the control

Tip: Not setting the Pivot to image borders lets some of it visible even on extreme values. This may be good for darwbars (organ visuals, made up from CAUGuiSliders), VU Meters etc.

Definition at line 196 of file CAUGuiMoreImages.h.


Constructor & Destructor Documentation

CAUGuiCroppingImage::CAUGuiCroppingImage char *  pngFileName,
SInt32  pivotOffsetX,
SInt32  pivotOffsetY,
SInt32  theOrientation,
UInt32  theMode
 

constructor for a CAUGuiCroppingImage

Parameters:
pngFileName the filename of the PNG resource
pivotOffsetX horizontal offset of center of rotation from center of image
pivotOffsetY vertical offset of center of rotation from center of image
theOrientation 1 = bottom-pivotY, 2 = top-pivotY, 3 = left-pivotX, 4 = right-pivotX
theMode 0 = cropping, 1 = shifting, 2 = scaling

Definition at line 168 of file CAUGuiMoreImages.cpp.

virtual CAUGuiCroppingImage::~CAUGuiCroppingImage  )  [inline, virtual]
 

destructor

Definition at line 213 of file CAUGuiMoreImages.h.


Member Function Documentation

void CAUGuiCroppingImage::draw CGContextRef  context,
UInt32  portHeight,
eRect rect,
float  value
[virtual]
 

letting Graphics draw themselves

Parameters:
context is the CGContextRef to render into
portHeight the height of the Window, needed for "upside down" Quartz drawing
rect the eRect where to draw into, does usually scale the image
value normalized between 0.f and 1.f, needed i.e. from frame based animation

Reimplemented from CAUGuiGraphic.

Definition at line 189 of file CAUGuiMoreImages.cpp.

References CAUGuiGraphic::getHeight(), CAUGuiGraphic::getImage(), CAUGuiGraphic::getWidth(), eRect::grow(), eRect::h, eRect::offset(), eRect::set(), eRect::to(), and eRect::w.


The documentation for this class was generated from the following files:
(c) 2002 - 2003 by Urs Heckmann www.u-he.com
Generated on Thu May 6 15:13:14 2004 for CAUGui by doxygen 1.3.6