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

CAUGuiSpinImage Class Reference

CAUGuiSpinImage handles rotating images. More...

#include <CAUGuiMoreImages.h>

Inheritance diagram for CAUGuiSpinImage:

CAUGuiGraphic CAUGuiItem List of all members.

Public Member Functions

 CAUGuiSpinImage (char *pngFileName, float min, float max, SInt32 pivotOffsetX, SInt32 pivotOffsetY, bool fixed)
 constructor for a CAUGuiSpinImage

virtual ~CAUGuiSpinImage ()
 destructor

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

virtual void draw (CGContextRef context, UInt32 portHeight, eRect *rect, float value, SInt32 pivotOffsetX, SInt32 pivotOffsetY)
 special case when used in a knob and the knob's internal pivot isn't in the center


Detailed Description

CAUGuiSpinImage handles rotating images.

This CAUGuiGraphic obviously handles an image.

It does this in two ways:

For both ways it has a so called Pivot point that by default sits in the center of the image. For both cases, this may be in most cases sufficient, but for orbital movement the there's another Pivot to be passed from the control object that should commonly be shifted _below_ the image by half the diameter of the circle.

The image passed is assumed to point to the top.

The amount rotation is scaled and mapped to a definable angle. Commonly it is a 270 degree rotation which means minimum value is 135 degree to the left (counter clockwise) and maximum value is 135 degree to the right (clockwise)

The scaling itself isn't done in degree or radians but in normalized measure of the unit circle, so the values look like this:

min = -0.375f // 135 degree counter clockwise

max = 0.375f // 135 degree clockwise

example:

the typical rotating knob:
CAUGuiGraphic* needle_handle = new CAUGuiSpinImage ( "knob_needle.png", -0.375f, 0.375f, 0, 0, false );

an orbiting handle with an Pivot offset to compensate for a little shadow on bottom right:
CAUGuiGraphic* round_handle = new CAUGuiSpinImage ( "round_handle.png", -0.375f, 0.375f, -2, 2, true );

Definition at line 50 of file CAUGuiMoreImages.h.


Constructor & Destructor Documentation

CAUGuiSpinImage::CAUGuiSpinImage char *  pngFileName,
float  min,
float  max,
SInt32  pivotOffsetX,
SInt32  pivotOffsetY,
bool  fixed
 

constructor for a CAUGuiSpinImage

Parameters:
pngFileName the filename of the PNG resource
min rotation amout to the left
max rotation amount to the right
pivotOffsetX horizontal offset of center of rotation from center of image
pivotOffsetY vertical offset of center of rotation from center of image
fixed false = rotation, true = orbital behaviour

Definition at line 12 of file CAUGuiMoreImages.cpp.

References CAUGuiGraphic::getHeight(), CAUGuiGraphic::getWidth(), kCAUGui_SpinImage, PI, and CAUGuiItem::setType().

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

destructor

Definition at line 68 of file CAUGuiMoreImages.h.


Member Function Documentation

void CAUGuiSpinImage::draw CGContextRef  context,
UInt32  portHeight,
eRect rect,
float  value,
SInt32  pivotOffsetX,
SInt32  pivotOffsetY
[virtual]
 

special case when used in a knob and the knob's internal pivot isn't in the center

Definition at line 72 of file CAUGuiMoreImages.cpp.

References CAUGuiGraphic::getImage(), and eRect::to().

void CAUGuiSpinImage::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 40 of file CAUGuiMoreImages.cpp.

References CAUGuiGraphic::getImage(), and eRect::to().


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:15 2004 for CAUGui by doxygen 1.3.6