Qbasicnews.com

Full Version: Couple of Questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a function or whatever that returns the color of a given pixel?

I tried writing all the elements in an array used in GET to a file to 'save' an image, and then later read it all back into another array. When I used PUT, the image was fine except there were a few scattered pixels that were the wrong color. What am I doing wrong?

Thanks.
thepixelcolor=POINT(x,y)
attribute = POINT(X,Y)

where X and Y give the coordinates of the pixel you're interested in. As for your other problem, all I can think of without seeing your code is to say to make sure you're using INTEGER or LONG arrays. (The effect you mention can sometimes occur with SINGLE or DOUBLE arrays.)
Quote:I tried writing all the elements in an array used in GET to a file to 'save' an image, and then later read it all back into another array. When I used PUT, the image was fine except there were a few scattered pixels that were the wrong color. What am I doing wrong?

do you have a ", PSET" after your PUT???
If not, type this:

Code:
Put (x,y),array,pset

This should work[/quote]
There's a faster way to do it Smile

Code:
'Initialize an offset array
DIM SHARED ysl(199) AS LONG
FOR k = 0
ysl(k) = k * 320&
NEXT

'Then, set segment to VGA memory (only for SCREEN 13)
DEF SEG = &HA000

'Now, to get any pixel, just use this:
colour = PEEK x + ysl(y)

Hope that helps.
Thanks guys. Appreciate your help! :bounce:
SetVideoSeg.

:*)
*high fives rel* woooh, yeah! i was just about to say that!