($, avoidMarks, labelInside, isGroupArea)
| 138629 | ]; |
| 138630 | } |
| 138631 | function markBitmaps($, avoidMarks, labelInside, isGroupArea) { |
| 138632 | // create canvas |
| 138633 | const width = $.width, height = $.height, border = labelInside || isGroupArea, context = (0, _vegaCanvas.canvas)(width, height).getContext("2d"); // render all marks to be avoided into canvas |
| 138634 | avoidMarks.forEach((items)=>draw(context, items, border)); // get canvas buffer, create bitmaps |
| 138635 | const buffer = new Uint32Array(context.getImageData(0, 0, width, height).data.buffer), layer1 = $.bitmap(), layer2 = border && $.bitmap(); // populate bitmap layers |
| 138636 | let x, y, u, v, alpha; |
| 138637 | for(y = 0; y < height; ++y)for(x = 0; x < width; ++x){ |
| 138638 | alpha = buffer[y * width + x] & ALPHA_MASK; |
| 138639 | if (alpha) { |
| 138640 | u = $(x); |
| 138641 | v = $(y); |
| 138642 | if (!isGroupArea) layer1.set(u, v); // update interior bitmap |
| 138643 | if (border && alpha ^ INSIDE_OPACITY_IN_ALPHA) layer2.set(u, v); // update border bitmap |
| 138644 | } |
| 138645 | } |
| 138646 | return [ |
| 138647 | layer1, |
| 138648 | layer2 |
| 138649 | ]; |
| 138650 | } |
| 138651 | function draw(context, items, interior) { |
| 138652 | if (!items.length) return; |
| 138653 | const type = items[0].mark.marktype; |
no test coverage detected