@@ -75,29 +75,23 @@ def from_size(cls, data, width, height):
75
75
return cls (data , monitor )
76
76
77
77
@property
78
- def top (self ):
78
+ def bgra (self ):
79
+ # type: () -> bytes
80
+ """ Compute BGRA values from the BGRA raw pixels. """
81
+ return bytes (self .raw )
82
+
83
+ @property
84
+ def height (self ):
79
85
# type: () -> int
80
- """ Convenient accessor to the top position . """
81
- return self .pos . top
86
+ """ Convenient accessor to the height size . """
87
+ return self .size . height
82
88
83
89
@property
84
90
def left (self ):
85
91
# type: () -> int
86
92
""" Convenient accessor to the left position. """
87
93
return self .pos .left
88
94
89
- @property
90
- def width (self ):
91
- # type: () -> int
92
- """ Convenient accessor to the width size. """
93
- return self .size .width
94
-
95
- @property
96
- def height (self ):
97
- # type: () -> int
98
- """ Convenient accessor to the height size. """
99
- return self .size .height
100
-
101
95
@property
102
96
def pixels (self ):
103
97
# type: () -> List[Tuple[int, int, int]]
@@ -111,31 +105,6 @@ def pixels(self):
111
105
112
106
return self .__pixels
113
107
114
- def pixel (self , coord_x , coord_y ):
115
- # type: (int, int) -> Tuple[int, int, int]
116
- """
117
- Returns the pixel value at a given position.
118
-
119
- :param int coord_x: The x coordinate.
120
- :param int coord_y: The y coordinate.
121
- :return tuple: The pixel value as (R, G, B).
122
- """
123
-
124
- try :
125
- return self .pixels [coord_y ][coord_x ]
126
- except IndexError :
127
- raise ScreenShotError ('Pixel location out of range.' , locals ())
128
-
129
- @property
130
- def bgra (self ):
131
- # type: () -> bytes
132
- """
133
- Compute BGRA values from the BGRA raw pixels.
134
-
135
- :return bytes: BGRA pixels.
136
- """
137
- return bytes (self .raw )
138
-
139
108
@property
140
109
def rgb (self ):
141
110
# type: () -> bytes
@@ -152,3 +121,30 @@ def rgb(self):
152
121
self .__rgb = bytes (rgb )
153
122
154
123
return self .__rgb
124
+
125
+ @property
126
+ def top (self ):
127
+ # type: () -> int
128
+ """ Convenient accessor to the top position. """
129
+ return self .pos .top
130
+
131
+ @property
132
+ def width (self ):
133
+ # type: () -> int
134
+ """ Convenient accessor to the width size. """
135
+ return self .size .width
136
+
137
+ def pixel (self , coord_x , coord_y ):
138
+ # type: (int, int) -> Tuple[int, int, int]
139
+ """
140
+ Returns the pixel value at a given position.
141
+
142
+ :param int coord_x: The x coordinate.
143
+ :param int coord_y: The y coordinate.
144
+ :return tuple: The pixel value as (R, G, B).
145
+ """
146
+
147
+ try :
148
+ return self .pixels [coord_y ][coord_x ]
149
+ except IndexError :
150
+ raise ScreenShotError ('Pixel location out of range.' , locals ())
0 commit comments