go_bitmap

package module
v0.0.0-...-22b8c80 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 9 Imported by: 0

README

go-bitmap

RLE Decompression and RDP6.0 bitmap Decompression

Documentation

Index

Constants

View Source
const (

	// opcode>>=5,count=opcode&0x1F:input[0]+32
	REGULAR_BG_RUN      = 0x00 // opcode=FILL
	REGULAR_FG_RUN      = 0x01 // opcode=MIX
	REGULAR_FGBG_IMAGE  = 0x02 // count=(code&0xF)<<3:input[0]+1,opcode=FOM
	REGULAR_COLOR_RUN   = 0x03 // opcode=COLOR
	REGULAR_COLOR_IMAGE = 0x04 // opcode=COPY

	// >> shift >> 4
	LITE_SET_FG_FG_RUN     = 0x0C // count=code&0xF:count=input[0]+16,opcode=MIX_SET
	LITE_SET_FG_FGBG_IMAGE = 0x0D // count=(code&0xF)<<3:input[0]+1,opcode=FOM_SET
	LITE_DITHERED_RUN      = 0x0E // count=code&0xF:count=input[0]+16,opcode=BICOLOR

	// no >> shift
	MEGA_MEGA_BG_RUN         = 0xF0 // count=input[0]|(input[1]<<8),opcode=FILL
	MEGA_MEGA_FG_RUN         = 0xF1 // count=input[0]|(input[1]<<8),opcode=MIX
	MEGA_MEGA_FGBG_IMAGE     = 0xF2 // count=input[0]|(input[1]<<8),opcode=FOM
	MEGA_MEGA_COLOR_RUN      = 0xF3 // count=input[0]|(input[1]<<8),opcode=COLOR
	MEGA_MEGA_COLOR_IMAGE    = 0xF4 // count=input[0]|(input[1]<<8),opcode=COPY
	MEGA_MEGA_SET_FG_RUN     = 0xF6 // count=input[0]|(input[1]<<8),opcode=MIX_SET
	MEGA_MEGA_SET_FGBG_IMAGE = 0xF7 // count=input[0]|(input[1]<<8),opcode=FOM_SET
	MEGA_MEGA_DITHERED_RUN   = 0xF8 // count=input[0]|(input[1]<<8),opcode=BICOLOR,input=2
	SPECIAL_FGBG_1           = 0xF9 // count=8,opcode=SPECIAL_FGBG_1
	SPECIAL_FGBG_2           = 0xFA // count=8,opcode=SPECIAL_FGBG_2
	SPECIAL_WHITE            = 0xFD // count=1,opcode=WHITE
	SPECIAL_BLACK            = 0xFE // count=1,opcode=BLACK
)

Variables

This section is empty.

Functions

func ReadByte

func ReadByte(r io.Reader) byte

func ReadBytes

func ReadBytes(r io.Reader, length int) []byte

func ReadIntLE

func ReadIntLE(r io.Reader) uint32

func ReadShortLE

func ReadShortLE(r io.Reader) uint16

func ThrowError

func ThrowError(e any)

func Throwf

func Throwf(format string, e ...any)

func Try

func Try(f func()) error

func TryCatch

func TryCatch(f func(), catch func(e any))

func WriteByte

func WriteByte(w io.Writer, b byte)

func WriteBytes

func WriteBytes(w io.Writer, data []byte)

func WriteShortLE

func WriteShortLE(w io.Writer, b uint16)

Types

type BitMap

type BitMap struct {
	Image image.Image
}

func NewBitMapFromRDP6

func NewBitMapFromRDP6(option *Option) *BitMap

func NewBitmapFromPlain

func NewBitmapFromPlain(option *Option) *BitMap

func NewBitmapFromRLE

func NewBitmapFromRLE(option *Option) *BitMap

func (*BitMap) LoadPlain

func (m *BitMap) LoadPlain(option *Option) *BitMap

func (*BitMap) LoadRDP60

func (m *BitMap) LoadRDP60(option *Option) *BitMap

func (*BitMap) LoadRLE

func (m *BitMap) LoadRLE(option *Option) *BitMap

LoadRLE 加载RLE格式的Bitmap数据

func (*BitMap) ToPng

func (m *BitMap) ToPng() []byte

type Option

type Option struct {
	Top         int    `json:"top"`
	Left        int    `json:"left"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	BitPerPixel int    `json:"-"`
	Data        []byte `json:"-"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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