ocio

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 6 Imported by: 0

README

OpenColorIO bindings for Go

Go CI Go project version GoDoc Go Report

OpenColorIO (OCIO) is a complete color management solution geared towards motion picture production with an emphasis on visual effects and computer animation. OCIO provides a straightforward and consistent user experience across all supporting applications while allowing for sophisticated back-end configuration options suitable for high-end production usage. OCIO is compatible with the Academy Color Encoding Specification (ACES) and is LUT-format agnostic, supporting many popular formats.

OpenColorIO is released as version 1.0 and has been in development since 2003. OCIO represents the culmination of years of production experience earned on such films as SpiderMan 2 (2004), Surf’s Up (2007), Cloudy with a Chance of Meatballs (2009), Alice in Wonderland (2010), and many more. OpenColorIO is natively supported in commercial applications like Katana, Mari, Silhouette FX, and others coming soon.

OpenColorIO is free and is one of several open source projects actively sponsored by Sony Imageworks.

http://opencolorio.org

Requirements

Status

So far only parts of the API have been exposed. Most of the Config API is done, along with the ColorSpace, Context, Transform, and color processing via CPU Path.

Installation

go get github.com/justinfx/opencolorigo

If you have installed OpenColorIO to a custom location, you will need to tell CGO where to find the headers and libs, and use the no_pkgconfig tag to disable pkg-config:

export CGO_CPPFLAGS="-I/path/to/include"
export CGO_LDFLAGS="-L/path/to/lib"
go get -tags no_pkgconfig github.com/justinfx/opencolorigo

Or just prefix the install command, and use the no_pkgconfig tag:

/usr/bin/env \
  CGO_CPPFLAGS="-I/usr/local/include" \
  CGO_LDFLAGS="-L/usr/local/lib -lopencolorio" \
  go get -tags no_pkgconfig github.com/justinfx/openimageigo

Example

func Example() {

    // Arbitrary source of image data
    //
    // ColorData is a []float32 containing the pixel values.
    // Could be in various formats:
    //     R,G,B,R,G,B,...     // 3 Channels
    //     R,G,B,A,R,G,B,A,... // 4 Channels
    //
    var imageData ocio.ColorData = getExampleImage()

    // Get the global OpenColorIO config
    // This will auto-initialize (using $OCIO) on first use
    cfg, err := ocio.CurrentConfig()
    if err != nil {
        panic(err.Error()
    }
    defer cfg.Destroy()

    // Get the processor corresponding to this transform.
    processor, err := cfg.Processor("linear", "Cineon")
    if err != nil {
        panic(err.Error())
    }
    defer processor.Destroy()

    // Wrap the image in a light-weight ImageDesc,
    // providing the width, height, and number of color channels
    // that imageData represents.
    imgDesc := ocio.NewPackedImageDesc(imageData, 512, 256, 3)
    defer imgDesc.Destroy()

    // Apply the color transformation (in place)
    err = processor.Apply(imgDesc)
    if err != nil {
        panic(err.Error())
    }
}

Memory Management

The objects returned by the API are wrappers over C/C++ libopencolorio memory. While finalizers are defined on these types in order to release C memory as some point, there isn't a guarantee as to exactly when finalizers will be run by the garbage collector. To ensure resources are freed quickly, a direct call to the Destroy() method of an API instance will immediately free the memory.

Documentation

Overview

OpenColorIO bindings - http://opencolorio.org/developers/api/OpenColorIO.html

Example

Usage Example: Compositing plugin that converts from “log” to “lin”

// Arbitrary source of image data
//
// ColorData is a []float32 containing the pixel values.
// Could be in various formats:
//     R,G,B,R,G,B,...     // 3 Channels
//     R,G,B,A,R,G,B,A,... // 4 Channels
//
var imageData ColorData = getExampleImage()

// Get the global OpenColorIO config
// This will auto-initialize (using $OCIO) on first use
cfg, err := CurrentConfig()
if err != nil {
	panic(err.Error())
}

// Get the processor corresponding to this transform.
processor, err := cfg.Processor(ROLE_COMPOSITING_LOG, ROLE_SCENE_LINEAR)
if err != nil {
	panic(err.Error())
}

// Wrap the image in a light-weight ImageDesc,
// providing the width, height, and number of color channels
// that imageData represents.
imgDesc := NewPackedImageDesc(imageData, 512, 256, 3)

// Apply the color transformation (in place)
err = processor.Apply(imgDesc)
if err != nil {
	panic(err.Error())
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ROLE_DEFAULT         = C.GoString(C.ROLE_DEFAULT)
	ROLE_REFERENCE       = C.GoString(C.ROLE_REFERENCE)
	ROLE_DATA            = C.GoString(C.ROLE_DATA)
	ROLE_COLOR_PICKING   = C.GoString(C.ROLE_COLOR_PICKING)
	ROLE_SCENE_LINEAR    = C.GoString(C.ROLE_SCENE_LINEAR)
	ROLE_COMPOSITING_LOG = C.GoString(C.ROLE_COMPOSITING_LOG)
	ROLE_COLOR_TIMING    = C.GoString(C.ROLE_COLOR_TIMING)
	ROLE_TEXTURE_PAINT   = C.GoString(C.ROLE_TEXTURE_PAINT)
	ROLE_MATTE_PAINT     = C.GoString(C.ROLE_MATTE_PAINT)
)

Functions

func ClearAllCaches

func ClearAllCaches()

OpenColorIO, during normal usage, tends to cache certain information (such as the contents of LUTs on disk, intermediate results, etc.). Calling this function will flush all such information. Under normal usage, this is not necessary, but it can be helpful in particular instances, such as designing OCIO profiles, and wanting to re-read luts without restarting.

func SetCurrentConfig

func SetCurrentConfig(config *Config) error

Set the current configuration. This will then store a copy of the specified config.

func SetLoggingLevel

func SetLoggingLevel(level LoggingLevelType)

Set the global logging level.

func Version

func Version() string

Get the version number for the library, as a dot-delimited string (e.g., “1.0.0”). This is also available at compile time as OCIO_VERSION.

func VersionHex

func VersionHex() int

Get the version number for the library, as a single 4-byte hex number (e.g., 0x01050200 for “1.5.2”), to be used for numeric comparisons. This is also available at compile time as OCIO_VERSION_HEX.

Types

type BitDepth

type BitDepth int
const (
	BIT_DEPTH_UNKNOWN BitDepth = C.BIT_DEPTH_UNKNOWN
	BIT_DEPTH_UINT8   BitDepth = C.BIT_DEPTH_UINT8
	BIT_DEPTH_UINT10  BitDepth = C.BIT_DEPTH_UINT10
	BIT_DEPTH_UINT12  BitDepth = C.BIT_DEPTH_UINT12
	BIT_DEPTH_UINT14  BitDepth = C.BIT_DEPTH_UINT14
	BIT_DEPTH_UINT16  BitDepth = C.BIT_DEPTH_UINT16
	BIT_DEPTH_UINT32  BitDepth = C.BIT_DEPTH_UINT32
	BIT_DEPTH_F16     BitDepth = C.BIT_DEPTH_F16
	BIT_DEPTH_F32     BitDepth = C.BIT_DEPTH_F32
)

type ColorData

type ColorData []float32

A ColorData meant to hold floating point pixel data in forms: * RGBRGB... * RGBARGBA...

type ColorSpace

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

The ColorSpace is the state of an image with respect to colorimetry and color encoding. Transforming images between different ColorSpaces is the primary motivation for this library.

While a complete discussion of colorspaces is beyond the scope of documentation, traditional uses would be to have ColorSpaces corresponding to: physical capture devices (known cameras, scanners), and internal ‘convenience’ spaces (such as scene linear, logarithmic).

ColorSpaces are specific to a particular image precision (float32, uint8, etc.), and the set of ColorSpaces that provide equivalent mappings (at different precisions) are referred to as a ‘family’.

func NewColorSpace

func NewColorSpace() *ColorSpace

Create a new empty ColorSpace

func (*ColorSpace) BitDepth

func (c *ColorSpace) BitDepth() BitDepth

func (*ColorSpace) Description

func (c *ColorSpace) Description() string

func (*ColorSpace) Destroy added in v1.0.2

func (c *ColorSpace) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*ColorSpace) EditableCopy

func (c *ColorSpace) EditableCopy() *ColorSpace

Create a new editable copy of this ColorSpace

func (*ColorSpace) EqualityGroup

func (c *ColorSpace) EqualityGroup() string

Get the ColorSpace group name (used for equality comparisons) This allows no-op transforms between different colorspaces. If an equalityGroup is not defined (an empty string), it will be considered unique (i.e., it will not compare as equal to other ColorSpaces with an empty equality group). This is often, though not always, set to the same value as ‘family’.

func (*ColorSpace) Family

func (c *ColorSpace) Family() string

func (*ColorSpace) Name

func (c *ColorSpace) Name() string

func (*ColorSpace) SetBitDepth

func (c *ColorSpace) SetBitDepth(bitDepth BitDepth)

func (*ColorSpace) SetDescription

func (c *ColorSpace) SetDescription(description string)

func (*ColorSpace) SetEqualityGroup

func (c *ColorSpace) SetEqualityGroup(group string)

func (*ColorSpace) SetFamily

func (c *ColorSpace) SetFamily(family string)

func (*ColorSpace) SetName

func (c *ColorSpace) SetName(name string)

func (*ColorSpace) String

func (c *ColorSpace) String() string

type Config

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

A Config defines all the colorspaces available at runtime.

func ConfigCreateFromData

func ConfigCreateFromData(data string) (*Config, error)

Create a Config from a valid yaml string

func ConfigCreateFromEnv

func ConfigCreateFromEnv() (*Config, error)

Create a Config by checking the OCIO environment variable

func ConfigCreateFromFile

func ConfigCreateFromFile(filename string) (*Config, error)

Create a Config from an existing yaml Config file

func CurrentConfig

func CurrentConfig() (*Config, error)

Get the current configuration. If a current config had not yet been set, it will be automatically initialized from the environment.

func NewConfig

func NewConfig() *Config

Create a new empty Config

func (*Config) ActiveDisplays

func (c *Config) ActiveDisplays() string

func (*Config) ActiveViews

func (c *Config) ActiveViews() string

func (*Config) AddColorSpace

func (c *Config) AddColorSpace(cs *ColorSpace) error

If another color space is already registered with the same name, this will overwrite it. This stores a copy of the specified color space.

func (*Config) AddDisplay

func (c *Config) AddDisplay(display, view, colorSpace, looks string) error

For the (display,view) combination, specify which colorSpace and look to use. If a look is not desired, then just pass an empty string

func (*Config) CacheID

func (c *Config) CacheID() (string, error)

This will produce a hash of the all colorspace definitions, etc. All external references, such as files used in FileTransforms, etc., will be incorporated into the cacheID. While the contents of the files are not read, the file system is queried for relavent information (mtime, inode) so that the Config’s cacheID will change when the underlying luts are updated.

The current Context will be used.

func (*Config) CacheIDWithContext

func (c *Config) CacheIDWithContext(context *Context) (string, error)

This will produce a hash of the all colorspace definitions, etc. All external references, such as files used in FileTransforms, etc., will be incorporated into the cacheID. While the contents of the files are not read, the file system is queried for relavent information (mtime, inode) so that the Config’s cacheID will change when the underlying luts are updated.

If a nil context is provided, file references will not be taken into account (this is essentially a hash of Config.Serialize).

func (*Config) ClearColorSpaces

func (c *Config) ClearColorSpaces() error

func (*Config) ClearDisplays

func (c *Config) ClearDisplays()

func (*Config) ColorSpace

func (c *Config) ColorSpace(name string) (*ColorSpace, error)

This will return null if the specified name is not found. Accepts either a color space OR role name. (Colorspace names take precedence over roles.)

func (*Config) ColorSpaceNameByIndex

func (c *Config) ColorSpaceNameByIndex(index int) (string, error)

This will null if an invalid index is specified

func (*Config) CurrentContext

func (c *Config) CurrentContext() (*Context, error)

func (*Config) DefaultDisplay

func (c *Config) DefaultDisplay() string

func (*Config) DefaultView

func (c *Config) DefaultView(display string) string

func (*Config) Description

func (c *Config) Description() (string, error)

func (*Config) Destroy added in v1.0.2

func (c *Config) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*Config) Display

func (c *Config) Display(index int) string

func (*Config) DisplayColorSpaceName

func (c *Config) DisplayColorSpaceName(display, view string) string

func (*Config) DisplayLooks

func (c *Config) DisplayLooks(display, view string) string

Looks is a potentially comma (or colon) delimited list of lookNames, Where +/- prefixes are optionally allowed to denote forward/inverse look specification. (And forward is assumed in the absense of either)

func (*Config) EditableCopy

func (c *Config) EditableCopy() *Config

Create a new editable copy of this Config

func (*Config) HasRole

func (c *Config) HasRole(role string) bool

Return true if the role has been defined.

func (*Config) IndexForColorSpace

func (c *Config) IndexForColorSpace(name string) (int, error)

Accepts either a color space OR role name. (Colorspace names take precedence over roles.)

func (*Config) IsStrictParsingEnabled

func (c *Config) IsStrictParsingEnabled() bool

func (*Config) NumColorSpaces

func (c *Config) NumColorSpaces() int

func (*Config) NumDisplays

func (c *Config) NumDisplays() int

func (*Config) NumRoles

func (c *Config) NumRoles() int

func (*Config) NumViews

func (c *Config) NumViews(display string) int

func (*Config) ParseColorSpaceFromString

func (c *Config) ParseColorSpaceFromString(str string) (string, error)

Given the specified string, get the longest, right-most, colorspace substring that appears.

* If strict parsing is enabled, and no color space is found, return an empty string. * If strict parsing is disabled, return ROLE_DEFAULT (if defined). * If the default role is not defined, return an empty string.

func (*Config) Processor

func (c *Config) Processor(args ...interface{}) (*Processor, error)

Convert from inputColorSpace to outputColorSpace

There are 4 ways this method may be called:

config.Processor(ctx *Context, src *ColorSpace, dst *ColorSpace)
config.Processor(ctx *Context, src string, dst string)
config.Processor(src *ColorSpace, dst *ColorSpace)
config.Processor(src string, dst string)

String names can be colorspace name, role name, or a combination of both.

This may provide higher fidelity than anticipated due to internal optimizations. For example, if the inputColorspace and the outputColorSpace are members of the same family, no conversion will be applied, even though strictly speaking quantization should be added

func (*Config) ProcessorCtxTransformDir

func (c *Config) ProcessorCtxTransformDir(
	ctx *Context, tx Transform, dir TransformDirection) (*Processor, error)

Get the processor for the specified transform, using a specific Context instead of the current Config context, and a transform direction.

Not often needed, but will allow for the re-use of atomic OCIO functionality (such as to apply an individual LUT file).

func (*Config) ProcessorTransform

func (c *Config) ProcessorTransform(tx Transform) (*Processor, error)

Get the processor for the specified transform, using the current Config context.

Not often needed, but will allow for the re-use of atomic OCIO functionality (such as to apply an individual LUT file).

func (*Config) ProcessorTransformDir

func (c *Config) ProcessorTransformDir(tx Transform, dir TransformDirection) (*Processor, error)

Get the processor for the specified transform, and a transform direction, using the current Config context.

Not often needed, but will allow for the re-use of atomic OCIO functionality (such as to apply an individual LUT file).

func (*Config) RoleName

func (c *Config) RoleName(index int) (string, error)

Get the role name at index, this will return values like ‘scene_linear’, ‘compositing_log’. Return empty string if index is out of range.

func (*Config) SanityCheck

func (c *Config) SanityCheck() error

This will return a non-nil error if the config is malformed. The most common error occurs when references are made to colorspaces that do not exist.

func (*Config) SearchPath

func (c *Config) SearchPath() (string, error)

Given a lut src name, where should we find it?

func (*Config) Serialize

func (c *Config) Serialize() (string, error)

func (*Config) SetActiveDisplays

func (c *Config) SetActiveDisplays(displays string) error

Comma-delimited list of display names.

func (*Config) SetActiveViews

func (c *Config) SetActiveViews(views string) error

Comma-delimited list of view names.

func (*Config) SetRole

func (c *Config) SetRole(role, colorSpaceName string) error

Setting the colorSpaceName name to a null string unsets it.

func (*Config) SetStrictParsingEnabled

func (c *Config) SetStrictParsingEnabled(enabled bool) error

func (*Config) View

func (c *Config) View(display string, index int) string

func (*Config) WorkingDir

func (c *Config) WorkingDir() (string, error)

Given a lut src name, where should we find it?

type Context

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

func NewContext

func NewContext() *Context

Create a new empty Context

func (*Context) CacheID

func (c *Context) CacheID() (string, error)

func (*Context) Destroy added in v1.0.2

func (c *Context) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*Context) EditableCopy

func (c *Context) EditableCopy() *Context

Create a new editable copy of this Context

func (*Context) EnvironmentMode added in v1.0.1

func (c *Context) EnvironmentMode() EnvironmentMode

func (*Context) LoadEnvironment

func (c *Context) LoadEnvironment()

Seed all string vars with the current environment.

func (*Context) ResolveFileLocation

func (c *Context) ResolveFileLocation(filename string) (string, error)

Do a file lookup. Evaluate all variables (as needed). Also, walk the full search path until the file is found. If the filename cannot be found, an error will be returned.

func (*Context) ResolveStringVar

func (c *Context) ResolveStringVar(val string) string

Do a file lookup. Evaluate the specified variable (as needed).

func (*Context) SearchPath

func (c *Context) SearchPath() string

func (*Context) SetEnvironmentMode added in v1.0.1

func (c *Context) SetEnvironmentMode(mode EnvironmentMode)

func (*Context) SetSearchPath

func (c *Context) SetSearchPath(path string)

func (*Context) SetStringVar

func (c *Context) SetStringVar(name, value string)

func (*Context) SetWorkingDir

func (c *Context) SetWorkingDir(dirname string)

func (*Context) StringVar

func (c *Context) StringVar(name string) string

func (*Context) WorkingDir

func (c *Context) WorkingDir() string

type DisplayTransform

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

func NewDisplayTransform

func NewDisplayTransform() *DisplayTransform

Create a new empty DisplayTransform

func (*DisplayTransform) Destroy added in v1.0.2

func (tx *DisplayTransform) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*DisplayTransform) Direction

func (tx *DisplayTransform) Direction() TransformDirection

func (*DisplayTransform) Display

func (tx *DisplayTransform) Display() string

Display returns the output display transform.

func (*DisplayTransform) EditableCopy

func (tx *DisplayTransform) EditableCopy() *DisplayTransform

Create a new editable copy of this DisplayTransform

func (*DisplayTransform) InputColorSpace

func (tx *DisplayTransform) InputColorSpace() string

InputColorSpace returns the incoming color space

func (*DisplayTransform) LooksOverride

func (tx *DisplayTransform) LooksOverride() string

func (*DisplayTransform) LooksOverrideEnabled

func (tx *DisplayTransform) LooksOverrideEnabled() bool

func (*DisplayTransform) SetDirection

func (tx *DisplayTransform) SetDirection(dir TransformDirection)

func (*DisplayTransform) SetDisplay

func (tx *DisplayTransform) SetDisplay(name string)

SetDisplay sets the output display transform. This is controlled by the specification of (display, view).

func (*DisplayTransform) SetInputColorSpace

func (tx *DisplayTransform) SetInputColorSpace(cs string)

SetInputColorSpace sets the incoming color space

func (*DisplayTransform) SetLooksOverride

func (tx *DisplayTransform) SetLooksOverride(looks string)

A user can optionally override the looks that are, by default, used with the expected display / view combination. A common use case for this functionality is in an image viewing app, where per-shot looks are supported. If for some reason a per-shot look is not defined for the current Context, the Config.Processor() function will not succeed by default. Thus, with this mechanism the viewing app could override to looks = "", and this will allow image display to continue (though hopefully) the interface would reflect this fallback option).

Looks is a potentially comma (or colon) delimited list of lookNames, where +/- prefixes are optionally allowed to denote forward/inverse look specification (And forward is assumed in the absence of either).

func (*DisplayTransform) SetLooksOverrideEnabled

func (tx *DisplayTransform) SetLooksOverrideEnabled(enabled bool)

SetLooksOverrideEnabled specifies whether the lookOverride should be used or not. This is a separate flag, as it's often useful to override "looks" to an empty string

func (*DisplayTransform) SetView

func (tx *DisplayTransform) SetView(name string)

SetView: Specify which view transform to use

func (*DisplayTransform) View

func (tx *DisplayTransform) View() string

View returns the view transform to use

type EnvironmentMode

type EnvironmentMode int
const (
	ENVIRONMENT_UNKNOWN         EnvironmentMode = C.ENV_ENVIRONMENT_UNKNOWN
	ENVIRONMENT_LOAD_PREDEFINED EnvironmentMode = C.ENV_ENVIRONMENT_LOAD_PREDEFINED
	ENVIRONMENT_LOAD_ALL        EnvironmentMode = C.ENV_ENVIRONMENT_LOAD_ALL
)

type ErrMissingFile

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

An exception class for errors detected at runtime, thrown when OCIO cannot find a file that is expected to exist. This is provided as a custom type to distinguish cases where one wants to continue looking for missing files, but wants to properly fail for other error conditions.

func (ErrMissingFile) Error

func (e ErrMissingFile) Error() string

type ImageDescriptor

type ImageDescriptor interface {
	// contains filtered or unexported methods
}

type InterpType

type InterpType int
const (
	INTERP_UNKNOWN     InterpType = C.INTERP_UNKNOWN
	INTERP_NEAREST     InterpType = C.INTERP_NEAREST
	INTERP_LINEAR      InterpType = C.INTERP_LINEAR
	INTERP_TETRAHEDRAL InterpType = C.INTERP_TETRAHEDRAL
	INTERP_BEST        InterpType = C.INTERP_BEST
)

type LoggingLevelType

type LoggingLevelType int
const (
	LOGGING_LEVEL_NONE    LoggingLevelType = C.LOGGING_LEVEL_NONE
	LOGGING_LEVEL_WARNING LoggingLevelType = C.LOGGING_LEVEL_WARNING
	LOGGING_LEVEL_INFO    LoggingLevelType = C.LOGGING_LEVEL_INFO
	LOGGING_LEVEL_DEBUG   LoggingLevelType = C.LOGGING_LEVEL_DEBUG
	LOGGING_LEVEL_UNKNOWN LoggingLevelType = C.LOGGING_LEVEL_UNKNOWN
)

func LoggingLevel

func LoggingLevel() LoggingLevelType

Get the global logging level. You can override this at runtime using the OCIO_LOGGING_LEVEL environment variable. The client application that sets this should use SetLoggingLevel(), and not the environment variable. The default value is INFO.

Returns on of the LOGGING_LEVEL_* const values

type PackedImageDesc

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

This is a light-weight wrapper around an image, that provides a context for pixel access

func NewPackedImageDesc

func NewPackedImageDesc(rgb ColorData, width, height, numChannels int) *PackedImageDesc

Create a PackedImageDesc wrapper for some raw rgb data Pass a []float32 slice of image data: rgbrgbrgb, etc. The number of channels must be greater than or equal to 3 If a 4th channel is specified, it is assumed to be alpha information. Channels > 4 will be ignored.

func (*PackedImageDesc) Data

func (p *PackedImageDesc) Data() ColorData

Return the current state of the image data, potentially modified if color transformations have been applied.

func (*PackedImageDesc) Destroy added in v1.0.2

func (p *PackedImageDesc) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*PackedImageDesc) Height

func (p *PackedImageDesc) Height() int

Pixel height of the image

func (*PackedImageDesc) NumChannels

func (p *PackedImageDesc) NumChannels() int

Number of color channels in the image

func (*PackedImageDesc) Width

func (p *PackedImageDesc) Width() int

Pixel width of the image

type Processor

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

func NewProcessor

func NewProcessor() *Processor

Create a new empty Processor

func (*Processor) Apply

func (p *Processor) Apply(i ImageDescriptor) error

Apply to an image.

func (*Processor) CpuCacheID

func (p *Processor) CpuCacheID() (string, error)

func (*Processor) Destroy added in v1.0.2

func (p *Processor) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*Processor) HasChannelCrosstalk

func (p *Processor) HasChannelCrosstalk() bool

does the processor represent an image transformation that introduces crosstalk between the image channels

func (*Processor) IsNoOp

func (p *Processor) IsNoOp() bool

func (*Processor) Metadata

func (p *Processor) Metadata() *ProcessorMetadata

type ProcessorMetadata

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

This class contains meta information about the process that generated this processor. The results of these functions do not impact the pixel processing.

func NewProcessorMetadata

func NewProcessorMetadata() *ProcessorMetadata

Create a new empty ProcessorMetadata

func (*ProcessorMetadata) AddFile

func (p *ProcessorMetadata) AddFile(fileName string)

func (*ProcessorMetadata) AddLook

func (p *ProcessorMetadata) AddLook(lookName string)

func (*ProcessorMetadata) Destroy added in v1.0.2

func (p *ProcessorMetadata) Destroy()

Destroy immediately frees resources for this instance instead of waiting for garbage collection finalizer to run at some point later

func (*ProcessorMetadata) File

func (p *ProcessorMetadata) File(index int) string

func (*ProcessorMetadata) Files added in v1.0.1

func (p *ProcessorMetadata) Files() []string

Files is a helper to return a slice of the file paths, using NumFiles and File(index)

func (*ProcessorMetadata) Look

func (p *ProcessorMetadata) Look(index int) string

func (*ProcessorMetadata) NumFiles

func (p *ProcessorMetadata) NumFiles() int

func (*ProcessorMetadata) NumLooks

func (p *ProcessorMetadata) NumLooks() int

type Transform

type Transform interface {
	// contains filtered or unexported methods
}

Transform interface represents the different types of concrete transform types that can be passed into API calls

type TransformDirection

type TransformDirection int
const (
	TRANSFORM_DIR_UNKNOWN TransformDirection = C.TRANSFORM_DIR_UNKNOWN
	TRANSFORM_DIR_FORWARD TransformDirection = C.TRANSFORM_DIR_FORWARD
	TRANSFORM_DIR_INVERSE TransformDirection = C.TRANSFORM_DIR_INVERSE
)

Jump to

Keyboard shortcuts

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