Package net.rim.device.api.ui

Examples of net.rim.device.api.ui.Graphics


              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 );
View Full Code Here


    protected void layout( int width, int height ) {
        width = getPreferredWidth();
        height = getPreferredHeight();

        _rainbow = new Bitmap( width, height );
        Graphics rainbowGraphics = Graphics.create( _rainbow );
        rainbowGraphics.drawShadedFilledPath( _xcoords, _ycoords, null, _colors, null );

        setExtent( width, height );
    }
View Full Code Here

        _colors = new int[] { 0xFFFFFF, 0x000000, 0x000000, _baseColor };

        // make new bitmap
        _backgroundBitmap = new Bitmap( width, height );// Bitmap.ROWWISE_MONOCHROME , width, height);// Bitmap.DEFAULT_TYPE,
                                                        // width, height );
        Graphics bitmapGraphics = Graphics.create( _backgroundBitmap );
        bitmapGraphics.drawShadedFilledPath( _xcoords, _ycoords, null, _colors, null );

        // Update selected color
        int[] argbData = new int[ 1 ];
        _backgroundBitmap.getARGB( argbData, 0, 1, _x, _y, 1, 1 );
        _selectedColor = argbData[ 0 ];
View Full Code Here

        if(nWidth == nOriginWidth && nHeight == nOriginHeight)
            return bmpSrc;

        //Prepare a drawing bitmap and graphic object
        Bitmap bmpOrigin = new Bitmap(nOriginWidth, nOriginHeight);
        Graphics graph = Graphics.create(bmpOrigin);

        //Create a line of transparent pixels for later use
        int[] aEmptyLine = new int[nWidth];
        for(int x = 0; x < nWidth; x++)
            aEmptyLine[x] = 0x00000000;
        //Create two scaled bitmaps
        Bitmap[] bmpScaled = new Bitmap[2];
        for(int i = 0; i < 2; i++)
        {
            //Draw the bitmap on a white background first, then on a black background
            graph.setColor((i == 0) ? Color.WHITE : Color.BLACK);
            graph.fillRect(0, 0, nOriginWidth, nOriginHeight);
            graph.drawBitmap(0, 0, nOriginWidth, nOriginHeight, bmpSrc, 0, 0);

            //Create a new bitmap with the desired size
            bmpScaled[i] = new Bitmap(nWidth, nHeight);
            if(nAspectRatio == Bitmap.SCALE_TO_FIT)
            {
View Full Code Here

    applyTransformation();

    // create the new bitmap
    Bitmap transformedBitmap = new Bitmap(bitmap.getType(), transformedRegion.width, transformedRegion.height);
    transformedBitmap.createAlpha(Bitmap.ALPHA_BITDEPTH_8BPP);
    Graphics graphics = new Graphics(transformedBitmap);
    paintTransformedBitmap(graphics);
    return transformedBitmap;
  }
View Full Code Here

    // Calculate the new scale based on the region sizes
    resultantScaleX = Fixed32.div(Fixed32.toFP(dstWidth), Fixed32.toFP(srcWidth));
    resultantScaleY = Fixed32.div(Fixed32.toFP(dstHeight), Fixed32.toFP(srcHeight));

    Graphics graphics = new Graphics(dst);
    paintTransformedBitmap(graphics, dstLeft - srcLeft, dstTop - srcTop);
  }
View Full Code Here

public class BitmapFactory {
   
    public static Bitmap getBackground(int width, int height) {
        Bitmap bg = new Bitmap(width, height);
        Graphics pen = Graphics.create(bg);
        int x1 = width / 3;
        int x2 = x1 * 2;
        int y1 = height / 3;
        int y2 = y1 * 2;
        pen.setColor(Color.BLACK);
        pen.drawLine(x1, 0, x1, height);
        pen.drawLine(x2, 0, x2, height);
        pen.drawLine(0, y1, width, y1);
        pen.drawLine(0, y2, width, y2);
        return bg;
    }
View Full Code Here

        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

        // 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);
            g.fillRoundRect(10, 10, displayWidth - ROUND_RECT_WIDTH_PAD,
                    displayHeight - ROUND_RECT_HEIGHT_PAD, ARC_WIDTH,
                    ARC_HEIGHT);
            g.setColor(Color.DARKGRAY);
            g.drawText(Integer.toString(i), displayWidth / 2, displayHeight / 2);

            final BitmapField field = new BitmapField(bitmap);
            manager.add(field);
        }
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.Graphics

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.