Midhandle cause blurred image!

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

Grey Alien(Posted 2006) [#1]
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?


tonyg(Posted 2006) [#2]
Bmax 1.18 it alls seems to look OK.
I was using the bmax.png file for reference.


Grey Alien(Posted 2006) [#3]
I have 1.18 too. Suppose it could be my video card, Radeon 9800XT. maybe I should post some screengrabs.


tonyg(Posted 2006) [#4]
Think you should. I have 9800pro


xlsior(Posted 2006) [#5]
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.


Grey Alien(Posted 2006) [#6]
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


taxlerendiosk(Posted 2006) [#7]
or just by doing this:

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


instead of using the inbuilt MidHandle functions.


Grey Alien(Posted 2006) [#8]
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!


xlsior(Posted 2006) [#9]
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.


Stu_ovine(Posted 2006) [#10]
This just caught me out ..... just wasted a hour rechecking my code :S


Grey Alien(Posted 2006) [#11]
well at least you know now :-)