Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualroadysix

Posted 12 July 2012 - 08:17 AM

Hi all, recently I've been trying my hand at some Java and Android development.
However, no matter what I try I just can't seem to get a level of image quality that I would be happy with for the sprites in the game.

I've had issues with banding showing with subtle colour transitions on background images and imprecise pixel positioning on both my android device and emulator.. below is an image compared with the original that demonstrates what I mean (though in this case the banding isn't so bad).

Posted Image

There seems to be some sort of filtering and and scaling going on which apparently I have no control over (which is why I'm here Posted Image)
So, has anyone come across this kind of issue before and how did you fix it? [code below]

[CODE]
import android.view.View;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new DrawView(this));
}

public class DrawView extends View
{
private Paint mpaint = new Paint( );
private Bitmap mbitmap;

public DrawView(Context context)
{
super(context);
mpaint.setDither(false);
mpaint.setAntiAlias(false);
mpaint.setFilterBitmap(false);

BitmapFactory.Options options = new BitmapFactory.Options( );
options.inDither = false;

mbitmap = BitmapFactory.decodeResource(context.getResources( ), R.drawable.box);
}

@Override
protected void onDraw(Canvas canvas)
{
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(mbitmap, 6, 6, mpaint);
}
}
}
[/CODE]

Thanks

PS: I also tried SurfaceView, same problems.. I know it is somehow possible to get decent pixel quality in android, just take a look at Zenonia (my images look like those from Zenonia 1 at the moment, I would like the quality achieved in Zenonia 3/4 Posted Image )

EDIT2: Some more evidence of the problem I'm having, definitely some unwanted scaling going on. I've tried putting the image in all drawable folders one at a time, hdpi scales down and mdpi scales to what you see in the image below:

Posted Image
The Image to the right is the one I am drawing and the one on the left is from the API demos.
I can't see what I'm doing wrong, I checked the code both are being loaded via the openRawResource( ) and the decodeStream( ) methods.
There is also no evidence of scaling the frog in the API demo.. two simple lines that I have included plus the line to draw is all I can find.

#3roadysix

Posted 12 July 2012 - 08:16 AM

Hi all, recently I've been trying my hand at some Java and Android development.
However, no matter what I try I just can't seem to get a level of image quality that I would be happy with for the sprites in the game.

I've had issues with banding showing with subtle colour transitions on background images and imprecise pixel positioning on both my android device and emulator.. below is an image compared with the original that demonstrates what I mean (though in this case the banding isn't so bad).

Posted Image

There seems to be some sort of filtering and and scaling going on which apparently I have no control over (which is why I'm here Posted Image)
So, has anyone come across this kind of issue before and how did you fix it? [code below]

[CODE]
import android.view.View;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new DrawView(this));
}

public class DrawView extends View
{
private Paint mpaint = new Paint( );
private Bitmap mbitmap;

public DrawView(Context context)
{
super(context);
mpaint.setDither(false);
mpaint.setAntiAlias(false);
mpaint.setFilterBitmap(false);

BitmapFactory.Options options = new BitmapFactory.Options( );
options.inDither = false;

mbitmap = BitmapFactory.decodeResource(context.getResources( ), R.drawable.box);
}

@Override
protected void onDraw(Canvas canvas)
{
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(mbitmap, 6, 6, mpaint);
}
}
}
[/CODE]

Thanks

PS: I also tried SurfaceView, same problems.. I know it is somehow possible to get decent pixel quality in android, just take a look at Zenonia (my images look like those from Zenonia 1 at the moment, I would like the quality achieved in Zenonia 3/4 Posted Image )

EDIT2: Some more evidence of the problem I'm having, definitely some unwanted scaling going on. I've tried putting the image in all drawable folders one at a time, hdpi scales down and mdpi scales to what you see in the image below:

Posted Image
The Image to the right is the one I am drawing and the one on the left is from the API demos.
I can't see what I'm doing wrong, I checked the code both are being loaded via the openRawResource( ) and the decodeStream( ) methods.

#2roadysix

Posted 11 July 2012 - 09:58 AM

Hi all, recently I've been trying my hand at some Java and Android development.
However, no matter what I try I just can't seem to get a level of image quality that I would be happy with for the sprites in the game.

I've had issues with banding showing with subtle colour transitions on background images and imprecise pixel positioning on both my android device and emulator.. below is an image compared with the original that demonstrates what I mean (though in this case the banding isn't so bad).

Posted Image

There seems to be some sort of filtering and and scaling going on which apparently I have no control over (which is why I'm here Posted Image)
So, has anyone come across this kind of issue before and how did you fix it? [code below]

[CODE]
import android.view.View;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new DrawView(this));
}

public class DrawView extends View
{
private Paint mpaint = new Paint( );
private Bitmap mbitmap;

public DrawView(Context context)
{
super(context);
mpaint.setDither(false);
mpaint.setAntiAlias(false);
mpaint.setFilterBitmap(false);

BitmapFactory.Options options = new BitmapFactory.Options( );
options.inDither = false;

mbitmap = BitmapFactory.decodeResource(context.getResources( ), R.drawable.box);
}

@Override
protected void onDraw(Canvas canvas)
{
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(mbitmap, 6, 6, mpaint);
}
}
}
[/CODE]

Thanks

PS: I also tried SurfaceView, same problems.. I know it is somehow possible to get decent pixel quality in android, just take a look at Zenonia (my images look like those from Zenonia 1 at the moment, I would like the quality achieved in Zenonia 3/4 Posted Image )

#1roadysix

Posted 11 July 2012 - 09:56 AM

Hi all, recently I've been trying my hand at some Java and Android development.
However, no matter what I try I just can't seem to get a level of image quality that I would be happy with for the sprites in the game.

I've had issues with banding showing with subtle colour transitions on background images and imprecise pixel positioning.. below is an image compared with the original that demonstrates what I mean (though in this case the banding isn't so bad).

Posted Image

There seems to be some sort of filtering and and scaling going on which apparently I have no control over (which is why I'm here :P)
So, has anyone come across this kind of issue before and how did you fix it? [code below]

[CODE]
import android.view.View;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Paint;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new DrawView(this));
}

public class DrawView extends View
{
private Paint mpaint = new Paint( );
private Bitmap mbitmap;

public DrawView(Context context)
{
super(context);
mpaint.setDither(false);
mpaint.setAntiAlias(false);
mpaint.setFilterBitmap(false);

BitmapFactory.Options options = new BitmapFactory.Options( );
options.inDither = false;

mbitmap = BitmapFactory.decodeResource(context.getResources( ), R.drawable.box);
}

@Override
protected void onDraw(Canvas canvas)
{
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(mbitmap, 6, 6, mpaint);
}
}
}
[/CODE]

Thanks

PS: I also tried SurfaceView, same problems.. I know it is somehow possible to get decent pixel quality in android, just take a look at Zenonia (my images look like those from Zenonia 1 at the moment, I would like the quality achieved in Zenonia 3/4 :) )

PARTNERS