Is it possible to turn the image directly into a memblock so the original image is not filled with a predefined color?
Maybe it will keep the alpha channel intact
I tried using make memblock from image but the function kicks out an error.
remstart
This example shows how to use the image copy functions to take images (from DBP images or memblock images)
and paste them into another image
remend
Set display Mode 800,600,32
Sync On : Sync Rate 60
Backdrop On
Color Backdrop 0
Autocam off
//create a red 512x512 empty texture
memblock = IMG_MAKE(512, 512, IMG_RGBA(255,0,0,255))
//load a test image/texture (metal grating for now)
Load image "images/smokenew1.png",1
//paste the loaded image directly into our red memblock texture we created
IMG_PASTE_IMAGE(memblock, 1, 0, 0) //paste it at pixel 0,0 (starting top left)
//turn the image into a memblock
srcMem = IMG_CONVERT(1, 1) //A 2nd parameter of 1 deletes the used image afterwards (but keeps the memblock version of it)
//paste the bottom right quarter of the test image into our own memblock texture
IMG_PASTE_MEMBLOCK_PART(memblock, srcMem, 300, 300, 127, 127, 255, 255)
//you can also paste a whole memblock image into another memblock image (doesn't have to be the same size either)
IMG_PASTE_MEMBLOCK(memblock, srcMem, 256, 0)
remstart
create image out of memblock image data - don't forget to call this once your finished modifying
a memblock image to update/create the image version of the memblock (which can be applied to objects, sprites, etc)
remend
IMG_UPDATE(memblock,1)
//position camera
position camera 0, 0, 0, -20
point camera 0, 0, 0, 0
//create a plain and texture it with our newly created image
make object plain 1, 10, 10
texture object 1,1
Do
//rotate plain
turn object left 1, 0.5
text 0,0,"FPS: "+STR$(SCREEN FPS())
Sync
loop
remstart
=====FULL COMMAND LIST================================
Creates a new memblock image filled with the specified colour.
IMG_MAKE(width, height, depth, colour)
Sets the colour of the specified pixel on a memblock image
IMG_SET_PIXEL(memblock, x, y, colour)
Does the same as IMAGE_SET_PIXEL except the memblock image width and height have to be entered.
This speeds things up a little if you have many pixels to write and already know the image width/height)
IMG_SET_PIXEL2(memblock, x, y, width, height, colour)
returns the colour of the specified pixel as a dword
IMG_GET_PIXEL(memblock , x , y )
Does the same as IMAGE_GET_PIXEL except the width and height have to be entered.
This speeds things up a little if you have many pixels to read and already know the image width/height)
IMG_GET_PIXEL2(memblock, x, y, width, height)
creates or updates a DBP image with the contents of a memblock image
IMG_UPDATE(memblock, img)
Pastes a normal image into a memblock image.
IMG_PASTE_IMAGE(mem , pasteImg , x , y )
paste a memblock image into another memblock image at the specified coords. Also create a to paste part of one memblock image into another memblock image.
IMG_PASTE_MEMBLOCK(mem , pasteMem , x , y )
copies the specified area of one memblock image (source) into another memblock image (destination)
IMG_PASTE_MEMBLOCK_PART(mem , pasteMem , x , y , sourceStartX , sourceStartY , sourceEndX , sourceEndY )
draws a solid colour rectangle inside a memblock image
IMG_DRAW_RECTANGLE(mem , x , y , width , height , colour )
draws an outline of a rectangle with the given line thickness
IMG_DRAW_RECTANGLE_OUTLINE(memblock, X, Y, Width, Height, Thickness, Colour)
draws a line - memblock, x1, y1, x2, y2, line width/thickness, red, green, blue
IMG_DRAW_LINE(mem , x1 , y1 , x2 , y2 , colour )
draws a filled circle
IMG_DRAW_CIRCLE(mem , x , y , radius , colour )
draws a circle outline
IMG_DRAW_CIRCLE_OUTLINE(mem , x , y , radius , dotRate , thickness , colour)
draws part of a circle
IMG_DRAW_CIRCLE_PART(mem , x , y , radius , fillPercent , cFill as boolean, angle as float, colour)
clears an image to the given color
IMG_CLEAR( memblock, colour)
flips a memblock image horizontally
IMG_FLIP_HORIZONTAL( memblock )
flips a memblock image vertically
IMG_FLIP_VERTICAL( memblock )
tints an image using the given color
IMG_TINT( memblock, colour)
deletes a memblock image; does exactly the same as DELETE MEMBLOCK
IMG_DELETE( memblock)
creates a memblock image from a DBP image
IMG_CONVERT( image, delete )
combines 4 colour channel values (bytes) into a single dword - for use with the colour parameter on most IMG functions.
IMG_RGBA(red, green, blue, alpha)
converts a memblock image to a greyscale memblock image
Added IMG_GREYSCALE( memblock )
Finds an unused memblock - used internally by the Memblock Image Library
FREE_MEMBLOCK()
remend
Edit: no I tried changing the image from 8 bit and I also tried changing the screen depth settings in dbpro and its ignoring the transparencies.
-------
Anyone know a plugin or set of functions that can cut out a section from a png image with transparencies then paste it into a new image with transparency intact so it can be saved? (once you start pasting images to the screen and copying them out the png transparencies are ruined.)