Package pyjsdl :: Module surface :: Class Surface

Class Surface

 pyjsobj.Element --+        
                   |        
pyjsobj.FocusElement --+    
                       |    
     pyjsobj.HTML5Canvas --+
                           |
                          Surface

pyjsdl.Surface

Instance Methods
 
__init__(self, size, *args, **kwargs)
Return Surface subclassed from a Canvas implementation. The size argument is the dimension (w,h) of surface.
 
__str__(self)
 
__repr__(self)
 
get_size(self)
Return width and height of surface.
 
get_width(self)
Return width of surface.
 
get_height(self)
Return height of surface.
 
resize(self, width, height)
Resize surface.
 
get_rect(self, **attr)
Return rect of the surface. An optional keyword argument of the rect position.
 
copy(self)
Return Surface that is a copy of this surface.
 
subsurface(self, rect)
Return Surface that represents a subsurface. The rect argument is the area of the subsurface. Argument can be 't'/'f' for data sync to/from subsurface.
 
getSubimage(self, x, y, width, height)
Return subimage of Surface. Arguments include x, y, width, and height of the subimage.
 
blit(self, surface, position, area=None)
Draw given surface on this surface at position. Optional area delimitates the region of given surface to draw.
 
set_colorkey(self, color, flags=None)
Set surface colorkey.
 
get_colorkey(self)
Return surface colorkey.
 
replace_color(self, color, new_color=None)
Replace color with with new_color or with alpha.
 
get_at(self, pos)
Get color of a surface pixel. The pos argument represents x,y position of pixel. Return color (r,g,b,a) of a surface pixel.
 
set_at(self, pos, color)
Set color of a surface pixel. The arguments represent position x,y and color of pixel.
 
fill(self, color=None, rect=None)
Fill surface with color.
 
get_parent(self)
Return parent Surface of subsurface.
 
get_offset(self)
Return offset of subsurface in surface.
 
toDataURL(self, datatype=None)
Return surface data as a base64 data string. Optional datatype to set data format, default to 'image/png'. Implemented with HTML5 Canvas toDataURL method.

Inherited from pyjsobj.HTML5Canvas: arc, beginPath, clear, closePath, drawImage, fillRect, fillText, getContext, getElement, getImageData, lineTo, measureText, moveTo, putImageData, restoreContext, rotate, saveContext, scale, setFillStyle, setFont, setLineWidth, setStrokeStyle, setTextAlign, setTextBaseline, stroke, strokeRect, strokeText, toBlob, transform, translate

Inherited from pyjsobj.FocusElement: addFocusListener, addKeyEventListener, addKeyboardListener, addMouseListener, blur, focus, onBlur, onFocus, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseEnter, onMouseLeave, onMouseMove, onMouseUp, onMouseWheel, onTouchCancel, onTouchEnd, onTouchInitiate, onTouchMove, onTouchStart, removeKeyEventListener, sinkEvents

Inherited from pyjsobj.Element: addEventListener, appendChild, click, getAttribute, getAttributes, getBoundingClientRect, getClientHeight, getClientLeft, getClientTop, getClientWidth, getID, getMouseWheelEventType, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getStyle, getTitle, removeChild, removeEventListener, setAttribute, setElement, setHeight, setID, setSize, setTitle, setWidth, style

Method Details

__init__(self, size, *args, **kwargs)
(Constructor)

 

Return Surface subclassed from a Canvas implementation. The size argument is the dimension (w,h) of surface.

Module initialization places pyjsdl.Surface in module's namespace.

Overrides: pyjsobj.Element.__init__

resize(self, width, height)

 
Resize surface.
Overrides: pyjsobj.HTML5Canvas.resize

fill(self, color=None, rect=None)

 
Fill surface with color.
Overrides: pyjsobj.HTML5Canvas.fill

toDataURL(self, datatype=None)

 
Return surface data as a base64 data string. Optional datatype to set data format, default to 'image/png'. Implemented with HTML5 Canvas toDataURL method.
Overrides: pyjsobj.HTML5Canvas.toDataURL