Documentation ¶
Index ¶
- func Decode(input gqlgen.DecodeImageInput) (string, error)
- func Encode(input gqlgen.EncodeImageInput) (string, error)
- func GetNRGBAValues(imageData util.ImageData, pixelOffset int, lsbUsed byte, channel util.Channel, ...) (*bytes.Buffer, error)
- func LSBSlice(used byte) []byte
- func NRGBAPixels(data util.ImageData, pixelOffset int, channel util.Channel, ...)
- func SetNRGBAValues(imageData util.ImageData, encodeData []byte, pixelOffset int, lsbUsed byte, ...)
- func ValidateDecodeInput(ctx context.Context, user *ent.User, input gqlgen.DecodeImageInput) error
- func ValidateEncodeInput(ctx context.Context, user *ent.User, input gqlgen.EncodeImageInput) error
- func ValidateLSB(n byte) bool
- type ChannelType
- type Metadata
- func (md Metadata) EncodeIntoImageData(imageData util.ImageData)
- func (md Metadata) GetBinaryLength() uint64
- func (md Metadata) GetChannel() util.Channel
- func (md Metadata) GetDistributionDivisor(imageData util.ImageData) int
- func (md Metadata) PixelsNeeded() uint64
- func (md Metadata) ToByteArr() []byte
- type PixelData
- func (pd PixelData) GetBlue() byte
- func (pd PixelData) GetChannelValue(channel ChannelType) byte
- func (pd PixelData) GetGreen() byte
- func (pd PixelData) GetRed() byte
- func (pd *PixelData) SetBlue(value byte)
- func (pd PixelData) SetChannelValue(channel ChannelType, value byte, lsbPos byte)
- func (pd *PixelData) SetGreen(value byte)
- func (pd *PixelData) SetRed(value byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(input gqlgen.DecodeImageInput) (string, error)
Decode decodes the data from the given generated.DecodeImageInput input.
func Encode ¶
func Encode(input gqlgen.EncodeImageInput) (string, error)
Encode encodes a message into the given graphql.Upload file based on input. Returns the image data base64 encoded.
func GetNRGBAValues ¶
func GetNRGBAValues( imageData util.ImageData, pixelOffset int, lsbUsed byte, channel util.Channel, distributionDivisor int, bufferLength int, ) (*bytes.Buffer, error)
GetNRGBAValues returns bytes.Buffer with ChannelType values.
func NRGBAPixels ¶
func NRGBAPixels( data util.ImageData, pixelOffset int, channel util.Channel, distributionDivisor int, resultChan chan PixelData, )
NRGBAPixels sends PixelData of util.ImageData based on given parameters.
func SetNRGBAValues ¶
func SetNRGBAValues( imageData util.ImageData, encodeData []byte, pixelOffset int, lsbUsed byte, channel util.Channel, distributionDivisor int, )
SetNRGBAValues sets ChannelType values into util.ImageData based on params.
func ValidateDecodeInput ¶
func ValidateDecodeInput( ctx context.Context, user *ent.User, input gqlgen.DecodeImageInput, ) error
ValidateDecodeInput validates the generated.DecodeImageInput.
func ValidateEncodeInput ¶
func ValidateEncodeInput( ctx context.Context, user *ent.User, input gqlgen.EncodeImageInput, ) error
ValidateEncodeInput validates the generated.EncodeImageInput.
func ValidateLSB ¶
ValidateLSB validates that the number n is within the LSB range.
Types ¶
type ChannelType ¶
type ChannelType byte
ChannelType represents a pixel color channel.
const ( // RedChannel represents the red ChannelType. RedChannel ChannelType = iota // GreenChannel represents the red ChannelType. GreenChannel // BlueChannel represents the red ChannelType. BlueChannel )
func (ChannelType) IsBlue ¶
func (ct ChannelType) IsBlue() bool
IsBlue returns whether the ChannelType represents a BlueChannel.
func (ChannelType) IsGreen ¶
func (ct ChannelType) IsGreen() bool
IsGreen returns whether the ChannelType represents a GreenChannel.
func (ChannelType) IsRed ¶
func (ct ChannelType) IsRed() bool
IsRed returns whether the ChannelType represents a RedChannel.
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata represents information which was used to encode data into an image.
func MetadataFromBinaryBuffer ¶
MetadataFromBinaryBuffer creates a new Metadata from bytes.Buffer.
func MetadataFromEncodeInput ¶
func MetadataFromEncodeInput( input gqlgen.EncodeImageInput, messageLength int, ) Metadata
MetadataFromEncodeInput creates Metadata from generated.EncodeImageInput.
func MetadataFromImageData ¶
MetadataFromImageData creates a new Metadata from util.ImageData.
func (Metadata) EncodeIntoImageData ¶
EncodeIntoImageData encodes the data represented into util.ImageData.
func (Metadata) GetBinaryLength ¶
GetBinaryLength returns the expected binary length of the data represented.
func (Metadata) GetChannel ¶
GetChannel returns the model.Channel represented by the Metadata.
func (Metadata) GetDistributionDivisor ¶
GetDistributionDivisor calculates the distribution divisor represented.
func (Metadata) PixelsNeeded ¶
PixelsNeeded returns needed pixels for encoding data based on its Metadata.
type PixelData ¶
type PixelData struct { Width int Height int Channels []ChannelType Color *color.NRGBA }
PixelData represents data of one particular pixel of an image.
func (PixelData) GetBlue ¶
GetBlue returns the underlying value of the BlueChannel of the PixelData.
func (PixelData) GetChannelValue ¶
func (pd PixelData) GetChannelValue(channel ChannelType) byte
GetChannelValue returns the value of the ChannelType of the PixelData.
func (PixelData) GetGreen ¶
GetGreen returns the underlying value of the GreenChannel of the PixelData.
func (PixelData) SetChannelValue ¶
func (pd PixelData) SetChannelValue( channel ChannelType, value byte, lsbPos byte, )
SetChannelValue sets the value of ChannelType of the PixelData on lsbPos.