Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
image.hpp
1 
16 #pragma once
17 #include "sdl.hpp"
18 #include "rect.hpp"
19 #include "color.hpp"
20 
21 
22 namespace rt{
23 
31  class image{
32  protected:
33  SDL_Surface* data;
40  image();
41 
42  public:
43 
47  image(int width, int height);
48 
55  image(const image& img);
56 
61  virtual ~image();
62 
66  virtual inline int width() const{
67  return data->w;
68  }
69 
73  virtual inline int height() const{
74  return data->h;
75  }
76 
80  virtual image copy() const;
81 
85  virtual color get_pixel(int x, int y) const;
86 
90  virtual void set_pixel(int x, int y, const color& c);
91 
96  virtual void blit(image& dst, const rect& srcrect, int dstx, int dsty) const;
97 
102  virtual void blit(image& dst, int dstx, int dsty) const;
103 
107  virtual void draw_line(int x1, int y1, int x2, int y2, const color& c);
108 
112  virtual void draw_rect(int x1, int y1, int x2, int y2, const color& c);
113 
117  virtual void fill_rect(int x1, int y1, int x2, int y2, const color& c);
118  };
119 
120 }
121 
virtual void draw_line(int x1, int y1, int x2, int y2, const color &c)
Definition: image.cpp:58
SDL_Rect rect
Rectangle.
Definition: rect.hpp:28
virtual void blit(image &dst, const rect &srcrect, int dstx, int dsty) const
Definition: image.cpp:42
virtual int width() const
Definition: image.hpp:66
virtual image copy() const
Definition: image.cpp:21
SDL_Surface * data
Definition: image.hpp:33
Definition: bitmap.cpp:4
image()
Definition: image.cpp:4
virtual void set_pixel(int x, int y, const color &c)
Definition: image.cpp:35
RGBA color representation.
Definition: color.hpp:31
virtual ~image()
Definition: image.cpp:16
virtual void draw_rect(int x1, int y1, int x2, int y2, const color &c)
Definition: image.cpp:113
virtual void fill_rect(int x1, int y1, int x2, int y2, const color &c)
Definition: image.cpp:120
virtual int height() const
Definition: image.hpp:73
virtual color get_pixel(int x, int y) const
Definition: image.cpp:27
Image surface.
Definition: image.hpp:31