Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PUT sprite with mask?
#1
Quick question:

Is there any way to PUT a sprite such that all non-black pixels are PSET, and all black pixels are ignored? None of the PUT action command words seem to do this.

*peace*

~ Megan.
Reply
#2
Yes, you can either use a mask/sprite combination or SuperPut. Here's an example using a mask:

Code:
DEFINT A-Z

SCREEN 13
DIM SpriteImage(129)
DIM SpriteMask(129)
DIM SaveBackground(129)

'Create the sprite
LINE (0, 0)-(15, 15), 255, BF
CIRCLE (8, 8), 7, 4, , , .83
PAINT (8, 8), 4
CIRCLE (10, 7), 2, 12, , , .83
PAINT (10, 7), 12
GET (0, 0)-(15, 15), SpriteImage(0)

'Create the mask from the sprite
FOR y = 0 TO 15
  FOR x = 0 TO 15
    IF POINT(x, y) = 255 THEN
      PSET (x + 16, y), 0
    ELSE
      PSET (x + 16, y), 255
    END IF
  NEXT
NEXT
GET (16, 0)-(31, 15), SpriteMask(0)

CLS

'Draw some shiznit on the screen
FOR x = 0 TO 319
  LINE (x, 0)-(x, 199), x AND 255
NEXT

FOR x = 0 TO 304

  'Wait for vsync
  WAIT &H3DA, 8, 8
  WAIT &H3DA, 8

  'restore old background
  IF x > 0 THEN PUT (x - 1, 92), SaveBackground(0), PSET

  'save new background
  GET (x, 92)-(x + 15, 107), SaveBackground(0)

  'Put sprite while preserving background
  PUT (x, 92), SpriteMask(0), OR
  PUT (x, 92), SpriteImage(0), AND

NEXT
Reply
#3
Damn, I wish they would've put a 'trans' flag in PUT.

*waits for a language that does*
Reply
#4
It's called RelLib, cha0s.
In the beginning, there is darkness – the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Reply
#5
I think he was making a subtle reference to fb Tongue
url=http://www.copy-pasta.com]CopyPasta[/url] - FilePasta
Reply
#6
Nonsense. This is a QB forum.
In the beginning, there is darkness – the emptiness of a matrix waiting for the light. Then a single photon flares into existence. Then another. Soon, thousands more. Optronic pathways connect, subroutines emerge from the chaos, and a holographic consciousness is born." -The Doctor
Reply
#7
that's why it was subtle Tongue
\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Reply
#8
:longeye:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)