Audacity  2.2.0
ImageRoll Class Reference

An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed pieces and repeating pieces. More...

#include <ImageRoll.h>

Public Types

enum  RollType {
  Uninitialized, FixedImage, HorizontalRoll, VerticalRoll,
  Frame
}
 

Public Member Functions

 ImageRoll ()
 
 ImageRoll (const wxImage &src)
 
 ImageRoll (RollType type, const wxImage &src, wxColour magicColor)
 
bool Ok () const
 
wxSize GetMinSize () const
 
wxSize GetMaxSize () const
 
void Draw (wxDC &dc, wxRect rect, wxRasterOperationMode logicalFunc=wxCOPY)
 

Static Public Member Functions

static ImageArray SplitH (const wxImage &src, wxColour magicColor)
 
static ImageArray SplitV (const wxImage &src, wxColour magicColor)
 

Protected Member Functions

void DrawBitmap (wxDC &dc, wxBitmap &bitmap, int x, int y, wxRasterOperationMode logicalFunc=wxCOPY)
 
void Init (RollType type, const wxImage &src, wxColour magicColor)
 

Protected Attributes

RollType mType
 
BitmapArray mPieces
 
wxSize mMinSize
 
wxSize mMaxSize
 

Detailed Description

An ImageRoll is an image that can be expanded to an arbitrary size; it is made up of both fixed pieces and repeating pieces.

A typical ImageRoll might be made up of two fixed ends and a repeating middle part:

  /-----\                       /-----\
  |LEFT |--REPEATING--REPEATING-|RIGHT|
  \-----/                       \-----/

As you resize the image, it could look like this:

  /-----\ /-----\
  |LEFT |-|RIGHT|
  \-----/ \-----/

Or like this:

  /-----\                                  /-----\
  |LEFT |--REPEATING--REPEATING--REPEATING-|RIGHT|
  \-----/                                  \-----/

Note that an ImageRoll can have a center piece; in fact, its pieces always alternate fixed, repeating, fixed, repeating, etc. - although one of these pieces is allowed to be of size zero, making it skipped. Here's an example with a center piece:

  /-----\                /------\                /-----\
  |LEFT |-REPEAT--REPEAT-|CENTER|-repeat--repeat-|RIGHT|
  \-----/                \------/                \-----/

Note that the left and right repeating sections can be different. Of course, an ImageRoll can be oriented vertically as well. In the future, support for an ImageRoll that expands both horizontally and vertically at the same time will be supported.

An ImageRoll is initialized with a single wxImage that defines all of its pieces. This is done by way of a "magic color" which separates each piece in the image. If the magic colored pixel is denoted by "X", the above ImageRoll could be encoded like this:

  /-----\X        X/------\X        X/-----\
  |LEFT |X-REPEAT-X|CENTER|X-repeat-X|RIGHT|
  \-----/X        X\------/X        X\-----/

Putting two lines of magic color in a row will create a blank piece. For example, for an ImageRoll with a center piece but no left and right pieces:

  X        X/------\X        X
  X-REPEAT-X|CENTER|X-repeat-X
  X        X\------/X        X

Once again, the pieces are always assumed to alternate: fixed, repeating, fixed, repeating, etc. The magic color is specified when you construct the ImageRoll from a wxImage.

In the constructor, you also choose whether it is a horizontal or vertical ImageRoll (and later a "Frame" as well). You can also choose a "fixed" ImageRoll, which behaves just like a wxImage - this is handy so that you can use ImageRolls everywhere you were previously using wxImages.

Member Enumeration Documentation

Enumerator
Uninitialized 
FixedImage 
HorizontalRoll 
VerticalRoll 
Frame 

Constructor & Destructor Documentation

ImageRoll::ImageRoll ( )

References mType, and Uninitialized.

ImageRoll::ImageRoll ( const wxImage &  src)

References FixedImage, and Init().

ImageRoll::ImageRoll ( RollType  type,
const wxImage &  src,
wxColour  magicColor 
)

References Init().

Member Function Documentation

void ImageRoll::Draw ( wxDC &  dc,
wxRect  rect,
wxRasterOperationMode  logicalFunc = wxCOPY 
)
void ImageRoll::DrawBitmap ( wxDC &  dc,
wxBitmap &  bitmap,
int  x,
int  y,
wxRasterOperationMode  logicalFunc = wxCOPY 
)
protected

Referenced by Draw().

wxSize ImageRoll::GetMaxSize ( ) const
inline

References mMaxSize.

wxSize ImageRoll::GetMinSize ( ) const
inline

References mMinSize.

void ImageRoll::Init ( RollType  type,
const wxImage &  src,
wxColour  magicColor 
)
protected
bool ImageRoll::Ok ( ) const

References mType, and Uninitialized.

Referenced by Draw(), and Init().

ImageArray ImageRoll::SplitH ( const wxImage &  src,
wxColour  magicColor 
)
static
ImageArray ImageRoll::SplitV ( const wxImage &  src,
wxColour  magicColor 
)
static

Referenced by Init().

Member Data Documentation

wxSize ImageRoll::mMaxSize
protected

Referenced by GetMaxSize(), and Init().

wxSize ImageRoll::mMinSize
protected

Referenced by GetMinSize(), and Init().

BitmapArray ImageRoll::mPieces
protected

Referenced by Draw(), and Init().

RollType ImageRoll::mType
protected

Referenced by Draw(), ImageRoll(), Init(), and Ok().


The documentation for this class was generated from the following files: