Documentation ¶
Overview ¶
Package draw 提供简单的绘图工具
Index ¶
- Constants
- func DrawHollowCircleXY[TC, TR, TW Number](canvas Canvas, centerX, centerY TC, radius TR, width TW)
- func DrawHollowRectXY[TP, TW Number](canvas Canvas, x1, y1, x2, y2 TP, width TW)
- func DrawLineXY[TP, TW Number](canvas Canvas, x1, y1, x2, y2 TP, width TW)
- func DrawPointXY[TP, TR Number](canvas Canvas, centerX, centerY TP, radius TR)
- func DrawSolidRectXY[T Number](canvas Canvas, x1, y1, x2, y2 T)
- func DrawTextXY[T Number](canvas TextCanvas, x, y T, text string, opts ...Option)
- type BlackColor
- type BlueColor
- type Canvas
- type GreenColor
- type MergedOptions
- type Number
- type Option
- type Point
- type RedColor
- type TextCanvas
- type WhiteColor
Constants ¶
View Source
const ( White = WhiteColor(0xFF) Black = BlackColor(0xFF) Red = RedColor(0xFF) Green = GreenColor(0xFF) Blue = BlueColor(0xFF) )
Red 表示简单红色
Variables ¶
This section is empty.
Functions ¶
func DrawHollowCircleXY ¶
DrawHollowCircle 封装 DrawHollowCircle, 但是提供具体的 XY 值而不是 Point
func DrawHollowRectXY ¶
DrawHollowRectXY 封装 DrawHollowRect, 但是提供具体的 XY 值而不是 Point
func DrawLineXY ¶
DrawLineXY 封装 DrawLine, 但是提供具体的 XY 值而不是 Point
func DrawPointXY ¶
DrawPointXY 封装 DrawPoint, 但是提供具体的 XY 值而不是 Point
func DrawSolidRectXY ¶
DrawSolidRectXY 封装 DrawSolidRect, 但是提供具体的 XY 值而不是 Point
func DrawTextXY ¶
func DrawTextXY[T Number](canvas TextCanvas, x, y T, text string, opts ...Option)
DrawTextXY 封装 DrawText, 但是提供具体的 XY 值而不是 Point
Types ¶
type BlackColor ¶
type BlackColor uint8
type Canvas ¶
type Canvas interface { Size() (width, height float64) SetDrawColor(clr color.Color) CurrentDrawColor() color.Color DrawPoint(center Point, radius float64) DrawHollowCircle(center Point, radius, width float64) DrawLine(from, to Point, width float64) DrawHollowRect(endpoint1, endpoint2 Point, width float64) DrawSolidRect(endpoint1, endpoint2 Point) DrawHollowPolygon(width float64, endpoints ...Point) DrawSolidPolygon(endpoints ...Point) Save(filepath string) error }
Canvas 表示一个画板
type GreenColor ¶
type GreenColor uint8
type MergedOptions ¶
MergedOptions 表示合并后的参数。调用方无需使用,这是给实现用的
func MergeOptions ¶
func MergeOptions(c Canvas, opts []Option) MergedOptions
MergeOptions 给实现方使用, 实现各种 option
type TextCanvas ¶
TextCanvas 表示一个能绘图的画布
type WhiteColor ¶
type WhiteColor uint8
Click to show internal directories.
Click to hide internal directories.