You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have create a new function to draw dashed line :
//// Draws a dashed line.//// $x1* (int) - The x coordinate for the first point.// $y1* (int) - The y coordinate for the first point.// $x2* (int) - The x coordinate for the second point.// $y2* (int) - The y coordinate for the second point.// $color (string|array) - The line color.// $thickness (int) - The line thickness (default 1).// $dashedLength (int) - Length of the dashed (default 4)//// Returns a SimpleImage object.//publicfunctionlineDashed($x1, $y1, $x2, $y2, $color, $thickness = 1, $dashedLength = 4) {
// Allocate the color$color = $this->allocateColor($color);
// Draw a lineimagesetthickness($this->image, $thickness);
$transparent = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
$style = array();
for ($i = 0; $i < $dashedLength; $i++) {
$style[] = $color;
}
for ($i = 0; $i < $dashedLength; $i++) {
$style[] = $transparent;
}
imagesetstyle($this->image, $style);
imageline($this->image, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED);
return$this;
}
The text was updated successfully, but these errors were encountered:
Hi,
I have create a new function to draw dashed line :
The text was updated successfully, but these errors were encountered: