Quote:I want to be able to PUT a cursor image on the screen. The problem is that the picture has to be a rectangle - and I don't want a completely square picture. Is there a way to PUT a graphic on the screen without PUTting the black pixels, leaving text or colors beneath it untouched?
Since there are already 3 replies referring you to something else, I'll just explain it to you...
For Mode 13h a.s.:
The trick is to know how the image is stored in memory. Suppose you have an integer array Mouse() and GET a picture in it.
Now:
Mouse(0) = WidthOfImage * 8
Mouse(1) = HeightOfImage
The first index will contain the width of the image, multiplied by eigth. The second index will contain the height of the image.
Then, the image data begins, one byte per pixel. Since you have the width and height of the image, you can calculate how many bytes there are after the 2nd index.
To read from memory, here's an example:
[syntax="qbasic"]DIM Mouse(51) AS INTEGER
SCREEN 13
GET (0, 0) - (9, 9), Mouse
'Look:
PRINT Mouse(0), Mouse(0) \ 8
PRINT Mouse(1)
'to read from memory:
Wid% = Mouse(0) \ 8
Hei% = Mouse(1)
pixels& = CLNG(Wid%) * CLNG(Hei%)
DEF SEG = VARSEG(Mouse(0))
offs% = VARPTR(Mouse(0))
FOR i& = 1 TO pixels&
pixelcolor = PEEK(offs% + 3 + i&)
'############
'now you can see if the pixel color equals zero, and if it's not,
'you can put it to screen (DEF SEG = &HA000)
'############
NEXT i&
DEF SEG[/syntax]
If you want the full code, you can also take a look at NeoLib v1.6b, it should be available at
Pete's QB Site.