Skip to content

Surface

themixray edited this page Dec 17, 2021 · 5 revisions

Init

Initialization a surface.

pygwin.surface((width,height))
  • width Surface width
  • height Surface height

Returns surface

Get pixels

Get surface's color pixels.

surface.pixels
surface.pixels[x][y]

Returns list

Get pixel color

Get color from pixel.

surface.getPixel(x, y)
  • x Pixel x
  • y Pixel y

Returns color

Set pixel color

Set color to pixel.

surface.setPixel(x, y, color)
  • x Pixel x
  • y Pixel y
  • color Pixel color

Returns surface

Get size

Get surface size.

surface.size

Returns tuple

Create rect

Create rect for the surface.

surface.rect(x, y, center=[])
  • x Surface x
  • y Surface y
  • center Center surface at...

Returns rect

Copy

Copy surface.

surface.copy()

Returns surface

Fill

Fill surface.

surface.fill(color)
  • color Fill color

Returns surface

Blit

Blit surface to surface.

surface.blit(surf, (x, y))
  • x Surface x
  • x Surface x
  • surf Surface or String

Returns surface

Crop

Crop surface.

surface.crop(rect)
  • rect Rect

Returns surface

Scale

Scale surface.

surface.scale(size)
  • size size

Returns surface

Rotate

Rotate surface.

surface.rotate(angle)
  • angle Degree of rotation

Returns surface

Flip

Flip surface.

surface.flip(x, y)
  • x Flip horizontally
  • y Flip vertically

Returns surface

Blur

Blur surface.

surface.blur(amt)
  • amt The power of blurring

Returns surface

Draw

Draw on the surface

Rect

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

Polygon

surface.draw.polygon(color,points,width=0)
  • color Polygon color
  • points List of positions
  • width Polygon border width

Returns surface

Circle

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

Ellipse

surface.draw.ellipse(color,rect,width=0)
  • color Ellipse color
  • rect Rect
  • width Ellipse border width

Returns surface

Line

surface.draw.line(color,start,end,width=1)
  • color Line color
  • start Start position
  • end End position
  • width Line width

Returns surface

Arc

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

Clone this wiki locally