Examples of EncodedImage


Examples of de.anomic.yacy.graphics.EncodedImage

            height = Math.min(576, height);
        }
        if (passiveLimit > 1000000) passiveLimit = 1000000;
        if (potentialLimit > 1000000) potentialLimit = 1000000;
        if (maxCount > 10000) maxCount = 10000;
        buffer = new EncodedImage(NetworkGraph.getNetworkPicture(sb.peers, 10000, width, height, passiveLimit, potentialLimit, maxCount, coronaangle, communicationTimeout, env.getConfig(SwitchboardConstants.NETWORK_NAME, "unspecified"), env.getConfig("network.unit.description", "unspecified"), bgcolor, cyc).getImage(), "png");
        lastAccessSeconds = System.currentTimeMillis() / 1000;

        sync.release();
        return buffer;
    }
View Full Code Here

Examples of de.anomic.yacy.graphics.EncodedImage

                        if (!method.equals(HeaderFramework.METHOD_HEAD)) {
                            result.writeTo(out);
                        }
                    }
                    if (img instanceof EncodedImage) {
                        final EncodedImage yp = (EncodedImage) img;
                        // send an image to client
                        targetDate = new Date(System.currentTimeMillis());
                        nocache = true;
                        final String mimeType = MimeTable.ext2mime(targetExt, "text/html");
                        final ByteBuffer result = yp.getImage();

                        // write the array to the client
                        HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
                        if (!method.equals(HeaderFramework.METHOD_HEAD)) {
                            result.writeTo(out);
View Full Code Here

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

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

        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

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

    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

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

     * @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

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

   */
  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

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

    }

    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

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

            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

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

                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
TOP
Copyright © 2018 www.massapi.com. 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.