This commit is contained in:
2023-04-30 13:45:21 -04:00
parent b92bdced9c
commit 800ee2570f
18 changed files with 38 additions and 51 deletions

View File

@@ -3,7 +3,7 @@ package shapes
import "math"
import "image"
import "image/color"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/artist"
// TODO: redo fill ellipse, stroke ellipse, etc. so that it only takes in
// destination and source, using the bounds of destination as the bounds of the
@@ -11,8 +11,8 @@ import "git.tebibyte.media/sashakoshka/tomo/canvas"
// of both canvases.
func FillEllipse (
destination canvas.Canvas,
source canvas.Canvas,
destination artist.Canvas,
source artist.Canvas,
bounds image.Rectangle,
) (
updatedRegion image.Rectangle,
@@ -42,8 +42,8 @@ func FillEllipse (
}
func StrokeEllipse (
destination canvas.Canvas,
source canvas.Canvas,
destination artist.Canvas,
source artist.Canvas,
bounds image.Rectangle,
weight int,
) {
@@ -170,7 +170,7 @@ func (context ellipsePlottingContext) plotEllipse () {
// FillColorEllipse fills an ellipse within the destination canvas with a solid
// color.
func FillColorEllipse (
destination canvas.Canvas,
destination artist.Canvas,
color color.RGBA,
bounds image.Rectangle,
) (
@@ -196,7 +196,7 @@ func FillColorEllipse (
// StrokeColorEllipse is similar to FillColorEllipse, but it draws an inset
// outline of an ellipse instead.
func StrokeColorEllipse (
destination canvas.Canvas,
destination artist.Canvas,
color color.RGBA,
bounds image.Rectangle,
weight int,

View File

@@ -2,12 +2,12 @@ package shapes
import "image"
import "image/color"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/artist"
// ColorLine draws a line from one point to another with the specified weight
// and color.
func ColorLine (
destination canvas.Canvas,
destination artist.Canvas,
color color.RGBA,
weight int,
min image.Point,

View File

@@ -2,14 +2,14 @@ package shapes
import "image"
import "image/color"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/artist"
import "git.tebibyte.media/sashakoshka/tomo/shatter"
// TODO: return updatedRegion for all routines in this package
func FillRectangle (
destination canvas.Canvas,
source canvas.Canvas,
destination artist.Canvas,
source artist.Canvas,
bounds image.Rectangle,
) (
updatedRegion image.Rectangle,
@@ -38,8 +38,8 @@ func FillRectangle (
}
func StrokeRectangle (
destination canvas.Canvas,
source canvas.Canvas,
destination artist.Canvas,
source artist.Canvas,
bounds image.Rectangle,
weight int,
) (
@@ -55,8 +55,8 @@ func StrokeRectangle (
// FillRectangleShatter is like FillRectangle, but it does not draw in areas
// specified in "rocks".
func FillRectangleShatter (
destination canvas.Canvas,
source canvas.Canvas,
destination artist.Canvas,
source artist.Canvas,
bounds image.Rectangle,
rocks ...image.Rectangle,
) (
@@ -65,7 +65,7 @@ func FillRectangleShatter (
tiles := shatter.Shatter(bounds, rocks...)
for _, tile := range tiles {
FillRectangle (
canvas.Cut(destination, tile),
artist.Cut(destination, tile),
source, tile)
updatedRegion = updatedRegion.Union(tile)
}
@@ -75,7 +75,7 @@ func FillRectangleShatter (
// FillColorRectangle fills a rectangle within the destination canvas with a
// solid color.
func FillColorRectangle (
destination canvas.Canvas,
destination artist.Canvas,
color color.RGBA,
bounds image.Rectangle,
) (
@@ -97,7 +97,7 @@ func FillColorRectangle (
// FillColorRectangleShatter is like FillColorRectangle, but it does not draw in
// areas specified in "rocks".
func FillColorRectangleShatter (
destination canvas.Canvas,
destination artist.Canvas,
color color.RGBA,
bounds image.Rectangle,
rocks ...image.Rectangle,
@@ -115,7 +115,7 @@ func FillColorRectangleShatter (
// StrokeColorRectangle is similar to FillColorRectangle, but it draws an inset
// outline of the given rectangle instead.
func StrokeColorRectangle (
destination canvas.Canvas,
destination artist.Canvas,
color color.RGBA,
bounds image.Rectangle,
weight int,