Package net.rim.device.api.system

Examples of net.rim.device.api.system.Bitmap


        // Ensure Bitmap will be at least original size
        width = Math.max(width, _origWidth);
        height = Math.max(height, _origHeight);

        // Create Bitmap from original scaled to new calculated dimensions
        final Bitmap bitmapScaled = new Bitmap((int) width, (int) height);
        _bitmapOrig.scaleInto(bitmapScaled, Bitmap.FILTER_BOX);

        // Replace Bitmap
        _bitmapField.setBitmap(bitmapScaled);
View Full Code Here


                displayName.append(")");
            }

            final String os = deviceData.nextToken().trim();
            final String imageFileName = modelNumber + ".png";
            final Bitmap bitmap = Bitmap.getBitmapResource(imageFileName);
            final String year = deviceData.nextToken().trim();
            final String interfaces = deviceData.nextToken().trim();

            _tableModel.addRow(new Object[] { bitmap, displayName.toString(),
                    os, year, interfaces });
View Full Code Here

            header.setModel(model);
            final XYEdges edgesFour = new XYEdges(4, 4, 4, 4);
            header.setBorder(BorderFactory.createRoundedBorder(edgesFour));

            // Set arrow images
            final Bitmap leftArrow = Bitmap.getBitmapResource("leftArrow.png");
            final Bitmap rightArrow =
                    Bitmap.getBitmapResource("rightArrow.png");
            if (leftArrow != null) {
                header.setLeftArrow(leftArrow);
            }
            if (rightArrow != null) {
View Full Code Here

         */
        BitmapDemoScreen() {
            setTitle("Bitmap Demo");

            // Create a Bitmap from a project resource
            final Bitmap bitmapOrig = Bitmap.getBitmapResource("rim.png");

            // Create a new Bitmap of arbitrary size with a bit
            // depth of 32 bits.
            final int scaledX = 175;
            final int scaledY = 50;
            Bitmap bitmapScaled =
                    new Bitmap(Bitmap.ROWWISE_32BIT_ARGB8888, scaledX, scaledY);

            // Scale the original Bitmap into the new Bitmap using
            // a Lanczos filter.
            bitmapOrig.scaleInto(bitmapScaled, Bitmap.FILTER_LANCZOS);

            // Display the original Bitmap on the screen
            final BitmapField bitmapFieldOrig =
                    new BitmapField(bitmapOrig, Field.FOCUSABLE);
            final StringBuffer strBuff = new StringBuffer("Original - ");
            strBuff.append(bitmapOrig.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapOrig.getHeight());
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldOrig);

            add(new SeparatorField());

            // Display the scaled Bitmap on the screen
            final BitmapField bitmapFieldScaled1 =
                    new BitmapField(bitmapScaled, Field.FOCUSABLE);
            strBuff.delete(0, strBuff.length());
            strBuff.append("\nScaled - ");
            strBuff.append(bitmapScaled.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapScaled.getHeight());
            strBuff.append(" - FILTER_LANCZOS - Aspect ratio not preserved");
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled1);

            add(new SeparatorField());

            // Redefine the scaled Bitmap
            bitmapScaled =
                    new Bitmap(Bitmap.ROWWISE_32BIT_ARGB8888, scaledX, scaledY);

            // Scale the original Bitmap into the new Bitmap using
            // a bilinear filter and maintaining aspect ratio.
            bitmapOrig.scaleInto(bitmapScaled, Bitmap.FILTER_BILINEAR,
                    Bitmap.SCALE_TO_FILL);

            // Display the newly scaled Bitmap on the screen
            final BitmapField bitmapFieldScaled2 =
                    new BitmapField(bitmapScaled, Field.FOCUSABLE);
            strBuff.delete(0, strBuff.length());
            strBuff.append("\nScaled - ");
            strBuff.append(bitmapScaled.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapScaled.getHeight());
            strBuff.append(" - FILTER_BILINEAR - Aspect ratio preserved");
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled2);

            add(new SeparatorField());

            // Redefine the scaled Bitmap
            bitmapScaled =
                    new Bitmap(Bitmap.ROWWISE_32BIT_ARGB8888, scaledX, scaledY);

            // Calculate fragment dimensions
            final int fragmentWidth = bitmapOrig.getWidth() >> 1; // >> 1
                                                                  // equivalent
                                                                  // to / 2
            final int fragmentHeight = bitmapOrig.getHeight() >> 1; // >> 1
                                                                    // equivalent
                                                                    // to / 2

            // Scale a fragment of the original Bitmap into the new Bitmap
            // using a box filter.
            bitmapOrig.scaleInto(0, 0, fragmentWidth, fragmentHeight,
                    bitmapScaled, 0, 0, bitmapScaled.getWidth(), bitmapScaled
                            .getHeight(), Bitmap.FILTER_BOX);

            // Display the newly scaled Bitmap on the screen
            final BitmapField bitmapFieldScaled3 =
                    new BitmapField(bitmapScaled, Field.FOCUSABLE);
            strBuff.delete(0, strBuff.length());
            strBuff.append("\nScaled fragment ");
            strBuff.append(fragmentWidth);
            strBuff.append(LABEL_X);
            strBuff.append(fragmentHeight);
            strBuff.append(" into ");
            strBuff.append(bitmapScaled.getWidth());
            strBuff.append(LABEL_X);
            strBuff.append(bitmapScaled.getHeight());
            strBuff.append(" - FILTER_BOX");
            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled3);

            // Add a menu item to display an animation in a popup screen
View Full Code Here

                    newWidth = _previousWidth * ratioHeight;
                }

                // Create Bitmap from original scaled to new calculated
                // dimensions
                final Bitmap bitmapScaled =
                        new Bitmap((int) newWidth, (int) newHeight);
                _bitmapOrig.scaleInto(bitmapScaled, Bitmap.FILTER_BOX);

                // Need to use invokeLater() as bitmap cannot be set while
                // in layout().
                UiApplication.getUiApplication().invokeLater(new Runnable() {
View Full Code Here

        // Add data to adapter
        while (deviceData.hasMoreTokens()) {
            final String modelNumber = deviceData.nextToken().trim();
            final String modelName = deviceData.nextToken().trim();
            deviceData.nextToken(); // Consume unwanted input
            final Bitmap bitmap =
                    Bitmap.getBitmapResource(modelNumber + ".png");
            deviceData.nextToken();
            deviceData.nextToken();

            final Object[] row = { modelName, modelNumber, bitmap };
View Full Code Here

                    // Get data from URL
                    final byte[] data = getData(invoc.getURL());

                    // Create image field
                    final Bitmap image =
                            Bitmap.createBitmapFromBytes(data, 0, -1, 5);
                    final BitmapField imageField =
                            new BitmapField(image, Field.FIELD_HCENTER);

                    screen.add(imageField);
View Full Code Here

        vg.vgSetfv(VG10.VG_CLEAR_COLOR, 4, MY_CLEAR_COLOR, 0);

        final XYRect rect = new XYRect();

        // Create the bitmap from bundled resource "icons.png"
        final Bitmap bitmap = Bitmap.getBitmapResource("icons.png");

        // Create the image for all the icons
        for (int i = 0; i < _imageHandles.length; i++) {
            // Update the XYRect in which the image will be displayed
            updateRect(rect, i);
View Full Code Here

                if (contact.countValues(Contact.EMAIL) > 0) {
                    final String email =
                            contact.getString(Contact.EMAIL, 0).trim();
                    if (email != null && email.endsWith("rim.com")) {
                        // Add an image if contact is a RIM employee
                        final Bitmap bitmap = Bitmap.getBitmapResource(IMAGE);
                        if (bitmap != null) {
                            final BitmapField bitmapField =
                                    new BitmapField(bitmap);
                            phoneScreen.add(bitmapField);
                            phoneScreen.add(new SeparatorField());
View Full Code Here

                if (contact.countValues(Contact.EMAIL) > 0) {
                    final String email =
                            contact.getString(Contact.EMAIL, 0).trim();
                    if (email != null && email.endsWith("rim.com")) {
                        // Add an image if contact is a RIM employee
                        final Bitmap bitmap = Bitmap.getBitmapResource(IMAGE);
                        if (bitmap != null) {
                            final BitmapField bitmapField =
                                    new BitmapField(bitmap);
                            phoneScreen.add(bitmapField);
                            phoneScreen.add(new SeparatorField());
View Full Code Here

TOP

Related Classes of net.rim.device.api.system.Bitmap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.