⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppsvgbitmap.java

📁 一个用Java写的
💻 JAVA
字号:
/****************************************************************** * Copyright (C) 2002-2006 Andrew Girow. All rights reserved.     * * ---------------------------------------------------------------* * This software is published under the terms of the TinyLine     * * License, a copy of which has been included with this           * * distribution in the TINYLINE_LICENSE.TXT file.                 * *                                                                * * For more information on the TinyLine,                          * * please see <http://www.tinyline.com/>.                         * *****************************************************************/package com.tinyline.app;import java.awt.*;import java.awt.image.*;import java.net.URL;import java.util.Hashtable;import com.tinyline.tiny2d.TinyBitmap;/** The <tt>PPSVGBitmap</tt> represents the TinyBitmap for the J2ME *  Personal Profile. The process of creating a raster image is *  different for different platforms and JVMs. *  That is why the derived class from the TinyBitmap class is needed. * * @author (C) Andrew Girow * @version 1.9 * <p> */public class PPSVGBitmap extends TinyBitmap implements ImageObserver{    /**     * Create a new <tt>PPSVGBitmap</tt> which gets pixel data     * from the base URL and the path.     *     * @param   baseUrl   the base URL context     * @param   imageRef  the String representation of the URL     * to use in fetching the pixel data.     */    public PPSVGBitmap(MediaTracker tracker, URL imgUrl)    {       Image image = null;       try       {           image = Toolkit.getDefaultToolkit().getImage(imgUrl);           tracker.addImage (image, 0);           tracker.waitForID(0);           width = image.getWidth(this); //       System.out.println("PPSVGBitmap width " + width);           height = image.getHeight(this); //       System.out.println("PPSVGBitmap height " + height);           PixelGrabber pg = new PixelGrabber(image, 0, 0, width, height, true);           try           {             pg.grabPixels();             pixels32 = (int [])pg.getPixels();           }           catch (InterruptedException e)           {             e.printStackTrace();  // Debug           }       }       catch (Exception e)       {           e.printStackTrace();  // Debug       }    }    /**     * Create a new <tt>PPSVGBitmap</tt> which gets pixel data     * from the given array of bytes.     * @param     imageData   an array of bytes, representing     *                         image data in a supported image format.     * @param     imageOffset  the offset of the beginning     *                         of the data in the array.     * @param     imageLength  the length of the data in the array.     */    public PPSVGBitmap(MediaTracker tracker, byte[] imageData, int imageOffset, int imageLength)    {       Image image = null;       try       {           image = Toolkit.getDefaultToolkit().createImage(           imageData, imageOffset, imageLength);           tracker.addImage (image, 0);           tracker.waitForID(0);           width = image.getWidth(this); //       System.out.println("PPSVGBitmap width " + width);           height = image.getHeight(this); //       System.out.println("PPSVGBitmap height " + height);           PixelGrabber pg = new PixelGrabber(image, 0, 0, width, height, true);           try           {             pg.grabPixels();             pixels32 = (int [])pg.getPixels();           }           catch (InterruptedException e)           {             e.printStackTrace();  // Debug           }       }       catch (Exception e)       {           e.printStackTrace();  // Debug       }    }    public boolean imageUpdate(Image img, int infoflags, int x, int y,           int width, int height)    {       return true;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -