Re: POINT

by Ben (no login)

 
You can avoid the need to use POINT. How can you do this? Simple. Set the palette after the image was drawn. We can know what colors to set using a color array.

Since anyone will agree that POINT is really slow, then why not use an alternative?

Here is an example using 4bit bmps. First make a 4bit bitmap with a program that makes unused colors get set to black. Then modify the bmp$ variable to be the location of your 4bit bitmap. Run the program and tell me if unused colors turned black?

Ofcourse, this can be optimized even faster. But this is just a rough example, so I used PSET and didnt bother optimizing anything. But it is faster then POINT.

So tell me if this works:

'Use a proper 4bit BMP!!! Or else it wont work
'Why 4bit? because I like screen 12!
DEFINT A-Z
TYPE bmh
id AS STRING * 2
blahh AS STRING * 16
x AS LONG
y AS LONG
blaah AS STRING * 28
END TYPE
DIM bm AS bmh

SCREEN 12

bmp$ = "4bit.bmp" '''FILENAME HERE!!!!

DIM r AS STRING * 1
DIM g AS STRING * 1
DIM b AS STRING * 1
DIM bi AS STRING * 1
DIM x, y AS LONG
DIM colors(15)
OPEN bmp$ FOR BINARY AS #1
GET #1, , bm
IF bm.id <> "BM" THEN PRINT "not bmp": SYSTEM
IF bm.x MOD 8 <> 0 THEN zp$ = SPACE$((8 - bm.x MOD 8) \ 2)
GET #1, 117, bi
FOR y0 = bm.y - 1 TO 0 STEP -1
FOR x0 = 0 TO bm.x - 1 STEP 2
GET #1, , bi
ln = ASC(bi) \ 16
hn = ASC(bi) AND 15
PSET (x0, y0), ln
PSET (x0 + 1, y0), hn
colors(ln) = -1
colors(hn) = -1
NEXT
GET #1, , zp$
NEXT
GET #1, 53, i
FOR i = 0 TO 15
OUT &H3C8, i
GET #1, , b
GET #1, , g
GET #1, , r
GET #1, , bi
IF colors(i) THEN
OUT &H3C9, ASC(r) \ 4
OUT &H3C9, ASC(g) \ 4
OUT &H3C9, ASC(b) \ 4
END IF
NEXT
CLOSE
FOR i = 0 TO 15
LOCATE , 75
COLOR i
PRINT CHR$(65) + STRING$(2, 83) + STRING$(3, 33)
SLEEP 1
NEXT
SYSTEM

Posted on Dec 9, 2008, 3:37 PM

Respond to this message   

Goto Forum Home

Response TitleAuthor and Date
* Not bad! The unused attributes are not always set to 0. on Dec 9
 Doesn't matter!Ben on Dec 9
  OK, I see what you did. I saw that IF non-zero statement is all. on Dec 9
   Bytes! not nibblesBen on Dec 9
    Sure have a ball. But the FourBit SUB means 4 bits. on Dec 9
    *If I were writing it today, I'd use a user-defined TYPE for the header info, too ;-) on Dec 11
     * Is it not a waste of memory if you only NEED a few bytes of data?Ben on Dec 11
      * Your blahh variable holds half the unused values anyway on Dec 11
       * yes, but I could just have a few variables and GET them by passing a offset to the GETBen on Dec 11
        You are only talking about 54 bytes which is hardly critical. on Dec 11
      Good point... on Dec 11
Did you do this on purpose? on Dec 9
 haha it was a typo I meant to type "bi" but forgot the "b" and had to set it 1 bBen on Dec 10
  Why not add the b instead of editing the number? Obfuscation perhaps? on Dec 10
   It was just an exampleBen on Dec 11

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement