40 #ifndef _uiimagelayer_cpp
41 #define _uiimagelayer_cpp
43 #include "UI/imagelayer.h"
44 #include "UI/quadrenderable.h"
45 #include "UI/screen.h"
79 Vector2 TopLeft, TopRight, BottomLeft, BottomRight;
86 if(0.0 != this->BorderWidth)
88 Vector2 OuterTopLeft = TopLeft, OuterTopRight = TopRight, OuterBottomLeft = BottomLeft, OuterBottomRight = BottomRight;
89 OuterTopLeft.
X -= BorderWidth; OuterTopLeft.
Y -= BorderWidth;
90 OuterTopRight.X += BorderWidth; OuterTopRight.Y -= BorderWidth;
91 OuterBottomLeft.X -= BorderWidth; OuterBottomLeft.Y += BorderWidth;
92 OuterBottomRight.X += BorderWidth; OuterBottomRight.Y += BorderWidth;
95 this->
RotationTransform(OuterTopLeft,OuterTopRight,OuterBottomLeft,OuterBottomRight);
96 this->
DrawBorder(TopLeft,TopRight,BottomLeft,BottomRight,
97 OuterTopLeft,OuterTopRight,OuterBottomLeft,OuterBottomRight);
102 this->
DrawFill(TopLeft,TopRight,BottomLeft,BottomRight);
111 if( 0 != this->BorderColours[UI::Border_North].AlphaChannel )
113 this->
PushTriangle(TopLeft, OuterTopRight, OuterTopLeft, WP, this->BorderColours[UI::Border_North], this->
PriAtlas);
114 this->
PushTriangle(TopLeft, TopRight, OuterTopRight, WP, this->BorderColours[UI::Border_North], this->
PriAtlas);
118 if( 0 != this->BorderColours[UI::Border_East].AlphaChannel )
120 this->
PushTriangle(BottomRight, OuterTopRight, TopRight, WP, this->BorderColours[UI::Border_East], this->
PriAtlas);
121 this->
PushTriangle(BottomRight, OuterBottomRight, OuterTopRight, WP, this->BorderColours[UI::Border_East], this->
PriAtlas);
125 if( 0 != this->BorderColours[UI::Border_South].AlphaChannel )
127 this->
PushTriangle(OuterBottomLeft, BottomRight, BottomLeft, WP, this->BorderColours[UI::Border_South], this->
PriAtlas);
128 this->
PushTriangle(OuterBottomLeft, OuterBottomRight, BottomRight, WP, this->BorderColours[UI::Border_South], this->
PriAtlas);
132 if( 0 != this->BorderColours[UI::Border_West].AlphaChannel )
134 this->
PushTriangle(OuterBottomLeft, TopLeft, OuterTopLeft, WP, BorderColours[UI::Border_West], this->
PriAtlas);
135 this->
PushTriangle(OuterBottomLeft, BottomLeft, TopLeft, WP, BorderColours[UI::Border_West], this->
PriAtlas);
144 if( this->LayerSprite == NULL ) {
154 this->
PushVertex(BottomLeft.
X, BottomLeft.
Y, UVs[UI::QC_BottomLeft], this->FillColours[UI::QC_BottomLeft], this->PriAtlas);
155 this->
PushVertex(TopRight.
X, TopRight.
Y, UVs[UI::QC_TopRight], this->FillColours[UI::QC_TopRight], this->PriAtlas);
156 this->
PushVertex(TopLeft.
X, TopLeft.
Y, UVs[UI::QC_TopLeft], this->FillColours[UI::QC_TopLeft], this->PriAtlas);
159 this->
PushVertex(BottomLeft.
X, BottomLeft.
Y, UVs[UI::QC_BottomLeft], this->FillColours[UI::QC_BottomLeft], this->PriAtlas);
160 this->
PushVertex(BottomRight.
X, BottomRight.
Y, UVs[UI::QC_BottomRight], this->FillColours[UI::QC_BottomRight], this->PriAtlas);
161 this->
PushVertex(TopRight.
X, TopRight.
Y, UVs[UI::QC_TopRight], this->FillColours[UI::QC_TopRight], this->PriAtlas);
170 return RenderLayer::RLT_Image;
178 this->FillColours[0] = Colour;
179 this->FillColours[1] = Colour;
180 this->FillColours[2] = Colour;
181 this->FillColours[3] = Colour;
187 this->FillColours[Corner] = Colour;
211 this->LayerSprite = PSprite;
231 case UI::Gradient_NorthSouth:
233 this->FillColours[0] = ColourA;
234 this->FillColours[1] = ColourA;
235 this->FillColours[2] = ColourB;
236 this->FillColours[3] = ColourB;
238 case UI::Gradient_WestEast:
240 this->FillColours[0] = ColourA;
241 this->FillColours[3] = ColourA;
242 this->FillColours[1] = ColourB;
243 this->FillColours[2] = ColourB;
245 case UI::Gradient_Diagonal_1:
252 this->FillColours[0] = ColourA;
253 this->FillColours[1] = Average;
254 this->FillColours[2] = ColourB;
255 this->FillColours[3] = Average;
257 case UI::Gradient_Diagonal_2:
264 this->FillColours[0] = Average;
265 this->FillColours[1] = ColourA;
266 this->FillColours[2] = Average;
267 this->FillColours[3] = ColourB;
275 return this->FillColours[Corner];
280 return ( 0 == this->FillColours[UI::QC_TopLeft].AlphaChannel &&
281 0 == this->FillColours[UI::QC_TopRight].AlphaChannel &&
282 0 == this->FillColours[UI::QC_BottomLeft].AlphaChannel &&
283 0 == this->FillColours[UI::QC_BottomRight].AlphaChannel );
291 this->BorderWidth = Width;
297 this->BorderColours[0] = Colour;
298 this->BorderColours[1] = Colour;
299 this->BorderColours[2] = Colour;
300 this->BorderColours[3] = Colour;
306 this->BorderColours[Side] = Colour;
319 this->BorderColours[UI::Border_North] = North;
320 this->BorderColours[UI::Border_South] = South;
321 this->BorderColours[UI::Border_East] = East;
322 this->BorderColours[UI::Border_West] = West;
333 return this->BorderWidth;
338 return this->BorderColours[Side];
359 this->FillColours[UI::QC_TopLeft].
ProtoSerialize(TopLeftFillNode);
362 this->FillColours[UI::QC_TopRight].
ProtoSerialize(TopRightFillNode);
365 this->FillColours[UI::QC_BottomLeft].
ProtoSerialize(BottomLeftFillNode);
368 this->FillColours[UI::QC_BottomRight].
ProtoSerialize(BottomRightFillNode);
373 this->BorderColours[UI::QC_TopLeft].
ProtoSerialize(TopLeftBorderNode);
376 this->BorderColours[UI::QC_TopRight].
ProtoSerialize(TopRightBorderNode);
379 this->BorderColours[UI::QC_BottomLeft].
ProtoSerialize(BottomLeftBorderNode);
382 this->BorderColours[UI::QC_BottomRight].
ProtoSerialize(BottomRightBorderNode);
396 if( !PropertiesNode.
Empty() ) {
398 CurrAttrib = PropertiesNode.
GetAttribute(
"BorderWidth");
399 if( !CurrAttrib.
Empty() )
400 this->BorderWidth = CurrAttrib.
AsReal();
403 if( !CurrAttrib.
Empty() )
407 if( !ScaleNode.
Empty() )
412 if( !TopLeftFillNode.
Empty() )
416 if( !TopRightFillNode.
Empty() )
420 if( !BottomLeftFillNode.
Empty() )
424 if( !BottomRightFillNode.
Empty() )
425 this->FillColours[UI::QC_BottomRight].
ProtoDeSerialize(BottomRightFillNode);
429 if( !TopLeftBorderNode.
Empty() )
433 if( !TopRightBorderNode.
Empty() )
437 if( !BottomLeftBorderNode.
Empty() )
438 this->BorderColours[UI::QC_BottomLeft].
ProtoDeSerialize(BottomLeftBorderNode);
441 if( !BottomRightBorderNode.
Empty() )
442 this->BorderColours[UI::QC_BottomRight].
ProtoDeSerialize(BottomRightBorderNode);