Posted: 13th Jun 2007 18:56
Hey, why is this method off copying an image in to another image, off the exact same properties ( Except from depth, in some case`es ), not working correctly.?

+ Code Snippet
mem1 as integer
mem2 as integer
img1 as integer
img2 as integer

mem1 = 1
img1 = 1
mem2 = 2
img2 = 2

debug_file$ as string
debug_file$ = "debug_imagefiles.txt"

REM Load image to add
load image "test.bmp", img1

REM Create first image
make_imagememblock(mem2,3 * 128,3 * 128)
make image from memblock img2,mem2
delete memblock mem2

`* image 1 = loaded image
`* image 2 = Internaly created image
`* Copy image 1 data to image 2, and save the new image

make memblock from image mem1, img1
make memblock from image mem2, img2

REM Copy loaded image to image 2
copy memory get memblock ptr( mem2 ), get memblock ptr( mem1 ), get memblock size( mem1 )

delete image img1
delete image img2
make image from memblock img2, mem2

delete memblock mem1
delete memblock mem2

if file exist( "result.bmp" ) then delete file "result.bmp"
save image "result.bmp", img2

END

FUNCTION make_imageMemblock(mem_b,w,h)
   make memblock mem_b,(w * h * 4) + 12   : REM Make memory enough for an image file
   write memblock dword mem_b,0,w         : REM Write width off image(bytes 0 - 3   (4 bytes
   write memblock dword mem_b,4,h         : REM Write height off image(bytes 4 - 7  (4 bytes
   write memblock dword mem_b,8,32        : REM Write color and alpha channels(bytes 8 - ?? (?? bytes
ENDFUNCTION



I'm working on a simple landscape editor thingy,(memblock matrix). The tiled image is created internally, (so you can add / delete textures), but when trying to load a project, this happens:



Now i could just delete the internally created tiled image, and load the "new" image, but this also(Only in some cases) scales the texture, so a 384 x 384 would become approx double the size.

I'm gonna figure it out ( i hope ), but i would really like to know why this isn't working.?

BTW, i did search for this, and found a lot off stuff related to this, just not an exact answer, so...

Download contains, code surge project file, source code, and test.bmp

Posted: 13th Jun 2007 19:17
, dam i feel stupid now. hehe

Well sry for posting, dident think off that at ALL.!

And Thank you, yes it did do the trick.

Posted: 13th Jun 2007 19:32


thx again