illustrator

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 17 Imported by: 0

README

illustrator

An tool to export illustrator to SVGs

Documentation

Index

Constants

View Source
const (
	AI_ClipPath     uint8 = 1 << 0
	AI_CompoundPath uint8 = 1 << 1
	AI_RasterImage  uint8 = 1 << 2
)

Variables

View Source
var (
	AI5_EndRaster   = []byte("%AI5_EndRaster")
	AI5_BeginRaster = []byte("%AI5_BeginRaster")
)

Functions

func XYArgs

func XYArgs(vals []string) (opacity string)

Types

type AIHeader

type AIHeader struct {
	Title            string
	BoundingBox      [4]int
	HiResBoundingBox [4]float64
}

func (*AIHeader) SetBoundingBox

func (h *AIHeader) SetBoundingBox(line []byte)

func (*AIHeader) SetHeader

func (h *AIHeader) SetHeader(title []byte)

func (*AIHeader) SetHiResBoundingBox

func (h *AIHeader) SetHiResBoundingBox(line []byte)

type AILayer

type AILayer struct {
	Name       string
	LayerIndex int // layer index

	Visible           bool
	Preview           bool
	Enabled           bool
	Printing          bool
	Dimmed            bool
	HasMultiLayerMask bool
	ColorIndex        int8 // between -1 and 26
	RGB               [3]uint8
}

type AIProlog

type AIProlog struct{}

type AIReader

type AIReader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

func NewAIReader

func NewAIReader(r io.Reader) (*AIReader, error)

func (*AIReader) Bytes

func (r *AIReader) Bytes() []byte

func (*AIReader) Draw

func (r *AIReader) Draw(drawer Drawer) error

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func (*Buffer) Bytes

func (w *Buffer) Bytes() []byte

func (*Buffer) Len

func (w *Buffer) Len() int

func (*Buffer) Reset

func (w *Buffer) Reset()

func (*Buffer) Text

func (w *Buffer) Text() string

func (*Buffer) WriteByte

func (w *Buffer) WriteByte(b byte) error

type ColorArgs

type ColorArgs struct {
	// contains filtered or unexported fields
}

func KArgs

func KArgs(vals []string) *ColorArgs

func XAArgs

func XAArgs(vals []string) *ColorArgs

func XArgs

func XArgs(vals []string) *ColorArgs

func XKArgs

func XKArgs(vals []string) *ColorArgs

func XXArgs

func XXArgs(vals []string) *ColorArgs

func (*ColorArgs) CMYK

func (args *ColorArgs) CMYK() [4]float64

func (*ColorArgs) RGB

func (args *ColorArgs) RGB() [3]uint8

func (*ColorArgs) SetTint

func (args *ColorArgs) SetTint(tint float64)

type CompressHandle

type CompressHandle interface {
	Decompress() ([]byte, error)

	Write(stream []byte) (n int, err error)
}

type Drawer

type Drawer interface {
	SetHeader(*AIHeader)

	// Layer
	BeginLayer(*AILayer)
	SetLayerName(name string)
	EndLayer()

	// Group
	Group()
	EndGroup()
	SetGroupAttr()

	// path
	ClosePath()
	PathRender(PathOp)
	Moveto(x, y float64)
	Lineto(x, y float64)
	Curveto1(x0, y0, x1, y1 float64)
	Curveto2(x1, y1, x2, y2 float64)
	Curveto(x0, y0, x1, y1, x2, y2 float64)

	// clip path
	ClipPath()
	ApplyClip()

	// compound path
	CompoundPath()
	EndCompoundPath()

	// set color
	SetRGB(PathOp, [3]uint8)
	SetCMYK(PathOp, [4]float64)
	SetOpacity(opacity string)

	// path attributes
	SetDash()
	SetFlat()
	SetLineCap(v string)
	SetLineJoin(v string)
	SetLineWidth(v string)
	SetMiterLimit(v string)

	// gradient
	DefGradient(g *Gradient) //
	SetGradient(g *Gradient)

	// raster
	SetRaster(obj *Raster)
}

type Gradient

type Gradient struct {
	Flag         int8 // 1-issue a clip; 2-disable rending
	GradientType int8 // 渐变类型0-linear; 1-radial

	Name string

	Colors []OffColor
	// contains filtered or unexported fields
}

func (*Gradient) AddColor

func (g *Gradient) AddColor(color *OffColor)

type OffColor

type OffColor struct {
	// contains filtered or unexported fields
}

func BSArgs

func BSArgs(vals []string) *OffColor

func (*OffColor) Color

func (sc *OffColor) Color() string

func (*OffColor) Offset

func (sc *OffColor) Offset() float64

func (*OffColor) Opacity

func (sc *OffColor) Opacity() float64

type PathOp

type PathOp int8
const (
	AI_Fill   PathOp = 1 << 0
	AI_Stroke PathOp = 1 << 1
)

type PdfObjectNameSlice

type PdfObjectNameSlice []core.PdfObjectName

func (PdfObjectNameSlice) Len

func (x PdfObjectNameSlice) Len() int

func (PdfObjectNameSlice) Less

func (x PdfObjectNameSlice) Less(i, j int) bool

func (PdfObjectNameSlice) Swap

func (x PdfObjectNameSlice) Swap(i, j int)

type Raster

type Raster struct {
	Matrix            [6]float64
	Bounds            [4]float64
	Width             float64
	Height            float64
	Bits              int8 // bits per piexel in image map
	ImageType         int8 // 1=bitmap/grayscale; 3 = RGB; 4=CMYK
	AlphaChannelCount int8 // 0 = version 6.0; other values reserved for future versions
	BinAscii          int8 // 0=ASCII hexadecimal; 1 = binary
	ImageMask         int8 // 0 = opaque; 1 = transparent/colorized

	RawData []byte
}

func XIArgs

func XIArgs(vals []string) *Raster

func (*Raster) B64Data

func (r *Raster) B64Data() (string, error)

func (*Raster) CMYK

func (r *Raster) CMYK(w, h int) (string, error)

func (*Raster) Gray

func (r *Raster) Gray(w, h int) (string, error)

func (*Raster) RGBA

func (r *Raster) RGBA(w, h int) (string, error)

type Reader

type Reader struct {
	*model.PdfReader
	// contains filtered or unexported fields
}

func NewFileReader

func NewFileReader(inputPath string) (*Reader, error)

func NewReader

func NewReader(r io.ReadSeeker) (*Reader, error)

func (*Reader) AsSvg

func (r *Reader) AsSvg() error

func (*Reader) GetAIPrivateData

func (r *Reader) GetAIPrivateData() ([]byte, error)

func (*Reader) GetAiMetaData

func (r *Reader) GetAiMetaData() *core.PdfObjectStream

func (*Reader) GetIllustrator

func (r *Reader) GetIllustrator() *core.PdfIndirectObject

type ZStdCompress

type ZStdCompress struct {
	// contains filtered or unexported fields
}

ZStdCompress

func (*ZStdCompress) Decompress

func (c *ZStdCompress) Decompress() ([]byte, error)

func (*ZStdCompress) Write

func (c *ZStdCompress) Write(stream []byte) (int, error)

type ZlibCompress

type ZlibCompress struct {
	// contains filtered or unexported fields
}

func (*ZlibCompress) Decompress

func (c *ZlibCompress) Decompress() ([]byte, error)

func (*ZlibCompress) Write

func (c *ZlibCompress) Write(stream []byte) (int, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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