Documentation
¶
Overview ¶
Package screenshot implements the screenshot edit window.
It's the main part of the application: it may be run after a fork(), if the main program was started as a system tray app.
Index ¶
- Constants
- Variables
- func Run()
- type FireShotFont
- type FireShotGO
- func (fs *FireShotGO) ApplyFilters(full bool)
- func (fs *FireShotGO) BuildEditWindow()
- func (gs *FireShotGO) ConnectUsPage()
- func (gs *FireShotGO) CopyImageToClipboard()
- func (gs *FireShotGO) DefaultName() string
- func (gs *FireShotGO) DelayedScreenshot(seconds int)
- func (gs *FireShotGO) DelayedScreenshotForm()
- func (gs *FireShotGO) FireShotNameByTime() string
- func (gs *FireShotGO) GetColorPreference(key string, defaultColor color.RGBA) color.RGBA
- func (gs *FireShotGO) GetStatusHandle() (status *widget.Label)
- func (fs *FireShotGO) MakeFireShotMenu() *fyne.MainMenu
- func (gs *FireShotGO) MakeInputTab(_ fyne.Window) fyne.CanvasObject
- func (gs *FireShotGO) MakeScreenshot() error
- func (gs *FireShotGO) RegisterShortcuts()
- func (gs *FireShotGO) SaveImage()
- func (gs *FireShotGO) SetColorPreference(key string, c color.Color)
- func (gs *FireShotGO) ShareWithGoogleDrive()
- func (gs *FireShotGO) ShareWithQiNiuDrive()
- func (gs *FireShotGO) ShowShortcutsPage()
- func (gs *FireShotGO) UndoLastFilter()
- type ImageFilter
- type MiniMap
- func (mm *MiniMap) BackgroundColor() color.Color
- func (mm *MiniMap) CreateRenderer() fyne.WidgetRenderer
- func (mm *MiniMap) Destroy()
- func (mm *MiniMap) DragEnd()
- func (mm *MiniMap) Dragged(ev *fyne.DragEvent)
- func (mm *MiniMap) Layout(size fyne.Size)
- func (mm *MiniMap) MinSize() fyne.Size
- func (mm *MiniMap) Objects() []fyne.CanvasObject
- func (mm *MiniMap) Refresh()
- func (mm *MiniMap) Resize(size fyne.Size)
- func (mm *MiniMap) SetMinSize(size fyne.Size)
- func (mm *MiniMap) Tapped(ev *fyne.PointEvent)
- type OperationType
- type ViewPort
- func (vp *ViewPort) CreateRenderer() fyne.WidgetRenderer
- func (vp *ViewPort) Destroy()
- func (vp *ViewPort) DragEnd()
- func (vp *ViewPort) DragPen(toPos fyne.Position)
- func (vp *ViewPort) Dragged(ev *fyne.DragEvent)
- func (vp *ViewPort) Layout(size fyne.Size)
- func (vp *ViewPort) MinSize() fyne.Size
- func (vp *ViewPort) MouseIn(ev *desktop.MouseEvent)
- func (vp *ViewPort) MouseMoved(ev *desktop.MouseEvent)
- func (vp *ViewPort) MouseOut()
- func (vp *ViewPort) Objects() []fyne.CanvasObject
- func (vp *ViewPort) PixelSize() (x, y int)
- func (vp *ViewPort) PosToPixel(pos fyne.Position) (x, y int)
- func (vp *ViewPort) Refresh()
- func (vp *ViewPort) Resize(size fyne.Size)
- func (vp *ViewPort) Scrolled(ev *fyne.ScrollEvent)
- func (vp *ViewPort) SetMinSize(size fyne.Size)
- func (vp *ViewPort) SetOp(op OperationType)
- func (vp *ViewPort) Tapped(ev *fyne.PointEvent)
Constants ¶
const ( GoogleDriveTokenPreference = "google_drive_token" QiNiuAccessKey = "qiNiuAccessKey" QiNiuSecretKey = "qiNiuSecretKey" QiNiuBucket = "qiNiuBucket" )
const ( BackgroundColorPreference = "BackgroundColor" DrawingColorPreference = "DrawingColor" FontSizePreference = "FontSize" ThicknessPreference = "Thickness" )
const DefaultPathPreference = "DefaultPath"
const DelayTimePreference = "DelayTime"
const FireShotFontSize = "FireShotFontSize"
const SelectScreenIndex = "SelectScreen"
Variables ¶
var ( Red = color.RGBA{R: 255, G: 64, B: 64, A: 255} Yellow = color.RGBA{R: 255, G: 255, B: 64, A: 255} Transparent = color.RGBA{} )
var (
GoogleDrivePath = []string{"FireShotGO"}
)
Functions ¶
Types ¶
type FireShotFont ¶ added in v1.0.6
type FireShotFont struct {
// contains filtered or unexported fields
}
func (*FireShotFont) FireShotFontEdit ¶ added in v1.0.6
func (ff *FireShotFont) FireShotFontEdit(gs *FireShotGO)
func (*FireShotFont) GetFireFontSize ¶ added in v1.0.6
func (ff *FireShotFont) GetFireFontSize(gs *FireShotGO) float32
type FireShotGO ¶
type FireShotGO struct { // 应用和窗口 App fyne.App // 主窗口 Win fyne.Window // topLevel 备份top层的窗口,用于更改主题一类的刷新使用 TopLevelContainer fyne.Container // 原始截图信息 OriginalScreenshot *image.RGBA // 截图时间记录 ScreenshotTime time.Time // 编辑之后的截图信息,每添加一个fileter这里都进行叠加一次 Screenshot *image.RGBA // The edited/composed screenshot CropRect image.Rectangle // 所有的fileter都添加到这里 Filters []ImageFilter // Configured filters: each filter is one edition to the image. // contains filtered or unexported fields }
func (*FireShotGO) ApplyFilters ¶
func (fs *FireShotGO) ApplyFilters(full bool)
ApplyFilters will apply `Filters` to the `CropRect` of the original image and regenerate Screenshot. If full == true, regenerates full Screenshot. If false, regenerates only visible area. 绘制预览图
func (*FireShotGO) BuildEditWindow ¶
func (fs *FireShotGO) BuildEditWindow()
func (*FireShotGO) ConnectUsPage ¶ added in v1.0.8
func (gs *FireShotGO) ConnectUsPage()
func (*FireShotGO) CopyImageToClipboard ¶
func (gs *FireShotGO) CopyImageToClipboard()
func (*FireShotGO) DefaultName ¶
func (gs *FireShotGO) DefaultName() string
DefaultName returns a default name to the screenshot, based on date/time it was made.
func (*FireShotGO) DelayedScreenshot ¶
func (gs *FireShotGO) DelayedScreenshot(seconds int)
func (*FireShotGO) DelayedScreenshotForm ¶
func (gs *FireShotGO) DelayedScreenshotForm()
func (*FireShotGO) FireShotNameByTime ¶ added in v1.0.7
func (gs *FireShotGO) FireShotNameByTime() string
func (*FireShotGO) GetColorPreference ¶
GetColorPreference 颜色信息设置,若是环境变量中没有设置就使用默认值
func (*FireShotGO) GetStatusHandle ¶ added in v1.0.6
func (gs *FireShotGO) GetStatusHandle() (status *widget.Label)
func (*FireShotGO) MakeFireShotMenu ¶ added in v1.0.8
func (fs *FireShotGO) MakeFireShotMenu() *fyne.MainMenu
MakeFireShotMenu 创建FireShotGo菜单栏
func (*FireShotGO) MakeInputTab ¶ added in v1.0.11
func (gs *FireShotGO) MakeInputTab(_ fyne.Window) fyne.CanvasObject
func (*FireShotGO) MakeScreenshot ¶
func (gs *FireShotGO) MakeScreenshot() error
MakeScreenshot 开始截屏
func (*FireShotGO) RegisterShortcuts ¶
func (gs *FireShotGO) RegisterShortcuts()
RegisterShortcuts adds all the shortcuts and keys FireShotGO listens to. When updating here, please update also the `fs.ShowShortcutsPage()` method to reflect the changes.
func (*FireShotGO) SaveImage ¶
func (gs *FireShotGO) SaveImage()
SaveImage opens a file save dialog box to save the currently edited screenshot.
func (*FireShotGO) SetColorPreference ¶
func (gs *FireShotGO) SetColorPreference(key string, c color.Color)
SetColorPreference sets the given color in the given preferences key.
func (*FireShotGO) ShareWithGoogleDrive ¶
func (gs *FireShotGO) ShareWithGoogleDrive()
func (*FireShotGO) ShareWithQiNiuDrive ¶ added in v1.0.7
func (gs *FireShotGO) ShareWithQiNiuDrive()
func (*FireShotGO) ShowShortcutsPage ¶
func (gs *FireShotGO) ShowShortcutsPage()
func (*FireShotGO) UndoLastFilter ¶
func (gs *FireShotGO) UndoLastFilter()
UndoLastFilter cancels the last filter applied, and regenerates everything.
type ImageFilter ¶
type MiniMap ¶
type MiniMap struct { widget.BaseWidget // contains filtered or unexported fields }
func NewMiniMap ¶
func NewMiniMap(gs *FireShotGO, vp *ViewPort) (mm *MiniMap)
func (*MiniMap) BackgroundColor ¶
func (*MiniMap) CreateRenderer ¶
func (mm *MiniMap) CreateRenderer() fyne.WidgetRenderer
func (*MiniMap) Dragged ¶
func (mm *MiniMap) Dragged(ev *fyne.DragEvent)
Dragged implements fyne.Draggable
func (*MiniMap) SetMinSize ¶
func (mm *MiniMap) SetMinSize(size fyne.Size)
type OperationType ¶
type OperationType int
OperationType 操作类型
const ( NoOp OperationType = iota // CropTopLeft 裁剪点 - 左上角 CropTopLeft // CropBottomRight 裁剪点 - 右下角 CropBottomRight // DrawCircle 绘制圆 包括椭圆和圆 DrawCircle // DrawArrow 绘制剪头 DrawArrow // DrawText 绘制文本 DrawText // DrawStraightLine 绘制直线 DrawStraightLine // DrawDottedLine 绘制虚线 DrawDottedLine // DrawShieldBlock 绘制遮挡块 DrawShieldBlock // DrawRectangle 绘制矩形 DrawRectangle // DrawPen 使用画笔进行绘制 DrawPen )
type ViewPort ¶
type ViewPort struct { widget.BaseWidget // Geometry of what is being displayed: // Log2Zoom is the log2 of the zoom multiplier, it's what we show to the user. It // is set by the "zoomEntry" field in the UI Log2Zoom float64 // Thickness 存储绘制直线等元素的宽度元素. Thickness float64 // DrawingColor 绘制图形的颜色信息. BackgroundColor text文本的背景颜色信息 DrawingColor, BackgroundColor color.Color // FontSize 字体的大小 FontSize float64 // 虚线间隔配置 DottedLineSpacing float64 fyne.ShortcutHandler // contains filtered or unexported fields }
ViewPort is our view port for the image being edited. It's a specialized widget that will display the image according to zoom / window select.
It is both a CanvasObject and a WidgetRenderer -- the abstractions in Fyne are not clear, but when those were implemented it worked (mostly copy&paste code).
Loosely based on github.com/fyne-io/pixeledit
func (*ViewPort) CreateRenderer ¶
func (vp *ViewPort) CreateRenderer() fyne.WidgetRenderer
func (*ViewPort) Dragged ¶
func (vp *ViewPort) Dragged(ev *fyne.DragEvent)
Dragged implements fyne.Draggable 拖动时候将对应图像实现放入到fileter中
func (*ViewPort) MouseIn ¶
func (vp *ViewPort) MouseIn(ev *desktop.MouseEvent)
MouseIn implements desktop.Hoverable.
func (*ViewPort) MouseMoved ¶
func (vp *ViewPort) MouseMoved(ev *desktop.MouseEvent)
MouseMoved implements desktop.Hoverable.
func (*ViewPort) PixelSize ¶
PixelSize returns the size in pixels of the this CanvasObject, based on the last request to redraw.
func (*ViewPort) PosToPixel ¶
PosToPixel converts from the undocumented Fyne screen float dimension to actual number of pixels position in the image.
func (*ViewPort) SetMinSize ¶
func (vp *ViewPort) SetMinSize(size fyne.Size)
func (*ViewPort) SetOp ¶
func (vp *ViewPort) SetOp(op OperationType)
SetOp changes the current op on the edit window. It interrupts any dragging event going on. 在编辑窗口选择需要进行的操作,比如选择绘制直线