ok, you don't have to use a dll to do this, i would only use a dll if i really had to personally.... but onto the task. ok, this is from something i just wrote a few days ago actually, i got the information from the read/writepixelfast examples i think, the docs can cover this stuff if you can pay attention for long enough that is! heh
this is how to load a bmp and read the pixels into a pixel array for writing to later, comments below.
now you've got all pixels in the array, you want to, ehh...
create the image from the data now. ok, this writes the pixel array to a new image.
I cant garantee this code is 100% perfect, as i havent tested, but it should be. One thing id like to mention is that i found writepixelfast doesn't work in fullscreen 16bit!? but plot does, its a little slower and more complex but at least it works, i guess.
Hope that helps some anyway.
this is how to load a bmp and read the pixels into a pixel array for writing to later, comments below.
xdim=256 : ydim=256 ;the image dimension vars Dim Imagedata(xdim,ydim) ;size pixel array mypic=LoadImage(filename$) ;load a bmp DrawImage mypic,0,0 ;draw image to screen LockBuffer ;must have for ReadPixelFast For y=0 To ydim ;x/y loop For x=0 To xdim Imagedata(x,y)=ReadPixelFast(x,y) ;read to array Next Next UnlockBuffer Cls ;clear image from screen
now you've got all pixels in the array, you want to, ehh...
create the image from the data now. ok, this writes the pixel array to a new image.
mynewpic=CreateImage(xdim,ydim) ;size new image SetBuffer ImageBuffer(mynewpic) ;put image in buffer LockBuffer ;must have for WritePixelFast For y=0 To ydim ;draw new image For x=0 To xdim WritePixelFast x,y,Imagedata(x,y) ;write to image Next Next UnlockBuffer SetBuffer BackBuffer() ;reset to screen buffer
I cant garantee this code is 100% perfect, as i havent tested, but it should be. One thing id like to mention is that i found writepixelfast doesn't work in fullscreen 16bit!? but plot does, its a little slower and more complex but at least it works, i guess.
Hope that helps some anyway.