wzx

package
v0.0.0-...-66ba032 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

解析 mir 使用的 圖像資源 wix wil/wzx wzl

Index

Constants

View Source
const (
	//bitmap 16 565
	COLOR_DEPTH_16_565 = 65536 //wil 標記
	DEPTH_16_565       = 0x105 //wzl 標記
	//bitmap 256
	COLOR_DEPTH_256 = 256   //wil 標記
	DEPTH_256       = 0x103 //wzl 標記

	//wix wil
	TYPE_WIX = 1
	//wzx wzl
	TYPE_WZX = 2
	//自定義 擴展格式 可用值
	TYPE_USER = 1000
)

Variables

View Source
var Palette = [...]byte{}/* 1024 elements not displayed */
View Source
var Palette565 = [12]byte{0x0, 0xF8, 0x0, 0x0,
	0xE0, 0x07, 0x0, 0x0,
	0x1F, 0x0, 0x0, 0x0,
}

Functions

func RegisterParser

func RegisterParser(t int, parser Parser)

註冊 資源 解析器

Types

type Bmp

type Bmp struct {
	Width  uint16
	Height uint16
	Sign   uint32

	Data []byte
}

位圖 img

func (*Bmp) Destory

func (i *Bmp) Destory()

銷毀 資源

func (*Bmp) GetData

func (i *Bmp) GetData() ([]byte, error)

func (*Bmp) GetSign

func (i *Bmp) GetSign() uint32

func (*Bmp) GetSize

func (i *Bmp) GetSize() (uint16, uint16)

type BmpHeader

type BmpHeader struct {
	//bm 標記 0x42 0x4D
	Flag [2]byte

	//檔案大小
	Size uint32

	//保留位 爲0
	Reserved1 uint16

	//保留位 爲0
	Reserved2 uint16

	//位圖數據 相對os.SEEK_SET 偏移
	Pos uint32
}

位圖頭信息

func (*BmpHeader) ToBinary

func (h *BmpHeader) ToBinary() []byte

type BmpInfo

type BmpInfo struct {
	//BmpInfo 結構大小 故 爲40
	Size uint32

	//圖像寬度
	Width uint32
	//圖像高度
	Height uint32

	//平面數 固定爲1
	Planes uint16

	//bit 數 2 4 8 16 24 32
	BitCount uint16

	//是否 壓縮
	//0	RI_RGB		不壓縮
	//1	RI_RLE8	8bit 編碼時 使用 rle算法
	//2	RI_RLE4	4bit 編碼時 使用 rle算法
	//3	RI_BITFIElDS	16/32 bit
	//4	RI_JPEG	包含 jpeg 圖像
	//5	RI_PNG		包含 png 圖像
	Compression uint32
	//圖像數據大小 biCompression爲RI_RGB時 此值可爲0
	SizeImage uint32

	//水平分辨率
	XPelsPerMeter uint32
	//垂直分辨率
	YPelsPerMeter uint32

	//調色板中顏色 使用數 爲0 全部使用
	ClrUsed uint32
	//重要顏色 索引數 爲0 全部重要
	ClrImportant uint32
}

位圖詳情

func (*BmpInfo) ToBinary

func (i *BmpInfo) ToBinary() []byte

type Img

type Img interface {
	GetSize() (uint16, uint16)
	GetSign() uint32
	GetData() ([]byte, error)

	//銷毀 資源
	Destory()
}

type Parser

type Parser interface {
	NewSource(t int, xPath, lPath string) (Source, error)
}

檔案 解析器定義

type Source

type Source interface {
	//返回 資源類型
	GetType() int

	//返回 圖像數量
	GetSize() int
	//返回 圖像偏移
	GetPos(i int) (int64, error)

	//返回 圖像 數據
	GetImg(i int) (Img, error)

	//銷毀 圖像 緩存數據
	ClearData(i int)

	//銷毀 資源
	Destory()
}

資源定義

func NewSource

func NewSource(t int, xPath, lPath string) (Source, error)

創建一個 資源 檔案

Jump to

Keyboard shortcuts

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