whee back in busineess

This commit is contained in:
2023-02-26 14:27:38 -05:00
parent 2859dc3313
commit 241c297626
9 changed files with 151 additions and 350 deletions

View File

@@ -3,9 +3,9 @@ package textdraw
import "image"
import "unicode"
import "image/draw"
import "image/color"
import "golang.org/x/image/math/fixed"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/artist"
// Drawer is an extended TypeSetter that is able to draw text. Much like
// TypeSetter, It has no constructor and its zero value can be used safely.
@@ -14,17 +14,11 @@ type Drawer struct { TypeSetter }
// Draw draws the drawer's text onto the specified canvas at the given offset.
func (drawer Drawer) Draw (
destination canvas.Canvas,
source artist.Pattern,
color color.RGBA,
offset image.Point,
) (
updatedRegion image.Rectangle,
) {
wrappedSource := artist.WrappedPattern {
Pattern: source,
Width: 0,
Height: 0, // TODO: choose a better width and height
}
drawer.For (func (
index int,
char rune,
@@ -46,7 +40,7 @@ func (drawer Drawer) Draw (
draw.DrawMask (
destination,
destinationRectangle,
wrappedSource, image.Point { },
image.NewUniform(color), image.Point { },
mask, maskPoint,
draw.Over)