Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Guide de dépannage Page 45

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 286
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 44
2
Using graphics and multimedia
Using images
Use raw images
Using images
Drawing and rendering images
Using audio
Using rich media
Task Steps
Allow applications to
use raw image data.
> To retrieve raw image data from a specified region of a bitmap and store the data in an integer array, invoke
Bitmap.getARGB().
void getARGB(int[] argbData, int offset, int scanLength, int x, int y, int width,
int height);
Retrieve image data. 1. Initialize an integer array.
Bitmap original = Bitmap.getPredefinedBitmap(Bitmap.INFORMATION);
int[] argb = new int[original.getWidth() * original.getHeight()];
2. To store the raw image data of the new or predefined bitmap in the integer array, invoke Bitmap.getARGB().
original.getARGB(argb, 0, original.getWidth(), 0, 0, original.getWidth(),
original.getHeight());
Compare two images to
see if they are identical.
>Invoke Bitmap.equals().
if(restored.equals(original)) {
System.out.println("Success! Bitmap renders correctly with RGB data.");
} else if(!restored.equals(original)) {
System.out.println("Bitmap rendered incorrectly with RGB data.");
}
Vue de la page 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 285 286

Commentaires sur ces manuels

Pas de commentaire