To my surprice this blury filter is also applied on IOS.
Is there any way to turn this off?
the code used:
B4X:
Dim b As Bitmap
Dim i As ImageView
Dim c As Canvas
Dim r As Rect
b.Initialize(File.DirAssets,"bruce.png")
i.Initialize("")
Page1.RootPanel.AddView(i,0,0,100%x,100%y)
c.Initialize(i)
r.Initialize(0,0,160,210)
c.DrawColor(0xff0000ff)
c.DrawBitmap(b,r)
c.Refresh
these test is just to see how people who do pixel based games do their thing (ok they use sophisticated things like spriteKit, libGDX but in a lot of cases it's overkill)
and with monster resolutions I expect some serious upscaling unless they store a 16x16 sprite as a 512x512 image.
You need to use ImageViews to show the bitmaps instead of canvas. This is actually much better for performance (see GameView thread for an example).
Use this code to disable antialiasing:
B4X:
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.LoadLayout("1")
NavControl.ShowPage(Page1)
ImageView1.Bitmap = LoadBitmap(File.DirAssets, "1.png")
Dim no As NativeObject = Me
no.RunMethod("disableAntiAlias:", Array(ImageView1))
End Sub
#if OBJC
- (void) disableAntiAlias:(UIImageView*)v {
v.layer.magnificationFilter = kCAFilterNearest;
}
I just tried with iGameView and the result is about the same as the normal imageview method.
Makes sense as you wrote it's also imageview based unlike the android version which is accelerated canvas.
Will give spriteKit a try but that would need more time as not much examples are available.