Gorgon Game Engine
Rectangle.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Animations.h"
4 #include "TextureAnimation.h"
5 #include "EmptyImage.h"
6 #include "Bitmap.h"
7 
8 #include <set>
9 
10 namespace Gorgon { namespace Graphics {
13  public:
15 
16  virtual IRectangleProvider &MoveOutProvider() override = 0;
17 
19  virtual RectangularAnimation &CreateTL() const = 0;
20 
22  virtual RectangularAnimation &CreateTM() const = 0;
23 
25  virtual RectangularAnimation &CreateTR() const = 0;
26 
28  virtual RectangularAnimation &CreateML() const = 0;
29 
31  virtual RectangularAnimation &CreateMM() const = 0;
32 
34  virtual RectangularAnimation &CreateMR() const = 0;
35 
37  virtual RectangularAnimation &CreateBL() const = 0;
38 
40  virtual RectangularAnimation &CreateBM() const = 0;
41 
43  virtual RectangularAnimation &CreateBR() const = 0;
44 
48  virtual void SetCenterTiling(bool value) {
49  ctiling = value;
50  }
51 
53  virtual bool GetCenterTiling() const {
54  return ctiling;
55  }
56 
60  virtual void SetSideTiling(bool value) {
61  stiling = value;
62  }
63 
65  virtual bool GetSideTiling() const {
66  return stiling;
67  }
68 
69  private:
70  bool ctiling = true;
71  bool stiling = true;
72  };
73 
80  public:
82 
83  Rectangle(const IRectangleProvider &prov, bool create = true);
84 
85  virtual ~Rectangle() {
86  tl.DeleteAnimation();
87  tm.DeleteAnimation();
88  tr.DeleteAnimation();
89  ml.DeleteAnimation();
90  mm.DeleteAnimation();
91  mr.DeleteAnimation();
92  bl.DeleteAnimation();
93  bm.DeleteAnimation();
94  br.DeleteAnimation();
95  }
96 
97  virtual bool Progress(unsigned &) override {
98  return true; //individual parts will work automatically
99  }
100 
101  int GetDuration() const override {
102  auto dur = mm.GetDuration();
103  if(dur)
104  return dur;
105 
106  dur = tm.GetDuration();
107  if(dur)
108  return dur;
109 
110  dur = ml.GetDuration();
111  if(dur)
112  return dur;
113 
114  dur = mr.GetDuration();
115  if(dur)
116  return dur;
117 
118  dur = bm.GetDuration();
119  if(dur)
120  return dur;
121 
122  dur = tl.GetDuration();
123  if(dur)
124  return dur;
125 
126  dur = tr.GetDuration();
127  if(dur)
128  return dur;
129 
130  dur = bl.GetDuration();
131  if(dur)
132  return dur;
133 
134  dur = br.GetDuration();
135 
136  return dur;
137  }
138 
139  protected:
140  virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override;
141 
142  virtual void drawin(TextureTarget &target, const SizeController &controller, const Geometry::Rectanglef &r, RGBAf color) const override;
143 
144  virtual Geometry::Size calculatesize(const Geometry::Size &area) const override {
145  return area;
146  }
147 
148  virtual Geometry::Size calculatesize(const SizeController &controller, const Geometry::Size &s) const override {
149  return controller.CalculateSize({mm.GetSize()}, {ml.GetWidth()+mr.GetWidth(), tm.GetHeight()+bm.GetHeight()}, s);
150  }
151 
152  virtual Geometry::Size getsize() const override;
153 
154  virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2,
155  const Geometry::Pointf &p3, const Geometry::Pointf &p4,
156  const Geometry::Pointf &tex1, const Geometry::Pointf &tex2,
157  const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, RGBAf color) const override;
158 
159 
160  virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color) const override;
161 
162 
163  virtual void draw(TextureTarget &target, const Geometry::Pointf &p, RGBAf color) const override;
164 
165  private:
166  RectangularAnimation &tl, &tm, &tr;
167  RectangularAnimation &ml, &mm, &mr;
168  RectangularAnimation &bl, &bm, &br;
169 
170  const IRectangleProvider &prov;
171  };
172 
184  template<class A_>
186  public:
188 
191 
193 
196  A_ &tl, A_ &tm, A_ &tr,
197  A_ &ml, A_ &mm, A_ &mr,
198  A_ &bl, A_ &bm, A_ &br
199  ) :
200  tl(&tl), tm(&tm), tr(&tr),
201  ml(&ml), mm(&mm), mr(&mr),
202  bl(&bl), bm(&bm), br(&br)
203  { }
204 
208  A_ &&tl, A_ &&tm, A_ &&tr,
209  A_ &&ml, A_ &&mm, A_ &&mr,
210  A_ &&bl, A_ &&bm, A_ &&br
211  ) :
212  tl(new A_(std::move(tl))), tm(new A_(std::move(tm))), tr(new A_(std::move(tr))),
213  ml(new A_(std::move(ml))), mm(new A_(std::move(mm))), mr(new A_(std::move(mr))),
214  bl(new A_(std::move(bl))), bm(new A_(std::move(bm))), br(new A_(std::move(br))),
215  own(true)
216  { }
217 
221  A_ &border
222  ) :
223  tl(&border), tm(&border), tr(&border),
224  ml(&border), mm(nullptr), mr(&border),
225  bl(&border), bm(&border), br(&border)
226  { }
227 
232  A_ &&border
233  ) :
234  tl(new A_(std::move(border))), tm(tl), tr(tl),
235  ml(tl), mm(nullptr), mr(tl),
236  bl(tl), bm(tl), br(tl),
237  own(true)
238  { }
239 
243  A_ &border, A_ &center
244  ) :
245  tl(&border), tm(&border), tr(&border),
246  ml(&border), mm(&center), mr(&border),
247  bl(&border), bm(&border), br(&border)
248  { }
249 
254  A_ &&border, A_ &&center
255  ) :
256  tl(new A_(std::move(border))), tm(tl), tr(tl),
257  ml(tl), mm(new A_(std::move(center))), mr(tl),
258  bl(tl), bm(tl), br(tl),
259  own(true)
260  { }
261 
264  A_ *tl, A_ *tm, A_ *tr,
265  A_ *ml, A_ *mm, A_ *mr,
266  A_ *bl, A_ *bm, A_ *br
267  ) :
268  tl(tl), tm(tm), tr(tr),
269  ml(ml), mm(mm), mr(mr),
270  bl(bl), bm(bm), br(br)
271  { }
272 
275  tl(other.tl), tm(other.tm), tr(other.tr),
276  ml(other.ml), mm(other.mm), mr(other.mr),
277  bl(other.bl), bm(other.bm), br(other.br),
278  own(other.own)
279  {
280  other.own = false;
281 
282  other.tl = nullptr;
283  other.tm = nullptr;
284  other.tr = nullptr;
285 
286  other.ml = nullptr;
287  other.mm = nullptr;
288  other.mr = nullptr;
289 
290  other.bl = nullptr;
291  other.bm = nullptr;
292  other.br = nullptr;
293 
294  SetCenterTiling(other.GetCenterTiling());
295  SetSideTiling(other.GetSideTiling());
296  }
297 
299  if(own) {
300  //delete unique ones
301  std::set<A_*> ptrs = {tl, tm, tr, ml, mm, mr, bl, bm, br};
302 
303  for(auto ptr : ptrs) {
304  delete ptr;
305  }
306  }
307  }
308 
309 
310 
312 
313  //types are derived not to type the same code for every class
314  virtual auto MoveOutProvider() -> decltype(*this) override {
315  auto ret = new typename std::remove_reference<decltype(*this)>::type(std::move(*this));
316 
317  return *ret;
318  }
319 
321  return *new Rectangle(*this, timer);
322  }
323 
324  Rectangle &CreateAnimation(bool create = true) const override {
325  return *new Rectangle(*this, create);
326  }
327 
328  virtual RectangularAnimation &CreateTL() const override {
329  if(tl)
330  return tl->CreateAnimation(false);
331  else
332  return EmptyImage::Instance();
333  }
334 
335 
336  virtual RectangularAnimation &CreateTM() const override {
337  if(tm)
338  return tm->CreateAnimation(false);
339  else
340  return EmptyImage::Instance();
341  }
342 
343 
344  virtual RectangularAnimation &CreateTR() const override {
345  if(tr)
346  return tr->CreateAnimation(false);
347  else
348  return EmptyImage::Instance();
349  }
350 
351 
352  virtual RectangularAnimation &CreateML() const override {
353  if(ml)
354  return ml->CreateAnimation(false);
355  else
356  return EmptyImage::Instance();
357  }
358 
359 
360  virtual RectangularAnimation &CreateMM() const override {
361  if(mm)
362  return mm->CreateAnimation(false);
363  else
364  return EmptyImage::Instance();
365  }
366 
367 
368  virtual RectangularAnimation &CreateMR() const override {
369  if(mr)
370  return mr->CreateAnimation(false);
371  else
372  return EmptyImage::Instance();
373  }
374 
375 
376  virtual RectangularAnimation &CreateBL() const override {
377  if(bl)
378  return bl->CreateAnimation(false);
379  else
380  return EmptyImage::Instance();
381  }
382 
383 
384  virtual RectangularAnimation &CreateBM() const override {
385  if(bm)
386  return bm->CreateAnimation(false);
387  else
388  return EmptyImage::Instance();
389  }
390 
391 
392  virtual RectangularAnimation &CreateBR() const override {
393  if(br)
394  return br->CreateAnimation(false);
395  else
396  return EmptyImage::Instance();
397  }
398 
400  A_ *GetTL() const {
401  return tl;
402  }
403 
405  A_ *GetTM() const {
406  return tm;
407  }
408 
410  A_ *GetTR() const {
411  return tr;
412  }
413 
415  A_ *GetML() const {
416  return ml;
417  }
418 
420  A_ *GetMM() const {
421  return mm;
422  }
423 
425  A_ *GetMR() const {
426  return mr;
427  }
428 
430  A_ *GetBL() const {
431  return bl;
432  }
433 
435  A_ *GetBM() const {
436  return bm;
437  }
438 
440  A_ *GetBR() const {
441  return br;
442  }
444  void SetTL(A_ *value) {
445  if(own)
446  delete tl;
447 
448  tl = value;
449  }
450 
452  void SetTM(A_ *value) {
453  if(own)
454  delete tm;
455 
456  tm = value;
457  }
458 
460  void SetTR(A_ *value) {
461  if(own)
462  delete tr;
463 
464  tr = value;
465  }
466 
468  void SetML(A_ *value) {
469  if(own)
470  delete ml;
471 
472  ml = value;
473  }
474 
476  void SetMM(A_ *value) {
477  if(own)
478  delete mm;
479 
480  mm = value;
481  }
482 
484  void SetMR(A_ *value) {
485  if(own)
486  delete mr;
487 
488  mr = value;
489  }
490 
492  void SetBL(A_ *value) {
493  if(own)
494  delete bl;
495 
496  bl = value;
497  }
498 
500  void SetBM(A_ *value) {
501  if(own)
502  delete bm;
503 
504  bm = value;
505  }
506 
508  void SetBR(A_ *value) {
509  if(own)
510  delete br;
511 
512  br = value;
513  }
514 
516  void Prepare() {
517  if(tl)
518  tl->Prepare();
519  if(tm)
520  tm->Prepare();
521  if(tr)
522  tr->Prepare();
523 
524  if(ml)
525  ml->Prepare();
526  if(mm)
527  mm->Prepare();
528  if(mr)
529  mr->Prepare();
530 
531  if(bl)
532  bl->Prepare();
533  if(bm)
534  bm->Prepare();
535  if(br)
536  br->Prepare();
537  }
538 
541  void OwnProviders() {
542  own = true;
543  }
544 
545  Geometry::Size GetSize() const override {
546  int maxt = std::max(std::max(
547  tl ? tl->GetHeight() : 0 ,
548  tm ? tm->GetHeight() : 0),
549  tr ? tr->GetHeight() : 0);
550 
551  int maxb = std::max(std::max(
552  bl ? bl->GetHeight() : 0 ,
553  bm ? bm->GetHeight() : 0),
554  br ? br->GetHeight() : 0);
555 
556  int maxl = std::max(std::max(
557  tl ? tl->GetWidth() : 0 ,
558  ml ? ml->GetWidth() : 0),
559  bl ? bl->GetWidth() : 0);
560 
561  int maxr = std::max(std::max(
562  tr ? tr->GetWidth() : 0 ,
563  mr ? mr->GetWidth() : 0),
564  br ? br->GetWidth() : 0);
565 
566  return{maxl+maxr+(mm ? mm->GetWidth() : 0), maxt+maxb+(mm ? mm->GetHeight() : 0)};
567  }
568 
569 
570 
571 
572  private:
573  A_ *tl = nullptr;
574  A_ *tm = nullptr;
575  A_ *tr = nullptr;
576 
577  A_ *ml = nullptr;
578  A_ *mm = nullptr;
579  A_ *mr = nullptr;
580 
581  A_ *bl = nullptr;
582  A_ *bm = nullptr;
583  A_ *br = nullptr;
584 
585  bool own = false;
586  };
587 
592 
593 
594 
599  BitmapRectangleProvider SliceHorizontal(const Bitmap &source, int t, int b, int tl, int tr, int l, int r, int bl, int br);
600 
605  BitmapRectangleProvider SliceVertical(const Bitmap &source, int l, int r, int tl, int bl, int t, int b, int tr, int br);
606 
610  inline BitmapRectangleProvider Slice(const Bitmap &source, Geometry::Bounds center) {
611  return SliceHorizontal(source, center.Top, center.Bottom, center.Left, center.Right, center.Left, center.Right, center.Left, center.Right);
612  }
613 
614 } }
Gorgon::Graphics::basic_RectangleProvider::operator=
basic_RectangleProvider & operator=(const basic_RectangleProvider &)=delete
Gorgon::Animation::Base::GetDuration
virtual int GetDuration() const =0
Returns the duration of the animation if it is a known apriori.
Gorgon::Graphics::basic_RectangleProvider::CreateMM
virtual RectangularAnimation & CreateMM() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:360
Gorgon::Geometry::basic_Bounds
This class represents boundaries of 2D objects.
Definition: Bounds.h:27
Gorgon::Graphics::Rectangle::drawin
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf color) const override
This function should draw the object to the target area.
Definition: Rectangle.cpp:63
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(basic_RectangleProvider &&other)
Move constructor.
Definition: Rectangle.h:274
Gorgon::Graphics::basic_RectangleProvider::SetBM
void SetBM(A_ *value)
Changes the BM animation, ownership semantics will not change.
Definition: Rectangle.h:500
Gorgon::Graphics::basic_RectangleProvider::Prepare
void Prepare()
Prepares all animation providers if the they support Prepare function.
Definition: Rectangle.h:516
Gorgon::Graphics::SizeController
This class allows control over a sizable object.
Definition: Graphics.h:161
Gorgon::Graphics::basic_RectangleProvider::GetML
A_ * GetML() const
Returns ML provider, may return nullptr.
Definition: Rectangle.h:415
Gorgon::Graphics::EmptyImage::Instance
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
Gorgon::Graphics::basic_RectangleProvider::SetTR
void SetTR(A_ *value)
Changes the TR animation, ownership semantics will not change.
Definition: Rectangle.h:460
Gorgon::Graphics::basic_RectangleProvider::CreateML
virtual RectangularAnimation & CreateML() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:352
Gorgon::Graphics::basic_RectangleProvider::MoveOutProvider
virtual auto MoveOutProvider() -> decltype(*this) override
This function moves this animation provider into a new provider.
Definition: Rectangle.h:314
Gorgon::Graphics::IRectangleProvider::GetSideTiling
virtual bool GetSideTiling() const
Returns if the middle part will be tiled.
Definition: Rectangle.h:65
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(const basic_RectangleProvider &)=delete
Gorgon::Graphics::basic_RectangleProvider::GetMM
A_ * GetMM() const
Returns MM provider, may return nullptr.
Definition: Rectangle.h:420
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ *tl, A_ *tm, A_ *tr, A_ *ml, A_ *mm, A_ *mr, A_ *bl, A_ *bm, A_ *br)
Filling constructor, nullptr is acceptable.
Definition: Rectangle.h:263
Gorgon::Graphics::basic_RectangleProvider::GetBR
A_ * GetBR() const
Returns BR provider, may return nullptr.
Definition: Rectangle.h:440
Gorgon::Graphics::basic_RectangleProvider::SetBL
void SetBL(A_ *value)
Changes the BL animation, ownership semantics will not change.
Definition: Rectangle.h:492
Gorgon::Geometry::Rectangle
basic_Rectangle< int > Rectangle
Definition: Rectangle.h:449
Gorgon::Graphics::Rectangle::draw
virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, const Geometry::Pointf &tex1, const Geometry::Pointf &tex2, const Geometry::Pointf &tex3, const Geometry::Pointf &tex4, RGBAf color) const override
This method should draw to object inside the given quad with the given texture coordinates.
Definition: Rectangle.cpp:119
Gorgon::Graphics::IRectangleProvider::CreateBL
virtual RectangularAnimation & CreateBL() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Animation::ControllerBase
Controllers are required to progress animations.
Definition: Animation.h:65
Gorgon::Graphics::IRectangleProvider::GetCenterTiling
virtual bool GetCenterTiling() const
Returns if the middle part will be tiled.
Definition: Rectangle.h:53
Gorgon::Graphics::IRectangleProvider::CreateMR
virtual RectangularAnimation & CreateMR() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::Slice
BitmapRectangleProvider Slice(const Bitmap &source, Geometry::Bounds center)
Slices an image to create a rectangle.
Definition: Rectangle.h:610
Gorgon::Graphics::basic_RectangleProvider::CreateAnimation
Rectangle & CreateAnimation(bool create=true) const override
This function should create and animation and depending on the create parameter, it should create its...
Definition: Rectangle.h:324
Gorgon::Graphics::IRectangleProvider::CreateBM
virtual RectangularAnimation & CreateBM() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ &&border, A_ &&center)
Filling constructor using move semantics, rectangle will create and own new objects.
Definition: Rectangle.h:253
Gorgon::Graphics::RGBAf
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Gorgon::Graphics::IRectangleProvider
Interface for RectangleProviders.
Definition: Rectangle.h:12
Gorgon::Graphics::basic_RectangleProvider::SetMM
void SetMM(A_ *value)
Changes the MM animation, ownership semantics will not change.
Definition: Rectangle.h:476
Gorgon::Graphics::basic_RectangleProvider::GetTM
A_ * GetTM() const
Returns TM provider, may return nullptr.
Definition: Rectangle.h:405
Gorgon::Graphics::Rectangle::GetDuration
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: Rectangle.h:101
EmptyImage.h
Gorgon::Graphics::basic_RectangleProvider::SetBR
void SetBR(A_ *value)
Changes the BR animation, ownership semantics will not change.
Definition: Rectangle.h:508
Gorgon::Geometry::basic_Bounds::Left
T_ Left
Left-most boundary.
Definition: Bounds.h:399
Gorgon::Graphics::basic_RectangleProvider::GetSize
Geometry::Size GetSize() const override
Definition: Rectangle.h:545
Gorgon::Graphics::basic_RectangleProvider::SetTM
void SetTM(A_ *value)
Changes the TM animation, ownership semantics will not change.
Definition: Rectangle.h:452
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Geometry::basic_Size
This class represents a 2D geometric size.
Definition: Size.h:23
Gorgon::Graphics::Rectangle::Progress
virtual bool Progress(unsigned &) override
This function should progress the animation.
Definition: Rectangle.h:97
Gorgon::Graphics::SliceHorizontal
BitmapRectangleProvider SliceHorizontal(const Bitmap &source, int t, int b, int tl, int tr, int l, int r, int bl, int br)
Horizontally slices the given image.
Definition: Rectangle.cpp:135
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ &tl, A_ &tm, A_ &tr, A_ &ml, A_ &mm, A_ &mr, A_ &bl, A_ &bm, A_ &br)
Filling constructor.
Definition: Rectangle.h:195
Gorgon::Animation::Base
This is the base class for all animations.
Definition: Animation.h:306
Gorgon::Graphics::basic_RectangleProvider::CreateBR
virtual RectangularAnimation & CreateBR() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:392
Gorgon::Graphics::basic_RectangleProvider::GetTL
A_ * GetTL() const
Returns TL provider, may return nullptr.
Definition: Rectangle.h:400
Gorgon::Graphics::IRectangleProvider::CreateTM
virtual RectangularAnimation & CreateTM() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::RectangularAnimation
Rectangular drawable animation.
Definition: Animations.h:19
Bitmap.h
Gorgon::Graphics::Rectangle::~Rectangle
virtual ~Rectangle()
Definition: Rectangle.h:85
Gorgon::Graphics::Bitmap
This object contains an bitmap image.
Definition: Bitmap.h:25
Gorgon::Graphics::IRectangleProvider::SetSideTiling
virtual void SetSideTiling(bool value)
Sets whether the side parts (tm, ml, mr, bm) would be tiled.
Definition: Rectangle.h:60
Gorgon::Graphics::IRectangleProvider::CreateMM
virtual RectangularAnimation & CreateMM() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::IRectangleProvider::CreateBR
virtual RectangularAnimation & CreateBR() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider()
Empty constructor, rectangle can be instanced even if it is completely empty.
Definition: Rectangle.h:190
Gorgon::Graphics::basic_RectangleProvider::SetML
void SetML(A_ *value)
Changes the ML animation, ownership semantics will not change.
Definition: Rectangle.h:468
Gorgon::Graphics::TextureTarget
This interface defines a class that can be used as a common target for texture based drawing.
Definition: TextureTargets.h:12
Gorgon::Graphics::basic_RectangleProvider::CreateTR
virtual RectangularAnimation & CreateTR() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:344
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ &&border)
Filling constructor using move semantics, rectangle will create and own new object.
Definition: Rectangle.h:231
Gorgon::Geometry::basic_Point
This class represents a 2D point.
Definition: Point.h:32
Gorgon::Graphics::basic_RectangleProvider::CreateAnimation
Rectangle & CreateAnimation(Gorgon::Animation::ControllerBase &timer) const override
This function should create a new animation with the given controller and if owner parameter is set t...
Definition: Rectangle.h:320
Gorgon::Graphics::basic_RectangleProvider::SetMR
void SetMR(A_ *value)
Changes the MR animation, ownership semantics will not change.
Definition: Rectangle.h:484
Gorgon::Animation::Base::DeleteAnimation
virtual void DeleteAnimation() const
Deletes this animation.
Definition: Animation.h:379
Gorgon::Graphics::Rectangle::Rectangle
Rectangle(const IRectangleProvider &prov, Gorgon::Animation::ControllerBase &timer)
Definition: Rectangle.cpp:29
Gorgon::Graphics::basic_RectangleProvider::GetBL
A_ * GetBL() const
Returns BL provider, may return nullptr.
Definition: Rectangle.h:430
Gorgon::Graphics::RectangularDrawable::GetSize
const Geometry::Size GetSize() const
Returns the size of this object.
Definition: Drawables.h:443
Gorgon::Graphics::basic_RectangleProvider::OwnProviders
void OwnProviders()
Issuing this function will make this rectangle to own its providers, destroying them along with itsel...
Definition: Rectangle.h:541
Animations.h
Gorgon::Graphics::RectangularAnimationProvider
This class provides rectangular animations.
Definition: Animations.h:48
Gorgon::Geometry::basic_Bounds::Right
T_ Right
Right-most boundary.
Definition: Bounds.h:405
Gorgon::Graphics::basic_RectangleProvider
This class allows instancing of a rectangle like image that is made out of three parts.
Definition: Rectangle.h:185
Gorgon::UI::Graphics
@ Graphics
Definition: Template.h:164
Gorgon::Graphics::Rectangle::calculatesize
virtual Geometry::Size calculatesize(const Geometry::Size &area) const override
This function should return the size of the object when it is requested to be drawn in the given area...
Definition: Rectangle.h:144
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ &&tl, A_ &&tm, A_ &&tr, A_ &&ml, A_ &&mm, A_ &&mr, A_ &&bl, A_ &&bm, A_ &&br)
Filling constructor using move semantics, rectangle will create and own new objects.
Definition: Rectangle.h:207
Gorgon::Geometry::basic_Bounds::Bottom
T_ Bottom
Bottom-most boundary.
Definition: Bounds.h:408
Gorgon::Graphics::IRectangleProvider::CreateTR
virtual RectangularAnimation & CreateTR() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ &border)
Filling constructor.
Definition: Rectangle.h:220
Gorgon::Graphics::IRectangleProvider::CreateTL
virtual RectangularAnimation & CreateTL() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Graphics::RectangularDrawable::GetHeight
int GetHeight() const
Returns the height of the drawable.
Definition: Drawables.h:451
Gorgon::Graphics::basic_RectangleProvider::GetTR
A_ * GetTR() const
Returns TR provider, may return nullptr.
Definition: Rectangle.h:410
Gorgon::Graphics::IRectangleProvider::IRectangleProvider
IRectangleProvider()
Definition: Rectangle.h:14
Gorgon::Graphics::basic_RectangleProvider::CreateBM
virtual RectangularAnimation & CreateBM() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:384
Gorgon::Graphics::RectangularDrawable::GetWidth
int GetWidth() const
Returns the width of the drawable.
Definition: Drawables.h:448
Gorgon::Graphics::basic_RectangleProvider::CreateTM
virtual RectangularAnimation & CreateTM() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:336
Gorgon::Graphics::basic_RectangleProvider::CreateTL
virtual RectangularAnimation & CreateTL() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:328
Gorgon::Graphics::basic_RectangleProvider::SetTL
void SetTL(A_ *value)
Changes the TL animation, ownership semantics will not change.
Definition: Rectangle.h:444
Gorgon::Graphics::basic_RectangleProvider::CreateMR
virtual RectangularAnimation & CreateMR() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:368
Gorgon::Graphics::basic_RectangleProvider::CreateBL
virtual RectangularAnimation & CreateBL() const override
Creates an animation without controller. This function should always return an animation.
Definition: Rectangle.h:376
Gorgon::Graphics::basic_RectangleProvider::GetMR
A_ * GetMR() const
Returns MR provider, may return nullptr.
Definition: Rectangle.h:425
Gorgon::Graphics::basic_RectangleProvider::GetBM
A_ * GetBM() const
Returns BM provider, may return nullptr.
Definition: Rectangle.h:435
Gorgon::Geometry::basic_Rectangle
Represents a rectangle in a 2D space.
Definition: Rectangle.h:19
Gorgon::Animation::Base::controller
ControllerBase * controller
Controller of this animation.
Definition: Animation.h:388
TextureAnimation.h
Gorgon::Graphics::basic_RectangleProvider::basic_RectangleProvider
basic_RectangleProvider(A_ &border, A_ &center)
Filling constructor.
Definition: Rectangle.h:242
Gorgon::Graphics::basic_RectangleProvider::~basic_RectangleProvider
~basic_RectangleProvider()
Definition: Rectangle.h:298
Gorgon::Graphics::Rectangle
This class allows drawing a rectangle like image that is made out of nine parts.
Definition: Rectangle.h:79
Gorgon::Graphics::SliceVertical
BitmapRectangleProvider SliceVertical(const Bitmap &source, int l, int r, int tl, int bl, int t, int b, int tr, int br)
Vertically slices the given image.
Definition: Rectangle.cpp:149
Gorgon::Graphics::IRectangleProvider::MoveOutProvider
virtual IRectangleProvider & MoveOutProvider() override=0
This function moves this animation provider into a new provider.
Gorgon::Graphics::Rectangle::calculatesize
virtual Geometry::Size calculatesize(const SizeController &controller, const Geometry::Size &s) const override
This function should return the size of the object when it is requested to be drawn in the given area...
Definition: Rectangle.h:148
Gorgon::Graphics::IRectangleProvider::SetCenterTiling
virtual void SetCenterTiling(bool value)
Sets whether the middle part would be tiled.
Definition: Rectangle.h:48
Gorgon::Graphics::Rectangle::getsize
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: Rectangle.cpp:53
Gorgon::Graphics::IRectangleProvider::CreateML
virtual RectangularAnimation & CreateML() const =0
Creates an animation without controller. This function should always return an animation.
Gorgon::Geometry::basic_Bounds::Top
T_ Top
Top-most boundary.
Definition: Bounds.h:402