Package snap.gfx
Class GFXEnv
java.lang.Object
snap.gfx.GFXEnv
An adapter class for drawing in a native environment (Java2D, JavaFX).
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
beep()
Plays a beep.createSiteForURL
(WebURL aURL) Creates a site for a URL.abstract SoundClip
Creates a sound for given source.void
downloadFile
(WebFile aFile) Tries to open the given file source with the platform reader.execProcess
(String[] args) Executes a process.abstract void
exit
(int aValue) This is really just here to help with TeaVM.Returns the root URL string of classes.static GFXEnv
getEnv()
Returns the Graphics environment.abstract String[]
Returns a list of all system family names.abstract FontFile
getFontFile
(String aName) Returns a font file for given name.abstract String[]
Returns a list of all system fontnames (excludes any that don't start with capital A-Z).abstract String[]
getFontNames
(String aFamilyName) Returns a list of all font names for a given family name.This is really just here to help with TeaVM.abstract Image
getImageForSizeAndDpiScale
(double aWidth, double aHeight, boolean hasAlpha, double dpiScale) Creates image for width, height and alpha and dpi scale (0 = screen dpi, 1 = 72 dpi, 2 = 144 dpi).abstract Image
getImageForSource
(Object aSource) Creates image from source.abstract Method
This is really just here to help with TeaVM.Returns the platform preferences object.getResource
(Class<?> aClass, String aPath) Returns resource for class and path.Returns the screen bounds inset to usable area.abstract double
Returns the screen resolution.abstract double
Returns the screen scale.abstract SoundClip
Returns a sound for given source.abstract void
Tries to open the given file source with the platform reader.void
openTextFile
(Object aSource) Tries to open the given file source with the platform text file reader.abstract void
Tries to open the given URL source with the platform URL reader.void
setBrowserWindowLocationHash
(String aString) Sets the Browser window.location.hash (if running in browser).
-
Field Details
-
_env
-
-
Constructor Details
-
GFXEnv
public GFXEnv()
-
-
Method Details
-
getEnv
Returns the Graphics environment. -
getResource
Returns resource for class and path. -
getFontNames
Returns a list of all system fontnames (excludes any that don't start with capital A-Z). -
getFamilyNames
Returns a list of all system family names. -
getFontNames
Returns a list of all font names for a given family name. -
getFontFile
Returns a font file for given name. -
getImageForSource
Creates image from source. -
getImageForSizeAndDpiScale
public abstract Image getImageForSizeAndDpiScale(double aWidth, double aHeight, boolean hasAlpha, double dpiScale) Creates image for width, height and alpha and dpi scale (0 = screen dpi, 1 = 72 dpi, 2 = 144 dpi). -
getSound
Returns a sound for given source. -
createSound
Creates a sound for given source. -
openFile
Tries to open the given file source with the platform reader. -
openURL
Tries to open the given URL source with the platform URL reader. -
downloadFile
Tries to open the given file source with the platform reader. -
openTextFile
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. -
getScreenBoundsInset
Returns the screen bounds inset to usable area. -
beep
public abstract void beep()Plays a beep. -
getPrefs
Returns the platform preferences object. -
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
Creates a site for a URL. -
exit
public abstract void exit(int aValue) This is really just here to help with TeaVM. -
getHostname
This is really just here to help with TeaVM. -
setBrowserWindowLocationHash
Sets the Browser window.location.hash (if running in browser). -
execProcess
Executes a process.
-