problem with maskimage() outline

Blitz3D Forums/Blitz3D Beginners Area/problem with maskimage() outline

NeuralizR(Posted 2004) [#1]
I'm using a simple 32x32 bmp (tried this with a png too).

I made a very simple image with 2 colors (0,0,0 and 255,0,255), a solid black disc with magenta filling the rest of the image.

my code looks like this

ball = LoadImage("ball.bmp")
MaskImage(ball,255,0,255)


Whenever I use DrawImage() to put it on the screen, I get a nice magenta border around the ball.

I originally created the image in photoshop, but figured that I might not be able to save the image without it doing some sort of anti-aliasing, so.... I created a new image from scratch in MSPaint. So I'm pretty sure it's saving the image with only 2 colors.

Any ideas???


sswift(Posted 2004) [#2]
I think you're antialising it when you draw it without realising it.

Why not post a link to the BMP? It's easy to confirm if that is the case or not.


NeuralizR(Posted 2004) [#3]
ball.bmp


sswift(Posted 2004) [#4]
Looks fine. and closer examination in photoshop reveals there are in fact, only 2 colors.

Are you trying to display this in Blitz3D, or BlitzPlus?

Are you scaling the image up before you blit it, or blitting it at the original size?

Are you positive you're loading this BMP here, and not an earlier one that you have have saved, by mistake?


NeuralizR(Posted 2004) [#5]
Positive it's this image, well, this one and another one that's not quite as simple, but same problem. :)

No scaling.

Blitz3D.

Let me put the bb file up there. :)

topdown.zip

... and yes, I know, this has a lot of "not the best way to do it" type things in it. :) Just started it tonight.

Gotta be just some dumb thing I'm not seeing. :x


NeuralizR(Posted 2004) [#6]
Oh, quickly...

tempimage = LoadImage("playership.bmp")
MaskImage(tempimage, 255,0,255)
MidHandle(tempimage)
player\image = CopyImage(tempimage)


I did that because I thought maybe I was screwing it up by operating on the image in player\image. I did initially try this by operating on the image in player\image itself.


NeuralizR(Posted 2004) [#7]
heh, it's the RotateImage() function that's causing it.

Suppose I should have mentioned I was using that earlier. *sheep*

Well, maybe I'll take a look at your 2D lib sswift. :) It has functions for doing rotations and such, right? :p


NeuralizR(Posted 2004) [#8]
Yup, definitely the problem.

RotateImage() and MaskImage() are definitely not compatible. :o *sigh* Guess I should at least see how other people are doing it if not just use someone elses lib. :)


Curtastic(Posted 2004) [#9]
TFormFilter False
rotateimage(


sswift(Posted 2004) [#10]
Yeah w2hat Coorae said. You're rotating the image with antialiasing turned on. That screws it up. But turn antialiasing off, with TFormFilter, and it should be fine.

Also, my 2D lib does not do rotation. If you want a sprite to be rotated with my lib, you rotate it just like you would any other image. My lib is for moving images around on the screen. (And soon, for animating them automatically and moving them automatically.)


NeuralizR(Posted 2004) [#11]
Thanks guys, completely fixed. :)