Closed hajimehoshi closed 2 years ago
/CC @eihigh
If the composition mode is 'Copy', DrawImage would work as 'ReplacePixels'.
While I can see there are some benefits to setting up a cache, I think the alternative implementation without caching should also be considered. I think simply documenting that using images that are not *ebiten.Image
can fall back to slow paths is acceptable. Users can still create their own *ebiten.Image
s when necessary. This is the same that happens today, albeit with multiple functions (DrawImage
/ Set
/ ReplacePixels
) instead of just one.
The concern is that users might abuse DrawImage with image.Image even though we warn such usages are slow. Actually Set
was used more often than I expected... Set
didn't have such warnings so this was my responsibility, but I think basically we cannot control how often they are used as long as the API is easy to access.
This would contribute to the API's easiness, but make its simplicity worse. This is opposite to my policy unforutnately.
This is still a draft.
*ebiten.Image
cache forimage.Image
*ebiten.Image
as the givenimage.Image
, pick it, callReplacePixels
, and then use it as a rendering sourceReplacePixels
should be called every time even if the image is not modified.*ebiten.Image
*ebiten.Image
objects. If one is too old, dispose it and remove it from the cache.Probably the concern is that this could cause a performance issue that is hard to investigate...