All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jogamp.nativewindow.jawt.JAWT_DrawingSurfaceInfo Maven / Gradle / Ivy

There is a newer version: 2.3.2
Show newest version
/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sat Jul 20 20:39:07 CEST 2013 ----! */


package jogamp.nativewindow.jawt;

import java.nio.*;

import com.jogamp.gluegen.runtime.*;
import com.jogamp.common.os.*;
import com.jogamp.common.nio.*;
import jogamp.common.os.MachineDescriptionRuntime;

import java.security.*;
import jogamp.nativewindow.jawt.*;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;

public class JAWT_DrawingSurfaceInfo {

  StructAccessor accessor;

  private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal();

  private static final int[] JAWT_DrawingSurfaceInfo_size = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 48 /* X86_64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */, 32 /* SPARC_32_SUNOS */  };
  private static final int[] bounds_offset = new int[] { 8 /* ARMle_EABI */, 8 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 8 /* X86_32_MACOS */, 8 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 8 /* SPARC_32_SUNOS */ };
  private static final int[] bounds_size = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */  };
  private static final int[] clipSize_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 32 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ };

  public static int size() {
    return JAWT_DrawingSurfaceInfo_size[mdIdx];
  }

  public static JAWT_DrawingSurfaceInfo create() {
    return create(Buffers.newDirectByteBuffer(size()));
  }

  public static JAWT_DrawingSurfaceInfo create(java.nio.ByteBuffer buf) {
      return new JAWT_DrawingSurfaceInfo(buf);
  }

  JAWT_DrawingSurfaceInfo(java.nio.ByteBuffer buf) {
    accessor = new StructAccessor(buf);
  }

  public java.nio.ByteBuffer getBuffer() {
    return accessor.getBuffer();
  }

  public JAWT_Rectangle getBounds() {
    return JAWT_Rectangle.create( accessor.slice( bounds_offset[mdIdx], bounds_size[mdIdx] ) );
 }

  public JAWT_DrawingSurfaceInfo setClipSize(int val) {
    accessor.setIntAt(clipSize_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.intSizeInBytes());
    return this;
  }

  public int getClipSize() {
    return accessor.getIntAt(clipSize_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.intSizeInBytes());
  }

  // --- Begin CustomJavaCode .cfg declarations
  public JAWT_PlatformInfo platformInfo(final JAWT jawt) {
    return newPlatformInfo(jawt, platformInfo0(getBuffer()));
  }
  
  private native ByteBuffer platformInfo0(Buffer jthis0);
  
  private static java.lang.reflect.Method platformInfoFactoryMethod;
  
  private static JAWT_PlatformInfo newPlatformInfo(JAWT jawt, ByteBuffer buf) {
    if (platformInfoFactoryMethod == null) {
      try {
          Class factoryClass;
          if (Platform.OS_TYPE == Platform.OSType.WINDOWS) {
            factoryClass = Class.forName("jogamp.nativewindow.jawt.windows.JAWT_Win32DrawingSurfaceInfo");
          } else if (Platform.OS_TYPE == Platform.OSType.MACOS) {
            if( 0 != ( jawt.getCachedVersion() & JAWTUtil.JAWT_MACOSX_USE_CALAYER ) ) {
                factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_SurfaceLayers");
            } else {
                factoryClass = Class.forName("jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo");
            }
          } else {
            // Assume Linux, Solaris, etc. Should probably test for these explicitly.
            factoryClass = Class.forName("jogamp.nativewindow.jawt.x11.JAWT_X11DrawingSurfaceInfo");
          }
          platformInfoFactoryMethod = factoryClass.getMethod("create",
                                                             new Class[] { ByteBuffer.class });
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    try {
      return (JAWT_PlatformInfo)
        platformInfoFactoryMethod.invoke(null, new Object[] { buf });
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
  // ---- End CustomJavaCode .cfg declarations
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy