loadPixMap or LoadImage

BlitzMax Forums/BlitzMax Beginners Area/loadPixMap or LoadImage

Neochrome(Posted 2012) [#1]
Which is faster?

im having trouble with tile game, i am currently using a celltype image,

LoadAnimImage while is good... but its not perfect!

im getting horrible Alpha Artifacts at the edges... now im aware that these can be corrected by adding a dark alpha map, but that then goes from white to black! lol

I want to USE the anim cell picture, so i want to make individual images/pixmap, however when i grab images i loose the Alpha Information

Im new to blitzmax
so im a little lost...

Question is, HOW (example would be cool but no pressure)
to create these Singular IMages which there alpha maps
and
which is fastest? DrawImage or Drawing Pixmaps?


Thanks


GfK(Posted 2012) [#2]
Drawimage is much, much faster.

Use PNG format instead of JPG. PNG has an alpha channel whereas JPG does not. Also PNG is lossless so no compression artefacts.


Neochrome(Posted 2012) [#3]
actually im aware of PNG and i use these heavily.

you've answered the draw pix thing tho

at the moment the png has an active alpha channel so thats ok.

BUT


as foo = loadanimage("foo.png",0,8, 64,64, FILTEREDIMAGE | MIPMAPPEDIMAGE | DYNAMICIMAGE)

i've scaled them to 96% of there real size.


DrawImage(foo%, 1,1, 1) ' frame one,

but on that frame where is a horrible white/black edge...



i wanted to make

tfoo:timage[10] = createimage(64,64)

and keep the alpha infomation..


SLotman(Posted 2012) [#4]
Use power of 2 images. Also, let a 1 pixel 'empty' border. This problem occurs because of imaging scaling to different resolutions and float point innacuracies.

You can draw your images on int(position) to also reduce those problems. But they will only go away if you use power of 2 sized images.


Neochrome(Posted 2012) [#5]
the image map is 0,8,64,64 is a power of two..

and INTed the positions... i FOUND that making an Arrow of Images FROM the Source tiles works well ;)

Except im loosing Alpha Information and im not sure how to do it :(

Cls
DrawImage(Foo%,0,0,0)
GrabImage(FooBlock1%,0,0,64,64)


obviously THAT is going to loose the alpha channel, but i now need to know.. HOW do i do this?

done my head in so far! lol

Thanks again


Neochrome(Posted 2012) [#6]
ok, think igot what i needed!
Man i need to use LOCKimage some more! lol

Everyone... THANK YOU :)