Package java.awt

Examples of java.awt.Canvas$CanvasBltBufferStrategy


            if (img != null)
            {
                scaledImage.img = frame.img.getScaledInstance(
                        (int)(getWidth() * zoom), (int)(getHeight() * zoom),
                        BufferedImage.SCALE_SMOOTH);
                MediaTracker mediaTracker = new MediaTracker(new Canvas());
                mediaTracker.addImage(scaledImage.img, 0);
                try {
                    mediaTracker.waitForID(0);
                }
                catch (InterruptedException ie) {
View Full Code Here


     *
     */
    public java.awt.Image createAwtImage(Color foreground, Color background) {
        int f = foreground.getRGB();
        int g = background.getRGB();
        Canvas canvas = new Canvas();
        int barWidth = (int)x;
        if (barWidth <= 0)
            barWidth = 1;
        int barDistance = (int)n;
        if (barDistance <= barWidth)
            barDistance = barWidth + 1;
        int barShort = (int)size;
        if (barShort <= 0)
            barShort = 1;
        int barTall = (int)barHeight;
        if (barTall <= barShort)
            barTall = barShort + 1;
        int width = ((code.length() + 1) * 5 + 1) * barDistance + barWidth;
        int pix[] = new int[width * barTall];
        byte bars[] = getBarsPostnet(code);
        byte flip = 1;
        if (codeType == PLANET) {
            flip = 0;
            bars[0] = 0;
            bars[bars.length - 1] = 0;
        }
        int idx = 0;
        for (int k = 0; k < bars.length; ++k) {
            boolean dot = (bars[k] == flip);
            for (int j = 0; j < barDistance; ++j) {
                pix[idx + j] = ((dot && j < barWidth) ? f : g);
            }
            idx += barDistance;
        }
        int limit = width * (barTall - barShort);
        for (int k = width; k < limit; k += width)
            System.arraycopy(pix, 0, pix, k, width);
        idx = limit;
        for (int k = 0; k < bars.length; ++k) {
            for (int j = 0; j < barDistance; ++j) {
                pix[idx + j] = ((j < barWidth) ? f : g);
            }
            idx += barDistance;
        }
        for (int k = limit + width; k < pix.length; k += width)
            System.arraycopy(pix, limit, pix, k, width);
        Image img = canvas.createImage(new MemoryImageSource(width, barTall, pix, 0, width));
       
        return img;
    }
View Full Code Here

     * @return the image
     */   
    public java.awt.Image createAwtImage(Color foreground, Color background) {
        int f = foreground.getRGB();
        int g = background.getRGB();
        Canvas canvas = new Canvas();

        int width = 0;
        byte bars[] = null;
        switch (codeType) {
            case EAN13:
                bars = getBarsEAN13(code);
                width = 11 + 12 * 7;
                break;
            case EAN8:
                bars = getBarsEAN8(code);
                width = 11 + 8 * 7;
                break;
            case UPCA:
                bars = getBarsEAN13("0" + code);
                width = 11 + 12 * 7;
                break;
            case UPCE:
                bars = getBarsUPCE(code);
                width = 9 + 6 * 7;
                break;
            case SUPP2:
                bars = getBarsSupplemental2(code);
                width = 6 + 2 * 7;
                break;
            case SUPP5:
                bars = getBarsSupplemental5(code);
                width = 4 + 5 * 7 + 4 * 2;
                break;
            default:
                throw new RuntimeException(MessageLocalization.getComposedMessage("invalid.code.type"));
        }

        boolean print = true;
        int ptr = 0;
        int height = (int)barHeight;
        int pix[] = new int[width * height];
        for (int k = 0; k < bars.length; ++k) {
            int w = bars[k];
            int c = g;
            if (print)
                c = f;
            print = !print;
            for (int j = 0; j < w; ++j)
                pix[ptr++] = c;
        }
        for (int k = width; k < pix.length; k += width) {
            System.arraycopy(pix, 0, pix, k, width);
        }
        Image img = canvas.createImage(new MemoryImageSource(width, height, pix, 0, width));
       
        return img;
    }   
View Full Code Here

        super("Thumbnail");
        Container container = getContentPane();
        container.setBackground(Color.white);
        container.setForeground(Color.black);

        canvas = new Canvas() {
            public synchronized void paint(Graphics g) {
                if (theImage != null)
                    g.drawImage(theImage,
                            (int) (w - theImage.getWidth(null)) / 2,
                            (int) (h - theImage.getHeight(null)) / 2, this);
View Full Code Here

    postString("Starting game...");

    // Create Custom Swing Frame
    postString("Creating Custom Swing Frame...");
    if (canvas == null) {
      canvas = new Canvas();
      canvas.setBackground(Color.black);
    }
    canvas.setSize(displayWidth, displayHeight);
    if (frame == null) {
      frame = new JFrame();
View Full Code Here

    private RasterFormatTag rasterFormatTag = null;

    private static final ImageLayout layoutHelper (ImageLayout layout,
                                                   Image image) {
        /* Determine image width and height using MediaTracker. */
        MediaTracker tracker = new MediaTracker(new Canvas());
        tracker.addImage(image, 0);
        try {
            tracker.waitForID(0);
        } catch (InterruptedException e) {
            e.printStackTrace();
View Full Code Here

   */
  public View(final BlockingQueue<QueueEvent> blockingQueue)
  {
    this.viewFrame = new JFrame("Bomberman version 0.5");
   
    this.gamePanel = new Canvas();
    this.rightPanel = new RightPanel();
    View.blockingQueue = blockingQueue;
   
    this.mapPainter = new MapPainter(gamePanel, null);
   
View Full Code Here

            args = new String[] {"--no-video-title-show"};
        }
        factory = new MediaPlayerFactory(args);
        mediaPlayer = factory.newEmbeddedMediaPlayer(null);
        mediaPlayer.addMediaPlayerEventListener(new MediaPlayerControl());
        Canvas c = new Canvas();
        this.getContentPane().setLayout(new BorderLayout());
        this.getContentPane().add(c, BorderLayout.CENTER);
        c.setBackground(Color.black);
        mediaPlayer.setVideoSurface(factory.newVideoSurface(c));
    }
View Full Code Here

     * @return the image
     */   
    public java.awt.Image createAwtImage(Color foreground, Color background) {
        int f = foreground.getRGB();
        int g = background.getRGB();
        Canvas canvas = new Canvas();

        String fullCode = code;
        if (generateChecksum && checksumText)
            fullCode = calculateChecksum(code);
        if (!startStopText)
            fullCode = fullCode.substring(1, fullCode.length() - 1);
        byte bars[] = getBarsCodabar(generateChecksum ? calculateChecksum(code) : code);
        int wide = 0;
        for (int k = 0; k < bars.length; ++k) {
            wide += bars[k];
        }
        int narrow = bars.length - wide;
        int fullWidth = narrow + wide * (int)n;
        boolean print = true;
        int ptr = 0;
        int height = (int)barHeight;
        int pix[] = new int[fullWidth * height];
        for (int k = 0; k < bars.length; ++k) {
            int w = (bars[k] == 0 ? 1 : (int)n);
            int c = g;
            if (print)
                c = f;
            print = !print;
            for (int j = 0; j < w; ++j)
                pix[ptr++] = c;
        }
        for (int k = fullWidth; k < pix.length; k += fullWidth) {
            System.arraycopy(pix, 0, pix, k, fullWidth);
        }
        Image img = canvas.createImage(new MemoryImageSource(fullWidth, height, pix, 0, fullWidth));
       
        return img;
    }
View Full Code Here

        public OffScreen() {
            super(imgsrcroot, "offscr", "Offscreen Image", Transparency.OPAQUE);
        }

        public Image makeImage(TestEnvironment env, int w, int h) {
            Canvas c = env.getCanvas();
            return c.createImage(w, h);
        }
View Full Code Here

TOP

Related Classes of java.awt.Canvas$CanvasBltBufferStrategy

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.