goPsdLib

package module
v0.0.0-...-97bac74 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2016 License: Apache-2.0 Imports: 9 Imported by: 1

README

goPsdLib

goPsdLib 是使用golang解析的psd文件的一个包,目前处于开始阶段,

1、已经完成图层解析

细节部分还在进行

欢迎加入 dogo 技术交流群:437274005 点击右侧按钮快捷加入 dogo交流群

Documentation

Index

Constants

View Source
const (
	BIT_MAP       colorMode = 0
	GRAYSCALE               = 1
	INDEXED                 = 2
	RGB                     = 3
	CMYK                    = 4
	MULTI_CHANNEL           = 7
	DUOTONE                 = 8
	LAB                     = 9
)

Variables

This section is empty.

Functions

func NewDocument

func NewDocument(fileName string) *document

func NewDocumentFromByte

func NewDocumentFromByte(b []byte) *document

func ParseFormFile

func ParseFormFile(filename string)

func StringValueIs

func StringValueIs(value string, values ...string) bool

func UnpackRLEBits

func UnpackRLEBits(data []byte, length int) []byte

Types

type AdditionalLayerInformation

type AdditionalLayerInformation struct {
	Signature  string
	Key        string
	DataLength uint64
}

type BooleanStructureEntity

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

type ChannelInformation

type ChannelInformation struct {
	Id          uint16
	Length      uint64
	Compression int16 //Compression. 0 = Raw Data, 1 = RLE compressed, 2 = ZIP without prediction, 3 = ZIP with prediction.
	Data        []byte
}

type ClassStructureEntity

type ClassStructureEntity struct {
	Name    string
	ClassID string
}

type Color

type Color struct {
	Red, Green, Blue, Alpha uint16
}

type ColorModeData

type ColorModeData struct {
	Length    uint32
	ColorData []byte
}

func (*ColorModeData) Inits

func (colorMode *ColorModeData) Inits(doc *document)

type CommonStateInfo

type CommonStateInfo struct {
	NextThreeItems uint32
	Version        uint32
	Visible        bool
	Unused         uint16
}

type Descriptor

type Descriptor struct {
	Key   string
	Type  string
	Value StructureEntity
	// contains filtered or unexported fields
}

type DescriptorStructure

type DescriptorStructure struct {
	Name        string
	ClassId     string
	ItemsNumber uint32
	Items       map[string]*Descriptor
}

type DropAndInnerShadowInfo

type DropAndInnerShadowInfo struct {
	// Size of the remaining items: 41 or 51 (depending on version)
	RemainingItems uint32
	// Version: 0 ( Photoshop 5.0) or 2 ( Photoshop 5.5)
	Version uint32
	// 	Blur value in pixels
	PixelsBlurValue uint32
	// 	Intensity as a percent
	Intensity uint32
	// Angle in degrees
	AngleDegrees uint32
	// Distance in pixels
	Distance uint32
	// Color: 2 bytes for space followed by 4 * 2 byte color component
	Color []byte
	// Blend mode: 4 bytes for signature and 4 bytes for key
	BlendMode []byte
	// Effect enabled
	Enabled bool

	// Opacity as a percent
	Opacity byte
	// Native color: 2 bytes for space followed by 4 * 2 byte color component
	NativeColor []byte
	// contains filtered or unexported fields
}

type EffectsLayerInfo

type EffectsLayerInfo struct {
	Version      uint16
	EffectsCount uint16
	Signature    string
	EffectsLayer map[string]effectsLayer
}

type EnumeratedDescriptorEntity

type EnumeratedDescriptorEntity struct {
	Type string
	Enum string
}

type EnumeratedReferenceEntity

type EnumeratedReferenceEntity struct {
	Name    string
	ClassID string
	TypeID  string
	Enum    string
}

type FileHeader

type FileHeader struct {

	// Mac OS: 8BPS
	// Windows: .PSD
	FileType  FileType
	Version   uint16
	Reserved  []byte
	Channels  uint16
	Height    uint32
	Width     uint32
	Depth     uint16
	ColorMode colorMode
}

func (*FileHeader) Inits

func (header *FileHeader) Inits(document *document)

type FileType

type FileType string
const (
	FILETYPE_BBPS FileType = "8BPS"
	FILETYPE_PSB           = "PSB"
)

type ImageData

type ImageData struct {
	CompressionMethod uint16
	Image             *image.RGBA
}

****************************************************************************

*
* Image Data
*
*****************************************************************************

func (*ImageData) Inits

func (img *ImageData) Inits(doc *document, _fileHeader *FileHeader)

#http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_89817

type ImageResources

type ImageResources struct {
	Length            uint32
	ImageResourcesBuf *document
	ImageResource     map[uint16]interface{}
}

func (*ImageResources) Inits

func (imageResources *ImageResources) Inits(doc *document)

type LayerBlendingRangesData

type LayerBlendingRangesData struct {
	LayerBlendingLength uint32

	SourceBlacks []int16
	SourceWhites []int16
	DestBlacks   []int16
	DestWhites   []int16
}

type LayerInfo

type LayerInfo struct {
	Length       uint64
	LayerCount   uint16
	LayerRecords []*LayerRecords
}

func (*LayerInfo) GetImage

func (layer *LayerInfo) GetImage()

type LayerMaskInformation

type LayerMaskInformation struct {
	Length                  uint64
	LayerMaskInformationBuf *document
	LayerInfo               *LayerInfo
}

****************************************************************************

*
* LayerMaskInformation
*
*****************************************************************************

func (*LayerMaskInformation) Inits

func (layreMask *LayerMaskInformation) Inits(doc *document, _fileHeader *FileHeader)

type LayerMaskORAdjustmentLayerData

type LayerMaskORAdjustmentLayerData struct {
	DataSize            uint32
	EnclosingLayerMask  []*Rectangle
	DefaultColor        byte
	Flags               byte
	MaskParameters      byte // Only present if bit 4 of Flags set above.
	MaskParametersValue []byte
	Padding             uint16
	RealFlags           byte
	MaskBackground      byte
}

type LayerRecords

type LayerRecords struct {
	ID                   uint32
	Rectangle            *Rectangle
	ChannelsNumber       uint16
	ChannelInformations  []*ChannelInformation
	BlendModeSignature   string
	BlendModeKey         string
	Opacity              byte
	Clipping             byte
	Flags                byte
	Filler               byte
	ExtraDataFieldLength uint32

	LayerMaskORAdjustmentLayerData *LayerMaskORAdjustmentLayerData
	LayerBlendingRangesData        *LayerBlendingRangesData
	LayerName                      string
	LayerNameSourceSetting         string
	AdditionalLayerInformation     *AdditionalLayerInformation
	VectorOrigination              *DescriptorStructure

	ProtectionFlags  uint32
	Color            *Color
	MetadataSetting  *MetadataSetting
	EffectsLayerInfo *EffectsLayerInfo
	ReferencePoint   []float64
	// contains filtered or unexported fields
}

http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_13084

type ListStructureEntity

type ListStructureEntity struct {
	ItemsNumber    uint32
	DescriptorList []*Descriptor
}

type LongEntity

type LongEntity struct {
	Value uint64
}

type MetadataSetting

type MetadataSetting struct {
	MetadataItemsCount     uint32
	DataSignature          []string
	DataKey                []string
	CopyOnSheetDuplication []byte
	Padding                [][]byte
	DataLength             []uint32
	Data                   [][]byte
}

type OffsetStructureEntity

type OffsetStructureEntity struct {
	Name    string
	ClassID string
	Value   uint32
}

type PropertyStructureEntity

type PropertyStructureEntity struct {
	Name    string
	ClassID string
	KeyId   string
}

type Rectangle

type Rectangle struct {
	Top                 uint32
	Left                uint32
	Bottom              uint32
	Right               uint32
	X, Y, Width, Height uint32
}

type ReferenceStructureEntity

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

type ResourceVersionInfo

type ResourceVersionInfo struct {
	Version           uint32
	HasRealMergedData byte
	WriterName        string
	ReaderName        string
	FileVersion       uint32
}

*

  • 0x0421 1057 (Photoshop 6.0) Version Info. 4 bytes version, 1 byte hasRealMergedData , Unicode string: writer name, Unicode string: reader name, 4 bytes file version.

type SlicesHeader

type SlicesHeader struct {
	Version      uint32
	Top          uint32
	Leftt        uint32
	Bottom       uint32
	Right        uint32
	GroupName    string
	SlicesNumber uint32
}

type SlicesResourceBlock

type SlicesResourceBlock struct {
	ID                  uint32
	GroupId             uint32
	Origin              uint32
	AssociatedLayerID   uint32
	Name                string
	Type                uint32
	Left                uint32
	Top                 uint32
	Right               uint32
	Bottom              uint32
	URL                 string
	Target              string
	Message             string
	AltTag              string
	CellTextIsHTML      bool
	CellText            string
	HorizontalAlignment uint32
	VerticalAlignment   uint32
	AlphaColor          byte
	Red                 byte
	Green               byte
	Blue                byte
	DescriptorVersion   uint32
	// contains filtered or unexported fields
}

type SlicesResourceFormat

type SlicesResourceFormat struct {
	Header *SlicesHeader
	Blocks []*SlicesResourceBlock
}

*

type StringStructureEntity

type StringStructureEntity struct {
	Value string
}

type StructureEntity

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

type UnitFloatStructureEntity

type UnitFloatStructureEntity struct {
	UnitsValue  string
	ActualValue float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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