<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] # **pygame.gfxdraw** Pygame 中繪制圖形的模塊。 ## **函數** * pygame.gfxdraw.pixel() —— 繪制一個像素點 * pygame.gfxdraw.hline() —— 繪制一條水平線 * pygame.gfxdraw.vline() —— 繪制一條垂直線 * pygame.gfxdraw.rectangle() —— 繪制一個矩形邊框 * pygame.gfxdraw.box() —— 繪制一個填充的矩形 * pygame.gfxdraw.line() —— 繪制一條直線 * pygame.gfxdraw.circle() —— 繪制一個圓形邊框 * pygame.gfxdraw.arc() —— 繪制一條弧線 * pygame.gfxdraw.aacircle() —— 繪制一個平滑(抗鋸齒)的圓形 * pygame.gfxdraw.filled\_circle() —— 繪制一個填充的圓形 * pygame.gfxdraw.ellipse() —— 繪制一個橢圓形邊框 * pygame.gfxdraw.aaellipse() —— 繪制一個平滑(抗鋸齒)的橢圓形 * pygame.gfxdraw.filled\_ellipse() —— 繪制一個填充的橢圓形 * pygame.gfxdraw.pie() —— 繪制一個扇形邊框 * pygame.gfxdraw.trigon() —— 繪制一個三角形邊框 * pygame.gfxdraw.aatrigon() —— 繪制一個平滑(抗鋸齒)的三角形 * pygame.gfxdraw.filled\_trigon() —— 繪制一個填充的三角形 * pygame.gfxdraw.polygon() —— 繪制一個多邊形邊框 * pygame.gfxdraw.aapolygon() —— 繪制一個平滑(抗鋸齒)的多邊形 * pygame.gfxdraw.filled\_polygon() —— 繪制一個填充的多邊形 * pygame.gfxdraw.textured\_polygon() —— 繪制一個紋理填充的多邊形 * pygame.gfxdraw.bezier() —— 繪制一條貝塞爾曲線 **注意:當前版本 API 函數可能會在下一個版本發生改變或者取消。如果你要使用這個實驗性的模塊,你的代碼將可能會與之后的 Pygame 版本不兼容。** 在一個 Surface 上繪制出幾種圖形。 大多數函數中有一個表示 RGB 色彩的三元組參數,有時也接收一個表示 RGBA 色彩的四元組參數,色彩參數也可以是已經映射到 Surface 對象內的像素格式下的一個整數值。 所有函數的參數都使用固定坐標,坐標和圓的半徑僅支持整數描述。 對于類似繪制矩形函數,盡管傳入一個 pygame.Rect 對象才是首選,但也可以接收一個用于描述 rect 的參數,像 (x, y, w, h) 序列。注意,對于一個 pygame.Rect 對象來說,矩形將不包含右邊和底邊。因此,對于 Rect 的 right 和 bottom 屬性的值其實是不再矩形上的。 繪制平滑和填充的圖形,首先使用抗鋸齒版本的函數(”aa” 開頭的那些),然后使用填充版本的函數。 例如: ~~~ col = (255, 0, 0) surf.fill((255, 255, 255)) pygame.gfxdraw.aacircle(surf, x, y, 30, col) pygame.gfxdraw.filled_circle(surf, x, y, 30, col) ~~~ 注意:pygame 不會自動導入 pygame.gfxdraw 模塊(因為目前來說,這還是一個實驗性的模塊),所以你需要在使用之前自己導入。 線程提示:在調用 C 語言函數部分,都會釋放 GIL(Global Interpreter Lock,全局解釋器鎖)。 pygame.gfxdraw 模塊不同于 draw 模塊的 API 函數使用,并且繪制的圖形也不一樣。因為它打包了 SDL\_gfx 庫的原函數,而非使用修訂后的版本。 ## **函數詳解** ### **pygame.gfxdraw.pixel()** 繪制一個像素點。 pixel(surface, x, y, color) -> None 在 Surface 對象上繪制一個像素點。 ### **pygame.gfxdraw.hline()** 繪制一條水平線。 hline(surface, x1, x2, y, color) -> None 在 Surface 對象上的 y 坐標處,繪制一條從 x1 到 x2 的直線。 ### **pygame.gfxdraw.vline()** 繪制一條垂直線。 vline(surface, x, y1, y2, color) -> None 在 Surface 對象上的 x 坐標處,繪制一條從 y1 到 y2 的直線。 ### **pygame.gfxdraw.rectangle()** 繪制一個矩形邊框。 rectangle(surface, rect, color) -> None 在 Surface 對象上繪制一個矩形邊框,rect 參數指定矩形的區域。 記住,Surface.fill() 方法也可以用于繪制填充矩形。事實上,Surface.fill() 可以在一些平臺上可以使用硬件加速,無論是軟件還是硬件顯示模式。 ### **pygame.gfxdraw.box()** 繪制一個填充的矩形。 box(surface, rect, color) -> None 在 Surface 對象上繪制一個填充的矩形。 ### **pygame.gfxdraw.line()** 繪制一條直線。 line(surface, x1, y1, x2, y2, color) -> None 在 Surface 對象上繪制一條直線,沒有 endcaps。 ### **pygame.gfxdraw.circle()** 繪制一個圓形。 circle(surface, x, y, r, color) -> None 在 Surface 對象上繪制一個圓形邊框。坐標參數 (x,y) 決定圓心的位置,r 參數決定半徑長度。沒有用顏色進行填充。 ### **pygame.gfxdraw.arc()** 繪制一條弧線。 arc(surface, x, y, r, start, end, color) -> None 在 Surface 對象上繪制一條弧線。 ### **pygame.gfxdraw.aacircle()** 繪制一個平滑(抗鋸齒)的圓形。 aacircle(surface, x, y, r, color) -> None 在 Surface 對象上繪制一個平滑(抗鋸齒)的圓形。 ### **pygame.gfxdraw.filled\_circle()** 繪制一個填充的圓形。 filled\_circle(surface, x, y, r, color) -> None 在 Surface 對象上繪制一個填充的原型,填充的顏色由 color 參數指定。 ### **pygame.gfxdraw.ellipse()** 繪制一個橢圓形邊框。 ellipse(surface, x, y, rx, ry, color) -> None 在 Surface 對象上繪制一個橢圓形邊框。 ### **pygame.gfxdraw.aaellipse()** 繪制一個平滑(抗鋸齒)的橢圓形。 aaellipse(surface, x, y, rx, ry, color) -> None 在 Surface 對象上繪制一個平滑(抗鋸齒)的橢圓形。 ### **pygame.gfxdraw.filled\_ellipse()** 繪制一個填充的橢圓形。 filled\_ellipse(surface, x, y, rx, ry, color) -> None 在 Surface 對象上繪制一個填充的橢圓形,填充的顏色由 color 參數指定。 ### **pygame.gfxdraw.pie()** 繪制一個扇形邊框。 pie(surface, x, y, r, start, end, color) -> None 在 Surface 對象上繪制一個扇形邊框。 ### **pygame.gfxdraw.trigon()** 繪制一個三角形邊框。 trigon(surface, x1, y1, x2, y2, x3, y3, color) -> None 在 Surface 對象上繪制一個三角形邊框。 ### **pygame.gfxdraw.aatrigon()** 繪制一個平滑(抗鋸齒)的三角形。 aatrigon(surface, x1, y1, x2, y2, x3, y3, color) -> None 在 Surface 對象上繪制一個平滑(抗鋸齒)的三角形。 ### **pygame.gfxdraw.filled\_trigon()** 繪制一個填充的三角形。 filled\_trigon(surface, x1, y1, x2, y2, x3, y3, color) -> None 在 Surface 對象上繪制一個填充的三角形,填充的顏色由 color 參數指定。 ### **pygame.gfxdraw.polygon()** 繪制一個多邊形邊框。 polygon(surface, points, color) -> None 在 Surface 對象上繪制一個多邊形邊框。 ### **pygame.gfxdraw.aapolygon()** 繪制一個平滑(抗鋸齒)的多邊形。 aapolygon(surface, points, color) -> None 在 Surface 對象上繪制一個平滑(抗鋸齒)的多邊形 ### **pygame.gfxdraw.filled\_polygon()** 繪制一個填充的多邊形。 filled\_polygon(surface, points, color) -> None 在 Surface 對象上繪制一個填充的多邊形,填充的顏色由 color 參數指定。 ### **pygame.gfxdraw.textured\_polygon()** 繪制一個紋理填充的多邊形。 textured\_polygon(surface, points, texture, tx, ty) -> None 在 Surface 對象上繪制一個紋理填充的多邊形。 一個帶 alpha 通道的紋理繪制到另一個帶 alpha 通道的 Surface 對象上,將不同于使用 Surface.blit() 繪制。 帶 alpha 通道的紋理不能被用于一個 8 位單像素的目標。 ### **pygame.gfxdraw.bezier()** 繪制一條貝塞爾曲線。 bezier(surface, points, steps, color) -> None 在 Surface 對象上繪制一條貝塞爾曲線。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看