Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStereogramFromMask ¶
NewStereogramFromMask creates a new "Random-Dot Stereogram" image from the provided mask source using the algorithm of Harold W. Thimbleby, Stuart Inglis and Ian H: https://www2.cs.sfu.ca/CourseCentral/414/li/material/refs/SIRDS-Computer-94.pdf
The mask source must contain an encoded valid png, jpeg or gif image data. The mask image will be interpreted as monochrome, regardless of the actual number of colors encoded in that image. All pixels in the mask image that have a zero alpha channel (transparent) will be ignored (by default), and the remaining pixels will be included in the final mask image. To explicitly specify the color that should be perceived as transparent in the mask image, specify a `WithMaskTransparentColor(...)` in the list of options.
A list of options can be provided to specify additional stereogram processing settings.
Types ¶
type Color ¶
Color represents color type.
func ColorFromHex ¶
ColorFromHex converts hex color string (#RRGGBBAA) into color model.
func MustColorFromHex ¶
MustColorFromHex converts hex color string (#RRGGBBAA) into color model.
It panics if the provided hes string is not a valid hexidecimal encoded color.
type StereogramConfig ¶
type StereogramConfig struct {
// Contains the color of the mask image pixels that should be considered transparent.
//
// If not specifed, every pixel in a mask image that has a zero alpha channel
// will be considered transparent.
MaskTransparentColor *Color
// Represents a list of colors used to create pixels in a stereogram image.
//
// It's recommended to specify at least 2 different colors so that
// the final stereogram image is colored (if you specify one color, the final image
// will always be monotonously filled with this color, which doesn't make sense 0_o).
// Each color presented will be randomly selected to form a unique pixel
// in the stereogram image.
//
// If the list of colors is not specified (by defaul), then a randomization algorithm
// will be applied when forming each individual pixel color.
Palette []Color
// Depth of field (fraction of viewing distance).
//
// Equal to 1/3 by default.
Mu float64
// Output stereogram image DPI.
//
// By defualt has 72 pixels per inch.
DPI int
// Eye separation ratio.
//
// Eye separation is assumed to be 2.5 * DPI in by default.
ERatio float64
}
StereogramConfig represents a stereogram image processing configuration model.
type StereogramOption ¶
type StereogramOption func(*StereogramConfig)
StereogramOption represents type for stereogram image processing option.
func WithColorPalette ¶
func WithColorPalette(palette ...Color) StereogramOption
WithColorPalette sets the list of colors used to create pixels in a stereogram image.
By default, this list is empty and therefore the colors of each pixel will be selected randomly.
func WithEyeSepartionRatio ¶
func WithEyeSepartionRatio(ratio float64) StereogramOption
WithEyeSepartionRatio sets the eye separtion ratio.
2.5 by default.
func WithMaskTransparentColor ¶
func WithMaskTransparentColor(color Color) StereogramOption
WithMaskTransparentColor sets the color that must be transparent for the mask source image.
By default, every pixel in a mask image that has a zero alpha channel will be considered transparent.
func WithOutputDPI ¶
func WithOutputDPI(dpi int) StereogramOption
WithOutputDPI sets the DPI of the stegeogram image.
72 by default.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic
command
|
|
|
gopher
command
|
|
|
logo
command
|
|
|
new-year-vibe
command
|


