Package snap.gfx

Class GFXEnv

java.lang.Object
snap.gfx.GFXEnv
Direct Known Subclasses:
AWTEnv

public abstract class GFXEnv extends Object
An adapter class for drawing in a native environment (Java2D, JavaFX).
  • Field Details

    • _env

      protected static GFXEnv _env
  • Constructor Details

    • GFXEnv

      public GFXEnv()
  • Method Details

    • getEnv

      public static GFXEnv getEnv()
      Returns the Graphics environment.
    • getResource

      public abstract URL getResource(Class<?> aClass, String aPath)
      Returns resource for class and path.
    • getFontNames

      public abstract String[] getFontNames()
      Returns a list of all system fontnames (excludes any that don't start with capital A-Z).
    • getFamilyNames

      public abstract String[] getFamilyNames()
      Returns a list of all system family names.
    • getFontNames

      public abstract String[] getFontNames(String aFamilyName)
      Returns a list of all font names for a given family name.
    • getFontFile

      public abstract FontFile getFontFile(String aName)
      Returns a font file for given name.
    • getImageForSource

      public abstract Image getImageForSource(Object aSource)
      Creates image from source.
    • getImageForSizeAndScale

      public abstract Image getImageForSizeAndScale(double aWidth, double aHeight, boolean hasAlpha, double aScale)
      Creates image for width, height and alpha and dpi scale (0 = screen dpi, 1 = 72 dpi, 2 = 144 dpi).
    • getSound

      public abstract SoundClip getSound(Object aSource)
      Returns a sound for given source.
    • createSound

      public abstract SoundClip createSound()
      Creates a sound for given source.
    • openFile

      public abstract void openFile(Object aSource)
      Tries to open the given file source with the platform reader.
    • openURL

      public abstract void openURL(Object aSource)
      Tries to open the given URL source with the platform URL reader.
    • openTextFile

      public void openTextFile(Object aSource)
      Tries to open the given file source with the platform text file reader.
    • getScreenResolution

      public abstract double getScreenResolution()
      Returns the screen resolution.
    • getScreenScale

      public abstract double getScreenScale()
      Returns the screen scale. Usually 1, but could be 2 for HiDPI/Retina displays.
    • beep

      public abstract void beep()
      Plays a beep.
    • getPrefs

      public Prefs getPrefs(String aName)
      Returns the platform preferences object.
    • getClassRoot

      public abstract String getClassRoot()
      Returns the root URL string of classes.
    • getMethod

      public abstract Method getMethod(Class<?> aClass, String aName, Class<?>... theClasses) throws NoSuchMethodException
      This is really just here to help with TeaVM.
      Throws:
      NoSuchMethodException
    • createSiteForURL

      public WebSite createSiteForURL(WebURL aURL)
      Creates a site for a URL.
    • exit

      public abstract void exit(int aValue)
      This is really just here to help with TeaVM.
    • getHostname

      public String getHostname()
      This is really just here to help with TeaVM.