Midhandle cause blurred image!

BlitzMax Forums/BlitzMax Beginners Area/Midhandle cause blurred image!

Weird, this code

Strict

Global width=800
Global height=600

Global logo:Timage

Graphics width,height,32

HideMouse

AutoMidHandle True

logo = LoadImage("logo.png")

Repeat

	Cls
	
	DrawImage(logo,400,200)
	
	Flip

Until KeyHit(KEY_ESCAPE)


cause the logo to appear but it's all antialiased thus slightly blurred. If I comment out the automidhandle line it's fine. Why is this?

Bmax 1.18 it alls seems to look OK.
I was using the bmax.png file for reference.

I have 1.18 too. Suppose it could be my video card, Radeon 9800XT. maybe I should post some screengrabs.

Think you should. I have 9800pro

Is your image odd sized (as in 'non-even') by any chance?

IIRC, midhandle in an odd-sized image leads to blurring since it will draw it at a half-pixel boundary... You may be able to prevent that from happening by either changing the size of your image slightly to be an even size, or possibly using either the MIPMAPPEDIMAGE or FILTEREDIMAGE flags in your loadimage statement.

that MUST be it, it's 197 pixels tall if I recall (I'm lon the laptop now) I'll try it out later. Thanks

or just by doing this:

SetImageHandle Logo, ImageWidth(Logo)/2, ImageHeight(Logo)/2


instead of using the inbuilt MidHandle functions.

Yeah it was due to it being an odd size and thus the graphics card was trying to draw at a 0.5 pixel and anti-aliasing everything!

I guess this is one of those things that really should be part of the midhandle command in the manual... It's a very common pitfall.

This just caught me out ..... just wasted a hour rechecking my code :S

well at least you know now :-)