Documentation
¶
Index ¶
- func ImCenter(im image.Image) (int, int)
- func PositionDelta(a, b fyne.Position) (float32, float32)
- type ImageElement
- type ScaleElement
- type SelectionBox
- type ZIElement
- type ZoomImage
- func (zi *ZoomImage) AddElement(e ZIElement)
- func (zi *ZoomImage) AddScalebar(length int, color color.Color)
- func (zi *ZoomImage) CreateRenderer() fyne.WidgetRenderer
- func (zi *ZoomImage) CurrentSelection() [2][2]int
- func (zi *ZoomImage) MouseDown(me *desktop.MouseEvent)
- func (zi *ZoomImage) MouseIn(_ *desktop.MouseEvent)
- func (zi *ZoomImage) MouseMoved(me *desktop.MouseEvent)
- func (zi *ZoomImage) MouseOut()
- func (zi *ZoomImage) MouseUp(_ *desktop.MouseEvent)
- func (zi *ZoomImage) RefreshRaster()
- type ZoomStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ImageElement ¶
func NewImageElement ¶
func NewImageElement(im image.Image) *ImageElement
func (*ImageElement) Contains ¶
func (ie *ImageElement) Contains(x, y int) bool
Add Contains so we implement ZIElement
func (*ImageElement) Fixed ¶
func (_ *ImageElement) Fixed() bool
func (*ImageElement) RegisterParent ¶
func (_ *ImageElement) RegisterParent(_ *ZoomImage)
type ScaleElement ¶
type ScaleElement struct {
Center [2]int //center of the rectangle
Size [2]int //x and y size
Color color.Color
Parent *ZoomImage
}
type for rendering a scalebar
func NewScaleElement ¶
func NewScaleElement(length int, imsize [2]int, color color.Color) *ScaleElement
make a new ScaleElement
func (*ScaleElement) Contains ¶
func (re *ScaleElement) Contains(x, y int) bool
func (*ScaleElement) ContainsScalebar ¶
func (re *ScaleElement) ContainsScalebar(x, y int) bool
separating this out so it can be called on a 'orphan' scaleelement
func (*ScaleElement) Fixed ¶
func (re *ScaleElement) Fixed() bool
func (*ScaleElement) RegisterParent ¶
func (se *ScaleElement) RegisterParent(zi *ZoomImage)
type SelectionBox ¶
A SelectionBox is four [fyne.canvas.Line]s The lines will form the box starting at the top left and going counterclockwise. P[0] is the top
func NewSelectionBox ¶
func NewSelectionBox(color color.Color, strokewidth float32) *SelectionBox
Make a new SelectionBox
func (*SelectionBox) Refresh ¶
func (sb *SelectionBox) Refresh()
func (*SelectionBox) SetEnd ¶
func (sb *SelectionBox) SetEnd(p fyne.Position)
Set the end position of a SelectionBox
func (*SelectionBox) SetStart ¶
func (sb *SelectionBox) SetStart(p fyne.Position)
Set the start position of a SelectionBox
func (*SelectionBox) SetVisible ¶
func (sb *SelectionBox) SetVisible(vis bool)
Change the visibility of a SelectionBox
type ZIElement ¶
type ZIElement interface {
Contains(x, y int) bool //does this element contain this pixel
At(x, y int) color.Color
Fixed() bool //should this element be fixed to the window
RegisterParent(*ZoomImage) //This will be called when this element is added to a ZoomWindow
}
interface for elements that we can overlay in a zoomimage
type ZoomImage ¶
type ZoomImage struct {
*canvas.Raster
Selection *SelectionBox
Status *ZoomStatus
Elements *[]ZIElement
ImSize [2]int //need to know the size of the image
Canvas fyne.Canvas
BaseIm *ImageElement
// contains filtered or unexported fields
}
ZoomImage will embed a canvas.Raster to render and will keep track of its zoom and pan status
func NewZoomImage ¶
func (*ZoomImage) AddElement ¶
add a ZIElement to a ZoomImage
func (*ZoomImage) AddScalebar ¶
add a scalebar to a ZoomImage
func (*ZoomImage) CreateRenderer ¶
func (zi *ZoomImage) CreateRenderer() fyne.WidgetRenderer
func (*ZoomImage) CurrentSelection ¶
Get the current selection in terms of indices into the image we are viewing This will return a 2d array where a[0] is the start and end indices in the x direction and a[1] is the start and end indices in the y direction
func (*ZoomImage) MouseDown ¶
func (zi *ZoomImage) MouseDown(me *desktop.MouseEvent)
func (*ZoomImage) MouseIn ¶
func (zi *ZoomImage) MouseIn(_ *desktop.MouseEvent)
func (*ZoomImage) MouseMoved ¶
func (zi *ZoomImage) MouseMoved(me *desktop.MouseEvent)
func (*ZoomImage) MouseUp ¶
func (zi *ZoomImage) MouseUp(_ *desktop.MouseEvent)
func (*ZoomImage) RefreshRaster ¶
func (zi *ZoomImage) RefreshRaster()
update the raster generate func (to account for new ZIElements)
type ZoomStatus ¶
type ZoomStatus struct {
Zoom int
//float so we don't get truncation error when working with [fyne.Position]
PanX, PanY float32
}
We want zoomposition to be its own object so we can share it with our render function
func NewZoomStatus ¶
func NewZoomStatus() *ZoomStatus
func (*ZoomStatus) SetPan ¶
func (zs *ZoomStatus) SetPan(x, y float32)
func (*ZoomStatus) SetZoom ¶
func (zs *ZoomStatus) SetZoom(z int)