QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Richard on September 21, 2021, 11:18:21 pm

Title: PSET (rubout)
Post by: Richard on September 21, 2021, 11:18:21 pm
If one has the code

PSET (x%, y%), &HFFFFFFFF&&

does

PSET (x%, y%), &HFF000000&&

rubout the fist pixel PSET?




If not - how to rub out (i.e. make black) the pixel?
Title: Re: PSET (rubout)
Post by: SMcNeill on September 21, 2021, 11:21:25 pm
In a 32-bit screen, that’d work. For other screens, you’d need to use the appropriate color value corresponding to black to overwrite the white.

If you need a non-alpha clear color, set _DONTBLEND and use color 0 instead.
Title: Re: PSET (rubout)
Post by: johnno56 on September 22, 2021, 02:41:40 am
What about PRESET()?
Title: Re: PSET (rubout)
Post by: SMcNeill on September 22, 2021, 02:51:11 am
What about PRESET()?

Isn’t PSET just a shortened name for PRESET?  In QBASIC, the two were interchangeable with each other.  https://www.qbasic.net/en/reference/qb11/Statement/PSET.htm

Syntax
PRESET [STEP] (x!,y!) [,color%]
PSET [STEP] (x!,y!) [,color%]


Description / Parameter(s)
STEP   Specifies that the x! and y! are expressed relative to the current graphics cursor location.
(x!,y!)   The screen coordinates of the pixel to be set.
color%   A color attribute that sets the pixel color. If color% is omitted, PRESET uses the current background and PSET uses the current foreground color.
Available color attributes depend on your graphics adapter and screen mode. Coordinate values depend on the graphics adapter, screen mode, and most recent VIEW and WINDOW statements.
Title: Re: PSET (rubout)
Post by: SMcNeill on September 22, 2021, 03:04:43 am
I guess the difference in PSET and PRESET is if one doesn’t specify a color.

COLOR red, blue

PSET would use red by default, and PRESET would use blue…

Since I don’t think I’ve ever used either without specifying a color myself, I always just figured one was a shortcut for the other.   Go figure!
Title: Re: PSET (rubout)
Post by: FellippeHeitor on September 22, 2021, 05:05:55 am
As default colors in most (all?) screen modes are white on black, the two commands would serve to set a pixel (P SET) or reset a pixel (P RESET). You probably interpreted it as PRE SET - I know I have, until very recently.