The NEW IMAGE
command allows you to define a memory area where you can
store an image coming from the screen (with the GET IMAGE
command), or
from another graphic resource.
The area must be defined by (constant) width and (constant) height, expressed in pixels. The actual size,
in terms of bytes of RAM, will depend on the graphics mode selected at the time. If it is not
possible to define an image in that screen mode, a specific error will be issued.
Generally speaking, it is not advisable to do a PUT IMAGE
of a NEW IMAGE
that has not
been initialized, at least once, by a GET IMAGE
. Infact, the PUT IMAGE
tries to draw
the contents of an uninitialized frame (i.e.: all zeros), including the palette. So it
could draw everything empty in terms of bitmap, and then overwrites the entire palette
with zeros, giving rise to unexpected result. So you have to use a preliminary GET IMAGE
on any NEW IMAGE
.
If you want to use the PUT IMAGE
without
side effects on palette, you can opt for the PUT BITMAP
. In this case, ugBASIC
will draw only the component related to the pixels, leaving the palette component
unchanged.
= NEW IMAGE( width, height )
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
NEW IMAGE ↔ NwIm
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS