image

package
v0.0.0-...-3fe5516 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewImageEngine

func NewImageEngine(workerPool *WorkerPool) domain.IConverter

NewImageEngine creates a new image conversion engine

func NewImageEngineLegacy

func NewImageEngineLegacy(
	workerCount int,
	workerPool *WorkerPool,
) ports.IConverter

NewImageEngineLegacy creates a new image conversion engine (legacy/unused)

Types

type BatchConversionResult

type BatchConversionResult struct {
	Index int
	Error error
}

BatchConversionResult represents the result of a batch conversion task

type BatchConversionTask

type BatchConversionTask struct {
	InputPath  string
	OutputPath string
	Index      int
}

BatchConversionTask represents a single conversion task in a batch

type ImageEngine

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

ImageEngine implements IConverter for image format conversions

func (*ImageEngine) BatchConvert

func (e *ImageEngine) BatchConvert(tasks []BatchConversionTask) []BatchConversionResult

BatchConvert processes multiple image conversions in parallel using the worker pool It takes a slice of input/output path pairs and processes them concurrently utilizing all available CPU cores through the worker pool

func (*ImageEngine) Close

func (e *ImageEngine) Close()

Close closes the worker pool to prevent goroutine leaks

func (*ImageEngine) Convert

func (e *ImageEngine) Convert(ctx context.Context, input, output string) error

Convert converts an image from one format to another

func (*ImageEngine) Validate

func (e *ImageEngine) Validate(ctx context.Context, file string) error

Validate checks if the input file is a valid image

type ImageEngineLegacy

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

ImageEngineLegacy implements ports.IConverter for image format conversions (legacy/unused) NOTE: This is a legacy implementation that is not currently used. The active implementation is in engine.go which implements domain.IConverter

func (*ImageEngineLegacy) BatchProcess

func (e *ImageEngineLegacy) BatchProcess(images [][]byte) [][]byte

BatchProcess processes multiple images in batch

func (*ImageEngineLegacy) Convert

func (e *ImageEngineLegacy) Convert(input []byte, outputFormat domain.Format) []byte

Convert performs the conversion from input to output format

func (*ImageEngineLegacy) GetSupportedInputTypes

func (e *ImageEngineLegacy) GetSupportedInputTypes() []domain.FileType

GetSupportedInputTypes returns the input file types this converter supports

func (*ImageEngineLegacy) GetSupportedOutputTypes

func (e *ImageEngineLegacy) GetSupportedOutputTypes() []domain.Format

GetSupportedOutputTypes returns the output formats this converter supports

func (*ImageEngineLegacy) Validate

func (e *ImageEngineLegacy) Validate(file string) domain.ValidationResult

Validate checks if the input file is valid for this converter

type Job

type Job struct {
}

Job represents a job to be processed by the worker pool

type Result

type Result struct {
}

Result represents the result of a job

type WorkerPool

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

WorkerPool manages parallel image processing using CPU cores

func NewWorkerPool

func NewWorkerPool() *WorkerPool

NewWorkerPool creates a new worker pool with NumCPU workers

func (*WorkerPool) Close

func (p *WorkerPool) Close()

Close closes the worker pool

func (*WorkerPool) Submit

func (p *WorkerPool) Submit(task func())

Submit submits a task to the worker pool

type WorkerPoolLegacy

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

WorkerPoolLegacy manages parallel image processing (legacy/unused) NOTE: This is a legacy implementation that is not currently used. The active implementation is in worker_pool.go

func NewWorkerPoolLegacy

func NewWorkerPoolLegacy(workers int) *WorkerPoolLegacy

NewWorkerPoolLegacy creates a new worker pool (legacy/unused)

func (*WorkerPoolLegacy) Collect

func (p *WorkerPoolLegacy) Collect() []Result

Collect collects results from the worker pool

func (*WorkerPoolLegacy) Shutdown

func (p *WorkerPoolLegacy) Shutdown()

Shutdown shuts down the worker pool

func (*WorkerPoolLegacy) Submit

func (p *WorkerPoolLegacy) Submit(job Job)

Submit submits a job to the worker pool

Jump to

Keyboard shortcuts

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