]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/XPM.h
1 // Scintilla source code edit control
3 ** Define a class that holds data in the X Pixmap (XPM) format.
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.
16 * Hold a pixmap in XPM format.
19 int pid
; // Assigned by container
26 ColourDesired
*colours
;
27 ColourDesired
ColourDesiredFromCode(int ch
) const;
28 ColourDesired
ColourFromCode(int ch
) const;
29 void FillRun(Surface
*surface
, int code
, int startX
, int y
, int x
);
31 ColourDesired
*colourCodeTable
[256];
33 XPM(const char *textForm
);
34 XPM(const char *const *linesForm
);
36 void Init(const char *textForm
);
37 void Init(const char *const *linesForm
);
39 /// Decompose image into runs and use FillRectangle for each run
40 void Draw(Surface
*surface
, PRectangle
&rc
);
41 char **InLinesForm() { return lines
; }
42 void SetId(int pid_
) { pid
= pid_
; }
43 int GetId() const { return pid
; }
44 int GetHeight() const { return height
; }
45 int GetWidth() const { return width
; }
46 void PixelAt(int x
, int y
, ColourDesired
&colour
, bool &transparent
) const;
47 static const char **LinesFormFromTextForm(const char *textForm
);
51 * A collection of pixmaps indexed by integer id.
54 XPM
**set
; ///< The stored XPMs.
55 int len
; ///< Current number of XPMs.
56 int maximum
; ///< Current maximum number of XPMs, increased by steps if reached.
57 int height
; ///< Memorize largest height of the set.
58 int width
; ///< Memorize largest width of the set.
65 void Add(int ident
, const char *textForm
);
68 /// Give the largest height of the set.
70 /// Give the largest width of the set.
75 * An translucent image stoed as a sequence of RGBA bytes.
78 // Private so RGBAImage objects can not be copied
79 RGBAImage(const RGBAImage
&);
80 RGBAImage
&operator=(const RGBAImage
&);
83 std::vector
<unsigned char> pixelBytes
;
85 RGBAImage(int width_
, int height_
, const unsigned char *pixels_
);
86 RGBAImage(const XPM
&xpm
);
88 int GetHeight() const { return height
; }
89 int GetWidth() const { return width
; }
90 int CountBytes() const;
91 const unsigned char *Pixels() const;
92 void SetPixel(int x
, int y
, ColourDesired colour
, int alpha
=0xff);
96 * A collection of RGBAImage pixmaps indexed by integer id.
99 typedef std::map
<int, RGBAImage
*> ImageMap
;
101 mutable int height
; ///< Memorize largest height of the set.
102 mutable int width
; ///< Memorize largest width of the set.
106 /// Remove all images.
109 void Add(int ident
, RGBAImage
*image
);
111 RGBAImage
*Get(int ident
);
112 /// Give the largest height of the set.
113 int GetHeight() const;
114 /// Give the largest width of the set.
115 int GetWidth() const;