imagequant: define more consts, move const definitions near their callers

This commit is contained in:
mappu 2016-11-24 20:53:18 +13:00
parent 40cdd10721
commit 0f93198ae1
2 changed files with 16 additions and 6 deletions

View File

@ -23,6 +23,11 @@ func NewAttributes() (*Attributes, error) {
return &Attributes{p: pAttr}, nil return &Attributes{p: pAttr}, nil
} }
const (
COLORS_MIN = 2
COLORS_MAX = 256
)
func (this *Attributes) SetMaxColors(colors int) error { func (this *Attributes) SetMaxColors(colors int) error {
return translateError(C.liq_set_max_colors(this.p, C.int(colors))) return translateError(C.liq_set_max_colors(this.p, C.int(colors)))
} }
@ -31,6 +36,11 @@ func (this *Attributes) GetMaxColors() int {
return int(C.liq_get_max_colors(this.p)) return int(C.liq_get_max_colors(this.p))
} }
const (
QUALITY_MIN = 0
QUALITY_MAX = 100
)
func (this *Attributes) SetQuality(minimum, maximum int) error { func (this *Attributes) SetQuality(minimum, maximum int) error {
return translateError(C.liq_set_quality(this.p, C.int(minimum), C.int(maximum))) return translateError(C.liq_set_quality(this.p, C.int(minimum), C.int(maximum)))
} }
@ -43,6 +53,12 @@ func (this *Attributes) GetMaxQuality() int {
return int(C.liq_get_max_quality(this.p)) return int(C.liq_get_max_quality(this.p))
} }
const (
SPEED_SLOWEST = 1
SPEED_DEFAULT = 3
SPEED_FASTEST = 10
)
func (this *Attributes) SetSpeed(speed int) error { func (this *Attributes) SetSpeed(speed int) error {
return translateError(C.liq_set_speed(this.p, C.int(speed))) return translateError(C.liq_set_speed(this.p, C.int(speed)))
} }

View File

@ -58,9 +58,3 @@ func GetLibraryVersion() int {
func GetLibraryVersionString() string { func GetLibraryVersionString() string {
return C.GoString(C.liqVersionString()) return C.GoString(C.liqVersionString())
} }
const (
SPEED_SLOWEST = 1
SPEED_DEFAULT = 3
SPEED_FASTEST = 10
)