Panda3D

pgFrameStyle.I
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pgFrameStyle.I
10 * @author drose
11 * @date 2001-07-03
12 */
13
14 /**
15 *
16 */
17 INLINE PGFrameStyle::
18 PGFrameStyle() {
19 _type = T_none;
20 _color.set(1.0f, 1.0f, 1.0f, 1.0f);
21 _width.set(0.1f, 0.1f);
22 _uv_width.set(0.1f, 0.1f);
23 _visible_scale.set(1.0f, 1.0f);
24 }
25
26 /**
27 *
28 */
29 INLINE PGFrameStyle::
30 PGFrameStyle(const PGFrameStyle &copy) :
31 _type(copy._type),
32 _color(copy._color),
33 _texture(copy._texture),
34 _width(copy._width),
35 _uv_width(copy._uv_width),
36 _visible_scale(copy._visible_scale)
37 {
38 }
39
40 /**
41 *
42 */
43 INLINE void PGFrameStyle::
44 operator = (const PGFrameStyle &copy) {
45 _type = copy._type;
46 _color = copy._color;
47 _texture = copy._texture;
48 _width = copy._width;
49 _uv_width = copy._uv_width;
50 _visible_scale = copy._visible_scale;
51 }
52
53 /**
54 *
55 */
56 INLINE PGFrameStyle::
57 ~PGFrameStyle() {
58 }
59
60 /**
61 * Sets the basic type of frame.
62 */
63 INLINE void PGFrameStyle::
64 set_type(PGFrameStyle::Type type) {
65 _type = type;
66 }
67
68 /**
69 * Returns the basic type of frame.
70 */
71 INLINE PGFrameStyle::Type PGFrameStyle::
72 get_type() const {
73 return _type;
74 }
75
76 /**
77 * Sets the dominant color of the frame.
78 */
79 INLINE void PGFrameStyle::
80 set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
81 set_color(LColor(r, g, b, a));
82 }
83
84 /**
85 * Sets the dominant color of the frame.
86 */
87 INLINE void PGFrameStyle::
88 set_color(const LColor &color) {
89 _color = color;
90 }
91
92 /**
93 * Returns the dominant color of the frame.
94 */
95 INLINE LColor PGFrameStyle::
96 get_color() const {
97 return _color;
98 }
99
100 /**
101 * Specifies a texture that should be applied to the frame.
102 */
103 INLINE void PGFrameStyle::
104 set_texture(Texture *texture) {
105 _texture = texture;
106 }
107
108 /**
109 * Returns true if a texture has been applied to the frame.
110 */
111 INLINE bool PGFrameStyle::
112 has_texture() const {
113 return !_texture.is_null();
114 }
115
116 /**
117 * Returns the texture that has been applied to the frame, or NULL if no
118 * texture has been applied.
119 */
120 INLINE Texture *PGFrameStyle::
121 get_texture() const {
122 return _texture;
123 }
124
125 /**
126 * Removes the texture from the frame.
127 */
128 INLINE void PGFrameStyle::
129 clear_texture() {
130 _texture.clear();
131 }
132
133 /**
134 * Sets the width parameter, which has meaning only for certain frame types.
135 * For instance, this is the width of the bevel for T_bevel_in or T_bevel_out.
136 * The units are in screen units.
137 */
138 INLINE void PGFrameStyle::
139 set_width(PN_stdfloat x, PN_stdfloat y) {
140 set_width(LVecBase2(x, y));
141 }
142
143 /**
144 * Sets the width parameter, which has meaning only for certain frame types.
145 * For instance, this is the width of the bevel for T_bevel_in or T_bevel_out.
146 * The units are in screen units.
147 */
148 INLINE void PGFrameStyle::
149 set_width(const LVecBase2 &width) {
150 _width = width;
151 }
152
153 /**
154 * Returns the width parameter, which has meaning only for certain frame
155 * types. For instance, this is the width of the bevel for T_bevel_in or
156 * T_bevel_out. The units are in screen units.
157 */
158 INLINE const LVecBase2 &PGFrameStyle::
159 get_width() const {
160 return _width;
161 }
162
163 /**
164 * Sets the uv_width parameter, which indicates the amount of the texture that
165 * is consumed by the inner bevel--the width in texture space of the amount
166 * indicated by set_width.
167 */
168 INLINE void PGFrameStyle::
169 set_uv_width(PN_stdfloat u, PN_stdfloat v) {
170 set_uv_width(LVecBase2(u, v));
171 }
172
173 /**
174 * Sets the uv_width parameter, which indicates the amount of the texture that
175 * is consumed by the inner bevel--the width in texture space of the amount
176 * indicated by set_width.
177 */
178 INLINE void PGFrameStyle::
179 set_uv_width(const LVecBase2 &uv_width) {
180 _uv_width = uv_width;
181 }
182
183 /**
184 * See set_uv_width().
185 */
186 INLINE const LVecBase2 &PGFrameStyle::
187 get_uv_width() const {
188 return _uv_width;
189 }
190
191 /**
192 * Sets a scale factor on the visible representation of the frame, in the X
193 * and Y directions. If this scale factor is other than 1, it will affect the
194 * size of the visible frame representation within the actual frame border.
195 */
196 INLINE void PGFrameStyle::
197 set_visible_scale(PN_stdfloat x, PN_stdfloat y) {
198 set_visible_scale(LVecBase2(x, y));
199 }
200
201 /**
202 * Sets a scale factor on the visible representation of the frame, in the X
203 * and Y directions. If this scale factor is other than 1, it will affect the
204 * size of the visible frame representation within the actual frame border.
205 */
206 INLINE void PGFrameStyle::
207 set_visible_scale(const LVecBase2 &visible_scale) {
208 _visible_scale = visible_scale;
209 }
210
211 /**
212 * Returns the scale factor on the visible representation of the frame, in the
213 * X and Y directions. If this scale factor is other than 1, it will affect
214 * the size of the visible frame representation within the actual frame
215 * border.
216 */
217 INLINE const LVecBase2 &PGFrameStyle::
218 get_visible_scale() const {
219 return _visible_scale;
220 }
221
222 /**
223 *
224 */
225 INLINE std::ostream &
226 operator << (std::ostream &out, const PGFrameStyle &pfs) {
227 pfs.output(out);
228 return out;
229 }
PGFrameStyle
Definition: pgFrameStyle.h:29
PGFrameStyle::set_type
void set_type(Type type)
Sets the basic type of frame.
Definition: pgFrameStyle.I:64
PGFrameStyle::set_texture
void set_texture(Texture *texture)
Specifies a texture that should be applied to the frame.
Definition: pgFrameStyle.I:104
PGFrameStyle::get_visible_scale
const LVecBase2 & get_visible_scale() const
Returns the scale factor on the visible representation of the frame, in the X and Y directions.
Definition: pgFrameStyle.I:218
PGFrameStyle::get_type
Type get_type() const
Returns the basic type of frame.
Definition: pgFrameStyle.I:72
PGFrameStyle::set_visible_scale
void set_visible_scale(PN_stdfloat x, PN_stdfloat y)
Sets a scale factor on the visible representation of the frame, in the X and Y directions.
Definition: pgFrameStyle.I:197
PGFrameStyle::get_color
LColor get_color() const
Returns the dominant color of the frame.
Definition: pgFrameStyle.I:96
PGFrameStyle::set_uv_width
void set_uv_width(PN_stdfloat u, PN_stdfloat v)
Sets the uv_width parameter, which indicates the amount of the texture that is consumed by the inner ...
Definition: pgFrameStyle.I:169
PGFrameStyle::set_color
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
Definition: pgFrameStyle.I:80
PGFrameStyle::has_texture
bool has_texture() const
Returns true if a texture has been applied to the frame.
Definition: pgFrameStyle.I:112
PGFrameStyle::get_width
const LVecBase2 & get_width() const
Returns the width parameter, which has meaning only for certain frame types.
Definition: pgFrameStyle.I:159
PGFrameStyle::clear_texture
void clear_texture()
Removes the texture from the frame.
Definition: pgFrameStyle.I:129
PGFrameStyle::get_texture
Texture * get_texture() const
Returns the texture that has been applied to the frame, or NULL if no texture has been applied.
Definition: pgFrameStyle.I:121
PGFrameStyle::set_width
void set_width(PN_stdfloat x, PN_stdfloat y)
Sets the width parameter, which has meaning only for certain frame types.
Definition: pgFrameStyle.I:139
PGFrameStyle::get_uv_width
const LVecBase2 & get_uv_width() const
See set_uv_width().
Definition: pgFrameStyle.I:187
Texture
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:71