axoverlay

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package axoverlay provides a Go interface to the Axis Overlay Library (axoverlay)

Index

Constants

View Source
const (
	FONT_WEIGHT_NORMAL = iota
	FONT_WEIGHT_BOLD
)
View Source
const (
	OPERATOR_CLEAR = iota

	OPERATOR_SOURCE
	OPERATOR_OVER
	OPERATOR_IN
	OPERATOR_OUT
	OPERATOR_ATOP

	OPERATOR_DEST
	OPERATOR_DEST_OVER
	OPERATOR_DEST_IN
	OPERATOR_DEST_OUT
	OPERATOR_DEST_ATOP

	OPERATOR_XOR
	OPERATOR_ADD
	OPERATOR_SATURATE

	OPERATOR_MULTIPLY
	OPERATOR_SCREEN
	OPERATOR_OVERLAY
	OPERATOR_DARKEN
	OPERATOR_LIGHTEN
	OPERATOR_COLOR_DODGE
	OPERATOR_COLOR_BURN
	OPERATOR_HARD_LIGHT
	OPERATOR_SOFT_LIGHT
	OPERATOR_DIFFERENCE
	OPERATOR_EXCLUSION
	OPERATOR_HSL_HUE
	OPERATOR_HSL_SATURATION
	OPERATOR_HSL_COLOR
	OPERATOR_HSL_LUMINOSITY
)
View Source
const (
	FONT_SLANT_NORMAL = iota
	FONT_SLANT_ITALIC
	FONT_SLANT_OBLIQUE
)
View Source
const PALETTE_VALUE_RANGE = 255.0

Variables

View Source
var (
	ColorTransparent        = color.RGBA{R: 0, G: 0, B: 0, A: 0}
	ColorBlack              = color.RGBA{R: 0, G: 0, B: 0, A: 255}
	ColorMaterialRed        = color.RGBA{R: 244, G: 67, B: 54, A: 255}
	ColorMaterialGreen      = color.RGBA{R: 76, G: 175, B: 80, A: 255}
	ColorMaterialBlue       = color.RGBA{R: 33, G: 150, B: 243, A: 255}
	ColorMaterialIndigo     = color.RGBA{R: 63, G: 81, B: 181, A: 255}
	ColorMaterialPink       = color.RGBA{R: 233, G: 30, B: 99, A: 255}
	ColorMaterialLime       = color.RGBA{R: 205, G: 220, B: 57, A: 255}
	ColorMaterialDeepPurple = color.RGBA{R: 103, G: 58, B: 183, A: 255}
	ColorMaterialAmber      = color.RGBA{R: 255, G: 193, B: 7, A: 255}
	ColorMaterialTeal       = color.RGBA{R: 0, G: 150, B: 136, A: 255}
	ColorMaterialCyan       = color.RGBA{R: 0, G: 188, B: 212, A: 255}
	ColorMaterialLightGreen = color.RGBA{R: 139, G: 195, B: 74, A: 255}
	ColorMaterialDeepOrange = color.RGBA{R: 255, G: 87, B: 34, A: 255}
	ColorMaterialBrown      = color.RGBA{R: 121, G: 85, B: 72, A: 255}
	ColorMaterialGrey       = color.RGBA{R: 158, G: 158, B: 158, A: 255}
	ColorWite               = color.RGBA{R: 255, G: 255, B: 255, A: 255}
)

Functions

func AxOverlayCleanup

func AxOverlayCleanup()

axoverlayCleanup frees up allocated resources.

func AxOverlayCreateOverlay

func AxOverlayCreateOverlay(data *AxOverlayOverlayData, user_data any) (int, error)

axoverlayCreateOverlay creates an overlay with the specified data.

func AxOverlayDataInitalze

func AxOverlayDataInitalze(overlay_data *AxOverlayOverlayData) error

func AxOverlayDestroyOverlay

func AxOverlayDestroyOverlay(id int) error

axoverlayDestroyOverlay destroys the overlay with the given ID.

func AxOverlayGetMaxResolution

func AxOverlayGetMaxResolution(camera int) (int, int, error)

func AxOverlayGetMaxResolutionHeight

func AxOverlayGetMaxResolutionHeight(camera int) (int, error)

axoverlayGetMaxResolutionHeight reads the maximum resolution height for a camera.

func AxOverlayGetMaxResolutionWidth

func AxOverlayGetMaxResolutionWidth(camera int) (int, error)

axoverlayGetMaxResolutionWidth reads the maximum resolution width for a camera.

func AxOverlayInit

func AxOverlayInit(settings *AxOverlaySettings) error

AxoverlayInit initializes the axoverlay system with specified settings.

func AxOverlayInitOverlayData

func AxOverlayInitOverlayData(data *AxOverlayOverlayData)

axoverlayInitOverlayData initializes an axoverlay_overlay_data struct with default values.

func AxOverlayIsBackendSupported

func AxOverlayIsBackendSupported(backend AxOverlayBackendType) bool

axoverlayIsBackendSupported checks if a specified backend is supported.

func AxOverlayRedraw

func AxOverlayRedraw() error

axoverlayRedraw signals the system that a redraw should be done.

func AxOverlayReloadStreams

func AxOverlayReloadStreams() error

axoverlayReloadStreams reloads all stream information.

func AxOverlaySetOverlayPosition

func AxOverlaySetOverlayPosition(id int, positionType AxOverlayPositionType, x, y float32) error

axoverlaySetOverlayPosition updates the position of an existing overlay.

func AxOverlaySetOverlaySize

func AxOverlaySetOverlaySize(id, width, height int) error

axoverlaySetOverlaySize updates the size of an existing overlay.

func AxOvlerayDeleteHandle

func AxOvlerayDeleteHandle()

func GoAxOverlayAdjustmentCallback

func GoAxOverlayAdjustmentCallback(id C.gint, stream *C.struct_axoverlay_stream_data, postype *C.enum_axoverlay_position_type, overlayX *C.gfloat, overlayY *C.gfloat, overlayWidth *C.gint, overlayHeight *C.gint, userData unsafe.Pointer)

func GoAxOverlayRenderCallback

func GoAxOverlayRenderCallback(renderingContext C.gpointer, id C.gint, stream *C.struct_axoverlay_stream_data, postype C.enum_axoverlay_position_type, overlayX C.gfloat, overlayY C.gfloat, overlayWidth C.gint, overlayHeight C.gint, userData unsafe.Pointer)

func GoAxOverlayStreamSelectCallback

func GoAxOverlayStreamSelectCallback(camera C.gint, width C.gint, height C.gint, rotation C.gint, isMirrored C.gboolean, streamType C.enum_axoverlay_stream_type) C.gboolean

func Index2Cairo

func Index2Cairo(colorIndex int) float64

Types

type Antialias

type Antialias int
const (
	ANTIALIAS_DEFAULT Antialias = iota
	ANTIALIAS_NONE
	ANTIALIAS_GRAY
	ANTIALIAS_SUBPIXEL
)

type AxOverlayAdjustmentCallback

type AxOverlayAdjustmentCallback func(adjustmentEvent *OverlayAdjustmentEvent)

Callback function types for stream selection, adjustment, and rendering.

type AxOverlayAnchorPoint

type AxOverlayAnchorPoint int

axoverlay_anchor_point defines anchor points for overlays.

const (
	AxOverlayAnchorTopLeft AxOverlayAnchorPoint = iota
	AxOverlayAnchorCenter
)

func (AxOverlayAnchorPoint) String

func (oap AxOverlayAnchorPoint) String() string

type AxOverlayBackendType

type AxOverlayBackendType int

axoverlay_backend_type defines backend types for the overlay system.

const (
	AxOverlayCairoImageBackend AxOverlayBackendType = 1
	AxOverlayOpenGLESBackend
	AxOverlayOpenBackend
)

type AxOverlayColorspace

type AxOverlayColorspace int

axoverlay_colorspace defines color space types similar to the C enumeration.

const (
	AxOverlayColorspaceARGB32 AxOverlayColorspace = iota
	AxOverlayColorspace4BitPalette
	AxOverlayColorspace1BitPalette
	AxOverlayColorspaceUndefined
)

type AxOverlayErrorCode

type AxOverlayErrorCode int
const (
	AxOverlayErrorInvalidValue       AxOverlayErrorCode = 1000
	AxOverlayErrorInternal           AxOverlayErrorCode = 2000
	AxOverlayErrorUnexpected         AxOverlayErrorCode = 3000
	AxOverlayErrorGeneric            AxOverlayErrorCode = 4000
	AxOverlayErrorInvalidArgument    AxOverlayErrorCode = 5000
	AxOverlayErrorServiceUnavailable AxOverlayErrorCode = 6000
	AxOverlayErrorBackend            AxOverlayErrorCode = 7000
)

func (AxOverlayErrorCode) ErrorName

func (code AxOverlayErrorCode) ErrorName() string

ErrorName returns the string representation of the AxOverlayErrorCode.

type AxOverlayOverlayData

type AxOverlayOverlayData struct {
	AnchorPoint   AxOverlayAnchorPoint
	PositionType  AxOverlayPositionType
	X, Y          float32
	Width, Height int
	ZPriority     int
	Colorspace    AxOverlayColorspace
	ScaleToStream bool
	// contains filtered or unexported fields
}

axoverlay_overlay_data is a struct to hold overlay configuration.

func (*AxOverlayOverlayData) Free

func (s *AxOverlayOverlayData) Free()

type AxOverlayPaletteColor

type AxOverlayPaletteColor struct {
	R, G, B, A byte
	Pixelate   bool
}

axoverlay_palette_color defines a color in the overlay palette.

type AxOverlayPositionType

type AxOverlayPositionType int

axoverlay_position_type defines overlay position types. This enum contains constants for the different position types. For the first four types any x and y coordinates specified are ignored. If the type is set to AxOverlayCustomNormalized then x and y coordinates should be normalized between -1 and 1. If the type is set to AxOverlayCustomSource then the overlay will be placed relative to the video source and not the video frame. If DPTZ is used the overlay will remain locked to the scene and not the video frame. Coordinates should be between 0 and max witdh and max height respectivly. In case the video is rotated the coordinates have be transformed to an unrotated coordinate system.

const (
	AxOverlayTopLeft AxOverlayPositionType = iota
	AxOverlayTopRight
	AxOverlayBottomLeft
	AxOverlayBottomRight
	AxOverlayCustomNormalized // Custom position normalized between [-1, 1]
	AxOverlayCustomSource     // Custom position in absolute coordinates relative to the max resolution
)

func (AxOverlayPositionType) String

func (opt AxOverlayPositionType) String() string

type AxOverlayRenderCallback

type AxOverlayRenderCallback func(renderEvent *OverlayRenderEvent)

Callback function types for stream selection, adjustment, and rendering.

type AxOverlaySettings

type AxOverlaySettings struct {
	// contains filtered or unexported fields
}

axoverlay_settings is a struct to hold overlay settings.

func NewAxOverlaySettings

func NewAxOverlaySettings(render AxOverlayRenderCallback, adjustment AxOverlayAdjustmentCallback, selectCallback AxOverlayStreamSelectCallback, backend AxOverlayBackendType) *AxOverlaySettings

AxoverlayInitAxoverlaySettings initializes axoverlay_settings with default values.

func (*AxOverlaySettings) Free

func (s *AxOverlaySettings) Free()

type AxOverlayStreamData

type AxOverlayStreamData struct {
	ID         int
	Camera     int
	Width      int
	Height     int
	Rotation   int
	IsMirrored bool
	Type       AxOverlayStreamType
	Ptr        *C.struct_axoverlay_stream_data
}

axoverlay_stream_data is a struct to hold stream data.

type AxOverlayStreamSelectCallback

type AxOverlayStreamSelectCallback func(streamSelectEvent *OverlayStreamSelectEvent) bool

Callback function types for stream selection, adjustment, and rendering.

type AxOverlayStreamType

type AxOverlayStreamType int

axoverlay_stream_type defines stream types for overlay input.

const (
	AxOverlayStreamJPEG AxOverlayStreamType = iota
	AxOverlayStreamH264
	AxOverlayStreamH265
	AxOverlayStreamYCbCr
	AxOverlayStreamVOUT
	AxOverlayStreamOther
)

type CairoContext

type CairoContext struct {
	// contains filtered or unexported fields
}

func NewCairoCtxFromC

func NewCairoCtxFromC(renderingContext C.gpointer) *CairoContext

func (*CairoContext) Arc

func (ctx *CairoContext) Arc(xc, yc, radius, angle1, angle2 float64)

func (*CairoContext) ArcNegative

func (ctx *CairoContext) ArcNegative(xc, yc, radius, angle1, angle2 float64)

func (*CairoContext) ClosePath

func (ctx *CairoContext) ClosePath()

func (*CairoContext) CopyPage

func (ctx *CairoContext) CopyPage()

func (*CairoContext) CreateSurfaceFromPNG added in v1.2.1

func (ctx *CairoContext) CreateSurfaceFromPNG(filename string) (*C.cairo_surface_t, error)

func (*CairoContext) CurveTo

func (ctx *CairoContext) CurveTo(x1, y1, x2, y2, x3, y3 float64)

func (*CairoContext) DrawArrow

func (ctx *CairoContext) DrawArrow(x, y, length, angle float64, color color.RGBA)

func (*CairoContext) DrawBoundingBox

func (ctx *CairoContext) DrawBoundingBox(x float64, y float64, width float64, height float64, rectColor color.RGBA, label string, labelColor color.RGBA, labelSize float64, labelFont string, minBoxSizeRenderW int)

func (*CairoContext) DrawBoundingBoxLabel

func (ctx *CairoContext) DrawBoundingBoxLabel(text string, x float64, y float64, padding float64, size float64, font_name string, textColor color.RGBA, bgColor color.RGBA)

func (*CairoContext) DrawBoundingBoxRect

func (ctx *CairoContext) DrawBoundingBoxRect(x float64, y float64, width float64, height float64, color color.RGBA, linewidth float64, alpha float64)

func (*CairoContext) DrawBoundingBoxSize

func (ctx *CairoContext) DrawBoundingBoxSize(x float64, y float64, width float64, height float64, padding float64, size float64, font_name string, textColor color.RGBA, bgColor color.RGBA)

func (*CairoContext) DrawPNG added in v1.2.1

func (ctx *CairoContext) DrawPNG(filename string, x, y, xScale, yScale float64) error

func (*CairoContext) DrawRect

func (ctx *CairoContext) DrawRect(x float64, y float64, width float64, height float64, color color.RGBA, linewidth float64)

func (*CairoContext) DrawText

func (ctx *CairoContext) DrawText(text string, x float64, y float64, size float64, font_name string, color color.RGBA)

func (*CairoContext) DrawTransparent

func (ctx *CairoContext) DrawTransparent(width, height int)

func (*CairoContext) Fill

func (ctx *CairoContext) Fill()

func (*CairoContext) FillPreserve

func (ctx *CairoContext) FillPreserve()

func (*CairoContext) GetLineWidth

func (ctx *CairoContext) GetLineWidth() float64

func (*CairoContext) LineTo

func (ctx *CairoContext) LineTo(x, y float64)

func (*CairoContext) Mask

func (ctx *CairoContext) Mask(pattern Pattern)

func (*CairoContext) MoveTo

func (ctx *CairoContext) MoveTo(x, y float64)

func (*CairoContext) NewPath

func (ctx *CairoContext) NewPath()

func (*CairoContext) NewSubPath

func (ctx *CairoContext) NewSubPath()

func (*CairoContext) Paint

func (ctx *CairoContext) Paint()

func (*CairoContext) PaintSurface added in v1.2.1

func (ctx *CairoContext) PaintSurface(s *CairoSurface, x, y float64)

func (*CairoContext) PaintWithAlpha

func (ctx *CairoContext) PaintWithAlpha(alpha float64)

func (*CairoContext) PathExtents

func (ctx *CairoContext) PathExtents() (left, top, right, bottom float64)

func (*CairoContext) Rectangle

func (ctx *CairoContext) Rectangle(x, y, width, height float64)

func (*CairoContext) RelCurveTo

func (ctx *CairoContext) RelCurveTo(dx1, dy1, dx2, dy2, dx3, dy3 float64)

func (*CairoContext) RelLineTo

func (ctx *CairoContext) RelLineTo(dx, dy float64)

func (*CairoContext) RelMoveTo

func (ctx *CairoContext) RelMoveTo(dx, dy float64)

func (*CairoContext) Rotate

func (ctx *CairoContext) Rotate(angle float64)

func (*CairoContext) Scale

func (ctx *CairoContext) Scale(sx, sy float64)

func (*CairoContext) SelectFontFace

func (ctx *CairoContext) SelectFontFace(name string, font_slant_t, font_weight_t int)

func (*CairoContext) SetAntialias

func (ctx *CairoContext) SetAntialias(antialias Antialias)

func (*CairoContext) SetDash

func (ctx *CairoContext) SetDash(dashes []float64, num_dashes int, offset float64)

func (*CairoContext) SetFillRule

func (ctx *CairoContext) SetFillRule(fill_rule FillRule)

func (*CairoContext) SetFontSize

func (ctx *CairoContext) SetFontSize(size float64)

func (*CairoContext) SetLineCap

func (ctx *CairoContext) SetLineCap(line_cap LineCap)

func (*CairoContext) SetLineJoin

func (ctx *CairoContext) SetLineJoin(line_join LineJoin)

func (*CairoContext) SetLineWidth

func (ctx *CairoContext) SetLineWidth(width float64)

func (*CairoContext) SetMiterLimit

func (ctx *CairoContext) SetMiterLimit(limit float64)

func (*CairoContext) SetOperator

func (ctx *CairoContext) SetOperator(operator Operator)

func (*CairoContext) SetSource

func (ctx *CairoContext) SetSource(pattern *Pattern)

func (*CairoContext) SetSourceRGB

func (ctx *CairoContext) SetSourceRGB(color color.RGBA)

func (*CairoContext) SetSourceRGBA

func (ctx *CairoContext) SetSourceRGBA(color color.RGBA)

func (*CairoContext) SetTolerance

func (ctx *CairoContext) SetTolerance(tolerance float64)

func (*CairoContext) ShowPage

func (ctx *CairoContext) ShowPage()

func (*CairoContext) ShowText

func (ctx *CairoContext) ShowText(text string)

func (*CairoContext) Stroke

func (ctx *CairoContext) Stroke()

func (*CairoContext) StrokePreserve

func (ctx *CairoContext) StrokePreserve()

func (*CairoContext) TextExtents

func (ctx *CairoContext) TextExtents(text string) *TextExtents

func (*CairoContext) TextPath

func (ctx *CairoContext) TextPath(text string)

func (*CairoContext) Translate

func (ctx *CairoContext) Translate(tx, ty float64)

type CairoSurface added in v1.2.1

type CairoSurface struct {
	// contains filtered or unexported fields
}

func NewCairoSurfaceFromPNG added in v1.2.1

func NewCairoSurfaceFromPNG(filename string) (*CairoSurface, error)

func (*CairoSurface) Destroy added in v1.2.1

func (s *CairoSurface) Destroy()

Method to destroy the surface

func (*CairoSurface) Height added in v1.2.1

func (s *CairoSurface) Height() int

Method to get the height of the surface

func (*CairoSurface) Width added in v1.2.1

func (s *CairoSurface) Width() int

Method to get the width of the surface

type FillRule

type FillRule int
const (
	FILL_RULE_WINDING FillRule = iota
	FILL_RULE_EVEN_ODD
)

type LineCap

type LineCap int
const (
	LINE_CAP_BUTT LineCap = iota
	LINE_CAP_ROUND
	LINE_CAP_SQUARE
)

type LineJoin

type LineJoin int
const (
	LINE_JOIN_MITER LineJoin = iota
	LINE_JOIN_ROUND
	LINE_JOIN_BEVEL
)

type Operator

type Operator int

type OverlayAdjustmentEvent

type OverlayAdjustmentEvent struct {
	OverlayId                   int                    // The ID of the overlay.
	Stream                      *AxOverlayStreamData   // The stream that the overlay is displayed on.
	PositionType                *AxOverlayPositionType // The position type of the overlay.
	OverlayX, OverlayY          *float32               // Pointers to the x and y coordinates of the overlay, can be adjusted.
	OverlayWidth, OverlayHeight *int                   // Pointers to the width and height of the overlay, can be adjusted.
	Userdata                    any                    // Optional user data associated with this overlay.
}

OverlayAdjustmentEvent wraps callback data for axoverlay_adjustment_function.

func (OverlayAdjustmentEvent) String

func (e OverlayAdjustmentEvent) String() string

String method for OverlayAdjustmentEvent

type OverlayError

type OverlayError struct {
	Ptr      *C.GError
	Code     AxOverlayErrorCode
	Message  string
	Expected bool
}

func (*OverlayError) Error

func (e *OverlayError) Error() string

type OverlayRenderEvent

type OverlayRenderEvent struct {
	CairoCtx                    *CairoContext         // A pointer to the Cairo rendering context.
	OverlayId                   int                   // The ID of the overlay.
	Stream                      *AxOverlayStreamData  // Information about the stream being rendered to.
	PositionType                AxOverlayPositionType // The position type of the overlay.
	OverlayX, OverlayY          float32               // The x and y coordinates of the overlay, can be adjusted.
	OverlayWidth, OverlayHeight int                   // The width and height of the overlay, can be adjusted.
	Userdata                    any                   // Optional user data associated with this overlay.
}

OverlayRenderEvent wraps callback data for axoverlay_render_function.

func (OverlayRenderEvent) String

func (e OverlayRenderEvent) String() string

String method for OverlayRenderEvent

type OverlayStreamSelectEvent

type OverlayStreamSelectEvent struct {
	Camera                  int                 // The ID of the camera for the stream.
	Width, Height, Rotation int                 // The width, height, and rotation of the stream.
	IsMirrored              bool                // TRUE if mirroring is enabled for the stream.
	StreamType              AxOverlayStreamType // The type of the stream.
}

OverlayStreamSelectEvent wraps callback data for axoverlay_stream_select_function.

func (OverlayStreamSelectEvent) String

func (e OverlayStreamSelectEvent) String() string

String method for OverlayStreamSelectEvent

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

type PatternType

type PatternType int
const (
	PATTERN_TYPE_SOLID PatternType = iota
	PATTERN_TYPE_SURFACE
	PATTERN_TYPE_LINEAR
	PATTERN_TYPE_RADIAL
)

type TextExtents

type TextExtents struct {
	Xbearing float64
	Ybearing float64
	Width    float64
	Height   float64
	Xadvance float64
	Yadvance float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL