init method

Future<void> init()

Initializes the shape painter by loading the bitmap pattern if specified.

Implementation

Future<void> init() async {
  if (renderinstruction.bitmapSrc != null) {
    try {
      SymbolImage? symbolImage = await SymbolCacheMgr().getOrCreateSymbol(
        renderinstruction.bitmapSrc!,
        renderinstruction.getBitmapWidth(),
        renderinstruction.getBitmapHeight(),
      );
      if (symbolImage == null) return;
      fill ??= UiPaint.fill();
      fill!.setBitmapShader(symbolImage);
      //symbolImage.dispose();
    } catch (error) {
      _log.warning("Error loading bitmap ${renderinstruction.bitmapSrc}", error);
    }
  }
}