Package net.rim.device.api.system

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


    public static Bitmap addStateIndicator(Bitmap unfocused_bmp, int color) {
        int width=unfocused_bmp.getWidth();
        int height=unfocused_bmp.getHeight();
        int [] argb = new int[width * height];
        unfocused_bmp.getARGB(argb, 0, width, 0, 0, width, height);
        Bitmap new_bmp = new Bitmap(width, height);
        new_bmp.setARGB(argb, 0, width, 0, 0, width, height);
        Graphics pen = Graphics.create(new_bmp);
        pen.setGlobalAlpha(Constants.TRANSPARENCY);
        pen.setColor(color);
        pen.fillRect(0, 0, width, height);
        return new_bmp;
View Full Code Here


   * @param iconFile
   *            full URL to an icon on the filesystem.
   * @since 1.3
   */
  public void addIcon(String iconFile) {
    Bitmap image = (new BitmapFile(iconFile)).getBitmap();
    if (image != null) {
      addIcon(image);
    }
  }
View Full Code Here

    if (icon == null) {
      return;
      // TODO does the API throw an Exception?
    }
    // Scale to same height as the other elements.
    Bitmap image = scaleImage(icon);

    if (this.icon != null) {
      this.icon.setBitmap(image);
    } else {
      this.icon = new BitmapField(image);
View Full Code Here

    int dimension = BannerFont.getFontHeight();
    if (!isDimension) {
      dimension -= 2; // old theme is better with full size image.
    }
    if (image.getHeight() > dimension) {
      Bitmap scaled = new Bitmap(dimension, dimension);
//#ifdef BlackBerrySDK4.2.1 | BlackBerrySDK4.3.0 | BlackBerrySDK4.5.0 | BlackBerrySDK4.6.0 | BlackBerrySDK4.6.1 | BlackBerrySDK4.7.0
      ImageManipulator manip = new ImageManipulator(image);
      manip.scaleInto(scaled, ImageManipulator.FILTER_BILINEAR, ImageManipulator.SCALE_TO_FIT);
//#else
      image.scaleInto(scaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT);
View Full Code Here

        mi_about.setCommandContext(this);
        mi_about.setCommand(new Command(new AboutCommand()));
        addMenuItem(mi_about);


        Bitmap blank_unfocused = BitmapFactory.getBlankUnfocused();
        Bitmap blank_focused = BitmapFactory.addStateIndicator(blank_unfocused, Constants.FOCUSED_COLOUR);
        Bitmap blank_clicked = BitmapFactory.addStateIndicator(blank_unfocused, Constants.CLICKED_COLOUR);

        nought_unfocused = BitmapFactory.getNoughtUnfocused();
        Bitmap nought_focused = BitmapFactory.addStateIndicator(nought_unfocused, Constants.FOCUSED_COLOUR);
        Bitmap nought_clicked = BitmapFactory.addStateIndicator(nought_unfocused, Constants.CLICKED_COLOUR);

        cross_unfocused = BitmapFactory.getCrossUnfocused();
        Bitmap cross_focused = BitmapFactory.addStateIndicator(cross_unfocused, Constants.FOCUSED_COLOUR);
        Bitmap cross_clicked = BitmapFactory.addStateIndicator(cross_unfocused, Constants.CLICKED_COLOUR);

        stale_mate_cross_bmp = BitmapFactory.addStateIndicator(cross_unfocused, Constants.STALE_MATE_TILE_COLOUR);
        stale_mate_nought_bmp = BitmapFactory.addStateIndicator(cross_unfocused, Constants.STALE_MATE_TILE_COLOUR);

        AbsoluteFieldManager abmgr = new AbsoluteFieldManager();
View Full Code Here

    public ActivityIndicatorScreen() {
        setTitle("Activity Indicator Screen");

        _views = new ActivityIndicatorView[7];

        Bitmap bitmap; // Reuse this reference

        // Add an ActivityIndicatorView featuring a rounded red border
        bitmap = Bitmap.getBitmapResource("spinner.png");
        final XYEdges edges = new XYEdges(2, 2, 2, 2);
        final Border border =
                BorderFactory.createRoundedBorder(edges, Color.CRIMSON,
                        Border.STYLE_SOLID);
        _views[0] =
                ActivityIndicatorFactory.createActivityIndicator(0, bitmap, 5,
                        0, "with border", Field.FIELD_HCENTER);
        _views[0].setBorder(border);
        add(_views[0]);
        add(new SeparatorField());

        // Add an ActivityIndicatorView with label and animation centered in a
        // horizontal layout
        bitmap = Bitmap.getBitmapResource("spinner.png");
        _views[1] =
                ActivityIndicatorFactory.createActivityIndicator(
                        new HorizontalFieldManager(), Field.FIELD_HCENTER,
                        bitmap, 5, 0, "horizontal centered layout",
                        Field.FIELD_HCENTER);
        add(_views[1]);
        add(new SeparatorField());

        // Add a centered ActivityIndicatorView between two focusable fields
        add(new LabelField("focusable field", Field.FOCUSABLE));
        bitmap = Bitmap.getBitmapResource("spinner2.png");
        _views[2] =
                ActivityIndicatorFactory.createActivityIndicator(
                        Field.FIELD_HCENTER, bitmap, 6, Field.FIELD_HCENTER,
                        "centered between focusable fields",
                        Field.FIELD_HCENTER);
        add(_views[2]);
        add(new LabelField("focusable field", Field.FOCUSABLE));
        add(new SeparatorField());

        // Add a right justified ActivityIndicatorView
        bitmap = Bitmap.getBitmapResource("spinner.png");
        _views[3] =
                ActivityIndicatorFactory.createActivityIndicator(
                        Field.USE_ALL_WIDTH, bitmap, 5, Field.FIELD_RIGHT,
                        "right justified layout", Field.FIELD_VCENTER);
        add(_views[3]);
        add(new SeparatorField());

        Background background; // Reuse this reference

        // Add an ActivityIndicatorView featuring a solid black background
        bitmap = Bitmap.getBitmapResource("orchid.png");
        background = BackgroundFactory.createSolidBackground(Color.BLACK);
        _views[4] =
                ActivityIndicatorFactory.createActivityIndicator(0, bitmap, 6,
                        0);
        _views[4].setBackground(background);
        add(_views[4]);
        add(new LabelField("solid background"));
        add(new SeparatorField());

        // Add an ActivityIndicatorView to another ActivityIndicatorView
        bitmap = Bitmap.getBitmapResource("progress.png");
        background = BackgroundFactory.createSolidBackground(Color.DARKGRAY);
        _views[5] =
                ActivityIndicatorFactory.createActivityIndicator(0, bitmap, 12,
                        0, "view added to another", 0);
        _views[5].setBackground(background);
        bitmap = Bitmap.getBitmapResource("spinner.png");
        _views[6] =
                ActivityIndicatorFactory.createActivityIndicator(0, bitmap, 5,
                        0);
        _views[5].add(_views[6]);
        add(_views[5]);

        final MenuItem cancelItem =
                new MenuItem(new StringProvider("Cancel spinners "), 0x230020,
                        0);
        cancelItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().cancel();
                }
            }
        }));

        final MenuItem resetItem =
                new MenuItem(new StringProvider("Reset spinners "), 0x230030, 0);
        resetItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().reset();
                }
            }
        }));

        final MenuItem resumeItem =
                new MenuItem(new StringProvider("Resume spinners "), 0x230040,
                        0);
        resumeItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().resume();
                }
            }
        }));

        final MenuItem delayedStop =
                new MenuItem(new StringProvider("Delayed start"), 0x230050, 0);
        delayedStop.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    final DelayedStart ds = new DelayedStart(_views[i]);
                    ds.start();
                }
            }
        }));

        final MenuItem delayedStart =
                new MenuItem(new StringProvider("Delayed stop"), 0x230060, 0);
        delayedStart.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    final DelayedStop ds = new DelayedStop(_views[i]);
                    ds.start();
                }
            }
        }));

        final MenuItem showPopupItem =
                new MenuItem(new StringProvider("Show Popup"), 0x230010, 0);
        showPopupItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Bitmap bitmap = Bitmap.getBitmapResource("orchid2.png");
                final ActivityIndicatorView view =
                        ActivityIndicatorFactory.createActivityIndicator(0,
                                bitmap, 6, Field.FIELD_HCENTER);
                bitmap = Bitmap.getBitmapResource("progress2.png");
                final ActivityIndicatorView view2 =
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();

            // Add data to the RichList
            final Object[] rowObjects = new Object[5];
View Full Code Here

        final HorizontalFieldManager manager =
                new HorizontalFieldManager(ScrollView.HORIZONTAL_SCROLL);

        // Create three pages inside the manager
        for (int i = 0; i < 3; i++) {
            final Bitmap bitmap = new Bitmap(displayWidth, displayHeight);

            final Graphics g = Graphics.create(bitmap);
            g.setBackgroundColor(Color.BLACK);
            g.clear();
            g.setColor(Color.ALICEBLUE);
View Full Code Here

        // Initialize and configure title bar
        final StandardTitleBar titleBar = new StandardTitleBar();

        titleBar.addTitle("<title goes here>");

        final Bitmap bitmap = Bitmap.getBitmapResource("logo.jpg");
        if (bitmap != null) {
            titleBar.addIcon(bitmap);
        }

        titleBar.addClock();
View Full Code Here

             */
            ImageMenuItem() {
                super(new StringProvider("Image menu item"), 0x230100, 0);

                // Create Image object from project resource
                final Bitmap bitmap = Bitmap.getBitmapResource("img.png");
                final Image image = ImageFactory.createImage(bitmap);

                // Set image as this menu item's icon
                setIcon(image);
            }
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.