日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php gd库画线,[PHP] GD库(十)绘制线段与圆弧 imageline、imagesetstyle 与 imagearc 函数...

發(fā)布時間:2025/3/19 php 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php gd库画线,[PHP] GD库(十)绘制线段与圆弧 imageline、imagesetstyle 与 imagearc 函数... 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

[PHP] GD庫(十)繪制線段與圓弧 imageline、imagesetstyle 與 imagearc 函數(shù)

imageline() 函數(shù)用于繪制一條線段。

imagearc() 函數(shù)用于繪制橢圓弧(包括圓弧)。

imagesetstyle() 函數(shù)用于設(shè)定畫線風格。

imageline()

imageline() 函數(shù)用于繪制一條線段。

語法:

bool imageline( resource image, int x1, int y1, int x2, int y2, int color )

用 color 顏色在圖像 image 中從坐標 x1,y1 到 x2,y2(圖像左上角坐標為 0,0)畫一條線段。

例子:

瀏覽器輸出圖像如下:

PHP 繪制線段示例

參考閱讀

- imagecreate():創(chuàng)建一幅空白圖像。

- imagecolorallocate():為圖像分配顏色。

imagesetstyle()

imagesetstyle() 設(shè)定所有畫線的函數(shù)(例如 imageline() 和 imagepolygon())在使用特殊顏色 IMG_COLOR_STYLED 或者用 IMG_COLOR_STYLEDBRUSHED 畫一行圖像時所使用的風格。如果成功則返回 TRUE ,失敗則返回 FALSE 。

語法:

bool imagesetstyle( resource image, array style )

style 參數(shù)是像素組成的數(shù)組。

imageline() 函數(shù)配合 imagesetstyle() 可以畫一條虛線段:

瀏覽器輸出圖像如下:

imagearc()

imagearc() 函數(shù)用于繪制橢圓弧(包括圓弧)。

語法:

bool imagearc(resource image, int cx, int cy, int w, int h, int s, int e, int color )

參數(shù)說明:

參數(shù)

說明

image

圖像資源,欲繪制橢圓弧的圖像

cx

橢圓中心 x 坐標

cy

橢圓中心 y 坐標

w

橢圓寬度

h

橢圓高度

s

起始點,0 表示 3 點鐘方向

e

角度,360 表示完全封閉

color

圖像顏色

例子:

該例子繪制一個圓圈,瀏覽器輸出如下:

PHP 繪制橢圓弧示例

總結(jié)

以上是生活随笔為你收集整理的php gd库画线,[PHP] GD库(十)绘制线段与圆弧 imageline、imagesetstyle 与 imagearc 函数...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。