Documentation
¶
Overview ¶
Package area provides functions working with image areas.
Index ¶
- func ExcludeBorder(area image.Rectangle) image.Rectangle
- func FromSize(size image.Point) (image.Rectangle, error)
- func HSplit(area image.Rectangle, heightPerc int) (top image.Rectangle, bottom image.Rectangle, err error)
- func HSplitCells(area image.Rectangle, cells int) (top image.Rectangle, bottom image.Rectangle, err error)
- func HSplitCellsReversed(area image.Rectangle, cells int) (top image.Rectangle, bottom image.Rectangle, err error)
- func HSplitReversed(area image.Rectangle, heightPerc int) (top image.Rectangle, bottom image.Rectangle, err error)
- func MoveDown(area image.Rectangle, cells int) (image.Rectangle, error)
- func MoveUp(area image.Rectangle, cells int) (image.Rectangle, error)
- func Shrink(area image.Rectangle, topCells, rightCells, bottomCells, leftCells int) (image.Rectangle, error)
- func ShrinkPercent(area image.Rectangle, topPerc, rightPerc, bottomPerc, leftPerc int) (image.Rectangle, error)
- func Size(area image.Rectangle) image.Point
- func VSplit(area image.Rectangle, widthPerc int) (left image.Rectangle, right image.Rectangle, err error)
- func VSplitCells(area image.Rectangle, cells int) (left image.Rectangle, right image.Rectangle, err error)
- func VSplitCellsReversed(area image.Rectangle, cells int) (left image.Rectangle, right image.Rectangle, err error)
- func VSplitReversed(area image.Rectangle, widthPerc int) (left image.Rectangle, right image.Rectangle, err error)
- func WithRatio(area image.Rectangle, ratio image.Point) image.Rectangle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExcludeBorder ¶
ExcludeBorder returns a new area created by subtracting a border around the provided area. Return the zero area if there isn't enough space to exclude the border.
func HSplit ¶
func HSplit(area image.Rectangle, heightPerc int) (top image.Rectangle, bottom image.Rectangle, err error)
HSplit returns two new areas created by splitting the provided area at the specified percentage of its height, applying the percentage to the top area. The percentage must be in the range 0 <= heightPerc <= 100. Can return zero size areas.
func HSplitCells ¶
func HSplitCells(area image.Rectangle, cells int) (top image.Rectangle, bottom image.Rectangle, err error)
HSplitCells returns two new areas created by splitting the provided area after the specified amount of cells of its height, as applied to the top area. The number of cells must be a zero or a positive integer. Providing a zero returns top=image.ZR, bottom=area. Providing a number equal or larger to area's height returns top=area, bottom=image.ZR.
func HSplitCellsReversed ¶ added in v0.20.0
func HSplitCellsReversed(area image.Rectangle, cells int) (top image.Rectangle, bottom image.Rectangle, err error)
HSplitCellsReversed returns two new areas created by splitting the provided area after the specified amount of cells of its height, as applied to the bottom area. The number of cells must be a zero or a positive integer. Providing a zero returns top=area, bottom=image.ZR. Providing a number equal or larger to area's height returns top=image.ZR, bottom=area.
func HSplitReversed ¶ added in v0.20.0
func HSplitReversed(area image.Rectangle, heightPerc int) (top image.Rectangle, bottom image.Rectangle, err error)
HSplitReversed returns two new areas created by splitting the provided area at the specified percentage of its height, applying the percentage to the bottom area. The percentage must be in the range 0 <= heightPerc <= 100. Can return zero size areas.
func MoveDown ¶
MoveDown returns a new area that is moved down by the specified amount of cells. The values must be zero or positive integers.
func MoveUp ¶
MoveUp returns a new area that is moved up by the specified amount of cells. Returns an error if the move would result in negative Y coordinates. The values must be zero or positive integers.
func Shrink ¶
func Shrink(area image.Rectangle, topCells, rightCells, bottomCells, leftCells int) (image.Rectangle, error)
Shrink returns a new area whose size is reduced by the specified amount of cells. Can return a zero area if there is no space left in the area. The values must be zero or positive integers.
func ShrinkPercent ¶
func ShrinkPercent(area image.Rectangle, topPerc, rightPerc, bottomPerc, leftPerc int) (image.Rectangle, error)
ShrinkPercent returns a new area whose size is reduced by percentage of its width or height. Can return a zero area if there is no space left in the area. The topPerc and bottomPerc indicate the percentage of area's height. The rightPerc and leftPerc indicate the percentage of area's width. The percentages must be in range 0 <= v <= 100.
func VSplit ¶
func VSplit(area image.Rectangle, widthPerc int) (left image.Rectangle, right image.Rectangle, err error)
VSplit returns two new areas created by splitting the provided area at the specified percentage of its width, applying the percentage to the left area. The percentage must be in the range 0 <= widthPerc <= 100. Can return zero size areas.
func VSplitCells ¶
func VSplitCells(area image.Rectangle, cells int) (left image.Rectangle, right image.Rectangle, err error)
VSplitCells returns two new areas created by splitting the provided area after the specified amount of cells of its width, as applied to the left area. The number of cells must be a zero or a positive integer. Providing a zero returns left=image.ZR, right=area. Providing a number equal or larger to area's width returns left=area, right=image.ZR.
func VSplitCellsReversed ¶ added in v0.20.0
func VSplitCellsReversed(area image.Rectangle, cells int) (left image.Rectangle, right image.Rectangle, err error)
VSplitCellsReversed returns two new areas created by splitting the provided area after the specified amount of cells of its width, as applied to the right area. The number of cells must be a zero or a positive integer. Providing a zero returns left=image.ZR, right=area. Providing a number equal or larger to area's width returns left=area, right=image.ZR.
func VSplitReversed ¶ added in v0.20.0
func VSplitReversed(area image.Rectangle, widthPerc int) (left image.Rectangle, right image.Rectangle, err error)
VSplitReversed returns two new areas created by splitting the provided area at the specified percentage of its width, applying the percentage to the right area. The percentage must be in the range 0 <= widthPerc <= 100. Can return zero size areas.
Types ¶
This section is empty.