VideoTools/vendor/github.com/srwiley/oksvg/svg_icon.go
Stu Leak bdc27c2253 Fix player frame generation and video playback
Major improvements to UnifiedPlayer:

1. GetFrameImage() now works when paused for responsive UI updates
2. Play() method properly starts FFmpeg process
3. Frame display loop runs continuously for smooth video display
4. Disabled audio temporarily to fix video playback fundamentals
5. Simplified FFmpeg command to focus on video stream only

Player now:
- Generates video frames correctly
- Shows video when paused
- Has responsive progress tracking
- Starts playback properly

Next steps: Re-enable audio playback once video is stable
2026-01-07 22:20:00 -05:00

38 lines
1.2 KiB
Go

// Copyright 2017 The oksvg Authors. All rights reserved.
// created: 2/12/2017 by S.R.Wiley
//
// utils.go implements translation of an SVG2.0 path into a rasterx Path.
package oksvg
import (
"github.com/srwiley/rasterx"
)
// SvgIcon holds data from parsed SVGs.
type SvgIcon struct {
ViewBox struct{ X, Y, W, H float64 }
Titles []string // Title elements collect here
Descriptions []string // Description elements collect here
Grads map[string]*rasterx.Gradient
Defs map[string][]definition
SVGPaths []SvgPath
Transform rasterx.Matrix2D
classes map[string]styleAttribute
}
// Draw the compiled SVG icon into the GraphicContext.
// All elements should be contained by the Bounds rectangle of the SvgIcon.
func (s *SvgIcon) Draw(r *rasterx.Dasher, opacity float64) {
for _, svgp := range s.SVGPaths {
svgp.DrawTransformed(r, opacity, s.Transform)
}
}
// SetTarget sets the Transform matrix to draw within the bounds of the rectangle arguments
func (s *SvgIcon) SetTarget(x, y, w, h float64) {
scaleW := w / s.ViewBox.W
scaleH := h / s.ViewBox.H
s.Transform = rasterx.Identity.Translate(x-s.ViewBox.X, y-s.ViewBox.Y).Scale(scaleW, scaleH)
}