mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-24 08:12:38 +02:00
Rename color to rgbColor to not conflict with image/color
This commit is contained in:
parent
ed795675be
commit
165ae18d87
@ -817,7 +817,7 @@ func vipsSmartCrop(img **C.struct__VipsImage, width, height int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func vipsFlatten(img **C.struct__VipsImage, bg color) error {
|
||||
func vipsFlatten(img **C.struct__VipsImage, bg rgbColor) error {
|
||||
var tmp *C.struct__VipsImage
|
||||
|
||||
if C.vips_flatten_go(*img, &tmp, C.double(bg.R), C.double(bg.G), C.double(bg.B)) != 0 {
|
||||
|
@ -98,7 +98,7 @@ var resizeTypes = map[string]resizeType{
|
||||
"crop": resizeCrop,
|
||||
}
|
||||
|
||||
type color struct{ R, G, B uint8 }
|
||||
type rgbColor struct{ R, G, B uint8 }
|
||||
|
||||
var hexColorRegex = regexp.MustCompile("^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$")
|
||||
|
||||
@ -127,7 +127,7 @@ type processingOptions struct {
|
||||
Format imageType
|
||||
Quality int
|
||||
Flatten bool
|
||||
Background color
|
||||
Background rgbColor
|
||||
Blur float32
|
||||
Sharpen float32
|
||||
|
||||
@ -197,8 +197,8 @@ func (po *processingOptions) presetUsed(name string) {
|
||||
po.UsedPresets = append(po.UsedPresets, name)
|
||||
}
|
||||
|
||||
func colorFromHex(hexcolor string) (color, error) {
|
||||
c := color{}
|
||||
func colorFromHex(hexcolor string) (rgbColor, error) {
|
||||
c := rgbColor{}
|
||||
|
||||
if !hexColorRegex.MatchString(hexcolor) {
|
||||
return c, fmt.Errorf("Invalid hex color: %s", hexcolor)
|
||||
@ -730,7 +730,7 @@ func defaultProcessingOptions(headers *processingHeaders) (*processingOptions, e
|
||||
Enlarge: false,
|
||||
Quality: conf.Quality,
|
||||
Format: imageTypeUnknown,
|
||||
Background: color{255, 255, 255},
|
||||
Background: rgbColor{255, 255, 255},
|
||||
Blur: 0,
|
||||
Sharpen: 0,
|
||||
Dpr: 1,
|
||||
|
4
svg.go
4
svg.go
@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"image"
|
||||
goColor "image/color"
|
||||
"image/color"
|
||||
"io"
|
||||
)
|
||||
|
||||
@ -16,7 +16,7 @@ func init() {
|
||||
return image.NewRGBA(image.Rect(0, 0, 1, 1)), nil
|
||||
},
|
||||
func(io.Reader) (image.Config, error) {
|
||||
return image.Config{ColorModel: goColor.RGBAModel, Width: 1, Height: 1}, nil
|
||||
return image.Config{ColorModel: color.RGBAModel, Width: 1, Height: 1}, nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
6
webp.go
6
webp.go
@ -9,7 +9,7 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"image"
|
||||
goColor "image/color"
|
||||
"image/color"
|
||||
"io"
|
||||
|
||||
"golang.org/x/image/riff"
|
||||
@ -69,7 +69,7 @@ func decodeWebpConfig(r io.Reader) (image.Config, error) {
|
||||
fh, err := d.DecodeFrameHeader()
|
||||
|
||||
return image.Config{
|
||||
ColorModel: goColor.YCbCrModel,
|
||||
ColorModel: color.YCbCrModel,
|
||||
Width: fh.Width,
|
||||
Height: fh.Height,
|
||||
}, err
|
||||
@ -96,7 +96,7 @@ func decodeWebpConfig(r io.Reader) (image.Config, error) {
|
||||
heightMinusOne := uint32(buf[7]) | uint32(buf[8])<<8 | uint32(buf[9])<<16
|
||||
|
||||
return image.Config{
|
||||
ColorModel: goColor.NYCbCrAModel,
|
||||
ColorModel: color.NYCbCrAModel,
|
||||
Width: int(widthMinusOne) + 1,
|
||||
Height: int(heightMinusOne) + 1,
|
||||
}, nil
|
||||
|
Loading…
Reference in New Issue
Block a user