This change adds NewImageWithOptions, that creates a new image with
the given options.
NewImageWithOptions takes image.Rectangle instead of a width and a
height, then a user can create an image with an arbitrary bounds.
A left-upper position can be a negative number.
NewImageWithOptions can create an unmanged image, that is no longer
on an automatic internal texture atlas. A user can have finer controls
over the image.
This change also adds tests for this function.
Updates #2013
Updates #2017
Updates #2124
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.
Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
Note that this applies only to the builtin shaders - interface for Kage stays
unchanged for compatibility.
Minor compatibility delta: when interpolating alpha values, previous code has
created nonsense values, such as, when interpolating from
fully-transparent-black (0,0,0,0) to opaque-white (1,1,1,1), something like
half-transparent-grey (0.25,0.25,0.25,0.5) where half-transparent-white
(0.5,0.5,0.5,0.5) is used by the new code.
I assume this is a strict improvement, however this may warrant some testing.
Possible later improvement could be moving the premultiplication from fragment
shader to CPU. Did not do this as it makes the code rather inconsistent of Kage
vs built-in shader usage.
Updates #1772
image.RGBA64Image aims to get 64bit color values efficiently to avoid
allocating an original color value and converting it to colorRGBA64.
Thus, we should avoid allocating color.RGBA for RGBA64At.
Updates #1769
QuadVertices or verticesBackend.slice reused its backend slice.
This caused a race condition. QuadVertices can be accessed from
multiple goroutines, and resetting the head and copying the data
at internal/graphicscommand might not be synced.
This change fixes this issue by basically reverting
9cb631e30f.
Closes#1546
The last parameter of QuadVertices represents whether we can flush
the backend vertices (on Wasm). The problem was that this was
unexpectedly false even though the image is the screen, when the
screen rendering is done with FilterLinear instead of FilterScreen.
Closes#1479