Documentation ¶
Index ¶
- Variables
- func GetFace(size float64) font.Face
- func GoFloatToStarlarkInt(val any) (_ starlark.Float, ok bool)
- func GoIntToStarlarkInt(val any) (_ starlark.Int, ok bool)
- func GoValueToStarlarkValue(val any) (_ starlark.Value, ok bool)
- func PackMethodResults(method reflect.Value, results []reflect.Value) (starlark.Value, error)
- func UnpackMethodArgs(name string, args starlark.Tuple, kwargs []starlark.Tuple, ...) ([]reflect.Value, error)
- func ValueToGoFloat[T ~float32 | float64](val starlark.Value) (_ T, ok bool)
- func ValueToGoInt[...](val starlark.Value) (_ T, ok bool)
- func ValueToGoString(val starlark.Value) (_ string, ok bool)
- type DrawContext
- func (d *DrawContext) Attr(name string) (starlark.Value, error)
- func (d *DrawContext) AttrNames() []string
- func (d *DrawContext) Freeze()
- func (d *DrawContext) GetBase64(format string, quality int) (_ starlark.String, err error)
- func (d *DrawContext) GetDataURI(format string, quality int) (_ starlark.String, err error)
- func (d *DrawContext) Hash() (uint32, error)
- func (d *DrawContext) String() string
- func (d *DrawContext) Truth() starlark.Bool
- func (d *DrawContext) Type() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ArialUnicodeMS *truetype.Font
View Source
var ArialUnicodeMSRaw []byte
View Source
var Module = &starlarkstruct.Module{ Name: "canvas", Members: starlark.StringDict{ "Context": starlark.NewBuiltin("Context", func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (_ starlark.Value, err error) { var width, height starlark.Int err = starlark.UnpackArgs(fn.Name(), args, kwargs, "width", &width, "height", &height) if err != nil { return nil, err } return NewContext(width, height) }), }, }
Functions ¶
func GoValueToStarlarkValue ¶
support int*、float*、string、bool
func PackMethodResults ¶
多个参数则返回 starlark.Tuple
func UnpackMethodArgs ¶
func ValueToGoFloat ¶
接受 int、float
func ValueToGoInt ¶
Types ¶
type DrawContext ¶
type DrawContext struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(width, height starlark.Int) (_ *DrawContext, err error)
func (*DrawContext) Attr ¶
func (d *DrawContext) Attr(name string) (starlark.Value, error)
Attr implements starlark.HasAttrs.
func (*DrawContext) AttrNames ¶
func (d *DrawContext) AttrNames() []string
AttrNames implements starlark.HasAttrs.
func (*DrawContext) GetDataURI ¶
func (*DrawContext) Hash ¶
func (d *DrawContext) Hash() (uint32, error)
Hash implements starlark.Value.
func (*DrawContext) String ¶
func (d *DrawContext) String() string
String implements starlark.Value.
func (*DrawContext) Truth ¶
func (d *DrawContext) Truth() starlark.Bool
Truth implements starlark.Value.
Click to show internal directories.
Click to hide internal directories.