Author Topic: PSET (rubout)  (Read 3499 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
PSET (rubout)
« 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?

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: PSET (rubout)
« Reply #1 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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: PSET (rubout)
« Reply #2 on: September 22, 2021, 02:41:40 am »
What about PRESET()?
Logic is the beginning of wisdom.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: PSET (rubout)
« Reply #3 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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: PSET (rubout)
« Reply #4 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!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

FellippeHeitor

  • Guest
Re: PSET (rubout)
« Reply #5 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.