Package java.awt

Examples of java.awt.BufferCapabilities$FlipContents


    {
        if (numBuffers > 2) {
            throw new AWTException(
                "Only double or single buffering is supported");
        }
        BufferCapabilities configCaps = getBufferCapabilities();
        if (!configCaps.isPageFlipping()) {
            throw new AWTException("Page flipping is not supported");
        }
        if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
            throw new AWTException("FlipContents.PRIOR is not supported");
        }
View Full Code Here


    {
        if (numBuffers > 2) {
            throw new AWTException(
                "Only double or single buffering is supported");
        }
        BufferCapabilities configCaps = getBufferCapabilities();
        if (!configCaps.isPageFlipping()) {
            throw new AWTException("Page flipping is not supported");
        }
        if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
            throw new AWTException("FlipContents.PRIOR is not supported");
        }
View Full Code Here

        }
        if (numBuffers > 2) {
            throw new AWTException(
                "Only double or single buffering is supported");
        }
        BufferCapabilities configCaps = getBufferCapabilities();
        if (!configCaps.isPageFlipping()) {
            throw new AWTException("Page flipping is not supported");
        }

        long window = peer.getContentWindow();
        int swapAction = getSwapAction(caps.getFlipContents());
View Full Code Here

    private void createBS(boolean requestVSync) {
        if (bs != null && requestVSync == currentBSVSynced) {
            return;
        }

        BufferCapabilities bc = defaultBC;
        if (requestVSync) {
            bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                    new ImageCapabilities(true),
                    new ImageCapabilities(true),
                    FlipContents.COPIED,
View Full Code Here

        }

        public void render() {
            ImageCapabilities imgBackBufCap = new ImageCapabilities(true);
            ImageCapabilities imgFrontBufCap = new ImageCapabilities(true);
            BufferCapabilities bufCap =
                new BufferCapabilities(imgFrontBufCap,
                    imgBackBufCap, BufferCapabilities.FlipContents.COPIED);
            try {

                createBufferStrategy(2, bufCap);
            } catch (AWTException ex) {
View Full Code Here

    {
        if (numBuffers > 2) {
            throw new AWTException(
                "Only double or single buffering is supported");
        }
        BufferCapabilities configCaps = getBufferCapabilities();
        if (!configCaps.isPageFlipping()) {
            throw new AWTException("Page flipping is not supported");
        }
        if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
            throw new AWTException("FlipContents.PRIOR is not supported");
        }
View Full Code Here

            if (context instanceof Boolean) {
                forceback = ((Boolean)context).booleanValue();
                if (forceback && peer instanceof BackBufferCapsProvider) {
                    BackBufferCapsProvider provider =
                        (BackBufferCapsProvider)peer;
                    BufferCapabilities caps = provider.getBackBufferCaps();
                    if (caps instanceof ExtendedBufferCapabilities) {
                        ExtendedBufferCapabilities ebc =
                            (ExtendedBufferCapabilities)caps;
                        if (ebc.getVSync() == VSYNC_ON &&
                            ebc.getFlipContents() == COPIED)
View Full Code Here

    public static D3DSurfaceData createData(WComponentPeer peer, Image image) {
        D3DGraphicsConfig gc = getGC(peer);
        if (gc == null || !peer.isAccelCapable()) {
            return null;
        }
        BufferCapabilities caps = peer.getBackBufferCaps();
        VSyncType vSyncType = VSYNC_DEFAULT;
        if (caps instanceof ExtendedBufferCapabilities) {
            vSyncType = ((ExtendedBufferCapabilities)caps).getVSync();
        }
        Rectangle r = peer.getBounds();
        BufferCapabilities.FlipContents flip = caps.getFlipContents();
        int swapEffect;
        if (flip == FlipContents.COPIED) {
            swapEffect = SWAP_COPY;
        } else if (flip == FlipContents.PRIOR) {
            swapEffect = SWAP_FLIP;
View Full Code Here

    {
        if (numBuffers > 2) {
            throw new AWTException(
                "Only double or single buffering is supported");
        }
        BufferCapabilities configCaps = getBufferCapabilities();
        if (!configCaps.isPageFlipping()) {
            throw new AWTException("Page flipping is not supported");
        }
        if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
            throw new AWTException("FlipContents.PRIOR is not supported");
        }
View Full Code Here

    // Ignore
  }

  public void canvasSetRenderingMode() {
    if (Monitor.MULTI_BUFFERING <= 0) return;
    BufferCapabilities desiredCaps = new BufferCapabilities(
      new ImageCapabilities(true), new ImageCapabilities(true),
      Monitor.PAGE_FLIPPING ? FlipContents.BACKGROUND : null
    );
    Class<?> extBufCapClass = null;
    try {
      // Creates ExtendedBufferCapabilities via reflection to avoid problems with AccessControl
      extBufCapClass = Class.forName("sun.java2d.pipe.hw.ExtendedBufferCapabilities");
    } catch (Exception ex) {}
    // First try with vSync option
    if (extBufCapClass != null && Monitor.BUFFER_VSYNC != -1)
      try {
        // Creates ExtendedBufferCapabilities via reflection to avoid problems with AccessControl
        Class<?> vSyncTypeClass = Class.forName("sun.java2d.pipe.hw.ExtendedBufferCapabilities$VSyncType");
        Constructor<?> extBufCapConstructor = extBufCapClass.getConstructor(
          new Class[] { BufferCapabilities.class, vSyncTypeClass }
        );
              Object vSyncType = vSyncTypeClass.getField(Monitor.BUFFER_VSYNC == 1 ? "VSYNC_ON" : "VSYNC_OFF").get(null);
              BufferCapabilities extBuffCaps = (BufferCapabilities)extBufCapConstructor.newInstance(
                new Object[] { desiredCaps, vSyncType }
              );
              // Try creating the BufferStrategy
              canvas.createBufferStrategy(Monitor.MULTI_BUFFERING, extBuffCaps);
      } catch (Exception ex) {}
    // Then try with remaining options (Flipping, etc)
    if (canvas.getBufferStrategy() == null)
      try {
        canvas.createBufferStrategy(Monitor.MULTI_BUFFERING, desiredCaps);
      } catch (Exception ex) {}
    // Last, use the default
    if (canvas.getBufferStrategy() == null) {
      System.out.println("Could not create desired BufferStrategy. Switching to default...");
      canvas.createBufferStrategy(Monitor.MULTI_BUFFERING);
    }
    bufferStrategy = canvas.getBufferStrategy();
    // Show info about the granted BufferStrategy
    if (bufferStrategy != null) System.out.println("Buffer Strategy: " + bufferStrategy.getClass().getSimpleName());
    BufferCapabilities grantedCaps = bufferStrategy.getCapabilities();
    System.out.println("Backbuffer Accelerated: " + grantedCaps.getBackBufferCapabilities().isAccelerated());
    System.out.println("PageFlipping Active: " + grantedCaps.isPageFlipping() + ", " + grantedCaps.getFlipContents());
    if (extBufCapClass != null && grantedCaps.getClass().equals(extBufCapClass))
      try {
        System.out.println("VSynch active: " + extBufCapClass.getMethod("getVSync",(Class<?>[])null).invoke(grantedCaps));
      } catch (Exception ex) {}
  }
View Full Code Here

TOP

Related Classes of java.awt.BufferCapabilities$FlipContents

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.