def fill(self, color=None, rect=None): """ Fill surface with color. """ if color is None: HTML5Canvas.fill(self) return self.beginPath() if color: if hasattr(color, 'a'): self.setFillStyle(color) else: self.setFillStyle(Color(color)) if not rect: _rect = Rect(0, 0, self.width, self.height) else: if self._display: surface_rect = self._display._surface_rect else: surface_rect = self.get_rect() if hasattr(rect, 'width'): _rect = surface_rect.clip(rect) else: _rect = surface_rect.clip(Rect(rect)) if not _rect.width or not _rect.height: return _rect self.fillRect(_rect.x, _rect.y, _rect.width, _rect.height) else: _rect = Rect(0, 0, self.width, self.height) self.clear() return _rect
def fill(self, color=None, rect=None): """ Fill surface with color. """ if color is None: HTML5Canvas.fill(self) return self.beginPath() if color: if hasattr(color, 'a'): self.setFillStyle(color) else: self.setFillStyle(Color(color)) if not rect: _rect = Rect(0, 0, self.width, self.height) else: if self._display: surface_rect = self._display._surface_rect else: surface_rect = self.get_rect() if hasattr(rect, 'width'): _rect = surface_rect.clip( rect ) else: _rect = surface_rect.clip( Rect(rect) ) if not _rect.width or not _rect.height: return _rect self.fillRect(_rect.x, _rect.y, _rect.width, _rect.height) else: _rect = Rect(0, 0, self.width, self.height) self.clear() return _rect
def __init__(self, size, *args, **kwargs): self.width = int(size[0]) self.height = int(size[1]) HTML5Canvas.__init__(self, self.width, self.height) self._display = None #display surface self._super_surface = None self._offset = (0, 0) self._colorkey = None self._nonimplemented_methods()
def __init__(self, size, *args, **kwargs): self.width = int(size[0]) self.height = int(size[1]) HTML5Canvas.__init__(self, self.width, self.height) self._display = None #display surface self._super_surface = None self._offset = (0,0) self._colorkey = None self._nonimplemented_methods()
def init(): """ **pyjsdl.font.init** Initialize font module. """ global _surf, _initialized, match_font if _initialized: return try: _surf = HTML5Canvas(1, 1) _surf.measureText('x') except: _surf = None _initialized = True
def resize(self, width, height): self.width = int(width) self.height = int(height) HTML5Canvas.resize(self, self.width, self.height)