5c70d9d85a6f690ae5c591b7d884677efad7fbaa
Stefan Schuermans complete implementation of...

Stefan Schuermans authored 7 years ago

1) /*
2)  * EtherPix simulator
3)  *
4)  * Copyright 2017 Stefan Schuermans <stefan schuermans info>
5)  *
6)  * This program is free software: you can redistribute it and/or modify
7)  * it under the terms of the GNU General Public License as published by
8)  * the Free Software Foundation, version 3 of the License.
9)  *
10)  *
11)  * This program is distributed in the hope that it will be useful,
12)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)  * GNU General Public License for more details.
15)  *
16)  * You should have received a copy of the GNU Lesser General Public License
17)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18)  */
19) 
20) #ifndef PIXEL_H
21) #define PIXEL_H
22) 
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

23) #include <gtkmm.h>
Stefan Schuermans implement receiving packets

Stefan Schuermans authored 7 years ago

24) #include <stdint.h>
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

25) 
26) #include "bbox.h"
27) #include "transform.h"
28) 
Stefan Schuermans complete implementation of...

Stefan Schuermans authored 7 years ago

29) /// a simulated pixel
30) class Pixel
31) {
32) public:
33)   /// default constructor
34)   Pixel();
35) 
36)   /// constructor based on coordinates and radius
37)   Pixel(double x, double y, double r);
38) 
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

39)   /**
40)    * @brief add pixel to the bounding box
41)    * @param[in,out] bb bounding box
42)    */
43)   void updateBBox(BBox &bb) const;
44) 
Stefan Schuermans implement receiving packets

Stefan Schuermans authored 7 years ago

45)   /**
46)    * @brief set color of pixel
47)    */
48)   void setColor(uint8_t red, uint8_t green, uint8_t blue)
49)   {
50)     m_red   = red  ;
51)     m_green = green;
52)     m_blue  = blue ;
53)   }
54) 
Stefan Schuermans implement drawing pixels

Stefan Schuermans authored 7 years ago

55)   /**
56)    * @brief draw pixel
57)    * @param[in] cairo cairo context for drawing
58)    * @param[in] tf coordinate transformation
59)    */
60)   void draw(Cairo::RefPtr<Cairo::Context> &cairo, Transform const &tf) const;
61) 
Stefan Schuermans complete implementation of...

Stefan Schuermans authored 7 years ago

62) protected:
63)    /// parameters of pixel
64)    //@{
65)    double m_x; ///< x coordinate
66)    double m_y; ///< y coordinate
67)    double m_r; ///< radius
68)    //@}
Stefan Schuermans implement receiving packets

Stefan Schuermans authored 7 years ago

69)    /// color of pixel
70)    //@{
71)    uint8_t m_red, m_green, m_blue;
72)    //@}