Package net.rim.device.api.system

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


                    }
        
                    fconn.create();

                    OutputStream outputStream = fconn.openOutputStream();
                    EncodedImage encodedImage;
                    if(fileExtension.equals("jpg") || fileExtension.equals("jpeg")){
                      encodedImage = JPEGEncodedImage.encode(b, 100);
                    }else{
                      encodedImage = PNGEncodedImage.encode(b);
                    }
                    byte[] imageBytes = encodedImage.getData();
                    outputStream.write(imageBytes);
                    outputStream.close();
                   
                    fconn.close();
                    Object[] args = {filePath+"//"+fileName+"."+fileExtension};
View Full Code Here


        int bgColor = processColorString( _widgetConfigImpl.getLoadingScreenColor() );
       
        if( _widgetConfigImpl.getBackgroundImage().length() != 0 ) {
            // Set background image
            EncodedImage backgroundImage = EncodedImage.getEncodedImageResource( _widgetConfigImpl.getBackgroundImage() );
            if( backgroundImage != null ) {
             
              // Resize the image to the display size.
              int scaleX = Fixed32.div( Fixed32.toFP( backgroundImage.getWidth() ), Fixed32.toFP( Display.getWidth() ) );
              int scaleY = Fixed32.div( Fixed32.toFP( backgroundImage.getHeight() ), Fixed32.toFP( Display.getHeight() ) );
              EncodedImage scaledBgImage = backgroundImage.scaleImage32(scaleX, scaleY);

              // Using the scaled bg image draw onto the blank white bitmap.
              Bitmap bgImg = new Bitmap( scaledBgImage.getScaledWidth(), scaledBgImage.getScaledHeight() );
                Graphics g = new Graphics( bgImg );
                if( bgColor != -1 ) {
                  g.setColor( bgColor );
                } else {
                  g.setColor( Color.WHITE );
                }
                g.fillRect( 0, 0, scaledBgImage.getScaledWidth(), scaledBgImage.getScaledHeight() );
                g.drawImage( 0, 0, scaledBgImage.getScaledWidth(), scaledBgImage.getScaledHeight(),
                    scaledBgImage, 0, 0, 0 );

                Background bg = BackgroundFactory.createBitmapBackground( bgImg,
                        Background.POSITION_X_CENTER, Background.POSITION_Y_CENTER, Background.REPEAT_SCALE_TO_FIT );
                this.setBackground( bg );
                this.getMainManager().setBackground( bg );
            }
        } else {
            // -1 denotes an invalid color
            if( bgColor != -1 ) {
                Background color = BackgroundFactory.createSolidBackground( bgColor );
                this.setBackground( color );
                this.getMainManager().setBackground( color );
            }
        }

        if( _widgetConfigImpl.getForegroundImage().length() != 0 ) {
            EncodedImage foregroundImage = EncodedImage.getEncodedImageResource( _widgetConfigImpl.getForegroundImage() );
            if( foregroundImage != null ) {
                _hfm = new HorizontalFieldManager( Manager.NO_HORIZONTAL_SCROLL | Manager.NO_VERTICAL_SCROLL
                        | Field.NON_FOCUSABLE | Field.FIELD_HCENTER );

                if( foregroundImage instanceof GIFEncodedImage ) {
                    _foregroundImage = new AnimatedGIFField( (GIFEncodedImage) foregroundImage );
                    ( ( AnimatedGIFField) _foregroundImage ).startAnimation();
                } else {
                    _foregroundImage = new BitmapField( foregroundImage.getBitmap() );
                }

                // Add the _foregroundImage field
                _hfm.add( _foregroundImage );
View Full Code Here

    public Object getIcon() {
        final int iconId = _item.getIconId();
        if(iconId == -1) {
            return UNDEFINED;
        } else {
            final EncodedImage icon = _box.getIcon(_item.getIconId());
            if(icon == null) {
                return UNDEFINED;
            } else {
                return Util.bitmapToBase64Str(icon.getBitmap());
            }
        }
    }
View Full Code Here

     * @see ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute( Object thiz, Object[] args ) {
        ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();

        EncodedImage image = EncodedImage.getEncodedImageResource( (String) args[ 0 ] );
        if( image == null ) {
            throw new IllegalArgumentException( "Icon was not found." );
        }
        try {
            ApplicationIcon icon = new ApplicationIcon( image );
View Full Code Here

   */
  private Bitmap load(String filename) {
    try {
      InputStream input = Connector.openInputStream(filename);
      byte[] data = IOUtilities.streamToBytes(input);
      EncodedImage image = EncodedImage.createEncodedImage(data, 0, data.length);
      return image.getBitmap();
    } catch (Exception e) {
      // Just output errors to console
      System.out.print(e.toString());
    }
    return null;
View Full Code Here

    }

    public void onMessage(Destination destination, Message message) {
      if (message instanceof ByteMessage) {
        byte[] results = ((ByteMessage) message).getBytePayload();
        EncodedImage image = EncodedImage.createEncodedImage(results, 0, -1);
        VideoData data = (VideoData) _thumbnailDestinations.get(destination);
        data.setThumbnail(image.getBitmap());
        _listener.thumbRetrieved(data);
        destination.destroy();
      }

    }
View Full Code Here

            if (args.length == 1 && args[0].equals("startup")) {
                final MessageListDemoDaemon daemon =
                        new MessageListDemoDaemon();

                // Register application indicator
                final EncodedImage indicatorIcon =
                        EncodedImage
                                .getEncodedImageResource("img/indicator.png");
                final ApplicationIcon applicationIcon =
                        new ApplicationIcon(indicatorIcon);
                ApplicationIndicatorRegistry.getInstance().register(
View Full Code Here

                final String iconResourcePath) {
            super(new StringProvider(label), 0x230100, priority);

            if (iconResourcePath != null) {
                // Retrieve the icon resource and add it to the menu item
                final EncodedImage encodedImage =
                        EncodedImage.getEncodedImageResource(iconResourcePath);
                if (encodedImage != null) {
                    final Image iconImage =
                            ImageFactory.createImage(encodedImage);
                    this.setIcon(iconImage);
View Full Code Here

                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
                    // Create an EncodedImage object to contain an animated
                    // gif resource.
                    final EncodedImage encodedImage =
                            EncodedImage
                                    .getEncodedImageResource("animation.gif");

                    // Create a BitmapField to contain the animation
                    final BitmapField bitmapFieldAnimation = new BitmapField();
View Full Code Here

     * @param raw
     *            A byte array representing an image
     */
    private void createImageScreen(final byte[] raw) {
        // Create image to be displayed
        final EncodedImage encodedImage =
                EncodedImage.createEncodedImage(raw, 0, raw.length);

        // Initialize the screen
        final ImageScreen imageScreen = new ImageScreen(raw, encodedImage);

View Full Code Here

TOP

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

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.