init method
Initializes the shape painter by loading bitmap patterns if specified.
Loads bitmap images from the symbol cache for pattern fills and configures the fill paint accordingly.
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);
}
}
}