aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/llgcode/draw2d/samples/helloworld
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-09-09 09:42:37 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-09-09 09:42:37 +0200
commit500caaeda74dd9c660279036293f4b2997cf0b03 (patch)
tree1226f60231a408b0aae67867faaa3f2cfbac8c83 /vendor/github.com/llgcode/draw2d/samples/helloworld
parent413560591fc2d89a73eb8a33ba28b0cc3407b1db (diff)
Add vendor
Diffstat (limited to 'vendor/github.com/llgcode/draw2d/samples/helloworld')
-rw-r--r--vendor/github.com/llgcode/draw2d/samples/helloworld/helloworld.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/github.com/llgcode/draw2d/samples/helloworld/helloworld.go b/vendor/github.com/llgcode/draw2d/samples/helloworld/helloworld.go
new file mode 100644
index 0000000..af5b47e
--- /dev/null
+++ b/vendor/github.com/llgcode/draw2d/samples/helloworld/helloworld.go
@@ -0,0 +1,40 @@
+// Copyright 2010 The draw2d Authors. All rights reserved.
+// created: 21/11/2010 by Laurent Le Goff, Stani Michiels
+
+// Package helloworld displays multiple "Hello World" (one rotated)
+// in a rounded rectangle.
+package helloworld
+
+import (
+ "fmt"
+ "image"
+
+ "github.com/llgcode/draw2d"
+ "github.com/llgcode/draw2d/draw2dkit"
+ "github.com/llgcode/draw2d/samples"
+)
+
+// 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
+}
+
+// Draw "Hello World"
+func Draw(gc draw2d.GraphicContext, text string) {
+ // Draw a rounded rectangle using default colors
+ draw2dkit.RoundedRectangle(gc, 5, 5, 135, 95, 10, 10)
+ gc.FillStroke()
+
+ // Set the font luximbi.ttf
+ gc.SetFontData(draw2d.FontData{Name: "luxi", Family: draw2d.FontFamilyMono, Style: draw2d.FontStyleBold | draw2d.FontStyleItalic})
+ // Set the fill text color to black
+ gc.SetFillColor(image.Black)
+ gc.SetFontSize(14)
+ // Display Hello World
+ gc.FillStringAt("Hello World", 8, 52)
+}