libseal

package module
v0.0.0-...-a7c541d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-libseal

简介

go-libseal 使用golang语言生成企业和个人印章。

功能

  • 生成企业印章
  • 生成个人印章

使用

1、获取包 go get github.com/xwc1125/go-libseal 2、生成企业印章调用

    dc, err := BuildCompanySeal("北京xxx科技有限公司", "110xxxxxxxx55", "Songti.ttc")
	if err != nil {
		t.Fatal(err)
	}
	os.MkdirAll("./img", os.ModePerm)
	err = dc.SavePNG("./img/out-company.png")
	if err != nil {
		t.Fatal(err)
	}

2、生成个人印章调用

	dc, err := BuildPersonalSeal("小明", "Songti.ttc")
    if err != nil {
        t.Fatal(err)
    }
    os.MkdirAll("./img", os.ModePerm)
    err = dc.SavePNG("./img/out-personal.png")
    if err != nil {
        t.Fatal(err)
    }

示例

  • 企业印章

企业印章

  • 个人印章

小明印章 小明印章

证书

go-libseal 的源码允许用户在遵循 Apache 2.0 开源证书 规则的前提下使用。

版权

Copyright@2022 xwc1125

xwc1125

Documentation

Overview

Package libseal

@author: xwc1125

Package libseal

@author: xwc1125

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCompanySeal

func BuildCompanySeal(companyName string, code string, fontFamily string) (*gg.Context, error)

BuildCompanySeal 生成印章图片,并保存到指定路径 @param conf 配置文件

func BuildPersonalSeal

func BuildPersonalSeal(userName string, fontFamily string) (*gg.Context, error)

BuildPersonalSeal 生成私人印章图片,并保存到指定路径 @param lineSize 边线宽度 @param font 字体对象 @param addString 追加字符

func DrawCircle

func DrawCircle(dc *gg.Context, circle *Circle)

DrawCircle 画圆 如果lineSize=0时,那么使用默认线宽=直径的1/35

func DrawFont4Arc

func DrawFont4Arc(dc *gg.Context, drawFont *DrawFont, point Point, circleRadius float64, allArc float64, isTop bool) error

DrawFont4Arc 在圆弧上写字 @param dc @param drawFont 文本内容 @param point 圆心 @param circleRadius 圆半径 @param allArc 总分配角度 @param isTop 是否上面写入

func DrawStar

func DrawStar(dc *gg.Context, star *Star)

DrawStar 画五角星

func GetCurrentDirectory

func GetCurrentDirectory() string

GetCurrentDirectory TODO

Types

type Circle

type Circle struct {
	Point     Point       // 圆心
	Radius    float64     // 半径
	LineSize  float64     // 线宽度
	LineColor color.Color // 线条颜色
	FillColor color.Color // 填充颜色
}

type DrawFont

type DrawFont struct {
	FontText   string      // 字体内容
	IsBold     bool        // 是否加粗
	FontFamily string      "宋体" // 字形名,默认为宋体
	FontSize   float64     // 字体大小
	FontColor  color.Color // 线颜色
}

type Point

type Point struct {
	X, Y float64
}

func Polygon

func Polygon(n int, x, y, r float64) []Point

Polygon TODO

type Star

type Star struct {
	Point      Point       // 圆心
	Radius     float64     // 半径
	LineSize   float64     // 线宽度
	PointCount int         // 星角个数
	LineColor  color.Color // 线条颜色
	FillColor  color.Color // 填充颜色
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL