Browse Source

Pixelcolor package; More formats

master v0.1.3
maze 11 months ago
parent
commit
33c8c9c52f
9 changed files with 196 additions and 99 deletions
  1. +13
    -11
      draw.go
  2. +12
    -12
      draw_test.go
  3. +4
    -4
      fx.go
  4. +8
    -8
      fx_test.go
  5. +141
    -50
      image.go
  6. +7
    -7
      pixelcolor/color.go
  7. +1
    -1
      pixelcolor/color_test.go
  8. +4
    -0
      pixelcolor/doc.go
  9. +6
    -6
      pixeleffect/fade.go

+ 13
- 11
draw.go View File

@ -4,22 +4,24 @@ import (
"encoding/binary"
"image"
"image/color"
"maze.io/x/pixel/pixelcolor"
)
func Fill(b Image, c color.Color) {
switch b := b.(type) {
case *Bitmap:
if toBit(c) {
if pixelcolor.ToBit(c) {
memset(b.Pix, 0xff)
} else {
memset(b.Pix, 0x00)
}
case *RGB565Image:
case *RGB565:
var v [2]byte
binary.BigEndian.PutUint16(v[:], uint16(toRGB565(c)))
binary.BigEndian.PutUint16(v[:], uint16(pixelcolor.ToRGB565(c)))
memsetSlice(b.Pix, v[:])
case *RGB888Image:
v := toRGB888(c)
case *RGB888:
v := pixelcolor.ToRGB888(c)
memsetSlice(b.Pix, []byte{v.R, v.G, v.B})
default:
// Naive and slow set pixel implementation.
@ -43,7 +45,7 @@ func fillRectangle(b Image, x, y, width, height int, c color.Color) {
switch b.Format {
case MHMSBFormat:
var v byte
if toBit(c) {
if pixelcolor.ToBit(c) {
v = 0x01
}
for xx := x; xx < x+width; xx++ {
@ -57,7 +59,7 @@ func fillRectangle(b Image, x, y, width, height int, c color.Color) {
case MVLSBFormat:
var v byte
if toBit(c) {
if pixelcolor.ToBit(c) {
v = 0x01
}
for ; height > 0; height, y = height-1, y+1 {
@ -72,12 +74,12 @@ func fillRectangle(b Image, x, y, width, height int, c color.Color) {
default:
}
case *RGB565Image:
case *RGB565:
var (
r = b.Bounds()
xe = min(x+width, r.Max.X)
ye = min(y+height, r.Max.Y)
c = toRGB565(c)
c = pixelcolor.ToRGB565(c)
v [2]byte
)
binary.BigEndian.PutUint16(v[:], uint16(c))
@ -86,12 +88,12 @@ func fillRectangle(b Image, x, y, width, height int, c color.Color) {
memsetSlice(b.Pix[o:o+(xe-x)*2], v[:])
}
case *RGB888Image:
case *RGB888:
var (
r = b.Bounds()
xe = min(x+width, r.Max.X)
ye = min(y+height, r.Max.Y)
v = toRGB888(c)
v = pixelcolor.ToRGB888(c)
)
for ; y < ye; y++ {
o := y*b.Stride + x*3


+ 12
- 12
draw_test.go View File

@ -25,7 +25,7 @@ func TestFill(t *testing.T) {
},
{
NewRGB565(5, 5),
&RGB565Image{
&RGB565{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x55, 0x5f, 0x55, 0x5f, 0x55, 0x5f, 0x55, 0x5f, 0x55, 0x5f,
@ -39,7 +39,7 @@ func TestFill(t *testing.T) {
},
{
NewRGB888(3, 3),
&RGB888Image{
&RGB888{
Rect: image.Rectangle{Max: image.Point{X: 3, Y: 3}},
Pix: []byte{
0x55, 0xaa, 0xff, 0x55, 0xaa, 0xff, 0x55, 0xaa, 0xff,
@ -85,7 +85,7 @@ func TestFillRectangle(t *testing.T) {
},
{
NewRGB565(5, 5),
&RGB565Image{
&RGB565{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x55, 0x5f, 0x55, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -99,7 +99,7 @@ func TestFillRectangle(t *testing.T) {
},
{
NewRGB888(3, 3),
&RGB888Image{
&RGB888{
Rect: image.Rectangle{Max: image.Point{X: 3, Y: 3}},
Pix: []byte{
0x55, 0xaa, 0xff, 0x55, 0xaa, 0xff, 0x00, 0x00, 0x00,
@ -145,7 +145,7 @@ func TestHLine(t *testing.T) {
},
{
NewRGB565(5, 5),
&RGB565Image{
&RGB565{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -159,7 +159,7 @@ func TestHLine(t *testing.T) {
},
{
NewRGB888(5, 5),
&RGB888Image{
&RGB888{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -207,7 +207,7 @@ func TestVLine(t *testing.T) {
},
{
NewRGB565(5, 5),
&RGB565Image{
&RGB565{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -221,7 +221,7 @@ func TestVLine(t *testing.T) {
},
{
NewRGB888(5, 5),
&RGB888Image{
&RGB888{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -269,7 +269,7 @@ func TestLine(t *testing.T) {
},
{
NewRGB565(5, 5),
&RGB565Image{
&RGB565{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -283,7 +283,7 @@ func TestLine(t *testing.T) {
},
{
NewRGB888(5, 5),
&RGB888Image{
&RGB888{
Rect: image.Rectangle{Max: image.Point{X: 5, Y: 5}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -331,7 +331,7 @@ func TestCircle(t *testing.T) {
},
{
NewRGB565(8, 8),
&RGB565Image{
&RGB565{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -348,7 +348,7 @@ func TestCircle(t *testing.T) {
},
{
NewRGB888(8, 8),
&RGB888Image{
&RGB888{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,


+ 4
- 4
fx.go View File

@ -59,11 +59,11 @@ func ScrollUp(b Image) {
copy(b.Pix, b.Pix[b.Stride:])
l := len(b.Pix)
zeroRange(b.Pix, l-b.Stride, l)
case *RGB565Image:
case *RGB565:
copy(b.Pix, b.Pix[b.Stride:])
l := len(b.Pix)
zeroRange(b.Pix, l-b.Stride, l)
case *RGB888Image:
case *RGB888:
copy(b.Pix, b.Pix[b.Stride:])
l := len(b.Pix)
zeroRange(b.Pix, l-b.Stride, l)
@ -75,10 +75,10 @@ func ScrollDown(b Image) {
case *Bitmap:
copy(b.Pix[b.Stride:], b.Pix)
zeroRange(b.Pix, 0, b.Stride)
case *RGB565Image:
case *RGB565:
copy(b.Pix[b.Stride:], b.Pix)
zeroRange(b.Pix, 0, b.Stride)
case *RGB888Image:
case *RGB888:
copy(b.Pix[b.Stride:], b.Pix)
zeroRange(b.Pix, 0, b.Stride)
}


+ 8
- 8
fx_test.go View File

@ -25,7 +25,7 @@ func TestScrollUp(t *testing.T) {
},
},
{
Test: &RGB565Image{
Test: &RGB565{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -40,7 +40,7 @@ func TestScrollUp(t *testing.T) {
},
Stride: 8 * 2,
},
Want: &RGB565Image{
Want: &RGB565{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -57,7 +57,7 @@ func TestScrollUp(t *testing.T) {
},
},
{
Test: &RGB888Image{
Test: &RGB888{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -72,7 +72,7 @@ func TestScrollUp(t *testing.T) {
},
Stride: 8 * 3,
},
Want: &RGB888Image{
Want: &RGB888{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -118,7 +118,7 @@ func TestScrollDown(t *testing.T) {
},
},
{
Test: &RGB565Image{
Test: &RGB565{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -133,7 +133,7 @@ func TestScrollDown(t *testing.T) {
},
Stride: 8 * 2,
},
Want: &RGB565Image{
Want: &RGB565{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -150,7 +150,7 @@ func TestScrollDown(t *testing.T) {
},
},
{
Test: &RGB888Image{
Test: &RGB888{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@ -165,7 +165,7 @@ func TestScrollDown(t *testing.T) {
},
Stride: 8 * 3,
},
Want: &RGB888Image{
Want: &RGB888{
Rect: image.Rectangle{Max: image.Point{X: 8, Y: 8}},
Pix: []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,


+ 141
- 50
image.go View File

@ -6,6 +6,8 @@ import (
"image"
"image/color"
"image/draw"
"maze.io/x/pixel/pixelcolor"
)
type Format int
@ -14,18 +16,27 @@ const (
UnknownFormat Format = iota
MHMSBFormat
MVLSBFormat
RGB332Format
RGB565Format
RGB888Format
RGBA4444Format
RGBA5551Format
)
func (f Format) ColorModel() color.Model {
switch f {
case MHMSBFormat, MVLSBFormat:
return BitModel
return pixelcolor.BitModel
case RGB332Format:
return pixelcolor.RGB332Model
case RGB565Format:
return RGB565Model
return pixelcolor.RGB565Model
case RGB888Format:
return RGB888Model
return pixelcolor.RGB888Model
case RGBA4444Format:
return pixelcolor.RGBA4444Model
case RGBA5551Format:
return pixelcolor.RGBA5551Model
default:
return color.RGBAModel
}
@ -68,13 +79,13 @@ func (b *Bitmap) Bounds() image.Rectangle {
func (b *Bitmap) At(x, y int) color.Color {
if x < 0 || y < 0 || x >= b.Rect.Max.X || y >= b.Rect.Max.Y {
return Off
return pixelcolor.Off
}
offset, mask := b.PixOffset(x, y)
if offset >= len(b.Pix) {
return Off
return pixelcolor.Off
}
return Bit(b.Pix[offset]&byte(mask) != 0)
return pixelcolor.Bit(b.Pix[offset]&byte(mask) != 0)
}
func (b *Bitmap) PixOffset(x, y int) (int, uint) {
@ -89,10 +100,10 @@ func (b *Bitmap) PixOffset(x, y int) (int, uint) {
}
func (b *Bitmap) Set(x, y int, c color.Color) {
b.SetBit(x, y, toBit(c))
b.SetBit(x, y, pixelcolor.ToBit(c))
}
func (b *Bitmap) SetBit(x, y int, c Bit) {
func (b *Bitmap) SetBit(x, y int, c pixelcolor.Bit) {
offset, mask := b.PixOffset(x, y)
if offset < 0 || offset >= len(b.Pix) {
return
@ -104,128 +115,202 @@ func (b *Bitmap) SetBit(x, y int, c Bit) {
}
}
type RGBImage struct {
type RGB332 struct {
Rect image.Rectangle
Pix []byte
Stride int
}
type RGB332Image struct {
Rect image.Rectangle
Pix []byte
Stride int
}
func (b *RGB332Image) Bounds() image.Rectangle {
func (b *RGB332) Bounds() image.Rectangle {
return b.Rect
}
func (b *RGB332Image) At(x, y int) color.Color {
func (b *RGB332) At(x, y int) color.Color {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return RGB332(0)
return pixelcolor.RGB332(0)
}
return RGB332(b.Pix[y*b.Stride+x])
return pixelcolor.RGB332(b.Pix[y*b.Stride+x])
}
func (b *RGB332Image) Set(x, y int, c color.Color) {
func (b *RGB332) Set(x, y int, c color.Color) {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return
}
b.Pix[y*b.Stride+x] = byte(toRGB332(c))
b.Pix[y*b.Stride+x] = byte(pixelcolor.ToRGB332(c))
}
func (RGB332Image) ColorModel() color.Model {
return RGB332Model
func (RGB332) ColorModel() color.Model {
return pixelcolor.RGB332Model
}
func NewRGB332(w, h int) *RGB332Image {
return &RGB332Image{
func NewRGB332(w, h int) *RGB332 {
return &RGB332{
Rect: image.Rectangle{Max: image.Point{X: w, Y: h}},
Stride: w,
Pix: make([]byte, w*h),
}
}
type RGB565Image struct {
type RGB565 struct {
Rect image.Rectangle
Pix []byte
Stride int
}
func (b *RGB565Image) Bounds() image.Rectangle {
func (b *RGB565) Bounds() image.Rectangle {
return b.Rect
}
func (b *RGB565Image) At(x, y int) color.Color {
func (b *RGB565) At(x, y int) color.Color {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return RGB565(0)
return pixelcolor.RGB565(0)
}
return RGB565(binary.BigEndian.Uint16(b.Pix[b.OffsetOf(x, y):]))
return pixelcolor.RGB565(binary.BigEndian.Uint16(b.Pix[b.OffsetOf(x, y):]))
}
func (b *RGB565Image) Set(x, y int, c color.Color) {
func (b *RGB565) Set(x, y int, c color.Color) {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return
}
binary.BigEndian.PutUint16(b.Pix[b.OffsetOf(x, y):], uint16(toRGB565(c)))
binary.BigEndian.PutUint16(b.Pix[b.OffsetOf(x, y):], uint16(pixelcolor.ToRGB565(c)))
}
func (b *RGB565Image) OffsetOf(x, y int) (offset int) {
func (b *RGB565) OffsetOf(x, y int) (offset int) {
return y*b.Stride + x*2
}
func (RGB565Image) ColorModel() color.Model {
return RGB565Model
func (RGB565) ColorModel() color.Model {
return pixelcolor.RGB565Model
}
func NewRGB565(w, h int) *RGB565Image {
return &RGB565Image{
func NewRGB565(w, h int) *RGB565 {
return &RGB565{
Rect: image.Rectangle{Max: image.Point{X: w, Y: h}},
Pix: make([]byte, w*h*2),
Stride: w * 2,
}
}
type RGB888Image struct {
type RGB888 struct {
Rect image.Rectangle
Pix []byte
Stride int
}
func NewRGB888(w, h int) *RGB888Image {
return &RGB888Image{
func (b *RGB888) Bounds() image.Rectangle {
return b.Rect
}
func (b *RGB888) At(x, y int) color.Color {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return color.Black
}
v := b.Pix[b.OffsetOf(x, y):]
return pixelcolor.RGB888{v[0], v[1], v[2]}
}
func (b *RGB888) Set(x, y int, c color.Color) {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return
}
v := pixelcolor.ToRGB888(c)
copy(b.Pix[b.OffsetOf(x, y):], []byte{v.R, v.G, v.B})
}
func (b *RGB888) OffsetOf(x, y int) (offset int) {
return y*b.Stride + x*3
}
func (b *RGB888) ColorModel() color.Model {
return pixelcolor.RGB888Model
}
func NewRGB888(w, h int) *RGB888 {
return &RGB888{
Rect: image.Rectangle{Max: image.Point{X: w, Y: h}},
Pix: make([]byte, w*h*3),
Stride: w * 3,
}
}
func (b *RGB888Image) Bounds() image.Rectangle {
type RGBA4444 struct {
Rect image.Rectangle
Pix []byte
Stride int
}
func (b *RGBA4444) Bounds() image.Rectangle {
return b.Rect
}
func (b *RGB888Image) At(x, y int) color.Color {
func (b *RGBA4444) At(x, y int) color.Color {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return color.Black
}
v := b.Pix[b.OffsetOf(x, y):]
return RGB888{v[0], v[1], v[2]}
return pixelcolor.RGBA4444(binary.BigEndian.Uint16(b.Pix[b.OffsetOf(x, y):]))
}
func (b *RGB888Image) Set(x, y int, c color.Color) {
func (b *RGBA4444) Set(x, y int, c color.Color) {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return
}
v := toRGB888(c)
copy(b.Pix[b.OffsetOf(x, y):], []byte{v.R, v.G, v.B})
binary.BigEndian.PutUint16(b.Pix[b.OffsetOf(x, y):], uint16(pixelcolor.ToRGBA4444(c)))
}
func (b *RGBA4444) OffsetOf(x, y int) (offset int) {
return y*b.Stride + x*3
}
func (b *RGBA4444) ColorModel() color.Model {
return pixelcolor.RGBA4444Model
}
func NewRGBA4444(w, h int) *RGBA4444 {
return &RGBA4444{
Rect: image.Rectangle{Max: image.Point{X: w, Y: h}},
Pix: make([]byte, w*h*2),
Stride: w * 2,
}
}
type RGBA5551 struct {
Rect image.Rectangle
Pix []byte
Stride int
}
func (b *RGBA5551) Bounds() image.Rectangle {
return b.Rect
}
func (b *RGB888Image) OffsetOf(x, y int) (offset int) {
func (b *RGBA5551) At(x, y int) color.Color {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return color.Black
}
return pixelcolor.RGBA5551(binary.BigEndian.Uint16(b.Pix[b.OffsetOf(x, y):]))
}
func (b *RGBA5551) Set(x, y int, c color.Color) {
if !(image.Point{X: x, Y: y}).In(b.Rect) {
return
}
binary.BigEndian.PutUint16(b.Pix[b.OffsetOf(x, y):], uint16(pixelcolor.ToRGBA5551(c)))
}
func (b *RGBA5551) OffsetOf(x, y int) (offset int) {
return y*b.Stride + x*3
}
func (b *RGB888Image) ColorModel() color.Model {
return RGB888Model
func (b *RGBA5551) ColorModel() color.Model {
return pixelcolor.RGBA5551Model
}
func NewRGBA5551(w, h int) *RGBA5551 {
return &RGBA5551{
Rect: image.Rectangle{Max: image.Point{X: w, Y: h}},
Pix: make([]byte, w*h*2),
Stride: w * 2,
}
}
func New(width, height int, format Format) (Image, error) {
@ -234,10 +319,16 @@ func New(width, height int, format Format) (Image, error) {
b := NewBitmap(width, height)
b.Format = format
return b, nil
case RGB332Format:
return NewRGB332(width, height), nil
case RGB565Format:
return NewRGB565(width, height), nil
case RGB888Format:
return NewRGB888(width, height), nil
case RGBA4444Format:
return NewRGBA4444(width, height), nil
case RGBA5551Format:
return NewRGBA5551(width, height), nil
default:
return nil, errors.New("framebuffer: invalid format")
}


color.go → pixelcolor/color.go View File


color_test.go → pixelcolor/color_test.go View File


+ 4
- 0
pixelcolor/doc.go View File

@ -0,0 +1,4 @@
/*
Package pixelcolor contains common color formats.
*/
package pixelcolor

+ 6
- 6
pixeleffect/fade.go View File

@ -204,10 +204,10 @@ func FadeOutShift(duration time.Duration, im pixel.Image) <-chan time.Time {
close(signal)
return signal
case *pixel.RGB565Image:
case *pixel.RGB565:
return repeatWithin(duration, shiftRightRGB565MaxSteps, func(_ int) { shiftRightRGB565(im) })
case *pixel.RGB888Image:
case *pixel.RGB888:
return repeatWithin(duration, shiftRightRGB888MaxSteps, func(_ int) { shiftRightRGB888(im) })
default:
@ -220,10 +220,10 @@ func ShiftRight(im pixel.Image) {
case *pixel.Bitmap:
// Pointless, ignored.
case *pixel.RGB565Image:
case *pixel.RGB565:
shiftRightRGB565(im)
case *pixel.RGB888Image:
case *pixel.RGB888:
shiftRightRGB888(im)
default:
@ -247,7 +247,7 @@ func shiftRightRGB(im pixel.Image) {
}
}
func shiftRightRGB565(im *pixel.RGB565Image) {
func shiftRightRGB565(im *pixel.RGB565) {
for i, l := 0, len(im.Pix); i < l; i += 2 {
var (
hi = im.Pix[i+0]
@ -263,7 +263,7 @@ func shiftRightRGB565(im *pixel.RGB565Image) {
}
}
func shiftRightRGB888(im *pixel.RGB888Image) {
func shiftRightRGB888(im *pixel.RGB888) {
for i, l := 0, len(im.Pix); i < l; i += 3 {
im.Pix[i+0] >>= 1
im.Pix[i+1] >>= 1


Loading…
Cancel
Save