PGraphicsRetina2D

processing.core

## Class PGraphicsRetina2D

- Object
- - PImage
  - - PGraphics
    - - PGraphicsJava2D
      - - PGraphicsRetina2D

- All Implemented Interfaces:
    Cloneable, PConstants

      public class PGraphicsRetina2D
      extends PGraphicsJava2D

- - ### Field Summary

    - ### Fields inherited from class PGraphicsJava2D

      `fillGradient, fillGradientObject, g2, strokeGradient, strokeGradientObject`

    - ### Fields inherited from class PGraphics

      `A, AB, AG, ambientB, ambientColor, ambientG, ambientR, AR, B, backgroundColor, BEEN_LIT, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveDetail, curveTightness, DA, DB, DEFAULT_VERTICES, DG, DR, EB, edge, EDGE, EG, ellipseMode, emissiveB, emissiveColor, emissiveG, emissiveR, ER, fill, fillColor, G, HAS_NORMAL, image, imageMode, normalX, normalY, normalZ, NX, NY, NZ, pixelCount, quality, R, rectMode, SA, SB, setAmbient, SG, shapeMode, SHINE, shininess, smooth, SPB, specularB, specularColor, specularG, specularR, SPG, sphereDetailU, sphereDetailV, SPR, SR, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, SW, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor, TX, TY, TZ, U, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ`

    - ### Fields inherited from class PImage

      `ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, parent, pixels, RED_MASK, width`

    - ### Fields inherited from interface PConstants

      `ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_RETINA_PIXELS, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_RETINA_PIXELS, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PGraphicsRetina2D()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginDraw()` ( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object.
    `void` | `blend(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mode)`
    `void` | `blend(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int mode)` ( begin auto-generated from PImage_blend.xml ) Blends a region of pixels into the image specified by the img parameter.
    `void` | `copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)` ( begin auto-generated from PImage_copy.xml ) Copies a region of pixels from one image into another.
    `void` | `copy(PImage src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)`
    `void` | `endDraw()` ( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen.
    `void` | `filter(int kind)`
    `void` | `filter(int kind, float param)` ( begin auto-generated from PImage_filter.xml ) Filters an image as defined by one of the following modes: THRESHOLD - converts the image to black and white pixels depending if they are above or below the threshold defined by the level parameter.
    `PImage` | `get()` Returns a copy of this PImage.
    `int` | `get(int x, int y)` ( begin auto-generated from PImage_get.xml ) Reads the color of any pixel or grabs a section of an image.
    `PImage` | `get(int x, int y, int w, int h)`
    `void` | `loadPixels()` ( begin auto-generated from PImage_loadPixels.xml ) Loads the pixel data for the image into its pixels[] array.
    `void` | `mask(int[] alpha)`
    `void` | `mask(PImage alpha)` ( begin auto-generated from PImage_mask.xml ) Masks part of an image from displaying by loading another image and using it as an alpha channel.
    `boolean` | `save(String filename)` ( begin auto-generated from PImage_save.xml ) Saves the image into a file.
    `void` | `set(int x, int y, int argb)` ( begin auto-generated from PImage_set.xml ) Changes the color of any pixel or writes an image directly into the display window. The x and y parameters specify the pixel to change and the color parameter specifies the color value.
    `void` | `set(int x, int y, PImage img)` Advanced
    `void` | `setParent(PApplet parent)`
    `void` | `updatePixels()`
    `void` | `updatePixels(int ux, int uy, int uw, int uh)` Update the pixels[] buffer to the PGraphics image.

    - ### Methods inherited from class PGraphicsJava2D

      `applyMatrix, applyMatrix, backgroundImpl, beginContour, beginRaw, beginShape, bezierDetail, bezierVertex, bezierVertex, box, canDraw, curveDetail, curveVertex, endContour, endRaw, endShape, getMatrix, getMatrix, getMatrix, hint, line, loadShape, loadShape, noClip, noSmooth, point, popMatrix, printMatrix, pushMatrix, quad, quadraticVertex, quadraticVertex, requestDraw, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, setMatrix, setMatrix, setSize, shearX, shearY, smooth, smooth, sphere, strokeCap, strokeJoin, strokeWeight, textAscent, textDescent, textSize, texture, translate, triangle, vertex, vertex, vertex, vertex, vertex`

    - ### Methods inherited from class PGraphics

      `alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, arc, background, background, background, background, background, background, background, beginCamera, beginPGL, beginShape, bezier, bezier, bezierPoint, bezierTangent, blendMode, blue, box, brightness, camera, camera, clear, clip, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, createShape, createShape, createShape, createShape, curve, curve, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, displayable, dispose, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endPGL, endShape, fill, fill, fill, fill, fill, fill, filter, flush, frustum, getCache, getRaw, getStyle, getStyle, green, haveRaw, hue, image, image, image, imageMode, is2D, is3D, isGL, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, loadShader, loadShader, modelX, modelY, modelZ, noFill, noLights, normal, noStroke, noTexture, noTint, ortho, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, rect, rect, rect, rectMode, red, removeCache, requestFocus, resetShader, resetShader, saturation, setCache, setFrameRate, setMatrix, setPath, setPrimary, shader, shader, shape, shape, shape, shapeMode, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, showWarning, specular, specular, specular, sphereDetail, sphereDetail, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, style, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textFont, textFont, textLeading, textMode, textureMode, textureWrap, textWidth, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate`

    - ### Methods inherited from class PImage

      `blendColor, clone, getImage, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, isLoaded, isModified, resize, setLoaded, setLoaded, setModified, setModified`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PGraphicsRetina2D

          public PGraphicsRetina2D()

  - ### Method Detail

    - #### setParent

          public void setParent(PApplet parent)

      Overrides:
        `setParent` in class `PGraphics`

    - #### beginDraw

          public void beginDraw()

      Description copied from class: `PGraphics`
      ( begin auto-generated from PGraphics_beginDraw.xml ) Sets the default properties for a PGraphics object. It should be called before anything is drawn into the object. ( end auto-generated )

      ### Advanced

      When creating your own PGraphics, you should call this before drawing anything.
      Overrides:
        `beginDraw` in class `PGraphicsJava2D`

    - #### endDraw

          public void endDraw()

      Description copied from class: `PGraphics`
      ( begin auto-generated from PGraphics_endDraw.xml ) Finalizes the rendering of a PGraphics object so that it can be shown on screen. ( end auto-generated )

      ### Advanced

      When creating your own PGraphics, you should call this when you're finished drawing.
      Overrides:
        `endDraw` in class `PGraphicsJava2D`

    - #### loadPixels

          public void loadPixels()

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_loadPixels.xml ) Loads the pixel data for the image into its pixels[] array. This function must always be called before reading from or writing to pixels[].
      renderers may or may not seem to require loadPixels() or updatePixels(). However, the rule is that any time you want to manipulate the pixels[] array, you must first call loadPixels(), and after changes have been made, call updatePixels(). Even if the renderer may not seem to use this function in the current Processing release, this will always be subject to change. ( end auto-generated )

      ### Advanced

      Call this when you want to mess with the pixels[] array.

      For subclasses where the pixels[] buffer isn't set by default, this should copy all data into the pixels[] array
      Overrides:
        `loadPixels` in class `PGraphicsJava2D`

    - #### updatePixels

          public void updatePixels()

      Overrides:
        `updatePixels` in class `PImage`

    - #### updatePixels

          public void updatePixels(int ux,
                          int uy,
                          int uw,
                          int uh)

      Update the pixels[] buffer to the PGraphics image.

      Unlike in PImage, where updatePixels() only requests that the update happens, in PGraphicsJava2D, this will happen immediately.

      Overrides:
        `updatePixels` in class `PGraphicsJava2D`
      Parameters:
        `ux` - x-coordinate of the upper-left corner
        `uy` - y-coordinate of the upper-left corner
        `uw` - width
        `uh` - height

    - #### get

          public int get(int x,
                int y)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_get.xml ) Reads the color of any pixel or grabs a section of an image. If no parameters are specified, the entire image is returned. Use the x and y parameters to get the value of one pixel. Get a section of the display window by specifying an additional width and height parameter. When getting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
      If the pixel requested is outside of the image window, black is returned. The numbers returned are scaled according to the current color ranges, but only RGB values are returned by this function. For example, even though you may have drawn a shape with colorMode(HSB), the numbers returned will be in RGB format.
      Getting the color of a single pixel with get(x, y) is easy, but not as fast as grabbing the data directly from pixels[]. The equivalent statement to get(x, y) using pixels[] is pixels[y*width+x]. See the reference for pixels[] for more information. ( end auto-generated )

      ### Advanced

      Returns an ARGB "color" type (a packed 32 bit int with the color. If the coordinate is outside the image, zero is returned (black, but completely transparent).

      If the image is in RGB format (i.e. on a PVideo object), the value will get its high bits set, just to avoid cases where they haven't been set already.

      If the image is in ALPHA format, this returns a white with its alpha value set.

      This function is included primarily for beginners. It is quite slow because it has to check to see if the x, y that was provided is inside the bounds, and then has to check to see what image type it is. If you want things to be more efficient, access the pixels[] array directly.

      Overrides:
        `get` in class `PGraphicsJava2D`
      Parameters:
        `x` - x-coordinate of the pixel
        `y` - y-coordinate of the pixel
      See Also:
        `PApplet.set(int, int, int)`, `PApplet.pixels`, `PApplet.copy(PImage, int, int, int, int, int, int, int, int)`

    - #### get

          public PImage get(int x,
                   int y,
                   int w,
                   int h)

      Overrides:
        `get` in class `PImage`
        `w` - width of pixel rectangle to get
        `h` - height of pixel rectangle to get

    - #### get

          public PImage get()

      Description copied from class: `PImage`
      Returns a copy of this PImage. Equivalent to get(0, 0, width, height).
      Overrides:
        `get` in class `PGraphicsJava2D`

    - #### set

          public void set(int x,
                 int y,
                 int argb)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_set.xml ) Changes the color of any pixel or writes an image directly into the display window.
      The x and y parameters specify the pixel to change and the color parameter specifies the color value. The color parameter is affected by the current color mode (the default is RGB values from 0 to 255). When setting an image, the x and y parameters define the coordinates for the upper-left corner of the image, regardless of the current imageMode().
      Setting the color of a single pixel with set(x, y) is easy, but not as fast as putting the data directly into pixels[]. The equivalent statement to set(x, y, #000000) using pixels[] is pixels[y*width+x] = #000000. See the reference for pixels[] for more information. ( end auto-generated )
      Overrides:
        `set` in class `PGraphicsJava2D`
      Parameters:
        `x` - x-coordinate of the pixel
        `y` - y-coordinate of the pixel
        `argb` - any value of the color datatype
      See Also:
        `PImage.get(int, int, int, int)`, `PImage.pixels`, `PImage.copy(PImage, int, int, int, int, int, int, int, int)`

    - #### set

          public void set(int x,
                 int y,
                 PImage img)

      Description copied from class: `PImage`

      ### Advanced

      Efficient method of drawing an image's pixels directly to this surface. No variations are employed, meaning that any scale, tint, or imageMode settings will be ignored.
      Overrides:
        `set` in class `PImage`
        `img` - image to copy into the original image

    - #### mask

          public void mask(int[] alpha)

      Overrides:
        `mask` in class `PGraphicsJava2D`

    - #### mask

          public void mask(PImage alpha)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_mask.xml ) Masks part of an image from displaying by loading another image and using it as an alpha channel. This mask image should only contain grayscale data, but only the blue color channel is used. The mask image needs to be the same size as the image to which it is applied.
      In addition to using a mask image, an integer array containing the alpha channel data can be specified directly. This method is useful for creating dynamically generated alpha masks. This array must be of the same length as the target image's pixels array and should contain only grayscale data of values between 0-255. ( end auto-generated )

      ### Advanced

      Set alpha channel for an image. Black colors in the source image will make the destination image completely transparent, and white will make things fully opaque. Gray values will be in-between steps.

      Strictly speaking the "blue" value from the source image is used as the alpha color. For a fully grayscale image, this is correct, but for a color image it's not 100% accurate. For a more accurate conversion, first use filter(GRAY) which will make the image into a "correct" grayscale by performing a proper luminance-based conversion.

      Overrides:
        `mask` in class `PGraphicsJava2D`

    - #### filter

          public void filter(int kind)

      Overrides:
        `filter` in class `PImage`

    - #### filter

          public void filter(int kind,
                    float param)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_filter.xml ) Filters an image as defined by one of the following modes:
      THRESHOLD - converts the image to black and white pixels depending if they are above or below the threshold defined by the level parameter. The level must be between 0.0 (black) and 1.0(white). If no level is specified, 0.5 is used.
      GRAY - converts any colors in the image to grayscale equivalents
      INVERT - sets each pixel to its inverse value
      POSTERIZE - limits each channel of the image to the number of colors specified as the level parameter
      BLUR - executes a Guassian blur with the level parameter specifying the extent of the blurring. If no level parameter is used, the blur is equivalent to Guassian blur of radius 1
      OPAQUE - sets the alpha channel to entirely opaque
      ERODE - reduces the light areas with the amount defined by the level parameter
      DILATE - increases the light areas with the amount defined by the level parameter ( end auto-generated )

      ### Advanced

      Method to apply a variety of basic filters to this image.

      - filter(BLUR) provides a basic blur.
      - filter(GRAY) converts the image to grayscale based on luminance.
      - filter(INVERT) will invert the color components in the image.
      - filter(OPAQUE) set all the high bits in the image to opaque
      - filter(THRESHOLD) converts the image to black and white.
      - filter(DILATE) grow white/light areas
      - filter(ERODE) shrink white/light areas
      Luminance conversion code contributed by toxi

      Gaussian blur code contributed by Mario Klingemann
      Overrides:
        `filter` in class `PImage`
      Parameters:
        `kind` - Either THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, or DILATE
        `param` - unique for each, see above

    - #### copy

          public void copy(int sx,
                  int sy,
                  int sw,
                  int sh,
                  int dx,
                  int dy,
                  int dw,
                  int dh)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_copy.xml ) Copies a region of pixels from one image into another. If the source and destination regions aren't the same size, it will automatically resize source pixels to fit the specified target region. No alpha information is used in the process, however if the source image has an alpha channel set, it will be copied as well.
      As of release 0149, this function ignores imageMode(). ( end auto-generated )
      Overrides:
        `copy` in class `PGraphicsJava2D`
      Parameters:
        `sx` - X coordinate of the source's upper left corner
        `sy` - Y coordinate of the source's upper left corner
        `sw` - source image width
        `sh` - source image height
        `dx` - X coordinate of the destination's upper left corner
        `dy` - Y coordinate of the destination's upper left corner
        `dw` - destination image width
        `dh` - destination image height
      See Also:
        `PGraphics.alpha(int)`, `PImage.blend(PImage, int, int, int, int, int, int, int, int, int)`

    - #### copy

          public void copy(PImage src,
                  int sx,
                  int sy,
                  int sw,
                  int sh,
                  int dx,
                  int dy,
                  int dw,
                  int dh)

      Overrides:
        `copy` in class `PGraphicsJava2D`
      Parameters:
        `src` - an image variable referring to the source image.

    - #### blend

          public void blend(int sx,
                   int sy,
                   int sw,
                   int sh,
                   int dx,
                   int dy,
                   int dw,
                   int dh,
                   int mode)

      Overrides:
        `blend` in class `PImage`

    - #### blend

          public void blend(PImage src,
                   int sx,
                   int sy,
                   int sw,
                   int sh,
                   int dx,
                   int dy,
                   int dw,
                   int dh,
                   int mode)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_blend.xml ) Blends a region of pixels into the image specified by the img parameter. These copies utilize full alpha channel support and a choice of the following modes to blend the colors of source pixels (A) with the ones of pixels in the destination image (B):
      BLEND - linear interpolation of colours: C = A*factor + B
      ADD - additive blending with white clip: C = min(A*factor + B, 255)
      SUBTRACT - subtractive blending with black clip: C = max(B - A*factor, 0)
      DARKEST - only the darkest colour succeeds: C = min(A*factor, B)
      LIGHTEST - only the lightest colour succeeds: C = max(A*factor, B)
      DIFFERENCE - subtract colors from underlying image.
      EXCLUSION - similar to DIFFERENCE, but less extreme.
      MULTIPLY - Multiply the colors, result will always be darker.
      SCREEN - Opposite multiply, uses inverse values of the colors.
      OVERLAY - A mix of MULTIPLY and SCREEN. Multiplies dark values, and screens light values.
      HARD_LIGHT - SCREEN when greater than 50% gray, MULTIPLY when lower.
      SOFT_LIGHT - Mix of DARKEST and LIGHTEST. Works like OVERLAY, but not as harsh.
      DODGE - Lightens light tones and increases contrast, ignores darks. Called "Color Dodge" in Illustrator and Photoshop.
      BURN - Darker areas are applied, increasing contrast, ignores lights. Called "Color Burn" in Illustrator and Photoshop.
      All modes use the alpha information (highest byte) of source image pixels as the blending factor. If the source and destination regions are different sizes, the image will be automatically resized to match the destination size. If the srcImg parameter is not used, the display window is used as the source image.
      As of release 0149, this function ignores imageMode(). ( end auto-generated )
      Overrides:
        `blend` in class `PImage`
      Parameters:
        `src` - an image variable referring to the source image
        `sx` - X coordinate of the source's upper left corner
        `sy` - Y coordinate of the source's upper left corner
        `sw` - source image width
        `sh` - source image height
        `dx` - X coordinate of the destinations's upper left corner
        `dy` - Y coordinate of the destinations's upper left corner
        `dw` - destination image width
        `dh` - destination image height
        `mode` - Either BLEND, ADD, SUBTRACT, LIGHTEST, DARKEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
      See Also:
        `PApplet.alpha(int)`, `PImage.copy(PImage, int, int, int, int, int, int, int, int)`, `PImage.blendColor(int,int,int)`

    - #### save

          public boolean save(String filename)

      Description copied from class: `PImage`
      ( begin auto-generated from PImage_save.xml ) Saves the image into a file. Images are saved in TIFF, TARGA, JPEG, and PNG format depending on the extension within the filename parameter. For example, "image.tif" will have a TIFF image and "image.png" will save a PNG image. If no extension is included in the filename, the image will save in TIFF format and .tif will be added to the name. These files are saved to the sketch's folder, which may be opened by selecting "Show sketch folder" from the "Sketch" menu. It is not possible to use save() while running the program in a web browser.
      To save an image created within the code, rather than through loading, it's necessary to make the image with the createImage() function so it is aware of the location of the program and can therefore save the file to the right place. See the createImage() reference for more information. ( end auto-generated )

      ### Advanced

      Save this image to disk.

      As of revision 0100, this function requires an absolute path, in order to avoid confusion. To save inside the sketch folder, use the function savePath() from PApplet, or use saveFrame() instead. As of revision 0116, savePath() is not needed if this object has been created (as recommended) via createImage() or createGraphics() or one of its neighbors.

      As of revision 0115, when using Java 1.4 and later, you can write to several formats besides tga and tiff. If Java 1.4 is installed and the extension used is supported (usually png, jpg, jpeg, bmp, and tiff), then those methods will be used to write the image. To get a list of the supported formats for writing, use:
      `println(javax.imageio.ImageIO.getReaderFormatNames())`

      To use the original built-in image writers, use .tga or .tif as the extension, or don't include an extension. When no extension is used, the extension .tif will be added to the file name.

      The ImageIO API claims to support wbmp files, however they probably require a black and white image. Basic testing produced a zero-length file with no error.

      Overrides:
        `save` in class `PImage`
      Parameters:
        `filename` - a sequence of letters and numbers