Audacity 3.2.0
|
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) | |
ImageRoll (const ImageRoll &) | |
ImageRoll & | operator= (const ImageRoll &) |
~ImageRoll () | |
bool | Ok () const |
wxSize | GetMinSize () const |
wxSize | GetMaxSize () const |
void | Draw (wxDC &dc, wxRect rect, int logicalFunc) |
void | Draw (wxDC &dc, wxRect rect) |
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, int logicalFunc) |
void | Init (RollType type, const wxImage &src, wxColour magicColor) |
Protected Attributes | |
RollType | mType |
std::vector< wxBitmap > | mPieces |
wxSize | mMinSize |
wxSize | mMaxSize |
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.
Definition at line 27 of file ImageRoll.h.
enum ImageRoll::RollType |
Enumerator | |
---|---|
Uninitialized | |
FixedImage | |
HorizontalRoll | |
VerticalRoll | |
Frame |
Definition at line 30 of file ImageRoll.h.
ImageRoll::ImageRoll | ( | ) |
Definition at line 282 of file ImageRoll.cpp.
References mType, and Uninitialized.
ImageRoll::ImageRoll | ( | const wxImage & | src | ) |
Definition at line 292 of file ImageRoll.cpp.
References FixedImage, and Init().
Definition at line 287 of file ImageRoll.cpp.
References Init().
|
default |
|
default |
void ImageRoll::Draw | ( | wxDC & | dc, |
wxRect | rect | ||
) |
Definition at line 316 of file ImageRoll.cpp.
References Draw().
void ImageRoll::Draw | ( | wxDC & | dc, |
wxRect | rect, | ||
int | logicalFunc | ||
) |
|
protected |
Definition at line 302 of file ImageRoll.cpp.
References wxRasterOperationMode.
|
inline |
Definition at line 48 of file ImageRoll.h.
|
inline |
Definition at line 47 of file ImageRoll.h.
Definition at line 219 of file ImageRoll.cpp.
References FixedImage, Frame, HorizontalRoll, mMaxSize, mMinSize, mPieces, mType, Ok(), SplitH(), SplitV(), Uninitialized, and VerticalRoll.
Referenced by ImageRoll().
bool ImageRoll::Ok | ( | ) | const |
Definition at line 297 of file ImageRoll.cpp.
References mType, and Uninitialized.
Referenced by Init().
|
static |
Definition at line 109 of file ImageRoll.cpp.
References wxImage().
Referenced by Init(), and ToolBarGrabber::ToolBarGrabber().
|
static |
Definition at line 165 of file ImageRoll.cpp.
References wxImage().
Referenced by Init().
|
protected |
Definition at line 69 of file ImageRoll.h.
Referenced by Init().
|
protected |
Definition at line 68 of file ImageRoll.h.
Referenced by Init().
|
protected |
Definition at line 67 of file ImageRoll.h.
Referenced by Init().
|
protected |
Definition at line 65 of file ImageRoll.h.
Referenced by ImageRoll(), Init(), and Ok().