fix pattern size regression
This commit is contained in:
parent
1ca79d8e26
commit
c3ee33f8ce
|
@ -11,7 +11,6 @@ import (
|
|||
// Pattern provides infinite algorithmically generated Patterns and implements
|
||||
// the image.Image interface.
|
||||
type Pattern struct {
|
||||
Size image.Point
|
||||
}
|
||||
|
||||
// Image interface
|
||||
|
@ -25,13 +24,13 @@ func (p *Pattern) ToFixedImage(bounds image.Rectangle) *image.NRGBA {
|
|||
img := image.NewNRGBA(bounds)
|
||||
// TODO: allow setting a mask?
|
||||
// override size for pattern?
|
||||
p.Size = bounds.Size() // override size for this Pattern
|
||||
draw.Draw(img, bounds, p, image.Point{}, draw.Src)
|
||||
return img
|
||||
}
|
||||
|
||||
type StripePattern struct {
|
||||
Pattern
|
||||
Size int
|
||||
Palette color.Palette
|
||||
}
|
||||
|
||||
|
@ -41,7 +40,7 @@ func (c *StripePattern) At(x, y int) color.Color {
|
|||
return color.Transparent
|
||||
}
|
||||
|
||||
pxPerStripe := c.Size.Y / n
|
||||
pxPerStripe := c.Size / n
|
||||
if pxPerStripe <= 0 {
|
||||
pxPerStripe = 1
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ func parseColorOrPalette(input string) image.Image {
|
|||
}
|
||||
|
||||
if pal := render.PrideFlags[input]; len(pal) != 0 {
|
||||
return &render.StripePattern{Palette: pal}
|
||||
return &render.StripePattern{Palette: pal, Size: 13}
|
||||
}
|
||||
|
||||
if p, ok := render.DynPatterns[input]; ok {
|
||||
|
|
Loading…
Reference in New Issue