draw2d/draw2dpdf/doc.go

42 lines
1.2 KiB
Go
Raw Normal View History

// Copyright 2015 The draw2d Authors. All rights reserved.
// created: 26/06/2015 by Stani Michiels
2015-07-07 21:59:20 +00:00
// Package draw2dpdf provides a graphic context that can draw vector
2015-07-12 01:04:30 +00:00
// graphics and text on pdf file with the gofpdf package.
2015-07-07 21:59:20 +00:00
//
// Quick Start
//
// The following Go code generates a simple drawing and saves it to a
// pdf document:
// // Initialize the graphic context on an RGBA image
// dest := draw2dpdf.NewPdf("L", "mm", "A4")
// gc := draw2d.NewGraphicContext(dest)
//
// // Set some properties
// gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff})
// gc.SetStrokeColor(color.RGBA{0x44, 0x44, 0x44, 0xff})
// gc.SetLineWidth(5)
//
// // Draw a closed shape
// gc.MoveTo(10, 10) // should always be called first for a new path
// gc.LineTo(100, 50)
// gc.QuadCurveTo(100, 10, 10, 10)
// gc.Close()
// gc.FillStroke()
//
// // Save to file
2015-07-12 01:04:30 +00:00
// draw2dpdf.SaveToPdfFile("hello.pdf", dest)
2015-07-07 21:59:20 +00:00
//
// There are more examples here:
2015-07-10 00:42:12 +00:00
// https://github.com/llgcode/draw2d/tree/master/samples
2015-07-07 21:59:20 +00:00
//
2015-07-12 01:04:30 +00:00
// Alternative backends
//
2015-07-07 21:59:20 +00:00
// Drawing on images is provided by the draw2d package.
// Drawing on opengl is provided by the draw2dgl package.
//
// Acknowledgments
//
// The pdf backend uses https://github.com/jung-kurt/gofpdf
2015-07-06 22:25:24 +00:00
package draw2dpdf