亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? photoframe.java

?? J2ME PHOTO處理
?? JAVA
字號(hào):
/* * * Copyright ? 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */package example.photoalbum;import java.util.Vector;import javax.microedition.lcdui.*;/** * This PhotoFrame provides the picture frame and drives the animation * of the frames and the picture. It handles the starting and stopping * of the Animation and contains the Thread used to do * the timing and requests that the Canvas be repainted * periodically. * It controls the border style and animation speed. */class PhotoFrame extends Canvas implements Runnable {    /**     * Mapping of speed values to delays in ms.     * Indices map to those in the speed ChoiceGroup in the options form.     * The indices are: 0 = stop, 1 = slow, 2 = medium, 3 = fast.     * @see setSpeed     */    private static final int[] speeds = { 999999999, 500, 250, 100, 0 };    /** border style */    private int style;    /** animation speed set */    private int speed;    /** Vector of images to display */    private Vector images;    /** Index of next image to display */    private int index;    /** X offset of image in frame */    private int imageX;    /** X offset of image in frame */    private int imageY;    /** Width and height of image */    private int imageWidth;    /** Width and height of image */    private int imageHeight;    /** Thread used for triggering repaints */    private Thread thread;    /** buffer image of the screen */    private Image image;    /** Pattern image used for border */    private Image bimage;    /** Time of most recent paint */    private long paintTime;    /** Time of most recent frame rate report */    private long statsTime;    /** Number of frames since last frame rate report */    int frameCount;    /** Last reported frame rate (for re-paint) */    int frameRate;    /**     * Create a new PhotoFrame.     * Create an offscreen mutable image into which the border is drawn.     * Border style is none (0).     * Speed is stopped (0) until set.     */    PhotoFrame() {        image = Image.createImage(getWidth(), getHeight());        setStyle(0);        setSpeed(0);    }    /**     * Set the array of images to be displayed.     * Update the width and height of the image and draw     * the border to fit around it in the offscreen image.     * @param images a vector of images to be displayed.     */    void setImages(Vector images) {        this.images = images;        if (images.size() > 0) {            Image image = (Image)images.elementAt(0);            imageWidth = image.getWidth();            imageHeight = image.getHeight();        } else {            imageWidth = 0;            imageHeight = 0;        }        index = 0;        imageX = (getWidth() - imageWidth) / 2;        imageY = (getHeight() - imageHeight) / 2;        genFrame(style, imageX, imageY, imageWidth, imageHeight);    }    /**     * Advance to the next image and wrap around if necessary.     */    void next() {        if ((images == null) || (++index >= images.size())) {            index = 0;        }    }    /**     * Back up to the previous image.     * Wrap around to the end if at the beginning.     */    void previous() {        if ((images != null) && (--index < 0)) {            index = images.size() - 1;        } else {            index = 0;        }    }    /**     * Reset the PhotoFrame so it holds minimal resources.     * The animation thread is stopped.     */    void reset() {        images = null;        thread = null;    }    /**     * Handle key events. FIRE events toggle between     * running and stopped.  LEFT and RIGHT key events     * when stopped show the previous or next image.     * @param keyCode of the key pressed     */    protected void keyPressed(int keyCode) {        int action = getGameAction(keyCode);        switch (action) {        case RIGHT:            if (thread == null) {                next();                repaint();            }            break;        case LEFT:            if (thread == null) {                previous();                repaint();            }            break;        case FIRE:            // Use FIRE to toggle the activity of the thread            if (thread == null) {                thread = new Thread(this);                thread.start();            } else {                synchronized (this) {                    // Wake up the thread to change the timing                    this.notify();                }                // Shouldn't be in synchronized block                thread = null;            }            break;        }    }    /**     * Handle key repeat events as regular key events.     * @param keyCode of the key repeated     */    protected void keyRepeated(int keyCode) {        keyPressed(keyCode);    }    /**     * Set the animation speed.     * Speed:     * <OL>     * <LI>0 = stop     * <LI>1 = slow     * <LI>2 = medium     * <LI>3 = fast     * <LI>4 = unlimited     * </OL>     * @param speed speedo of animation 0-3;     */    void setSpeed(int speed) {        this.speed = speed;        statsTime = 0;    }    /**     * Get the speed at which animation occurs.     * @return the current speed.     * @see setSpeed     */    int getSpeed() {        return speed;    }    /**     * Set the frame style.     * Recreate the photo frame image from the current style     * and location and size     * <p>     * Style:     * <OL>     * <LI> Style 0: No border is drawn.     * <LI> Style 1: A simple border is drawn     * <LI> Style 2: The border is outlined and an image     * is created to tile within the border.     * </OL>     * @param style the style of the border; 0 = none, 1 = simple,     * 2 = fancy.     */    void setStyle(int style) {        this.style = style;        genFrame(style, imageX, imageY, imageWidth, imageHeight);    }    /**     * Get the style being used for borders.     * @return the style.     */    int getStyle() {        return style;    }    /**     * Notified when Canvas is made visible.     * If there is more than one image to display     * create the thread to run the animation timing.     */    protected void showNotify() {        if ((images != null) && (images.size() > 1)) {            thread = new Thread(this);            thread.start();        }    }    /**     * Notified when the Canvas is no longer visible.     * Signal the running Thread that it should stop.     */    protected void hideNotify() {        thread = null;    }    /**     * Return true if the specified rectangle does not intersect     * the clipping rectangle of the graphics object.  If it returns     * true then the object must be drawn otherwise it would be clipped     * completely.     * The checks are done     * @param g the Graphics context to check.     * @param x the x value of the upper left corner of the rectangle     * @param y the y value of the upper left corner of the rectangle     * @param w the width of the rectangle     * @param h the height of the rectangle     * @return true if the rectangle intersects the clipping region     */    boolean intersectsClip(Graphics g, int x, int y, int w, int h) {        int cx = g.getClipX();        if ((x + w) <= cx) {            return false;        }        int cw = g.getClipWidth();        if (x > (cx + cw)) {            return false;        }        int cy = g.getClipY();        if ((y + h) <= cy) {            return false;        }        int ch = g.getClipHeight();        if (y > (cy + ch)) {            return false;        }        return true;    }    /**     * Runs the animation and makes the repaint requests.     * The thread will exit when it is no longer the current     * Animation thread.     */    public void run() {        Thread mythread = Thread.currentThread();        long scheduled = System.currentTimeMillis();        statsTime = scheduled;        paintTime = scheduled;        frameCount = 0;        frameRate = 0;        /*         * The following code was changed to fix bug 4918599.         * The bug is caused by a deadlock caused by         * bad-designed use of synchronized blocks in demo.         */        while (thread == mythread) {            // Update when the next frame should be drawn            // and compute the delta till then            scheduled += speeds[speed];            long delta = scheduled - paintTime;            if (delta > 0) {                synchronized (this) {                    try {                        this.wait(delta);                    } catch (InterruptedException e) {                    }                }            }            // Advance and repaint the screen            next();            repaint();            serviceRepaints();        }    }    /**     * Paint is called whenever the canvas should be redrawn.     * It clears the canvas and draws the frame and the current     * current frame from the animation.     * @param g the Graphics context to which to draw     */    protected void paint(Graphics g) {        paintTime = System.currentTimeMillis();        if (image != null) {            // Draw the frame unless only the picture is being re-drawn            // This is the inverse of the usual clip check.            int cx = 0;            // Draw the frame unless only the picture is being re-drawn            // This is the inverse of the usual clip check.            int cy = 0;            // Draw the frame unless only the picture is being re-drawn            // This is the inverse of the usual clip check.            int cw = 0;            // Draw the frame unless only the picture is being re-drawn            // This is the inverse of the usual clip check.            int ch = 0;            if (((cx = g.getClipX()) < imageX) || ((cy = g.getClipY()) < imageY) ||                    ((cx + (cw = g.getClipWidth())) > (imageX + imageWidth)) ||                    ((cy + (ch = g.getClipHeight())) > (imageY + imageHeight))) {                g.drawImage(image, 0, 0, Graphics.LEFT | Graphics.TOP);                if (frameRate > 0) {                    g.fillRect(0, getHeight(), 60, 20);                    g.drawString("FPS = " + frameRate, 0, getHeight(),                        Graphics.BOTTOM | Graphics.LEFT);                }            }            // Draw the image if it intersects the clipping region            if ((images != null) && (index < images.size()) &&                    intersectsClip(g, imageX, imageY, imageWidth, imageHeight)) {                g.drawImage((Image)images.elementAt(index), imageX, imageY,                    Graphics.LEFT | Graphics.TOP);            }            frameCount++;            // Update Frame rate            int delta = (int)(paintTime - statsTime);            if ((delta > 1000) && (delta < 10000)) {                frameRate = (((frameCount * 1000) + 500) / delta);                frameCount = 0;                statsTime = paintTime;                repaint(); // queue full repaint to display frame rate            }        }    }    /**     * Paint the photo frame into the buffered screen image.     * This will avoid drawing each of its parts on each repaint.     * Paint will only need to put the image into the frame.     * @param style the style of frame to draw.     * @param x the x offset of the image.     * @param y the y offset of the image     * @param width the width of the animation image     * @param height the height of the animation image     */    private void genFrame(int style, int x, int y, int width, int height) {        Graphics g = image.getGraphics();        // Clear the entire image to white        g.setColor(0xffffff);        g.fillRect(0, 0, image.getWidth() + 1, image.getHeight() + 1);        // Set the origin of the image and paint the border and image.        g.translate(x, y);        paintBorder(g, style, width, height);    }    /**     * Draw a border of the selected style.     * @param g graphics context to which to draw.     * @param style of the border to display     * @param w the width reserved for the image     * @param h the height reserved of the image     * @see setStyle     */    private void paintBorder(Graphics g, int style, int w, int h) {        if (style == 1) {            g.setGrayScale(128);            g.drawRect(-1, -1, w + 1, h + 1);            g.drawRect(-2, -2, w + 3, h + 3);        }        if (style == 2) {            // Draw fancy border with image between outer and inner rectangles            if (bimage == null) {                bimage = genBorder(); // Generate the border image            }            int bw = bimage.getWidth();            int bh = bimage.getHeight();            int i;            // Draw the inner and outer solid border            g.setGrayScale(128);            g.drawRect(-1, -1, w + 1, h + 1);            g.drawRect(-bw - 2, -bh - 2, w + (bw * 2) + 3, h + (bh * 2) + 3);            // Draw it in each corner            g.drawImage(bimage, -1, -1, Graphics.BOTTOM | Graphics.RIGHT);            g.drawImage(bimage, -1, h + 1, Graphics.TOP | Graphics.RIGHT);            g.drawImage(bimage, w + 1, -1, Graphics.BOTTOM | Graphics.LEFT);            g.drawImage(bimage, w + 1, h + 1, Graphics.TOP | Graphics.LEFT);            // Draw the embedded image down left and right sides            for (i = ((h % bh) / 2); i < (h - bh); i += bh) {                g.drawImage(bimage, -1, i, Graphics.RIGHT | Graphics.TOP);                g.drawImage(bimage, w + 1, i, Graphics.LEFT | Graphics.TOP);            }            // Draw the embedded image across the top and bottom            for (i = ((w % bw) / 2); i < (w - bw); i += bw) {                g.drawImage(bimage, i, -1, Graphics.LEFT | Graphics.BOTTOM);                g.drawImage(bimage, i, h + 1, Graphics.LEFT | Graphics.TOP);            }        }    }    /**     * Create an image for the border.     * The border consists of a simple "+" drawn in a 5x5 image.     * Fill the image with white and draw the "+" as magenta.     * @return the image initialized with the pattern     */    private Image genBorder() {        Image image = Image.createImage(5, 5);        Graphics g = image.getGraphics();        g.setColor(255, 255, 255);        g.fillRect(0, 0, 5, 5);        g.setColor(128, 0, 255);        g.drawLine(2, 1, 2, 3); // vertical        g.drawLine(1, 2, 3, 2); // horizontal        return image;    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人成伊人成综合网小说| 丰满放荡岳乱妇91ww| 一区二区三区精品久久久| 国产精品你懂的在线欣赏| 日本一区二区三级电影在线观看 | 欧美老肥妇做.爰bbww| 日本高清视频一区二区| 91在线视频观看| 91视频你懂的| 欧美在线一二三四区| 欧美在线观看18| 91日韩在线专区| 欧美视频日韩视频| 欧美撒尿777hd撒尿| 欧美日韩亚洲不卡| 欧美日韩国产片| 日韩视频一区二区三区在线播放| 日韩丝袜美女视频| 久久亚洲私人国产精品va媚药| 精品va天堂亚洲国产| 久久综合九色综合欧美亚洲| 国产色爱av资源综合区| 亚洲国产精品传媒在线观看| 国产精品盗摄一区二区三区| 亚洲美女淫视频| 亚洲 欧美综合在线网络| 青青草国产成人99久久| 国产一区二区女| 国产成人精品免费在线| 色综合夜色一区| 91精品国产综合久久小美女| 欧美精品一区二区久久婷婷| 欧美国产成人精品| 亚洲精品菠萝久久久久久久| 婷婷六月综合亚洲| 极品尤物av久久免费看| 成人开心网精品视频| 在线观看国产日韩| 精品国产一区二区三区久久久蜜月| 久久久精品影视| 亚洲精品老司机| 青青草97国产精品免费观看 | 91精品欧美一区二区三区综合在| 久久综合九色综合欧美亚洲| 亚洲精品日产精品乱码不卡| 美美哒免费高清在线观看视频一区二区 | 久久精品日产第一区二区三区高清版 | 欧美在线999| 欧美日韩精品三区| 国产欧美视频在线观看| 亚洲一卡二卡三卡四卡 | 中文字幕字幕中文在线中不卡视频| 亚洲天堂免费在线观看视频| 亚洲激情自拍视频| 日本美女一区二区三区| 国产suv精品一区二区6| 在线观看日韩电影| 精品免费国产二区三区| 久久久久久久久久久电影| 国产三级欧美三级日产三级99| 国产精品盗摄一区二区三区| 日韩高清国产一区在线| 成人毛片视频在线观看| 99re8在线精品视频免费播放| 欧美日韩一区视频| 久久免费视频色| 亚洲宅男天堂在线观看无病毒| 另类调教123区| 色综合久久九月婷婷色综合| 日韩视频一区二区在线观看| 国产精品高潮久久久久无| 无吗不卡中文字幕| 成人app网站| 欧美一区二区三区的| 国产精品初高中害羞小美女文 | 国产综合色精品一区二区三区| 91尤物视频在线观看| 日韩一区二区不卡| 一区二区三区四区中文字幕| 国产一区三区三区| 欧美日韩中字一区| 国产精品久久久久久久久免费桃花 | 欧美视频中文一区二区三区在线观看 | 久久综合网色—综合色88| 一区二区三区av电影| 国产高清在线观看免费不卡| 欧美猛男gaygay网站| 国产精品国产三级国产a| 久久99国产精品久久99| 欧美日韩在线直播| 最新高清无码专区| 人人超碰91尤物精品国产| 欧美情侣在线播放| 亚洲激情成人在线| 成人的网站免费观看| 欧美精品一区二区三区一线天视频| 亚洲国产视频a| 99re视频精品| 国产精品视频看| 国产精品一二二区| 精品免费视频.| 日韩福利视频网| 欧美影院精品一区| 久久精品视频网| 六月丁香婷婷久久| 欧美一区二区在线播放| 亚洲国产精品一区二区久久| av中文字幕不卡| 中文字幕精品—区二区四季| 国产成a人亚洲精| 精品国产一区二区精华| 欧美a一区二区| 欧美一区在线视频| 日韩av一区二区在线影视| 99这里都是精品| 亚洲欧洲日韩在线| 91亚洲精品乱码久久久久久蜜桃| 国产精品少妇自拍| 国产精品一区久久久久| 久久久噜噜噜久噜久久综合| 黑人巨大精品欧美黑白配亚洲| 精品国产一区二区在线观看| 久久机这里只有精品| 日韩你懂的在线播放| 人人精品人人爱| 欧美一区二区网站| 国产成人福利片| 国产精品美女久久久久av爽李琼| 成人小视频在线| 国产精品白丝在线| 91麻豆精品在线观看| 亚洲美女区一区| 欧美在线免费视屏| 五月天一区二区| 日韩女优电影在线观看| 国产成人免费高清| 一区在线中文字幕| 日本国产一区二区| 日韩精品一二三区| 91精品国产综合久久婷婷香蕉 | 99久久精品99国产精品| 中文字幕一区二区三| 欧美在线观看禁18| 日本欧美一区二区在线观看| 欧美不卡一二三| 国产成人福利片| 亚洲精品视频在线看| 欧美午夜免费电影| 国产激情一区二区三区四区| 中文字幕一区免费在线观看 | 91精品国产日韩91久久久久久| 日韩二区三区在线观看| 精品久久国产字幕高潮| 成人综合日日夜夜| 亚洲自拍偷拍麻豆| 欧美大黄免费观看| 成人黄色小视频| 亚洲一区在线观看免费| 日韩欧美亚洲一区二区| 久久久亚洲午夜电影| 99久久夜色精品国产网站| 亚洲一区二区三区视频在线播放| 日韩区在线观看| 成人av午夜电影| 日韩av中文在线观看| 国产精品久久久久久一区二区三区 | 亚洲免费大片在线观看| 精品国产一区二区三区久久久蜜月 | 色诱视频网站一区| 免费观看一级特黄欧美大片| 国产精品美女久久福利网站| 欧美日韩电影在线| 国产成人av电影在线播放| 亚洲精品第一国产综合野| 欧美一级欧美三级| 国产另类ts人妖一区二区| 亚洲免费视频中文字幕| 日韩一区二区三区在线观看| av一区二区三区| 久草中文综合在线| 亚洲综合男人的天堂| 国产亚洲一本大道中文在线| 色88888久久久久久影院按摩| 久久国产生活片100| 亚洲视频免费看| 欧美一区二区三区思思人| 99精品一区二区| 激情文学综合插| 亚洲午夜精品在线| 国产精品三级视频| 欧美成人vr18sexvr| 欧美亚洲综合另类| 狠狠色丁香九九婷婷综合五月| 色播五月激情综合网| 国产精品一区二区久激情瑜伽| 亚洲影院免费观看| 中文字幕亚洲在| 久久精品一区蜜桃臀影院| 51精品秘密在线观看| 在线区一区二视频|