Examples of BitMap


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

    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

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

        _xcoords = new int[] { 0, 0, width, width };
        _ycoords = new int[] { 0, height, height, 0 };
        _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
View Full Code Here

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

            int type = listItem.getType();
            Font font = graphics.getFont();
            final int checkboxSize = font.getHeight() - 6;
            final int textStart = PADDING + checkboxSize + 10;

            Bitmap checkWhite = GPATools.ResizeTransparentBitmap( Bitmap.getBitmapResource( "chk-white.png" ), checkboxSize,
                    checkboxSize, Bitmap.FILTER_BOX, Bitmap.SCALE_TO_FILL );
            Bitmap checkBlue = GPATools.ResizeTransparentBitmap( Bitmap.getBitmapResource( "chk-blue.png" ), checkboxSize,
                    checkboxSize, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL );
            Bitmap boxEmpty = GPATools.ResizeTransparentBitmap( Bitmap.getBitmapResource( "box-empty.png" ), checkboxSize,
                    checkboxSize, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL );

            switch( type ) {
                case SelectAsyncFunction.POPUP_ITEM_TYPE_SEPARATOR:
                    graphics.setColor( Color.GRAY );
View Full Code Here

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

        int nOriginHeight = bmpSrc.getHeight();
        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)
            {
                //Set the alpha channel of all pixels to 0 to ensure transparency is
                //applied around the picture, if needed by the transformation
                for(int y = 0; y < nHeight; y++)
                    bmpScaled[i].setARGB(aEmptyLine, 0, nWidth, 0, y, nWidth, 1);
            }

            //Scale the bitmap
            bmpOrigin.scaleInto(bmpScaled[i], nFilterType, nAspectRatio);
        }

        //Prepare objects for final iteration
        Bitmap bmpFinal = bmpScaled[0];
        int[][] aPixelLine = new int[2][nWidth];

        //Iterate every line of the two scaled bitmaps
        for(int y = 0; y < nHeight; y++)
        {
            bmpScaled[0].getARGB(aPixelLine[0], 0, nWidth, 0, y, nWidth, 1);
            bmpScaled[1].getARGB(aPixelLine[1], 0, nWidth, 0, y, nWidth, 1);

            //Check every pixel one by one
            for(int x = 0; x < nWidth; x++)
            {
                //If the pixel was untouched (alpha channel still at 0), keep it transparent
                if(((aPixelLine[0][x] >> 24) & 0xff) == 0)
                    aPixelLine[0][x] = 0x00000000;
                else
                {
                    //Compute the alpha value based on the difference of intensity
                    //in the red channel
                    int nAlpha = ((aPixelLine[1][x] >> 16) & 0xff) -
                                    ((aPixelLine[0][x] >> 16) & 0xff) + 255;
                    if(nAlpha == 0)
                        aPixelLine[0][x] = 0x00000000; //Completely transparent
                    else if(nAlpha >= 255)
                        aPixelLine[0][x] |= 0xff000000; //Completely opaque
                    else
                    {
                        //Compute the value of the each channel one by one
                        int nRed = ((aPixelLine[0][x] >> 16 ) & 0xff);
                        int nGreen = ((aPixelLine[0][x] >> 8 ) & 0xff);
                        int nBlue = (aPixelLine[0][x] & 0xff);

                        nRed = (int)(255 + (255.0 * ((double)(nRed-255)/(double)nAlpha)));
                        nGreen = (int)(255 + (255.0 * ((double)(nGreen-255)/(double)nAlpha)));
                        nBlue = (int)(255 + (255.0 * ((double)(nBlue-255)/(double)nAlpha)));

                        if(nRed < 0) nRed = 0;
                        if(nGreen < 0) nGreen = 0;
                        if(nBlue < 0) nBlue = 0;
                        aPixelLine[0][x] = nBlue | (nGreen<<8) | (nRed<<16) | (nAlpha<<24);
                    }
                }
            }

            //Change the pixels of this line to their final value
            bmpFinal.setARGB(aPixelLine[0], 0, nWidth, 0, y, nWidth, 1);
        }
        return bmpFinal;
    }
View Full Code Here

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

    private class SetDisplayPic extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final String displayPicURI = (String) args[0];
            final ScriptableFunction onComplete = (ScriptableFunction) args[1];
            final Bitmap displayPic = Util.requestBitmap(displayPicURI);
           
            Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                protected void dispatch() {
                    boolean result;
                    try {
View Full Code Here

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

            final Object iconURI = options.getField("icon");
            if(iconURI.equals(UNDEFINED)) {
                iconID = -1;
            } else {
                final byte[] iconBytes = Util.requestBitmapBytes((String) iconURI);
                final Bitmap icon = Bitmap.createBitmapFromBytes(iconBytes, 0, iconBytes.length, 1);
                iconID = Math.abs(ByteBuffer.wrap(iconBytes).hashCode()); // icon ID is hash code of bitmap
                if(! _profileBox.isIconRegistered(iconID)) {
                    _profileBox.registerIcon(iconID, PNGEncodedImage.encode(icon));
                }
            }
View Full Code Here

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

                vc.addElement( (byte) b );
            }

            // An application could have multiple entry points and each entry point has its own icon.
            // We need to update icons for all entry points to be the same one.
            Bitmap image = Bitmap.createBitmapFromBytes( vc.getArray(), 0, vc.size(), 1 );
            ApplicationDescriptor current = ApplicationDescriptor.currentApplicationDescriptor();
            int moduleHandle = current.getModuleHandle();
            ApplicationDescriptor[] descriptors = CodeModuleManager.getApplicationDescriptors( moduleHandle );
           
            if( args.length == 1 || !( (Boolean) args[ 1 ] ).booleanValue() ) {
View Full Code Here

Examples of net.sf.jpluck.palm.bitmap.Bitmap

                    addCompositeImage(resource, embeddedImage, embeddedSettings, false);
                } else {
                    embeddedImage = ImageConverter.rescale(image, embeddedSettings.getBitDepth(),
                                                           embeddedSettings.getMaxWidth(),
                                                           embeddedSettings.getMaxHeight());
                    Bitmap bitmap = ImageConverter.convert(embeddedImage, embeddedSettings.getBitDepth());
                    ImageRecord imageRecord = resource.createImageRecord(bitmap, false);
                    pluckerDocument.addRecord(imageRecord);
                }
                if (!embeddedSettings.isIncludeAlternate() ||
                        ((image.getWidth() <= embeddedImage.getWidth()) &&
                        (image.getHeight() <= embeddedImage.getHeight()))) {
                    return;
                }
            }

            if ((jxlDocument.isIncludeStandaloneImages())) {
                // TODO: Improve heuristic for determining whether to include an alternate image.
                ImageSettings standaloneSettings = jxlDocument.getStandaloneImageSettings();
                if (ClientConfiguration.getDefault().isUseMultiImage()) {
                    BufferedImage standaloneImage = ImageConverter.rescale(image, standaloneSettings.getMaxWidth(),
                                                                           standaloneSettings.getMaxHeight());
                    addCompositeImage(resource, standaloneImage, standaloneSettings, resource.isEmbedded());
                } else {
                    BufferedImage standaloneImage = ImageConverter.rescale(image, standaloneSettings.getMaxWidth(),
                                                                           standaloneSettings.getMaxHeight());
                    int width = standaloneImage.getWidth();
                    int height = standaloneImage.getHeight();

                    int targetBitDepth = standaloneSettings.getBitDepth();
                    int maxPossiblebitDepth = 0;
                    if ((maxPossiblebitDepth == 0) && (targetBitDepth >= 8)) {
                        if ((width * height) <= 60000) {
                            maxPossiblebitDepth = 8;
                        }
                    }
                    if ((maxPossiblebitDepth == 0) && (targetBitDepth >= 4)) {
                        if ((width * height) <= 120000) {
                            maxPossiblebitDepth = 4;
                        }
                    }
                    if ((maxPossiblebitDepth == 0) && (targetBitDepth >= 2)) {
                        if ((width * height) <= 240000) {
                            maxPossiblebitDepth = 2;
                        }
                    }
                    if ((maxPossiblebitDepth == 0) && (targetBitDepth >= 1)) {
                        if ((width * height) <= 480000) {
                            maxPossiblebitDepth = 1;
                        }
                    }
                    if (maxPossiblebitDepth > 0) {
                        Bitmap bitmap = ImageConverter.convert(standaloneImage, maxPossiblebitDepth);
                        ImageRecord imageRecord = resource.createImageRecord(bitmap, resource.isEmbedded());
                        pluckerDocument.addRecord(imageRecord);
                    }
                }
            }
View Full Code Here

Examples of org.boris.pecoff4j.resources.Bitmap

import org.boris.pecoff4j.resources.VersionInfo;

public class ResourceParser
{
    public static Bitmap readBitmap(IDataReader dr) throws IOException {
        Bitmap bm = new Bitmap();
        bm.setFileHeader(readBitmapFileHeader(dr));
        bm.setInfoHeader(readBitmapInfoHeader(dr));

        return bm;
    }
View Full Code Here

Examples of org.chaidb.db.helper.BitMap

    private static final int BLOCK_SIZE = BTreeSpec.PAGE_SIZE;

    public BTreeChanges(int treeid) throws ChaiDBException {
        this.treeid = treeid;
        bitMaps = new LinkedHashMap(1);
        BitMap bitMap = new BitMap(INIT_CAP);
        bitMaps.put(new Integer(0), bitMap);
        btreepath = pbm.getBTreeName(treeid);
        trackName = btreepath + EXT;

        // init bitMap from file
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.