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

📄 intro.java

📁 这是ACCP的JAVA ppt课件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                doRandom = (type & RAND) != 0;            }            public void reset(int w, int h) {                if (doRandom) {                    int num = (int) (Math.random() * 5.0);                    switch (num) {                        case 0 : type = OVAL; break;                        case 1 : type = RECT; break;                        case 2 : type = RECT | WID; break;                        case 3 : type = RECT | HEI; break;                        case 4 : type = ARC; break;                        default : type = OVAL;                     }                }                shape = null;                bimg = null;                extent = 360.0;                zoom = 2.0;            }            public void step(int w, int h) {                if (bimg == null) {                    int biw = Surface.bimg.getWidth();                    int bih = Surface.bimg.getHeight();                    bimg = new BufferedImage(biw, bih, BufferedImage.TYPE_INT_RGB);                    Graphics2D big = bimg.createGraphics();                    big.drawImage(Surface.bimg, 0, 0, null);                }                double z = Math.min(w, h) * zoom;                if ((type & OVAL) != 0) {                    shape = new Ellipse2D.Double(w/2-z/2,h/2-z/2,z,z);                } else if ((type & ARC) != 0) {                    shape = new Arc2D.Double(-100,-100,w+200,h+200,90,extent,Arc2D.PIE);                    extent -= eIncr;                } else if ((type & RECT) != 0) {                    if ((type & WID) != 0) {                        shape = new Rectangle2D.Double(w/2-z/2,0,z,h);                    } else if ((type & HEI) != 0) {                        shape = new Rectangle2D.Double(0,h/2-z/2,w,z);                    } else {                        shape = new Rectangle2D.Double(w/2-z/2,h/2-z/2,z,z);                    }                }                zoom += zIncr;            }            public void render(int w, int h, Graphics2D g2) {                g2.clip(shape);                g2.drawImage(bimg, 0, 0, null);            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End CoE class        /**         * Dither Dissolve Effect. For each successive step in the animation,          * a pseudo-random starting horizontal position is chosen using list,          * and then the corresponding points created from xlist and ylist are         * blacked out for the current "chunk".  The x and y chunk starting         * positions are each incremented by the associated chunk size, and          * this process is repeated for the number of "steps" in the          * animation, causing an equal number of pseudo-randomly picked          * "blocks" to be blacked out during each step of the animation.         */        static class DdE implements Part {            private int beginning, ending;            private BufferedImage bimg;            private Graphics2D big;            private List list, xlist, ylist;            private int xeNum, yeNum;    // element number            private int xcSize, ycSize;  // chunk size            private int inc;            private int blocksize;            public DdE(int beg, int end, int blocksize) {                this.beginning = beg;                this.ending = end;                this.blocksize = blocksize;             }            private void createShuffledLists() {                int width = bimg.getWidth();                int height = bimg.getHeight();                Integer xarray[] = new Integer[width];                Integer yarray[] = new Integer[height];                Integer array[] = new Integer[ending - beginning + 1];                for (int i = 0; i < xarray.length; i++) {                    xarray[i] = new Integer(i);                }                for (int j = 0; j < yarray.length; j++) {                    yarray[j] = new Integer(j);                }                for (int k = 0; k < array.length; k++) {                    array[k] = new Integer(k);                }                 java.util.Collections.shuffle(xlist = Arrays.asList(xarray));                java.util.Collections.shuffle(ylist = Arrays.asList(yarray));                java.util.Collections.shuffle(list = Arrays.asList(array));            }            public void reset(int w, int h) {                bimg = null;            }            public void step(int w, int h) {                if (bimg == null) {                    int biw = Surface.bimg.getWidth();                    int bih = Surface.bimg.getHeight();                    bimg = new BufferedImage(biw, bih, BufferedImage.TYPE_INT_RGB);                    createShuffledLists();                    big = bimg.createGraphics();                    big.drawImage(Surface.bimg, 0, 0, null);                    xcSize = (xlist.size() / (ending - beginning)) + 1;                    ycSize = (ylist.size() / (ending - beginning)) + 1;                    xeNum = 0;                    inc = 0;                }                xeNum = xcSize * ((Integer)list.get(inc)).intValue();                yeNum = -ycSize;                inc++;            }            public void render(int w, int h, Graphics2D g2) {                big.setColor(black);                 for (int k = 0; k <= (ending - beginning); k++) {                    if ((xeNum + xcSize) > xlist.size()) {                        xeNum = 0;                    } else {                        xeNum += xcSize;                    }                    yeNum += ycSize;                    for (int i = xeNum; i < xeNum+xcSize && i < xlist.size(); i++) {                        for (int j = yeNum; j < yeNum+ycSize && j < ylist.size(); j++) {                               int xval = ((Integer)xlist.get(i)).intValue();                            int yval = ((Integer)ylist.get(j)).intValue();                            if (((xval % blocksize) == 0) &&                                ((yval % blocksize) == 0)) {                                big.fillRect(xval, yval, blocksize, blocksize);                            }                        }                    }                }                           g2.drawImage(bimg, 0, 0, null);            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End DdE class        /**         * Subimage effect.  Subimage the scene's buffered         * image then rotate and scale down the subimages.         */        static class SiE implements Part {            private int beginning, ending;            private BufferedImage bimg;            private double rIncr, sIncr;            private double scale, rotate;            private int siw, sih;            private Vector subs = new Vector(20);            private Vector pts = new Vector(20);            public SiE(int siw, int sih, int beg, int end) {                this.siw = siw;                this.sih = sih;                this.beginning = beg;                this.ending = end;                rIncr = 360.0 / (ending - beginning);                sIncr = 1.0 / (ending - beginning);            }            public void reset(int w, int h) {                scale = 1.0;                  rotate = 0.0;                bimg = null;                subs.clear();                pts.clear();            }            public void step(int w, int h) {                if (bimg == null) {                    int biw = Surface.bimg.getWidth();                    int bih = Surface.bimg.getHeight();                    bimg = new BufferedImage(biw, bih, BufferedImage.TYPE_INT_RGB);                    Graphics2D big = bimg.createGraphics();                    big.drawImage(Surface.bimg, 0, 0, null);                    for (int x = 0; x < w && scale > 0.0; x+=siw) {                        int ww = x+siw < w ? siw : w-x;                        for (int y = 0; y < h; y+=sih) {                            int hh = y+sih < h ? sih : h-y;                            subs.addElement(bimg.getSubimage(x,y,ww,hh));                                pts.addElement(new Point(x, y));                        }                    }                }                                rotate += rIncr;                scale -= sIncr;            }            public void render(int w, int h, Graphics2D g2) {                AffineTransform saveTx = g2.getTransform();                g2.setColor(blue);                for (int i = 0; i < subs.size() && scale > 0.0; i++) {                    BufferedImage bi = (BufferedImage) subs.get(i);                    Point p = (Point) pts.get(i);                    int ww = bi.getWidth();                    int hh = bi.getHeight();                    AffineTransform at = new AffineTransform();                    at.rotate(Math.toRadians(rotate), p.x+ww/2, p.y+hh/2);                     at.translate(p.x, p.y);                    at.scale(scale, scale);                    Rectangle b1 = new Rectangle(0, 0, ww, hh);                    Shape shape = at.createTransformedShape(b1);                    Rectangle2D b2 = shape.getBounds2D();                    double xx = (p.x+ww/2) - (b2.getX()+b2.getWidth()/2);                    double yy = (p.y+hh/2) - (b2.getY()+b2.getHeight()/2);                    AffineTransform toCenterAT = new AffineTransform();                    toCenterAT.translate(xx, yy);                    toCenterAT.concatenate(at);                    g2.setTransform(toCenterAT);                    g2.drawImage(bi, 0, 0, null);                    g2.draw(b1);                }                g2.setTransform(saveTx);            }            public int getBegin() {                return beginning;            }            public int getEnd() {                return ending;            }        } // End SiE class        /**         * Line Effect.  Flattened ellipse with lines from the center          * to the edge.  Expand or collapse the ellipse.  Fade in or out          * the lines.         */        static class LnE implements Part {            static final int INC  = 1;            static final int DEC  = 2;            static final int R    = 4;              // rotate            static final int RI   = R | INC;            static final int RD   = R | DEC;            static final int ZOOM   = 8;            // zoom            static final int ZOOMI  = ZOOM | INC;            static final int ZOOMD  = ZOOM | DEC;                static final int AC   = 32;             // AlphaComposite            static final int ACI   = 32 | INC;            static final int ACD   = 32 | DEC;             private int beginning, ending;            private double rIncr, rotate;            private double zIncr, zoom;            private Vector pts = new Vector();            private float alpha, aIncr;            private int type;            public LnE(int type, int beg, int end) {                this.type = type;                this.beginning = beg;                this.ending = end;                rIncr = 360.0 / (ending - beginning);                aIncr = 0.9f / (ending - beginning);                zIncr = 2.0 / (ending - beginning);                if ((type & DEC) != 0) {                    rIncr = -rIncr;                    aIncr = -aIncr;                    zIncr = -zIncr;                }            }            public void generatePts(int w, int h, double sizeF) {                pts.clear();                double size = Math.min(w, h) * sizeF;                Ellipse2D ellipse = new Ellipse2D.Double(w/2-size/2,h/2-size/2,size,size);                PathIterator pi = ellipse.getPathIterator(null, 0.8);                while ( !pi.isDone() ) {                    double[] pt = new double[6];                    switch ( pi.currentSegment(pt) ) {                        case FlatteningPathIterator.SEG_MOVETO:                        case FlatteningPathIterator.SEG_LINETO:                            pts.addElement(new Point2D.Double(pt[0], pt[1]));                    }                    pi.next();                }            }            public void reset(int w, int h) {                if ((type & DEC) != 0) {                    rotate = 360;                    alpha = 1.0f;                    zoom = 2.0;

⌨️ 快捷键说明

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