1
// Scintilla source code edit control
3
** Define a classes to hold image data in the X Pixmap (XPM) and RGBA formats.
5
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
6
// The License.txt file describes the conditions under which this software may be distributed.
21
* Hold a pixmap in XPM format.
27
std::vector<unsigned char> pixels;
28
ColourDesired colourCodeTable[256];
30
ColourDesired ColourFromCode(int ch) const;
31
void FillRun(Surface *surface, int code, int startX, int y, int x);
33
explicit XPM(const char *textForm);
34
explicit XPM(const char *const *linesForm);
36
void Init(const char *textForm);
37
void Init(const char *const *linesForm);
38
/// Decompose image into runs and use FillRectangle for each run
39
void Draw(Surface *surface, PRectangle &rc);
40
int GetHeight() const { return height; }
41
int GetWidth() const { return width; }
42
void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const;
44
static std::vector<const char *>LinesFormFromTextForm(const char *textForm);
48
* A translucent image stored as a sequence of RGBA bytes.
51
// Private so RGBAImage objects can not be copied
52
RGBAImage(const RGBAImage &);
53
RGBAImage &operator=(const RGBAImage &);
57
std::vector<unsigned char> pixelBytes;
59
RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_);
60
explicit RGBAImage(const XPM &xpm);
62
int GetHeight() const { return height; }
63
int GetWidth() const { return width; }
64
float GetScale() const { return scale; }
65
float GetScaledHeight() const { return height / scale; }
66
float GetScaledWidth() const { return width / scale; }
67
int CountBytes() const;
68
const unsigned char *Pixels() const;
69
void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff);
73
* A collection of RGBAImage pixmaps indexed by integer id.
76
typedef std::map<int, RGBAImage*> ImageMap;
78
mutable int height; ///< Memorize largest height of the set.
79
mutable int width; ///< Memorize largest width of the set.
83
/// Remove all images.
86
void Add(int ident, RGBAImage *image);
88
RGBAImage *Get(int ident);
89
/// Give the largest height of the set.
90
int GetHeight() const;
91
/// Give the largest width of the set.