VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gxdrawable.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 //
18 // gxdrawable.cpp
19 //
20 
21 #include "gdef.h"
22 #include "gxdef.h"
23 #include "gxdrawable.h"
24 #include "gxdisplay.h"
25 #include "gxcontext.h"
26 #include "gassert.h"
27 
29  m_display(display)
30 {
31 }
32 
34 {
35 }
36 
37 void GX::Drawable::drawPoint( Context & gc , int x , int y )
38 {
39  XDrawPoint( m_display.x() , xd() , gc.x() , x , y ) ;
40 }
41 
42 void GX::Drawable::drawLine( Context & gc , int x1 , int y1 , int x2 , int y2 )
43 {
44  XDrawLine( m_display.x() , xd() , gc.x() , x1 , y1 , x2 , y2 ) ;
45 }
46 
47 void GX::Drawable::drawRectangle( Context & gc , int x , int y , int dx , int dy )
48 {
49  G_ASSERT( dx >= 0 && dy >= 0 ) ;
50  XFillRectangle( m_display.x() , xd() , gc.x() , x , y ,
51  static_cast<unsigned int>(dx) , static_cast<unsigned int>(dy) ) ;
52 }
53 
54 void GX::Drawable::drawArc( Context & gc , int x , int y , unsigned int width ,
55  unsigned int height , int angle1 , int angle2 )
56 {
57  XDrawArc( m_display.x() , xd() , gc.x() , x , y , width , height , angle1 , angle2 ) ;
58 }
59 
60 /// \file gxdrawable.cpp
An Xlib Display wrapper.
Definition: gxdisplay.h:38
void drawPoint(Context &, int x, int y)
Draws a point.
Definition: gxdrawable.cpp:37
Drawable(Display &)
Constructor. The display reference is kept.
Definition: gxdrawable.cpp:28
::GC x()
Returns the X object.
Definition: gxcontext.cpp:63
void drawRectangle(Context &, int x, int y, int dx, int dy)
Draws a rectangle.
Definition: gxdrawable.cpp:47
void drawLine(Context &, int x1, int y1, int x2, int y2)
Draws a line.
Definition: gxdrawable.cpp:42
An Xlib GC wrapper.
Definition: gxcontext.h:37
void drawArc(Context &, int x, int y, unsigned int width, unsigned int height, int angle1, int angle2)
Draws an arc.
Definition: gxdrawable.cpp:54
virtual ~Drawable()
Destructor.
Definition: gxdrawable.cpp:33