Documentation ¶
Index ¶
- type FieldData
- type FieldPlacer
- type FormGenerator
- func (f *FormGenerator) AddField(name string, field FieldPlacer)
- func (f *FormGenerator) GetFields() []models.Field
- func (f *FormGenerator) GetFormImage() *FormImage
- func (f *FormGenerator) GetName() string
- func (f *FormGenerator) MakeForm() (form models.Form, err error)
- func (f *FormGenerator) ModifyFieldContent(name string, newContent interface{}) error
- func (f *FormGenerator) RemoveField(name string)
- type FormImage
- type ImageField
- type MultiLinedTextFieldPlacer
- func (f *MultiLinedTextFieldPlacer) GetBounds() shapes.Bounds
- func (f *MultiLinedTextFieldPlacer) GetContent() interface{}
- func (f *MultiLinedTextFieldPlacer) GetPosition() shapes.Point2
- func (f *MultiLinedTextFieldPlacer) PlaceField() error
- func (f *MultiLinedTextFieldPlacer) SetContent(txt interface{})
- func (f *MultiLinedTextFieldPlacer) SetPartOfContent(charValue, place interface{})
- type Orientation
- type SelectionFieldPlacer
- func (s *SelectionFieldPlacer) GetBounds() shapes.Bounds
- func (s *SelectionFieldPlacer) GetContent() interface{}
- func (s *SelectionFieldPlacer) GetPosition() shapes.Point2
- func (s *SelectionFieldPlacer) PlaceField() error
- func (s *SelectionFieldPlacer) SetContent(selections interface{})
- func (s *SelectionFieldPlacer) SetPartOfContent(selection, selectionValue interface{})
- type TextFieldPlacer
- func (f *TextFieldPlacer) GetBounds() shapes.Bounds
- func (f *TextFieldPlacer) GetContent() interface{}
- func (f *TextFieldPlacer) GetPosition() shapes.Point2
- func (f *TextFieldPlacer) PlaceField() error
- func (f *TextFieldPlacer) SetContent(txt interface{})
- func (f *TextFieldPlacer) SetPartOfContent(charValue, place interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldData ¶
type FieldData interface { // GetContent returns the content of the current field GetContent() interface{} // SetContent sets a new value for the fields content SetContent(value interface{}) // SetPartOfContent sets a portion of the content // // e.g. if we want to modify an entry in a map it would look like this // SetPartOfContent(value, key) // and for a string // SetPartOfContent(charValue, index) // // believe it or not this little method saved the project // from being added to the stack of un-finished projects :] SetPartOfContent(content, place interface{}) }
FieldData represents the field's data, well duh a field has got to have some data :0
type FieldPlacer ¶
type FieldPlacer interface { FieldData // PlaceField draws the field on its parent image, and returns an occurring error PlaceField() error }
FieldPlacer places a field on its form
func CreateFieldPlacer ¶
func CreateFieldPlacer(field models.Field, parentImage *FormImage) (fp FieldPlacer)
CreateFieldPlacer returns a proper field placer according to the given field
type FormGenerator ¶
type FormGenerator struct {
// contains filtered or unexported fields
}
FormGenerator generates a form
func NewFormGenerator ¶
func NewFormGenerator(name string, formImg *FormImage, fields []models.Field) *FormGenerator
NewFormGenerator returns a new FormGenerator instance
func (*FormGenerator) AddField ¶
func (f *FormGenerator) AddField(name string, field FieldPlacer)
AddField adds a field into the form
func (*FormGenerator) GetFields ¶
func (f *FormGenerator) GetFields() []models.Field
GetFields returns fields, lol
func (*FormGenerator) GetFormImage ¶
func (f *FormGenerator) GetFormImage() *FormImage
func (*FormGenerator) GetName ¶
func (f *FormGenerator) GetName() string
GetName returns form's name
func (*FormGenerator) MakeForm ¶
func (f *FormGenerator) MakeForm() (form models.Form, err error)
MakeForm generates the form with the given fields' data and returns an occurring error
func (*FormGenerator) ModifyFieldContent ¶
func (f *FormGenerator) ModifyFieldContent(name string, newContent interface{}) error
ModifyFieldContent modifies an *existing* field
func (*FormGenerator) RemoveField ¶
func (f *FormGenerator) RemoveField(name string)
RemoveField removes the first encountered field with the given name
type FormImage ¶
type FormImage struct {
// contains filtered or unexported fields
}
FormImage represents the source image of a form
func NewFormImage ¶
NewFormImage returns a new FormImage instance
func NewFormImageFromB64Image ¶
NewFormImageFromB64Image returns a new FormImage instance using a base64 image string
func (*FormImage) GetSurface ¶
func (i *FormImage) GetSurface() *cairo.Surface
GetSurface returns a pointer to the working image surface used in field drawing
func (*FormImage) ResetChanges ¶
func (i *FormImage) ResetChanges()
ResetChanges resets all of the changes done to the working image surface
type ImageField ¶
type ImageField struct {
// contains filtered or unexported fields
}
ImageField represents an image to be placed in a form
func NewImageField ¶
func NewImageField(name string, img image.Image) *ImageField
NewImageField returns a new ImageField instance
func (*ImageField) CanPlaceField ¶
func (i *ImageField) CanPlaceField() bool
CanPlaceField reports whether the image can be placed(w/o overflowing parent) or not
func (*ImageField) GetBounds ¶
func (i *ImageField) GetBounds() *shapes.Bounds
GetBounds returns image field's bounds
func (*ImageField) GetPosition ¶
func (i *ImageField) GetPosition() *shapes.Point2
GetPosition returns image field's position
func (*ImageField) PlaceField ¶
func (i *ImageField) PlaceField() error
PlaceField draws the image on its parent image, and returns an occurring error
func (*ImageField) SetContent ¶
func (i *ImageField) SetContent(value interface{})
SetContent sets a new value for the image
type MultiLinedTextFieldPlacer ¶
type MultiLinedTextFieldPlacer struct {
// contains filtered or unexported fields
}
MultiLinedTextFieldPlacer represents a text to be placed in a form
func NewMultiLinedTextFieldPlacer ¶
func NewMultiLinedTextFieldPlacer(numLines int, lineHeight float64, textPlacer *TextFieldPlacer) *MultiLinedTextFieldPlacer
NewMultiLinedTextFieldPlacer returns a new MultiLinedTextFieldPlacer instance the isRTL optional flag is used to indicate whether a non RTL text is placed in an RTL context
func (*MultiLinedTextFieldPlacer) GetBounds ¶
func (f *MultiLinedTextFieldPlacer) GetBounds() shapes.Bounds
GetBounds returns text field's bounds
func (*MultiLinedTextFieldPlacer) GetContent ¶
func (f *MultiLinedTextFieldPlacer) GetContent() interface{}
GetContent returns the inner text of the current text field
func (*MultiLinedTextFieldPlacer) GetPosition ¶
func (f *MultiLinedTextFieldPlacer) GetPosition() shapes.Point2
GetPosition returns text field's position
func (*MultiLinedTextFieldPlacer) PlaceField ¶
func (f *MultiLinedTextFieldPlacer) PlaceField() error
PlaceField draws the text on its parent image, and returns an occurring error
func (*MultiLinedTextFieldPlacer) SetContent ¶
func (f *MultiLinedTextFieldPlacer) SetContent(txt interface{})
SetContent sets a new value for the text
func (*MultiLinedTextFieldPlacer) SetPartOfContent ¶
func (f *MultiLinedTextFieldPlacer) SetPartOfContent(charValue, place interface{})
SetPartOfContent sets the value of a character in the string
type Orientation ¶
type Orientation int
Orientation represents selection field's orientation
const ( VerticalSelection Orientation = iota HorizontalSelection )
Orientations :)
type SelectionFieldPlacer ¶
type SelectionFieldPlacer struct {
// contains filtered or unexported fields
}
SelectionFieldPlacer represents a selection(highlighter) field ho ho ho to be placed in a form
func NewSelectionFieldPlacer ¶
func NewSelectionFieldPlacer(polygonDrawer *utils.PolygonDrawer, selections map[string]int, orientation Orientation) *SelectionFieldPlacer
NewSelectionFieldPlacer returns a new SelectionFieldPlacer instance
func (*SelectionFieldPlacer) GetBounds ¶
func (s *SelectionFieldPlacer) GetBounds() shapes.Bounds
GetBounds returns image field's bounds
func (*SelectionFieldPlacer) GetContent ¶
func (s *SelectionFieldPlacer) GetContent() interface{}
GetContent returns the content of the current field
func (*SelectionFieldPlacer) GetPosition ¶
func (s *SelectionFieldPlacer) GetPosition() shapes.Point2
GetPosition returns image field's position
func (*SelectionFieldPlacer) PlaceField ¶
func (s *SelectionFieldPlacer) PlaceField() error
PlaceField draws the selection box on its parent image, and returns an occurring error
func (*SelectionFieldPlacer) SetContent ¶
func (s *SelectionFieldPlacer) SetContent(selections interface{})
SetContent sets the selections lol
func (*SelectionFieldPlacer) SetPartOfContent ¶
func (s *SelectionFieldPlacer) SetPartOfContent(selection, selectionValue interface{})
SetPartOfContent sets the position of the selection box depending on the box name ok I know I really fucked up in here that the first parameter is ignored, but it works best this way SetPartOfContent("selection", selectionName)
type TextFieldPlacer ¶
type TextFieldPlacer struct {
// contains filtered or unexported fields
}
TextFieldPlacer represents a text to be placed in a form
func NewTextFieldPlacer ¶
func NewTextFieldPlacer(text logogen.Text, fieldXWidth float64, fontName string, position shapes.Point2, parent *FormImage, isRTL ...bool) *TextFieldPlacer
NewTextFieldPlacer returns a new TextFieldPlacer instance the isRTL optional flag is used to indicate whether a non RTL text is placed in an RTL context
func (*TextFieldPlacer) GetBounds ¶
func (f *TextFieldPlacer) GetBounds() shapes.Bounds
GetBounds returns text field's bounds
func (*TextFieldPlacer) GetContent ¶
func (f *TextFieldPlacer) GetContent() interface{}
GetContent returns the inner text of the current text field
func (*TextFieldPlacer) GetPosition ¶
func (f *TextFieldPlacer) GetPosition() shapes.Point2
GetPosition returns text field's position
func (*TextFieldPlacer) PlaceField ¶
func (f *TextFieldPlacer) PlaceField() error
PlaceField draws the text on its parent image, and returns an occurring error
func (*TextFieldPlacer) SetContent ¶
func (f *TextFieldPlacer) SetContent(txt interface{})
SetContent sets a new value for the text
func (*TextFieldPlacer) SetPartOfContent ¶
func (f *TextFieldPlacer) SetPartOfContent(charValue, place interface{})
SetPartOfContent sets the value of a character in the string