예제 #1
0
파일: helloworld.go 프로젝트: zzn01/draw2d
// Main draws "Hello World" and returns the filename. This should only be
// used during testing.
func Main(gc draw2d.GraphicContext, ext string) (string, error) {
	// Draw hello world
	Draw(gc, fmt.Sprintf("Hello World %d dpi", gc.GetDPI()))

	// Return the output filename
	return samples.Output("helloworld", ext), nil
}
예제 #2
0
파일: vgimg.go 프로젝트: zzn01/plot
// UseImageWithContext specifies both an image
// and a graphic context to create the canvas from.
// The minimum point of the given image
// should probably be 0,0.
func UseImageWithContext(img draw.Image, gc draw2d.GraphicContext) option {
	return func(c *Canvas) uint32 {
		c.img = img
		c.gc = gc
		c.dpi = gc.GetDPI()
		return setsDPI | setsSize
	}
}