Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PUT "transparent" graphics?
#11
SuperPut is faster than QB's PUT, because it's basically RelSpriteFlip with a hacked calling convention. Wink

The "solution" really depends on what screen mode mycophobiac is using. If it's 13h, then he's got a lot of choices (poking the background into the sprite, masking, libs, or SuperPut).

If the mode is anything else, he's pretty much stuck with masking. (Well, poking the background into the sprite would still work, but it would take more work...)
Reply
#12
Quote:
Z!re Wrote:The bad thing is that that way requires twice as much memory as a routine that simply just ignores the color 0.

I agree. but there is no function as fast as put that ignores the 0 you could make your own put, with PEEK. but it'll never have the same speed. or you should do it in ASM (I don't know much ASM therefore never tried to do this)

Ohhhh yaaeaaaah!!!!

BU&KKLLLL FUSKNG SHNITDW!!!!

THEIR R FASTERT MORE BETTERR THEN PUTGETPUTGET U NO!!!

IO MADE IT 2 C COUSEE I MADE BOUT" 4 OPTMAZTIONS 2!!!!


BYI :???:
Reply
#13
Quote:Ohhhh yaaeaaaah!!!!

BU&KKLLLL FUSKNG SHNITDW!!!!

THEIR R FASTERT MORE BETTERR THEN PUTGETPUTGET U NO!!!

IO MADE IT 2 C COUSEE I MADE BOUT" 4 OPTMAZTIONS 2!!!!


BYI :???:

umm... :???: You confuse me buddy. Perhaps you should rewrite this in english? I would comment about your content, but i have a sneaky suspicion that nemesis = sarcastic.
Jumping Jahoolipers!
Reply
#14
Oh....
What I meant was, using the custom put AND + XOR masking
technique is sometimes confusing, eats up memory X2, and
is just plain ineffecient and slow. Remember this method requires
2 PUTS :barf:
I wrote a routine for ya, and threw in some comments for a
custom AND, XOR routine that's faster, easier, and more effecient.
For maximum performance, use a compiled version of the routine.
It's really faster than PUT AND + PUT XOR !!!
(Actually, it's probablly the fastest Pure QBASIC, SCREEN 13
PUT routine available, as far as I know of!
I included the source so anyone can implement the routine in their own custom PUT routines!!!

Check it out...

EDIT... Had a few unecessary lines of code that I forgot to delete,
heh, I quickly assembeled this routine from my library so...

Code:
'
' ANDXOR v1.1, A Pure QBASIC, (SCREEN 13) auto-masking PUT routine!
'
' (C)opyright 2004, Pure QB Innovations
'
' Email any questions, comments, or suggestions to...
'  ESmemberNEMESIS@aol.com
'
' Visit the Pure QB Innovations web site at...
'  http://members.aol.com/esmembernemesis/index.htm
'
' THIS PROGRAM MAY BE DISTRIBUTED FREELY AS PUBLIC DOMAIN SOFTWARE
' AS LONG AS ANY PART OF THIS FILE IS NOT ALTERED IN ANY WAY.
' IF YOU DO WISH TO USE THESE ROUTINES IN YOUR OWN PROGRAMS
' THEN PLEASE GIVE CREDIT TO THE AUTHOR -==-Mario LaRosa-==-
'
'$STATIC
'
DEFINT A-Z
'
'Viewing parameters, (out of range pixels are clipped).
'
COMMON SHARED viewXL, viewXR, viewYT, viewYB
'
'Auto-dimensioning function for image arrays.
'
DECLARE FUNCTION DIMGET (pixels)
'
'Faster, more effecient Auto-maksed PUT.
'
'ARRAY()... Pre-dimensioned ARRAY holding image(s).
'Xleft... Left-horizontal screen cordiante to PUT image at.
'Ytop... Top-verticle screen cordinate to PUT image at.
'
DECLARE SUB ANDXOR (ARRAY(), Xleft, Ytop)
'
'Graphics mode (SCREEN 13), VGA;(320X200X256).
'
SCREEN 13
'
'SET Viewing port to full screen, (maximum values).
'
viewXL = 0: viewXR = 319: viewYT = 0: viewYB = 199
'
'Dimension ARRAY to hold 64x64 image with function DIMGET(pixels).
'
DIM BALL(DIMGET(64 * 64))
'
'Draw, and capture image via GET.
'
FOR S = 31 TO 1 STEP -1
  CIRCLE (32, 32), S, 31 - S \ 2
  PAINT (32, 32), 31 - S \ 2
NEXT S
'
GET (0, 0)-(63, 63), BALL(0)
'
CLS
'
'Bench marks for ANDXOR routine.
'
DO: LOOP UNTIL TIMER <> TIMER: t! = TIMER
'
FOR z = 1 TO 10000
  '
  x = -63 + INT(RND(1) * 383 + 1)
  y = -63 + INT(RND(1) * 263 + 1)
  '
  ANDXOR BALL(), x, y
  '
NEXT
'
t! = ABS(TIMER - t!)
'
SLEEP
'
CLS : COLOR 7
LOCATE 1, 1: PRINT "That's 1O,OOO, (64x64) images in just..."
LOCATE 3, 1: PRINT t!; " Seconds!"
COLOR 12
LOCATE 5, 1: PRINT "Fast, huh?"
'
SLEEP
'
SYSTEM
'

SUB ANDXOR (ARRAY(), Xleft, Ytop)
'
TW = ARRAY(0) \ 8
TH = ARRAY(1)
  '
XR = (Xleft + TW) - 1
YB = (Ytop + TH) - 1
'
IF Xleft < viewXL THEN
  IF XR < viewXL THEN EXIT SUB
  LD = (viewXL - Xleft): XD = LD
  XL = viewXL
ELSE
  XL = Xleft
END IF
'
IF Ytop < viewYT THEN
  IF YB < viewYT THEN EXIT SUB
  YD = viewYT - Ytop
  YT = viewYT
ELSE
  YT = Ytop
END IF
'
IF XR > viewXR THEN
  IF XL > viewXR THEN EXIT SUB
  XD = XD + (XR - viewXR)
  XR = viewXR
END IF
'
IF YB > viewYB THEN
  IF YT > viewYB THEN EXIT SUB
  YB = viewYB
END IF
'
A = 4 + ((YD * TW) + LD)
B = TW - XD
R = TW - DR
'
DIM BT(&H0 TO &HF)
DIM BD(&H0 TO &HF)
'
FOR x = &H0 TO &HF
  BD(x) = (x + XL)
NEXT
'
FOR VY = (YT * 20) TO (YB * 20) STEP 20
  '
  TS& = VARSEG(ARRAY(0))
  DS& = &HA000 + VY
  '
  FOR x = &H0 TO &HF
   BT(x) = (x + A)
  NEXT
  '
  GSR = FALSE
  '
  FOR x = &H1 TO (B \ &H10)
   '
   DEF SEG = TS&
   '
aBF: BF = PEEK(BT(&HF))
aBE: BE = PEEK(BT(&HE))
aBD: BD = PEEK(BT(&HD))
aBC: BC = PEEK(BT(&HC))
aBB: BB = PEEK(BT(&HB))
aBA: BA = PEEK(BT(&HA))
aB9: B9 = PEEK(BT(&H9))
aB8: B8 = PEEK(BT(&H8))
aB7: B7 = PEEK(BT(&H7))
aB6: B6 = PEEK(BT(&H6))
aB5: B5 = PEEK(BT(&H5))
aB4: B4 = PEEK(BT(&H4))
aB3: B3 = PEEK(BT(&H3))
aB2: B2 = PEEK(BT(&H2))
aB1: B1 = PEEK(BT(&H1))
aB0: B0 = PEEK(BT(&H0))
   '
   IF GSR THEN RETURN
   '
   DEF SEG = DS&
   '
aTF: IF BF THEN POKE BD(&HF), BF
aTE: IF BE THEN POKE BD(&HE), BE
aTD: IF BD THEN POKE BD(&HD), BD
aTC: IF BC THEN POKE BD(&HC), BC
aTB: IF BB THEN POKE BD(&HB), BB
aTA: IF BA THEN POKE BD(&HA), BA
aT9: IF B9 THEN POKE BD(&H9), B9
aT8: IF B8 THEN POKE BD(&H8), B8
aT7: IF B7 THEN POKE BD(&H7), B7
aT6: IF B6 THEN POKE BD(&H6), B6
aT5: IF B5 THEN POKE BD(&H5), B5
aT4: IF B4 THEN POKE BD(&H4), B4
aT3: IF B3 THEN POKE BD(&H3), B3
aT2: IF B2 THEN POKE BD(&H2), B2
aT1: IF B1 THEN POKE BD(&H1), B1
aT0: IF B0 THEN POKE BD(&H0), B0
   '
   IF GSR THEN RETURN
   '
   TS& = TS& + &H1
   DS& = DS& + &H1
   '
  NEXT
  '
  GSR = NOT FALSE
  '
  SELECT CASE (B MOD &H10)
   CASE &H1
    DEF SEG = TS&
    GOSUB aB0
    DEF SEG = DS&
    GOSUB aT0
   CASE &H2
    DEF SEG = TS&
    GOSUB aB1
    DEF SEG = DS&
    GOSUB aT1
   CASE &H3
    DEF SEG = TS&
    GOSUB aB2
    DEF SEG = DS&
    GOSUB aT2
   CASE &H4
    DEF SEG = TS&
    GOSUB aB3
    DEF SEG = DS&
    GOSUB aT3
   CASE &H5
    DEF SEG = TS&
    GOSUB aB4
    DEF SEG = DS&
    GOSUB aT4
   CASE &H6
    DEF SEG = TS&
    GOSUB aB5
    DEF SEG = DS&
    GOSUB aT5
   CASE &H7
    DEF SEG = TS&
    GOSUB aB6
    DEF SEG = DS&
    GOSUB aT6
   CASE &H8
    DEF SEG = TS&
    GOSUB aB7
    DEF SEG = DS&
    GOSUB aT7
   CASE &H9
    DEF SEG = TS&
    GOSUB aB8
    DEF SEG = DS&
    GOSUB aT8
   CASE &HA
    DEF SEG = TS&
    GOSUB aB9
    DEF SEG = DS&
    GOSUB aT9
   CASE &HB
    DEF SEG = TS&
    GOSUB aBA
    DEF SEG = DS&
    GOSUB aTA
   CASE &HC
    DEF SEG = TS&
    GOSUB aBB
    DEF SEG = DS&
    GOSUB aTB
   CASE &HD
    DEF SEG = TS&
    GOSUB aBC
    DEF SEG = DS&
    GOSUB aTC
   CASE &HE
    DEF SEG = TS&
    GOSUB aBD
    DEF SEG = DS&
    GOSUB aTD
   CASE &HF
    DEF SEG = TS&
    GOSUB aBE
    DEF SEG = DS&
    GOSUB aTE
  END SELECT
  '
  A = A + R
  '
NEXT
'
END SUB

FUNCTION DIMGET (pixels)
DIMGET = ((5 + (pixels)) \ 2) - 1
END FUNCTION

Cya!
Reply
#15
I think I already told you this...you cannot make something both copyrighted and public domain. They are complete opposites.
Reply
#16
Quote:I think I already told you this...you cannot make something both copyrighted and public domain. They are complete opposites.

Yeah, I should dump the Public Domain part and say Freeware, but I don't know. I read some documentation on copyrights, but never about Public Domain :???:

Anyways, would Copyright and Freeware work together?

Nemesis
Reply
#17
"Public domain" means that anybody can do anything with it. "Freeware" works fine in your case.
Reply
#18
I use this sort of thing...


for y% = 1 to 10 ' sprite y size
for x% = 1 to 10 ' sprite x size
if sprite(x%,y%) <> 0 then pset (x%,y%),sprite(x%,y%)
next x%
next y%
PY is done
Reply
#19
Nemesis: yep, copyright and freeware would work together. But I think you should release it as GPL Big Grin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)