Advertisement
alishaik786

ScaleImage.java

Jan 18th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public class Abc extends MainScreen
  2. {
  3. Bitmap boxImage=Bitmap.getBitmapResource("box_s2.png"),scaleBitmap;
  4. //box_s2.png this image original height is 380X230;
  5.  
  6. public Abc()
  7. {
  8. setTitle("Loading Screen");
  9. createGUI();
  10. }
  11.  
  12. private void createGUI()
  13. {
  14.  
  15. if(Display.getWidth()==480 && Display.getHeight()==360)
  16. {
  17. scaleBitmap=new Bitmap(150, 150);//Your required width and height;
  18. boxImage.scaleInto(scaleBitmap, Bitmap.FILTER_LANCZOS);
  19. }
  20. else//Means normal screens decrease the size;
  21. {
  22. scaleBitmap=new Bitmap(100, 100);
  23. boxImage.scaleInto(scaleBitmap, Bitmap.FILTER_LANCZOS);
  24. }
  25. BitmapField bitmapField=new BitmapField(scaleBitmap); //Here you use the GridField Manager;
  26. add(bitmapField);
  27. }
  28.  
  29. public boolean onMenu(int instance)
  30. {
  31. return true;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement