• can you get anti-aliasing for a DImage?
    2 replies, posted
I have this icon displayed on the HUD but it looks terrible. Is there a certain way I should do this, or certain size the image should be, or some kind of way to add anti-aliasing to the image? The image is 64x64, but I sized it down to 32x32 in game via lua because it looks a little more clean. I'm using this to produce the image: [lua] COINS.Icon = vgui.Create("DImage") COINS.Icon:SetImage("coin64.png") COINS.Icon:SetSize(32, 32) COINS.Icon:SetPos(4, 4) [/lua]
I'm just wondering, you said it's an icon displayed on your HUD. Why aren't you using surface.DrawTexturedRect? [lua] -- Outside hook: local CoinImage = Material( "coin64.png" ); -- Inside a hook: surface.SetMaterial( CoinImage ); surface.DrawTexturedRect( 4, 4, 32, 32 ); [/lua] I *think* that drawing .png's that way uses a bicubic/bilinear filter.
[QUOTE=Walrus Viking;40343649]I'm just wondering, you said it's an icon displayed on your HUD. Why aren't you using surface.DrawTexturedRect? [lua] -- Outside hook: local CoinImage = Material( "coin64.png" ); -- Inside a hook: surface.SetMaterial( CoinImage ); surface.DrawTexturedRect( 4, 4, 32, 32 ); [/lua] I *think* that drawing .png's that way uses a bicubic/bilinear filter.[/QUOTE] I actually was a little unsure of how to properly put images on the HUD so that's how I did it, thanks for showing me how it should be done though! Also I think my issue came more from me messing with the image size in game and trying to shrink it. Everything looks great now, thanks for your help!
Sorry, you need to Log In to post a reply to this thread.