mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Use affine.ColorM instead of graphics.Matrix
This commit is contained in:
parent
84baee8ca7
commit
d02c67a996
@ -140,9 +140,8 @@ func (i *imageImpl) DrawImage(image *Image, options *DrawImageOptions) error {
|
||||
if i.restorable == nil {
|
||||
return errors.New("ebiten: image is already disposed")
|
||||
}
|
||||
colorm := options.ColorM
|
||||
mode := opengl.CompositeMode(options.CompositeMode)
|
||||
if err := i.restorable.DrawImage(image.impl.restorable, vs, &colorm, mode); err != nil {
|
||||
if err := i.restorable.DrawImage(image.impl.restorable, vs, options.ColorM.impl, mode); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@ -23,13 +23,10 @@ import (
|
||||
"math"
|
||||
"sync"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||
)
|
||||
|
||||
type Matrix interface {
|
||||
Element(i, j int) float64
|
||||
}
|
||||
|
||||
type command interface {
|
||||
Exec(context *opengl.Context, indexOffsetInBytes int) error
|
||||
}
|
||||
@ -185,7 +182,7 @@ type drawImageCommand struct {
|
||||
dst *Image
|
||||
src *Image
|
||||
vertices []int16
|
||||
color Matrix
|
||||
color affine.ColorM
|
||||
mode opengl.CompositeMode
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||
)
|
||||
|
||||
@ -94,7 +95,7 @@ func (i *Image) Fill(clr color.RGBA) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *Image) DrawImage(src *Image, vertices []int16, clr Matrix, mode opengl.CompositeMode) error {
|
||||
func (i *Image) DrawImage(src *Image, vertices []int16, clr affine.ColorM, mode opengl.CompositeMode) error {
|
||||
c := &drawImageCommand{
|
||||
dst: i,
|
||||
src: src,
|
||||
|
@ -17,6 +17,7 @@ package graphics
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||
)
|
||||
|
||||
@ -201,7 +202,7 @@ type programContext struct {
|
||||
context *opengl.Context
|
||||
projectionMatrix []float32
|
||||
texture opengl.Texture
|
||||
colorM Matrix
|
||||
colorM affine.ColorM
|
||||
}
|
||||
|
||||
func (p *programContext) begin() error {
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||
)
|
||||
@ -26,7 +27,7 @@ import (
|
||||
type drawImageHistoryItem struct {
|
||||
image *graphics.Image
|
||||
vertices []int16
|
||||
colorm graphics.Matrix
|
||||
colorm affine.ColorM
|
||||
mode opengl.CompositeMode
|
||||
}
|
||||
|
||||
@ -144,7 +145,7 @@ func (p *Image) ReplacePixels(pixels []uint8) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Image) DrawImage(img *Image, vertices []int16, colorm graphics.Matrix, mode opengl.CompositeMode) error {
|
||||
func (p *Image) DrawImage(img *Image, vertices []int16, colorm affine.ColorM, mode opengl.CompositeMode) error {
|
||||
if img.stale || img.volatile {
|
||||
p.makeStale()
|
||||
} else {
|
||||
@ -156,7 +157,7 @@ func (p *Image) DrawImage(img *Image, vertices []int16, colorm graphics.Matrix,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Image) appendDrawImageHistory(image *graphics.Image, vertices []int16, colorm graphics.Matrix, mode opengl.CompositeMode) {
|
||||
func (p *Image) appendDrawImageHistory(image *graphics.Image, vertices []int16, colorm affine.ColorM, mode opengl.CompositeMode) {
|
||||
if p.stale {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user