Writepixel command

Blitz3D Forums/Blitz3D Programming/Writepixel command

hi, can anyone tell me how i can enter the values for ARGB in the thrd syntax of the writepixel command please? thanks.

http://www.blitzbasic.com/codearcs/codearcs.php?code=551

sorry, think i understand how it works now, thanks.

Hi, just came across another problem, hope someone can help, i'm needing to be able to use the writepixel command with an array name, is that possible, it for a graphics system i'm working on and i need to be able to assign each pixel to an array, sort of like: array(pixel, x, y) = writepixel blah, blah, ect... how can i go about this. thanks


sort of like: array(pixel, x, y) = writepixel blah, blah, ect... how can i go about this. thanks



Your can't do it like that, but you can assign an integer to the array

Array( Pixel , x, y ) = ARGBvalue

Stevie

Maybe the "index" dimanesion isn't required. Probably he meant something like this:

sw=graphicswidth()
sh=graphicsheight()
setbuffer backbuffer()

dim arr(sw-1,sh-1)
lockbuffer()
for j=0 to sh-1
for i=0 to sw-1
argb=readpixelfast(i,j)  ;read pixel
arr(i,j)=argb    ; store in array
argb2= (argb and FEFEFE) shr 1  ;  some fx: darken
writepixelfast i,j,argb2
; or, of course:
writepixelfast i,j,arr(i,j)  ; accessing array by pixel coords
next
next
unlockbuffer()

(just typed)

ok, i think jfk got closer to what i'm wanting, but the system i'm trying to make requires the pixel to be free to move around the screen and i'm wanting to be able to get hold of multiple pixel to apply some maths dependent on it's position, I not realy sure how to explain what i'm trying to do very well, what i'm needing is the pixels to be writen in a while loop so i can manipulate then in real time, that why i was hoping there was a way to assign a pixel to an array. any further advice available. thanks

"..requires the pixel to be free to move around the screen.."

Ehrm, sorry, the pixels of my display don't move, at least not if I'm not drunk or so.
I think you meant something like pixel content object. Then Stevie's Suggestion was a better advice. You may use types, or an array like this:

dim arr(10000,2)

arr(i,0)=ARGB
arr(i,1)=x
arr(i,2)=y

now you can alter the position as well as the color. You still need to draw them all, of course.

ok thanks, i'll have a go at that, thanks for the help.