Package com.sun.dtv.lwuit

Examples of com.sun.dtv.lwuit.Graphics


        }
        if(transitionType == TYPE_FADE) {
            motion = Motion.createSplineMotion(0, 256, speed);
            motion.start();
           
            Graphics g = buffer.getGraphics();
            g.translate(-source.getAbsoluteX(), -source.getAbsoluteY());
           
            if(getSource().getParent() != null){
                getSource().getComponentForm().paintComponent(g);
            }
            //getSource().paintBackgrounds(g);
            paint(g, getDestination(), 0, 0);
            rgbBuffer = new RGBImage(buffer.getRGB(), buffer.getWidth(), buffer.getHeight());
           
            paint(g, getSource(), 0, 0);
            g.translate(source.getAbsoluteX(), source.getAbsoluteY());
           
        } else {
            if (transitionType == TYPE_SLIDE) {
                int dest;
                int startOffset = 0;
                if (slideType == SLIDE_HORIZONTAL) {
                    dest = w;
                    if(destination instanceof Dialog) {
                        startOffset = w - ((Dialog)destination).getContentPane().getWidth();
                        if(forward) {
                            startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.LEFT);
                        } else {
                            startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.RIGHT);
                        }
                    } else {
                        if(source instanceof Dialog) {
                            dest = ((Dialog)source).getContentPane().getWidth();
                            if(forward) {
                                dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.LEFT);
                            } else {
                                dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.RIGHT);
                            }
                        }
                    }
                } else {
                    dest = h;
                    if(destination instanceof Dialog) {
                        startOffset = h - ((Dialog)destination).getContentPane().getHeight() -
                            ((Dialog)destination).getTitleComponent().getHeight();
                        if(forward) {
                            startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.BOTTOM);
                        } else {
                            startOffset -= ((Dialog)destination).getContentPane().getStyle().getMargin(Component.TOP);
                            startOffset -= ((Dialog)destination).getTitleStyle().getMargin(Component.TOP);
                            if(!drawDialogMenu && ((Dialog)destination).getCommandCount() > 0) {
                                startOffset -= ((Dialog)destination).getSoftButton(0).getParent().getHeight();
                            }
                        }
                    } else {
                        if(source instanceof Dialog) {
                            dest = ((Dialog)source).getContentPane().getHeight() +
                                ((Dialog)source).getTitleComponent().getHeight();
                            if(forward) {
                                dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.BOTTOM);
                            } else {
                                dest += ((Dialog)source).getContentPane().getStyle().getMargin(Component.TOP);
                                dest += ((Dialog)source).getTitleStyle().getMargin(Component.TOP);
                                if(((Dialog)source).getCommandCount() > 0) {
                                    dest += ((Dialog)source).getSoftButton(0).getParent().getHeight();
                                }
                            }
                        }
                    }
                }
               
                motion = Motion.createSplineMotion(startOffset, dest, speed);

                // make sure the destination is painted fully at least once
                // we must use a full buffer otherwise the clipping will take effect
                Graphics g = buffer.getGraphics();
               
                // If this is a dialog render the tinted frame once since
                // tinting is expensive
                if(getSource() instanceof Dialog) {
                    paint(g, getDestination(), 0, 0);
View Full Code Here


                // rounded is also responsible for drawing the background
                Style s = c.getStyle();
                if(s.getBgImage() != null) {
                    // we need to draw a background image!
                    Image i = Image.createImage(width, height);
                    Graphics imageG = i.getGraphics();
                    imageG.setColor(0);
                    imageG.fillRoundRect(0, 0, width, height, arcWidth, arcHeight);
                    int[] rgb = i.getRGB();
                    int transColor = rgb[0];
                    int[] imageRGB = s.getBgImage().scaled(width, height).getRGB();
                    for(int iter = 0 ; iter < rgb.length ; iter++) {
                        if(rgb[iter] == transColor) {
                            imageRGB[iter] = 0;
                        }
                    }
                    g.drawImage(new RGBImage(imageRGB, width, height), x, y);
                } else {
                    int foreground = g.getColor();
                    if(c.hasFocus()) {
                        g.setColor(s.getBgSelectionColor());
                    } else {
                        g.setColor(s.getBgColor());
                    }

                    // Its opaque much easier job!
                    if(s.getBgTransparency() == ((byte)0xff)) {
                        g.fillRoundRect(x, y , width, height, arcWidth, arcHeight);
                    } else {
                        // if its transparent we don't need to do anything, if its
                        // translucent... well....
                        if(s.getBgTransparency() != 0) {
                            Image i = Image.createImage(width, height);
                            int[] imageRgb;
                            if(g.getColor() != 0xffffff) {
                                Graphics imageG = i.getGraphics();
                                imageG.setColor(g.getColor());
                                imageG.fillRoundRect(0, 0 , width, height, arcWidth, arcHeight);
                                imageRgb = i.getRGB();
                            } else {
                                // background color is white we need to remove a different color
                                // black is the only other "reliable" color on the device
                                Graphics imageG = i.getGraphics();
                                imageG.setColor(0);
                                imageG.fillRect(0, 0, width, height);
                                imageG.setColor(g.getColor());
                                imageG.fillRoundRect(0, 0 , width, height, arcWidth, arcHeight);
                                imageRgb = i.getRGB();
                            }
                            int removeColor = imageRgb[0];
                            int size = width * height;
                            int alphaInt = ((s.getBgTransparency() & 0xff) << 24) & 0xff000000;
View Full Code Here

TOP

Related Classes of com.sun.dtv.lwuit.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.