Package voltage.core

# Class VoltageCanvas

java.lang.Object
voltage.core.VoltageComponent
voltage.core.VoltageCanvas

public class VoltageCanvas extends VoltageComponent
An object in which you can custom draw on and accept mouse input

- ## Field Summary

  ### Fields inherited from class voltage.core.VoltageComponent

  `componentName, displayName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoltageCanvas(String name, String displayName, VoltageModule module, int width, int height)`
  `VoltageCanvas(String name, VoltageModule module, int width, int height)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `Clear()`
  Clears the canvas.
  `int`
  `GetBitmapHeight()`
  Gets the height of the bitmap.
  `int`
  `GetBitmapWidth()`
  Gets the width of the bitmap.
  `Graphics2D`
  `GetGraphics()`
  Gets the 2D graphics drawing object
  `void`
  `GetPixelData(int[] pixels)`
  Retrieves the contents of the canvas image
  `void`
  `GetPixelDataRect(int[] pixels, int topX, int topY, int bottomX, int bottomY)`
  Retrieves the pixels for a rectangular section of the canvas image.
  `void`
  `Invalidate()`
  Flags the entire canvas to be redrawn.
  `void`
  `InvalidateRect(int topX, int topY, int bottomX, int bottomY)`
  Flags the a rectangular region of the canvas to be redrawn.
  `boolean`
  `IsHighDensity()`
  Is this a high density canvas?
  `void`
  `SetAlwaysRedrawEntireCanvas(boolean bRedrawAllFlag)`
  Causes any invalidate to always redraw the entire canvas.
  `void`
  `SetHighDensity(boolean bHighDensity)`
  Sets the canvas to high density.
  `void`
  `SetRect(int x, int y, int width, int height)`
  Set the position and size of this control.
  `void`
  `SetSize(int width, int height)`
  Set the size of this control.

  ### Methods inherited from class voltage.core.VoltageComponent

  `AddChildComponent, GetComponentID, GetDisplayName, GetHeight, GetMaxValue, GetMinValue, GetRect, GetSkin, GetTooltipText, GetTransparency, GetUserProperty, GetValue, GetWidth, GetX, GetY, IsEnabled, IsVisible, RemoveChildComponent, SetCanBeAutomated, SetEnabled, SetPosition, SetRect, SetSkin, SetTransparency, SetUnits, SetUserProperty, SetValue, SetValue, SetValueNoNotification, SetVisible, SetWantsMouseNotifications, SetZOrder, SkewNormalizedValue, UpdateGUIValue, WantsMouseNotifications`

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### VoltageCanvas

    public VoltageCanvas(String name, String displayName, VoltageModule module, int width, int height)

  - ### VoltageCanvas

    public VoltageCanvas(String name, VoltageModule module, int width, int height)

- ## Method Details

  - ### SetAlwaysRedrawEntireCanvas

    public void SetAlwaysRedrawEntireCanvas(boolean bRedrawAllFlag)
    Causes any invalidate to always redraw the entire canvas. This is important for canvas controls that have other controls that might be causing the canvas to invalidate partially.
    Parameters:
      `bRedrawAllFlag` - set to true if you want the whole control to redraw on any partial invalidation.

  - ### GetBitmapWidth

    public int GetBitmapWidth()
    Gets the width of the bitmap. It can be 2 times as big as the width of the object if it is high density.
    Returns:
      the width of the bitmap.

  - ### GetBitmapHeight

    public int GetBitmapHeight()
    Gets the height of the bitmap. It can be 2 times as big as the height of the object if it is high density.
    Returns:
      the height of the bitmap.

  - ### SetSize

    public void SetSize(int width, int height)
    Set the size of this control.
    Overrides:
      `SetSize` in class `VoltageComponent`
    Parameters:
      `width` - width of control
      `height` - height of control

  - ### SetRect

    public void SetRect(int x, int y, int width, int height)
    Set the position and size of this control.
    Overrides:
      `SetRect` in class `VoltageComponent`
    Parameters:
      `x` - leftmost position
      `y` - top position
      `width` - width of control
      `height` - height of control

  - ### GetGraphics

    public Graphics2D GetGraphics()
    Gets the 2D graphics drawing object
    Returns:
      the Graphic object you can draw on.

  - ### Clear

    public void Clear()
    Clears the canvas.

  - ### GetPixelData

    public void GetPixelData(int[] pixels)
    Retrieves the contents of the canvas image
    Parameters:
      `pixels` - array of pixels.

  - ### GetPixelDataRect

    public void GetPixelDataRect(int[] pixels, int topX, int topY, int bottomX, int bottomY)
    Retrieves the pixels for a rectangular section of the canvas image.
    Parameters:
      `pixels` - array of pixels.
      `topX` - top left corner's x coordinate.
      `topY` - top left corner's y coordinate.
      `bottomX` - bottom right corner's x coordinate.
      `bottomY` - bottom right corner's y coordinate.

  - ### Invalidate

    public void Invalidate()
    Flags the entire canvas to be redrawn.

  - ### InvalidateRect

    public void InvalidateRect(int topX, int topY, int bottomX, int bottomY)
    Flags the a rectangular region of the canvas to be redrawn.
    Parameters:
      `topX` - top left corner's x coordinate.
      `topY` - top left corner's y coordinate.
      `bottomX` - bottom right corner's x coordinate.
      `bottomY` - bottom right corner's y coordinate.

  - ### SetHighDensity

    public void SetHighDensity(boolean bHighDensity)
    Sets the canvas to high density.
    Parameters:
      `bHighDensity` - set to true if its high density.

  - ### IsHighDensity

    public boolean IsHighDensity()
    Is this a high density canvas?
    Returns:
      true if high density