void renderBox(iDrawContext context, iGeometry geometry, int id, float boundingBoxesOpacity, ref Matrix3x2 tform) { // if( id != 0 ) return; Rect box; if (geometry is iPathGeometry pathGeometry) { box = pathGeometry.getApproximateBounds(ref tform); } else { box = geometry.getBounds(ref tform); } Vector4 color = Color.moreRandomColor(id); if (context.device.premultipliedAlphaBrushes) { color *= boundingBoxesOpacity; } else { color.W = boundingBoxesOpacity; } context.transform.pushIdentity(); context.drawRectangle(box, context.device.createSolidColorBrush(color), 1); context.transform.pop(); }
void Draw.iDrawContext.drawRectangle(Rect rect, Draw.iBrush brush, float width) { applyTransform(); rect.deflate(width * 0.5f); context.drawRectangle(ref rect, width, (iBrush)brush); }