I'd like to create a dynamic image of format PF_BGR888
Nothing in the docs :)
Nothing in the docs :)
MemCopy(PixmapPixelPtr(tempPixMap),Frame,width*Height*3) ' Gotta flip it. Damn GDI tempPixMap = YFlipPixmap(tempPixMap) ' Draw it tempImage = LoadImage(tempPixMap, DYNAMICIMAGE) DrawImage(tempImage, x, y)
Pixmaps Pixmaps provide storage for rectangular regions of pixels. You can create a new pixmap using the CreatePixmap command, or load a pixmap from a stream using LoadPixmap. Pixmaps have 5 properties: width, height, a byte pointer to the pixmap's pixels, pitch and format. You can retrieve a pointer to a pixmap's pixels using the PixmapPixelPtr command. A pixmap's pitch refers to the number of bytes between one row of pixels in the pixmap and the next. To retrieve a pixmap's pitch, use the PixmapPitch command. A pixmap's pixel format determines how the pixels within a pixmap are stored in memory. This must be taken into account if you want to access pixels directly via a pixmap's pixel pointer. You can retrieve the format of a pixmap using the PixmapFormat command, and convert pixmap's from one format to another using ConvertPixmap. You can also resize a pixmap, flip a pixmap horizontally or vertically and more.
graphics 640,480 local mypix:TPixmap=createpixmap(200,200,PF_BGR888) local image:TImage
while not keyhit(key_escape) cls 'memcopy stuff
image=loadimage(pix)
setscale 2.0,2.0 drawimage image,0,0 flip wend
Graphics 640,480 SeedRnd MilliSecs() ' load an image. If it's not a specific image then just use... ' Pix=createpixmap(width,height,format) ' that means you can miss the convert step image:Timage=LoadImage("max.png") pix:TPixmap=LockImage(image) pix=ConvertPixmap(pix,PF_BGR888) While Not KeyHit(key_escape) Cls ' This is a substitution for your memcopy bit. For x = 1 To 30 WritePixel(pix,Rand(0,pix.width-1),Rand(0,pix.height-1),-65536) Next 'load the pixmap into an image (not hard) image=LoadImage(pix) ' change the drawscale SetScale 2.0,2.0 ' draw the image DrawImage image,0,0 Flip Wend
MemCopy(PixmapPixelPtr(tempPixMap),Frame,width*Height*3) ' Gotta flip it. Damn GDI tempPixMap = YFlipPixmap(tempPixMap) ' Draw it tempImage = LoadImage(tempPixMap, DYNAMICIMAGE) DrawImage(tempImage, x, y)