Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I paint a shape?
#2
Unfortunately, painting is a headache in this programming language, and especially if you want to use 32-bit color. :/

First you have to make absolutely sure the shape is closed. If not the painting would take over the whole screen or, less often, other screen elements that could ruin your landscape or portrait.

It's better to forget about "P" command for DRAW for 32-bit color because it's confusing, "C" already requires specific LONG integer values and otherwise this programming system is very good yelling "Illegal function call" back at you if it doesn't like a value. You have the border color already in a variable called "colr". Assuming the color you want to paint with is called "paintcolr" then the code could be added like this:

Code: (Select All)
DIM paintcolr AS LONG
paintcolr = _RGB(255, 0, 0)
PAINT(501, 301), paintcolr, colr

The POINT TO SELECT TO PAINT is very important. I had to deduce it from your code which seems to draw an octagon and begins from the top-left corner. Figuring out the point inside the closed figure to paint is a science in itself in BASIC graphics programming.

I suppose you could use STR$() to force the _RGB() values that you want for "P" command for DRAW but using PAINT is more concise. Otherwise would have to use POINT(0) and POINT(1) to obtain the X,Y coordinates of the DRAW "pen" but it's not reliable. Irritatingly the Wiki page on POINT() says nothing about DRAW.



This is a quick silly program that I wrote demonstrating POINT(0) and POINT(1):

Code: (Select All)

SCREEN 12
LOCATE 1, 1
PRINT POINT(0), POINT(1)
DRAW "s16fbdbrdhdbehebddhfbdhrbebuh"
LOCATE 2, 1
PRINT POINT(0), POINT(1)
END

It is verified the first X,Y coordinates shown is the middle of the screen.
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: 5 Guest(s)