-
Notifications
You must be signed in to change notification settings - Fork 2
Surface
themixray edited this page Dec 17, 2021
·
5 revisions
Initialization a surface.
pygwin.surface((width,height))
- width Surface width
- height Surface height
Returns surface
Get surface's color pixels.
surface.pixels
surface.pixels[x][y]
Returns list
Get color from pixel.
surface.getPixel(x, y)
- x Pixel x
- y Pixel y
Returns color
Set color to pixel.
surface.setPixel(x, y, color)
- x Pixel x
- y Pixel y
- color Pixel color
Returns surface
Get surface size.
surface.size
Returns tuple
Create rect for the surface.
surface.rect(x, y, center=[])
- x Surface x
- y Surface y
- center Center surface at...
Returns rect
Copy surface.
surface.copy()
Returns surface
Fill surface.
surface.fill(color)
- color Fill color
Returns surface
Blit surface to surface.
surface.blit(surf, (x, y))
- x Surface x
- x Surface x
- surf Surface or String
Returns surface
Crop surface.
surface.crop(rect)
- rect Rect
Returns surface
Scale surface.
surface.scale(size)
- size size
Returns surface
Rotate surface.
surface.rotate(angle)
- angle Degree of rotation
Returns surface
Flip surface.
surface.flip(x, y)
- x Flip horizontally
- y Flip vertically
Returns surface
Blur surface.
surface.blur(amt)
- amt The power of blurring
Returns surface
Draw on the surface
surface.draw.rect(color,rect,
width=0,borderRadius=0,
borderTopLeftRadius=-1,
borderTopRightRadius=-1,
borderBottomLeftRadius=-1,
borderBottomRightRadius=-1)
- color Rect color
- rect Rect
- width Rect border width
- borderRadius Rect border radius
- borderTopLeftRadius Rect top left border radius
- borderTopRightRadius Rect top right border radius
- borderBottomLeftRadius Rect bottom left border radius
- borderBottomRightRadius Rect bottom right border radius
Returns surface
surface.draw.polygon(color,points,width=0)
- color Polygon color
- points List of positions
- width Polygon border width
Returns surface
surface.draw.circle(color,center,
radius,width=0,
drawTopLeft=None,
drawTopRight=None,
drawBottomLeft=None,
drawBottomRight=None)
- color Circle color
- center Center position
- radius Circle radius
- drawTopLeft Draw top left
- drawTopRight Draw top right
- drawBottomLeft Draw bottom left
- drawBottomRight Draw bottom right
Returns surface
surface.draw.ellipse(color,rect,width=0)
- color Ellipse color
- rect Rect
- width Ellipse border width
Returns surface
surface.draw.line(color,start,end,width=1)
- color Line color
- start Start position
- end End position
- width Line width
Returns surface
surface.draw.arc(color,rect,startAngle,
stopAngle,width=1)
- color Arc color
- rect Rect
- startAngle Start angle
- stopAngle Stop angle
- width Arc width
Returns surface