# Class `juce.Graphics`

Graphics drawing target.

Is a pointer to a JUCE Graphics object. Received in gui.paint as an argument.

## Constructors

juce.Graphics (imageToDrawOnto) | Constuct from a juce.Image.

## Methods

juce.Graphics:setColour (newColour) | Set working colour.
juce.Graphics:setOpacity (newOpacity) | Set working opacity.
juce.Graphics:setGradientFill (gradient) | Set working Gradient.
juce.Graphics:setTiledImageFill (imageToUse, anchorX, anchorY, opacity) | Set Tiled Image Fill.
juce.Graphics:setFillType (newFill) | Set Fill.
juce.Graphics:setFont (newFont) | Set Font.
juce.Graphics:setFont (newFontHeight) | Set Font.
juce.Graphics:getCurrentFont () | Get Current Font.
juce.Graphics:drawSingleLineText (text, startX, baselineY[, justification=Justification.left]) | Draw single line of text.
juce.Graphics:drawMultiLineText (text, startX, baselineY, maximumLineWidth) | Draw multiline text.
juce.Graphics:drawText (x, y, width, height[, justification=Justification.left[, useEllipsesIfTooBig=false]]) | Draw text.
juce.Graphics:drawText (area[, justification=Justification.left[, useEllipsesIfTooBig=false]]) | Draw text.
juce.Graphics:drawFittedText (x, y, width, height, justification, maximumNumberOfLines[, minimumHorizontalScale=0.7]) | Draw fitted text.
juce.Graphics:drawFittedText (area, justification, maximumNumberOfLines[, minimumHorizontalScale=0.7]) | Draw fitted text.
juce.Graphics:fillAll ([colourToUse]) | Fill the entire graphics target.
juce.Graphics:fillRect (x, y, width, height) | Fill rectangle with current fill type.
juce.Graphics:fillRect (area) | Fill rectangle with current fill type.
juce.Graphics:fillRect_float (x, y, width, height) | Fill rectangle (sub-pixel accuracy).
juce.Graphics:fillRoundedRectangle (x, y, width, height, cornerSize) | Fill rounded rectangle.
juce.Graphics:fillRoundedRectangle (area, cornerSize) | Fill rounded rectangle.
juce.Graphics:fillCheckerBoard (area, checkWidth, checkHeight, colour1, colour2) | Fill chequerboard.
juce.Graphics:drawRect (x, y, width, height[, lineThickness=1]) | Draw rectangle.
juce.Graphics:drawRect (area[, lineThickness=1]) | Draw rectangle.
juce.Graphics:drawRect_float (x, y, width, height[, lineThickness=1]) | Draw rect (sub-pixel accuracy).
juce.Graphics:drawRect_float (area[, lineThickness=1]) | Draw rect (sub-pixel accuracy).
juce.Graphics:drawRoundedRectangle (x, y, width, height, cornerSize[, lineThickness=1]) | Draw rounded rectangle.
juce.Graphics:drawRoundedRectangle (area, cornerSize[, lineThickness=1]) | Draw rounded rectangle.
juce.Graphics:setPixel (x, y) | Set pixel with current colour.
juce.Graphics:fillEllipse (x, y, width, height) | Fill ellipse with current fill.
juce.Graphics:drawEllipse (x, y, width, height[, lineThickness=1]) | Draw ellipse with current colour.
juce.Graphics:drawLine (startX, startY, endX, endY[, lineThickness=1]) | Draw line.
juce.Graphics:drawLine (line[, lineThickness=1]) | Draw line.
juce.Graphics:drawDashedLine (line, dashLengths, numDashLengths[, lineThickness=1[, dashIndexToStartFrom=0]]) | Draw dashed line.
juce.Graphics:drawVerticalLine (x, top, bottom) | Draw vertical line.
juce.Graphics:drawHorizontalLine (y, left, right) | Draw horizontal line.
juce.Graphics:fillPath (path[, transform=juce.AffineTransform.identity]) | Fill path.
juce.Graphics:strokePath (path[, args]) | Stroke path.
juce.Graphics:drawArrow (line, lineThickness, arrowheadWidth, arrowheadLength) | Draw arrow.
juce.Graphics:setImageResamplingQuality (newQuality) | Set image resampling quality.
juce.Graphics:drawImageAt (imageToDraw, topLeftX, topLeftY[, fillAlphaChannelWithCurrentBrush=false]) | Draw unscaled image at location.
juce.Graphics:drawImage (imageToDraw, destX, destY, destWidth, destHeight, sourceX, sourceY, sourceWidth, sourceHeight[, fillAlphaChannelWithCurrentBrush=false]) | Draw a portion of an image, stretched into a target rectangle.
juce.Graphics:drawImageTransformed (imageToDraw, transform[, fillAlphaChannelWithCurrentBrush=false]) | Draw transformed image.
juce.Graphics:drawImageWithin (imageToDraw, destX, destY, destWidth, destHeight[, placementWithinTarget=juce.RectanglePlacement.centred[, fillAlphaChannelWithCurrentBrush=false]]) | Draw image within.
juce.Graphics:getClipBounds () | Get clip bounds.
juce.Graphics:clipRegionIntersects () | Clip region intersects.
juce.Graphics:isClipEmpty () | Is clipping region empty.
juce.Graphics:saveState () | Save state.
juce.Graphics:restoreState () | Restore state.
juce.Graphics:beginTransparencyLayer () | Begin transparency layer.
juce.Graphics:endTransparencyLayer () | End transparency layer.
juce.Graphics:setOrigin (newOriginX, newOriginY) | Set origin.
juce.Graphics:addTransform (transform) | Add a transformation matrix.
juce.Graphics:resetToDefaultState () | Reset to default state.
juce.Graphics:isVectorDevice () | Is vector device.

## Tables

juce.Graphics.ResamplingQuality | Resampling qualities.

## Constructors

juce.Graphics (imageToDrawOnto)
  Constuct from a juce.Image. Use this constructor to draw directly onto an juce.Image in memory.

  A typical use is to can create a juce.Image object and use it as a backbuffer for pre-rendering graphics.

  ### Parameters:

  - imageToDrawOnto juce.Image

## Methods

juce.Graphics:setColour (newColour)
  Set working colour. Set the colour to be used for subsequent calls such as drawRect and drawText.

  ### Parameters:

  - newColour juce.Colour
juce.Graphics:setOpacity (newOpacity)
  Set working opacity. Set the opacity to be used for subsequent calls.

  ### Parameters:

  - newOpacity
juce.Graphics:setGradientFill (gradient)
  Set working Gradient. Use a gradient as fill for subsequent calls such as fillRect.

  ### Parameters:

  - gradient juce.ColourGradient
juce.Graphics:setTiledImageFill
(imageToUse, anchorX, anchorY, opacity)
  Set Tiled Image Fill. Use a tiled image as fill for subsequent calls such as fillRect.

  ### Parameters:

  - imageToUse juce.Image
  - anchorX
  - anchorY
  - opacity
juce.Graphics:setFillType (newFill)
  Set Fill.

  ### Parameters:

  - newFill juce.FillType
juce.Graphics:setFont (newFont)
  Set Font.

  ### Parameters:

  - newFont juce.Font
juce.Graphics:setFont (newFontHeight)
  Set Font.

  ### Parameters:

  - newFontHeight number
juce.Graphics:getCurrentFont ()
  Get Current Font. treturn juce.Font the current font
juce.Graphics:drawSingleLineText
(text, startX, baselineY[, justification=Justification.left])
  Draw single line of text.

  ### Parameters:

  - text string
  - startX
  - baselineY
  - justification juce.Justification (default Justification.left)
juce.Graphics:drawMultiLineText
(text, startX, baselineY, maximumLineWidth)
  Draw multiline text.

  ### Parameters:

  - text string
  - startX
  - baselineY
  - maximumLineWidth
juce.Graphics:drawText
(x, y, width, height[, justification=Justification.left[, useEllipsesIfTooBig=false]])
  Draw text.

  ### Parameters:

  - x
  - y
  - width
  - height
  - justification juce.Justification (default Justification.left)
  - useEllipsesIfTooBig (default false)
juce.Graphics:drawText
(area[, justification=Justification.left[, useEllipsesIfTooBig=false]])
  Draw text.

  ### Parameters:

  - area juce.Rectangle_int
  - justification juce.Justification (default Justification.left)
  - useEllipsesIfTooBig (default false)
juce.Graphics:drawFittedText
(x, y, width, height, justification, maximumNumberOfLines[, minimumHorizontalScale=0.7])
  Draw fitted text. Awkwardly squishes the font (up to minimumHorizontalScale) if necessary.

  ### Parameters:

  - x
  - y
  - width
  - height
  - justification juce.Justification
  - maximumNumberOfLines
  - minimumHorizontalScale (default 0.7)
juce.Graphics:drawFittedText
(area, justification, maximumNumberOfLines[, minimumHorizontalScale=0.7])
  Draw fitted text. Awkwardly squishes the font (up to minimumHorizontalScale) if necessary.

  ### Parameters:

  - area juce.Rectangle_int
  - justification juce.Justification
  - maximumNumberOfLines
  - minimumHorizontalScale (default 0.7)
juce.Graphics:fillAll ([colourToUse])
  Fill the entire graphics target.

  ### Parameters:

  - colourToUse juce.Colour
juce.Graphics:fillRect (x, y, width, height)
  Fill rectangle with current fill type.

  ### Parameters:

  - x
  - y
  - width
  - height
juce.Graphics:fillRect (area)
  Fill rectangle with current fill type.

  ### Parameters:

  - area juce.Rectangle_int
juce.Graphics:fillRect_float (x, y, width, height)
  Fill rectangle (sub-pixel accuracy).

  ### Parameters:

  - x
  - y
  - width
  - height
juce.Graphics:fillRoundedRectangle
(x, y, width, height, cornerSize)
  Fill rounded rectangle.

  ### Parameters:

  - x
  - y
  - width
  - height
  - cornerSize
juce.Graphics:fillRoundedRectangle (area, cornerSize)
  Fill rounded rectangle.

  ### Parameters:

  - area juce.Rectangle_int
  - cornerSize
juce.Graphics:fillCheckerBoard
(area, checkWidth, checkHeight, colour1, colour2)
  Fill chequerboard. (and i thought juce used British spelling)

  ### Parameters:

  - area juce.Rectangle_int
  - checkWidth
  - checkHeight
  - colour1 juce.Colour
  - colour2 juce.Colour
juce.Graphics:drawRect
(x, y, width, height[, lineThickness=1])
  Draw rectangle.

  ### Parameters:

  - x
  - y
  - width
  - height
  - lineThickness (default 1)
juce.Graphics:drawRect (area[, lineThickness=1])
  Draw rectangle.

  ### Parameters:

  - area juce.Rectangle_int
  - lineThickness (default 1)
juce.Graphics:drawRect_float
(x, y, width, height[, lineThickness=1])
  Draw rect (sub-pixel accuracy).

  ### Parameters:

  - x
  - y
  - width
  - height
  - lineThickness (default 1)
juce.Graphics:drawRect_float (area[, lineThickness=1])
  Draw rect (sub-pixel accuracy).

  ### Parameters:

  - area juce.Rectangle_int
  - lineThickness (default 1)
juce.Graphics:drawRoundedRectangle
(x, y, width, height, cornerSize[, lineThickness=1])
  Draw rounded rectangle.

  ### Parameters:

  - x
  - y
  - width
  - height
  - cornerSize
  - lineThickness (default 1)
juce.Graphics:drawRoundedRectangle
(area, cornerSize[, lineThickness=1])
  Draw rounded rectangle.

  ### Parameters:

  - area juce.Rectangle_int
  - cornerSize
  - lineThickness (default 1)
juce.Graphics:setPixel (x, y)
  Set pixel with current colour.

  ### Parameters:

  - x
  - y
juce.Graphics:fillEllipse (x, y, width, height)
  Fill ellipse with current fill.

  ### Parameters:

  - x
  - y
  - width
  - height
juce.Graphics:drawEllipse
(x, y, width, height[, lineThickness=1])
  Draw ellipse with current colour.

  ### Parameters:

  - x
  - y
  - width
  - height
  - lineThickness (default 1)
juce.Graphics:drawLine
(startX, startY, endX, endY[, lineThickness=1])
  Draw line.

  ### Parameters:

  - startX
  - startY
  - endX
  - endY
  - lineThickness (default 1)
juce.Graphics:drawLine (line[, lineThickness=1])
  Draw line.

  ### Parameters:

  - line juce.Line
  - lineThickness (default 1)
juce.Graphics:drawDashedLine
(line, dashLengths, numDashLengths[, lineThickness=1[, dashIndexToStartFrom=0]])
  Draw dashed line.

  ### Parameters:

  - line juce.Line
  - dashLengths (const float* ctype)
  - numDashLengths
  - lineThickness (default 1)
  - dashIndexToStartFrom (default 0)
juce.Graphics:drawVerticalLine (x, top, bottom)
  Draw vertical line.

  ### Parameters:

  - x
  - top
  - bottom
juce.Graphics:drawHorizontalLine (y, left, right)
  Draw horizontal line.

  ### Parameters:

  - y
  - left
  - right
juce.Graphics:fillPath
(path[, transform=juce.AffineTransform.identity])
  Fill path.

  ### Parameters:

  - path juce.Path
  - transform juce.AffineTransform (default juce.AffineTransform.identity)
juce.Graphics:strokePath (path[, args])
  Stroke path. All named arguments are optional

  ### Parameters:

  - path juce.Path
  - args
    - thickness
    - jointStyle juce.Path.JointStyle default : juce.Path.JointStyle.mitered
    - endCapStyle juce.Path.EndCapStyle default : juce.Path.EndCapStyle.butt
    - transform juce.AffineTransform default : juce.AffineTransform.identity
juce.Graphics:drawArrow
(line, lineThickness, arrowheadWidth, arrowheadLength)
  Draw arrow.

  ### Parameters:

  - line juce.Line
  - lineThickness
  - arrowheadWidth
  - arrowheadLength
juce.Graphics:setImageResamplingQuality (newQuality)
  Set image resampling quality.

  ### Parameters:

  - newQuality juce.Graphics.ResamplingQuality
juce.Graphics:drawImageAt
(imageToDraw, topLeftX, topLeftY[, fillAlphaChannelWithCurrentBrush=false])
  Draw unscaled image at location.

  ### Parameters:

  - imageToDraw juce.Image
  - topLeftX
  - topLeftY
  - fillAlphaChannelWithCurrentBrush (default false)
juce.Graphics:drawImage
(imageToDraw, destX, destY, destWidth, destHeight, sourceX, sourceY, sourceWidth, sourceHeight[, fillAlphaChannelWithCurrentBrush=false])
  Draw a portion of an image, stretched into a target rectangle.

  ### Parameters:

  - imageToDraw juce.Image
  - destX
  - destY
  - destWidth
  - destHeight
  - sourceX
  - sourceY
  - sourceWidth
  - sourceHeight
  - fillAlphaChannelWithCurrentBrush (default false)
juce.Graphics:drawImageTransformed
(imageToDraw, transform[, fillAlphaChannelWithCurrentBrush=false])
  Draw transformed image.

  ### Parameters:

  - imageToDraw juce.Image
  - transform juce.AffineTransform
  - fillAlphaChannelWithCurrentBrush (default false)
juce.Graphics:drawImageWithin
(imageToDraw, destX, destY, destWidth, destHeight[, placementWithinTarget=juce.RectanglePlacement.centred[, fillAlphaChannelWithCurrentBrush=false]])
  Draw image within.

  ### Parameters:

  - imageToDraw juce.Image
  - destX
  - destY
  - destWidth
  - destHeight
  - placementWithinTarget (default juce.RectanglePlacement.centred)
  - fillAlphaChannelWithCurrentBrush (default false)
juce.Graphics:getClipBounds ()
  Get clip bounds. Get the portion of the graphics target that needs to be redrawn.

  ### Returns:

  juce.Rectangle_int Clipping area
juce.Graphics:clipRegionIntersects ()
  Clip region intersects. Check if a rectangle intersects with the redrawing region

  ### Returns:

  1. juce.Rectangle_int Clipping area
  2. boolean intersection check
juce.Graphics:isClipEmpty ()
  Is clipping region empty.

  ### Returns:

  boolean whether the redrawing area is empty
juce.Graphics:saveState ()
  Save state. Saves the current state of the graphics target on a stack. This does not save the actual graphic's contents but its current colour, transform, origin, etc.
juce.Graphics:restoreState ()
  Restore state. Restores a state of the graphics target from the stack. Useful to cancel any previous uses of addTransform, setColour, etc.
juce.Graphics:beginTransparencyLayer ()
  Begin transparency layer. Saves the current state and begins drawing on a temporary layer, to be applied with the specified final transparency.
juce.Graphics:endTransparencyLayer ()
  End transparency layer. Applies the transparency layer that was started with beginTransparencyLayer.
juce.Graphics:setOrigin (newOriginX, newOriginY)
  Set origin.

  ### Parameters:

  - newOriginX
  - newOriginY
juce.Graphics:addTransform (transform)
  Add a transformation matrix. The matrix will be chained onto the current one, and affect all subsequent graphics operations. Use saveState and restoreState to apply a temporary transform.

  ### Parameters:

  - transform juce.AffineTransform
juce.Graphics:resetToDefaultState ()
  Reset to default state.
juce.Graphics:isVectorDevice ()
  Is vector device.

  ### Returns:

  boolean whether the target is a vector device.

## Tables

juce.Graphics.ResamplingQuality
  Resampling qualities.

  ### Fields:

  - low
  - medium
  - high

generated by LDoc 1.4.2