mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
Add graphicsutil package
This commit is contained in:
parent
d4112004b0
commit
247cd6e1c3
3
image.go
3
image.go
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/internal/affine"
|
"github.com/hajimehoshi/ebiten/internal/affine"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
"github.com/hajimehoshi/ebiten/internal/graphics"
|
||||||
|
"github.com/hajimehoshi/ebiten/internal/graphicsutil"
|
||||||
"github.com/hajimehoshi/ebiten/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/opengl"
|
||||||
"github.com/hajimehoshi/ebiten/internal/restorable"
|
"github.com/hajimehoshi/ebiten/internal/restorable"
|
||||||
)
|
)
|
||||||
@ -416,7 +417,7 @@ func NewImageFromImage(source image.Image, filter Filter) (*Image, error) {
|
|||||||
size := source.Bounds().Size()
|
size := source.Bounds().Size()
|
||||||
checkSize(size.X, size.Y)
|
checkSize(size.X, size.Y)
|
||||||
width, height := size.X, size.Y
|
width, height := size.X, size.Y
|
||||||
rgbaImg := restorable.CopyImage(source)
|
rgbaImg := graphicsutil.CopyImage(source)
|
||||||
p := make([]byte, 4*width*height)
|
p := make([]byte, 4*width*height)
|
||||||
for j := 0; j < height; j++ {
|
for j := 0; j < height; j++ {
|
||||||
copy(p[j*width*4:(j+1)*width*4], rgbaImg.Pix[j*rgbaImg.Stride:])
|
copy(p[j*width*4:(j+1)*width*4], rgbaImg.Pix[j*rgbaImg.Stride:])
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package restorable
|
package graphicsutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
package restorable_test
|
package graphicsutil_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"image"
|
"image"
|
||||||
@ -20,7 +20,7 @@ import (
|
|||||||
"image/color/palette"
|
"image/color/palette"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "github.com/hajimehoshi/ebiten/internal/restorable"
|
. "github.com/hajimehoshi/ebiten/internal/graphicsutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCopyImage(t *testing.T) {
|
func TestCopyImage(t *testing.T) {
|
Loading…
Reference in New Issue
Block a user