Namespace: gdi | Spider Monkey Panel

## gdi

Functions for working with graphics. Most of them are wrappers for Gdi and GdiPlus methods.

### Methods

#### static CreateImage(w, h) → {GdiBitmap}
`js/foo_spider_monkey_panel.js`, `line 743`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `w` | number |
  `h` | number |

  ##### Returns:

  GdiBitmap

#### static Font(name, size_px, styleopt) → nullable {GdiFont}
`js/foo_spider_monkey_panel.js`, `line 756`

  Performance note: avoid using inside `on_paint`.
  Performance note II: try caching and reusing `GdiFont` objects, since the maximum amount of such objects is hard-limited by Windows. `GdiFont` creation will fail after reaching this limit.

  ##### Parameters:

  Name | Type | Attributes | Default | Description
  --- | --- | --- | --- | ---
  `name` | string |  |  |
  `size_px` | number |  |  | See Helper.js > Point2Pixel function for conversions
  `style` | number | <optional> | 0 | See Flags.js > FontStyle

  ##### Returns:

  GdiFont - null, if font is not present.

#### static Image(path) → nullable {GdiBitmap}
`js/foo_spider_monkey_panel.js`, `line 770`

  Load image from file.
  Performance note: consider using gdi.LoadImageAsync or gdi.LoadImageAsyncV2 if there are a lot of images to load or if the image is big.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `path` | string |

  ##### Returns:

  GdiBitmap - null, if image failed to load.

  ##### Example

      let img = gdi.Image('e:\\images folder\\my_image.png');

#### static LoadImageAsync(window_id, path) → {number}
`js/foo_spider_monkey_panel.js`, `line 782`

  Load image from file asynchronously.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `window_id` | number | see window.ID
  `path` | string |

  ##### Returns:

  number - a unique id, which is used in on_load_image_done.

  ##### Example

      // See `samples/basic/LoadImageAsync.js`

#### static LoadImageAsyncV2(window_id, path) → {Promise.<?GdiBitmap>}
`js/foo_spider_monkey_panel.js`, `line 795`

  Load image from file asynchronously. Returns a `Promise` object, which will be resolved when image loading is done.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `window_id` | number | see window.ID
  `path` | string |

  ##### Returns:

  Promise.<?GdiBitmap>

  ##### Example

      // See `samples/basic/LoadImageAsyncV2.js`