1
A
回答
2
这应该做你问什么:
# load the image
image = pygame.image.load("some_image.png")
# draw a yellow line on the image
pygame.draw.line(image, (255, 255, 0), (0, 0), (100, 100))
通常你不画原始图像的,因为你必须重新加载图像来获得原始回(或创建在它开始绘制之前它的一个副本)。也许你真正需要的是更多这样的东西:
# initialize pygame and screen
import pygame
pygame.init()
screen = pygame.display.set_mode((720, 576))
# Draw the image to the screen
screen.blit(image, (0, 0))
# Draw a line on top of the image on the screen
pygame.draw.line(screen, (255, 255, 255), (0, 0), (50, 50))
0
帮助的模块pygame.draw在pygame的:
名称 pygame.draw - 用于绘制形状
FILE d pygame的模块:\ Program Files文件\ python25 \ LIB \站点包\ pygame的\ draw.pyd
功能 aaline(...) pygame.draw.aaline(表面,颜色,startpos,endpos,混合= 1):返回的Rect 绘制细平滑处理线条
aalines(...)
pygame.draw.aalines(Surface, color, closed, pointlist, blend=1): return Rect
arc(...)
pygame.draw.arc(Surface, color, Rect, start_angle, stop_angle, width=1): return Rect
draw a partial section of an ellipse
circle(...)
pygame.draw.circle(Surface, color, pos, radius, width=0): return Rect
draw a circle around a point
ellipse(...)
pygame.draw.ellipse(Surface, color, Rect, width=0): return Rect
draw a round shape inside a rectangle
line(...)
pygame.draw.line(Surface, color, start_pos, end_pos, width=1): return Rect
draw a straight line segment
lines(...)
pygame.draw.lines(Surface, color, closed, pointlist, width=1): return Rect
draw multiple contiguous line segments
polygon(...)
pygame.draw.polygon(Surface, color, pointlist, width=0): return Rect
draw a shape with any number of sides
rect(...)
pygame.draw.rect(Surface, color, Rect, width=0): return Rect
draw a rectangle shape
相关问题
- 1. 在pygame中绘制快速线条
- 2. 如何在pygame中重绘渐变背景上的文字?
- 3. 如何在图表上绘制线条?
- 4. 如何在iPad上绘制线条图?
- 5. 背景(图片)在画布上绘制,同时在上面
- 6. 如何在绘制线条时避免背景擦除?
- 7. 如何在Qt中使用QPainter.drawImage在jpeg/png图片的背景图片上绘制jpeg/png图片?
- 8. 在画布上绘制背景图像
- 9. 如何添加背景图片到pygame gui中的按钮?
- 10. 如何在pygame中绘制一条线并更改颜色?
- 11. 在flot图的背景上绘制线段
- 12. 背景图片上的背景图像
- 13. 在已绘制的SurfaceView背景上绘制位图
- 14. 如何使用底图Python在背景上绘制散点图
- 15. 如何在openGL中绘制背景
- 16. 如何在UIScrollView中绘制大背景?
- 17. 如何在bb中的编码图像上绘制一条线?
- 18. 如何在ImageViewZoom中使用的位图上绘制线条?
- 19. iphone - 在设置背景视图时在UITableViewCell中绘制一条线
- 20. 如何在图像上绘制线条/绘画?
- 21. Pygame擦除背景上的图像
- 22. Windowsforms:如何在DataGridView上绘制线条?
- 23. 如何在android中为achartengine折线图设置背景图片?
- 24. Tkinter:如何在背景画布上绘制图像
- 25. 如何绘制比CSS中默认的背景颜色更多的线条?
- 26. 在拍摄图像上绘制线条
- 27. 用PyQt在图像上绘制线条
- 28. 在c#图上绘制一条线
- 29. 未在Google地图上绘制线条
- 30. 在地图上绘制一条线