Posts: 292
Threads: 31
Joined: Apr 2003
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.
Posts: 1,080
Threads: 87
Joined: Feb 2002
thepixelcolor=POINT(x,y)
/post]
Posts: 704
Threads: 0
Joined: Dec 2002
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.)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 594
Threads: 11
Joined: Oct 2002
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]
B 4 EVER
Posts: 1,166
Threads: 62
Joined: Apr 2003
There's a faster way to do it
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.
am an asshole. Get used to it.
Posts: 292
Threads: 31
Joined: Apr 2003
Thanks guys. Appreciate your help! :bounce:
Posts: 3,288
Threads: 167
Joined: Nov 2001
Posts: 2,020
Threads: 24
Joined: Jun 2002
*high fives rel* woooh, yeah! i was just about to say that!
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry