Gorgon Game Engine
BlankImage.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Animations.h"
4 
5 namespace Gorgon { namespace Graphics {
6 
14  public:
15  explicit BlankImage(Geometry::Size size, RGBAf color = 1.f) : size(size), color(color) {}
16 
17  BlankImage(int w, int h, RGBAf color = 1.f) : BlankImage({w, h}, color) {}
18 
19  explicit BlankImage(RGBAf color = 1.f) : color(color) {}
20 
21  virtual BlankImage &MoveOutProvider() override {
22  return *new BlankImage(size, color);
23  }
24 
26  return const_cast<BlankImage&>(*this);
27  }
28 
29  virtual BlankImage &CreateAnimation(bool =true) const override {
30  return const_cast<BlankImage&>(*this);
31  }
32 
33  virtual bool Progress(unsigned &) override {
34  return true;
35  }
36 
37  int GetDuration() const override {
38  return 0;
39  }
40 
41  virtual void DeleteAnimation() const override {
42  }
43 
44  virtual void SetController(Gorgon::Animation::ControllerBase &) override { }
45 
47  RGBAf GetColor() const {
48  return color;
49  }
50 
52  void SetColor(RGBAf value) {
53  color = value;
54  }
55 
57  void SetSize(Geometry::Size value) {
58  size = value;
59  }
60 
61  Geometry::Size GetSize() const override {
62  return size;
63  }
64 
65  protected:
66  virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, const Geometry::Pointf &, const Geometry::Pointf &, const Geometry::Pointf &, const Geometry::Pointf &, RGBAf c) const override {
67  target.Draw(p1, p2, p3, p4, color*c);
68  }
69 
70  virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf c) const override {
71  target.Draw(p1, p2, p3, p4, color*c);
72  }
73 
74  virtual void drawstretched(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf c) const override {
75  target.Draw(r, color*c);
76  }
77 
78  virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf c) const override {
79  target.Draw(r, color*c);
80  }
81 
82  virtual void drawin(TextureTarget &target, const SizeController &controller, const Geometry::Rectanglef &r, RGBAf c) const override {
83  target.Draw(r, color*c);
84  }
85 
86  virtual Geometry::Size getsize() const override {
87  return size;
88  }
89 
90  virtual Geometry::Size calculatesize(const Geometry::Size &area) const override {
91  return area;
92  }
93 
94  virtual Geometry::Size calculatesize(const SizeController &controller, const Geometry::Size &s) const override {
95  return s;
96  }
97 
98  private:
99  Geometry::Size size = {0, 0};
100  RGBAf color = {1.0f};
101  };
102 
103 }}
Gorgon::Graphics::SizeController
This class allows control over a sizable object.
Definition: Graphics.h:161
Gorgon::Graphics::BlankImage::drawstretched
virtual void drawstretched(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf c) const override
This function should draw the object to the target area.
Definition: BlankImage.h:74
Gorgon::Animation::ControllerBase
Controllers are required to progress animations.
Definition: Animation.h:65
Gorgon::Graphics::BlankImage::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: BlankImage.h:94
Gorgon::Graphics::RGBAf
Represents a four channel 32 bit float per channel color information.
Definition: Color.h:373
Gorgon::Graphics::BlankImage::GetDuration
int GetDuration() const override
Returns the duration of the animation if it is a known apriori.
Definition: BlankImage.h:37
Gorgon::Graphics::BlankImage::Progress
virtual bool Progress(unsigned &) override
This function should progress the animation.
Definition: BlankImage.h:33
Gorgon::Graphics::BlankImage::SetColor
void SetColor(RGBAf value)
Sets the color of this blank image.
Definition: BlankImage.h:52
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::BlankImage::GetColor
RGBAf GetColor() const
Returns the color of this blank image.
Definition: BlankImage.h:47
Gorgon::Graphics::RectangularAnimation
Rectangular drawable animation.
Definition: Animations.h:19
Gorgon::Graphics::BlankImage::GetSize
Geometry::Size GetSize() const override
Definition: BlankImage.h:61
Gorgon::Graphics::BlankImage::getsize
virtual Geometry::Size getsize() const override
Should return the exact size of this object.
Definition: BlankImage.h:86
Gorgon::Graphics::BlankImage::CreateAnimation
virtual BlankImage & CreateAnimation(Gorgon::Animation::ControllerBase &) const override
This function should create a new animation with the given controller and if owner parameter is set t...
Definition: BlankImage.h:25
Gorgon::Graphics::BlankImage::MoveOutProvider
virtual BlankImage & MoveOutProvider() override
This function moves this animation provider into a new provider.
Definition: BlankImage.h:21
Gorgon::Graphics::BlankImage::BlankImage
BlankImage(RGBAf color=1.f)
Definition: BlankImage.h:19
Gorgon::Graphics::BlankImage::DeleteAnimation
virtual void DeleteAnimation() const override
Deletes this animation.
Definition: BlankImage.h:41
Gorgon::Graphics::BlankImage::BlankImage
BlankImage(Geometry::Size size, RGBAf color=1.f)
Definition: BlankImage.h:15
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::Geometry::basic_Point
This class represents a 2D point.
Definition: Point.h:32
Gorgon::Graphics::TextureTarget::Draw
virtual void Draw(const TextureSource &image, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf color=RGBAf(1.f))=0
Draws a simple texture to the screen.
Gorgon::Graphics::BlankImage::SetController
virtual void SetController(Gorgon::Animation::ControllerBase &) override
Sets the controller to the given controller.
Definition: BlankImage.h:44
Gorgon::Graphics::BlankImage::SetSize
void SetSize(Geometry::Size value)
Sets the size of this blank image.
Definition: BlankImage.h:57
Gorgon::Graphics::BlankImage::BlankImage
BlankImage(int w, int h, RGBAf color=1.f)
Definition: BlankImage.h:17
Animations.h
Gorgon::Graphics::BlankImage::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 &, const Geometry::Pointf &, const Geometry::Pointf &, const Geometry::Pointf &, RGBAf c) const override
This method should draw to object inside the given quad with the given texture coordinates.
Definition: BlankImage.h:66
Gorgon::Graphics::RectangularAnimationProvider
This class provides rectangular animations.
Definition: Animations.h:48
Gorgon::UI::Graphics
@ Graphics
Definition: Template.h:164
Gorgon::Graphics::BlankImage::drawin
virtual void drawin(TextureTarget &target, const SizeController &controller, const Geometry::Rectanglef &r, RGBAf c) const override
This function should draw this drawable inside the given rectangle according to the given controller.
Definition: BlankImage.h:82
Gorgon::Graphics::BlankImage::draw
virtual void draw(TextureTarget &target, const Geometry::Pointf &p1, const Geometry::Pointf &p2, const Geometry::Pointf &p3, const Geometry::Pointf &p4, RGBAf c) const override
This function should draw the object inside the given quad.
Definition: BlankImage.h:70
Gorgon::Graphics::BlankImage
Pure color blank image, default size is 0x0, but can be drawn with any size.
Definition: BlankImage.h:13
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
Gorgon::Graphics::BlankImage::drawin
virtual void drawin(TextureTarget &target, const Geometry::Rectanglef &r, RGBAf c) const override
This function should draw the object to the target area.
Definition: BlankImage.h:78
Gorgon::Graphics::BlankImage::CreateAnimation
virtual BlankImage & CreateAnimation(bool=true) const override
This function should create and animation and depending on the create parameter, it should create its...
Definition: BlankImage.h:29
Gorgon::Graphics::BlankImage::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: BlankImage.h:90