How do I paint a shape?
#4
You can do the painting right on the default screen or on a work screen.

Try not to think in terms of needing to paint the object. Many times I'll simply paint an entire work screen, draw my object, then paint OUTSIDE the object to get the effect I need. Code below shows a few examples:

Code: (Select All)
SCREEN _NEWIMAGE(1200, 820, 32)

' Do the painting on the default screen (_DEST 0)

CLS , _RGB32(255, 0, 0) '            paint the entire screen first
DIM colr AS _UNSIGNED LONG: colr = _RGB(255, 0, 0)
colr = _RGB(0, 255, 255)
PSET (500, 300): DRAW "C" + STR$(colr) + "R100F100D100G100L100H100U100E100"
PAINT (0, 0), _RGB32(0, 0, 0), colr ' paint the screen black until cyan is met

SLEEP

' Do the painting on a work screen that gets copied to the default screen.

CLS
PRINT
PRINT " This is the default screen _DEST 0"
PRINT " The work screen will not wipe this text out"
WorkScreen& = _NEWIMAGE(1200, 820, 32)
_DEST WorkScreen& '                  all graphics command sent to work screen
CLS , _RGB32(255, 0, 0) '            paint the entire work screen first
PSET (500, 300): DRAW "C" + STR$(colr) + "R100F100D100G100L100H100U100E100"
PAINT (0, 0), _RGB32(0, 0, 0), colr ' paint the work screen black until colr met
_CLEARCOLOR _RGB32(0, 0, 0) '        make black on the work screen transparent
_DEST 0 '                            go back to default screen
_PUTIMAGE , WorkScreen&, 0 '          copy the work screen to the default screen
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply


Messages In This Thread
How do I paint a shape? - by PhilOfPerth - 06-27-2023, 08:00 AM
RE: How do I paint a shape? - by mnrvovrfc - 06-27-2023, 10:54 AM
RE: How do I paint a shape? - by OldMoses - 06-27-2023, 11:22 AM
RE: How do I paint a shape? - by TerryRitchie - 06-27-2023, 11:56 AM
RE: How do I paint a shape? - by bplus - 06-27-2023, 12:26 PM
RE: How do I paint a shape? - by Petr - 06-27-2023, 02:05 PM
RE: How do I paint a shape? - by Petr - 06-27-2023, 02:19 PM
RE: How do I paint a shape? - by PhilOfPerth - 06-28-2023, 05:20 AM
RE: How do I paint a shape? - by mnrvovrfc - 06-28-2023, 07:13 PM
RE: How do I paint a shape? - by Petr - 06-27-2023, 02:39 PM
RE: How do I paint a shape? - by TempodiBasic - 06-28-2023, 12:19 AM
RE: How do I paint a shape? - by PhilOfPerth - 06-28-2023, 05:36 AM
RE: How do I paint a shape? - by bplus - 06-28-2023, 01:29 AM
RE: How do I paint a shape? - by mnrvovrfc - 06-28-2023, 02:08 AM
RE: How do I paint a shape? - by PhilOfPerth - 06-28-2023, 05:04 AM
RE: How do I paint a shape? - by bplus - 06-28-2023, 02:16 AM
RE: How do I paint a shape? - by mnrvovrfc - 06-28-2023, 02:50 AM
RE: How do I paint a shape? - by bplus - 06-28-2023, 03:03 AM
RE: How do I paint a shape? - by bplus - 06-28-2023, 02:30 AM
RE: How do I paint a shape? - by PhilOfPerth - 06-28-2023, 05:03 AM
RE: How do I paint a shape? - by TempodiBasic - 06-28-2023, 09:24 PM
RE: How do I paint a shape? - by TempodiBasic - 06-28-2023, 10:09 PM



Users browsing this thread: 8 Guest(s)