1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# This file is part of gempy.
#
# gempy - https://github.com/ArmstrongJ/gempy
# Copyright (C) 2011 Jeffrey Armstrong
# <jeffrey.armstrong@approximatrix.com>
#
# Foobar is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# Foobar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Foobar. If not, see <http://www.gnu.org/licenses/>.
#
from error import GEMError
from constants import *
import _gem
def get_screen_handle():
"""Returns a VDI handle for the current screen"""
return _gem.v_open_screen()
def close(handle):
"""Closes the passed VDI handle"""
_gem.v_clsvwk(handle)
# Drawing primitives
def bar(handle,pt1,pt2=None):
"""Draw a filled rectangle"""
xpt1 = pt1
if pt2 is None and len(pt1) == 4:
xpt1 = (pt1[0],pt1[1])
xpt2 = (pt1[0]+pt1[2],pt1[1]+pt1[3])
elif len(pt2) == 2 and len(pt1) == 2:
xpt2 = pt2
else:
raise ArgumentError('Points should be one (x,y,w,h) tuple or an (x,y) pair of tuples')
_gem.v_bar(handle,xpt1,xpt2)
def ellipse(handle,center,radii):
"""Draw eclipse"""
_gem.v_ellipse(handle,center,radii)
def vsf_color(handle,index):
"""Set the fill color index"""
_gem.vsf_color(handle,index)
def vs_clip(handle, enable, pt1, pt2=None):
"""Set the clipping region"""
xpt1 = pt1
if pt2 is None and len(pt1) == 4:
xpt1 = (pt1[0],pt1[1])
xpt2 = (pt1[0]+pt1[2],pt1[1]+pt1[3])
elif len(pt2) == 2 and len(pt1) == 2:
xpt2 = pt2
else:
raise ArgumentError('Point should be one (x,y,w,h) tuple or an (x,y) pair of tuples')
if enable:
xenable = 1
else:
xenable = 0
_gem.vs_clip(handle,xenable, xpt1, xpt2)
|