コード例 #1
0
        protected void fillGeometry(iPathGeometry path, SolidColorData color, bool vaa, int instance = 0)
        {
            getCurrentTransform(out Matrix3x2 tform, out float pixel);
            if (!path.testApproximateBounds(ref tform) || color.brushType == eBrushType.Null)
            {
                return;
            }

            eBuildFilledMesh fillOptions = DrawUtilsPrivate.fillFlagsFromColor(color.brushType, false);

            if (fillOptions == eBuildFilledMesh.None)
            {
                return;                 // Null brush
            }
            if (!vaa)
            {
                fillOptions &= ~eBuildFilledMesh.VAA;
            }

            sPendingDrawCall pdc = tesselatorThread.fill(path, ref tform, pixel, fillOptions, instance);

            flushIfNeeded(pdc.drawInfo.drawCallsCount);

            Order o = order();

            drawMeshes.meshes.add(ref pdc);
            calls.add(sDrawCall.solidColorFill(o, ref tform, color.paletteIndex));
        }
コード例 #2
0
        protected void fillAndStrokeGeometry(iPathGeometry path, SolidColorData?fill, SolidColorData stroke, float width, ref sStrokeStyle strokeStyle, int instance = 0)
        {
            if ((fill?.brushType ?? eBrushType.Null) == eBrushType.Null)
            {
                // No fill, just stroke
                if (stroke.brushType != eBrushType.Null)
                {
                    strokeGeometry(path, stroke, null, width, ref strokeStyle, instance);
                }
                return;
            }
            if (stroke.brushType == eBrushType.Null)
            {
                // No stroke, just fill
                fillGeometry(path, fill.Value, true, instance);
                return;
            }

            getCurrentTransform(out Matrix3x2 tform, out float pixel);
            if (!path.testApproximateBounds(ref tform, width))
            {
                return;
            }

            eBuildFilledMesh   fillOptions = DrawUtilsPrivate.fillFlagsFromColor(fill.Value.brushType, true);
            StrokeRenderParams srp         = StrokeRenderParams.strokedPath(stroke.paletteIndex, width, pixel);
            Order o;

            if (fill.Value == stroke)
            {
                // Colors are the same, combine the draw calls
                sPendingDrawCall pdc = tesselatorThread.fillAndStroke(path, ref tform, pixel, fillOptions, new sStrokeInfo(strokeStyle, srp.meshWidth), instance);
                flushIfNeeded(pdc.drawInfo.drawCallsCount);
                o = order();
                drawMeshes.meshes.add(ref pdc);
                calls.add(sDrawCall.solidColorStroke(o, ref tform, ref srp));
                return;
            }

            var  pendingCalls = tesselatorThread.fillAndStrokeSeparate(path, ref tform, pixel, fillOptions, new sStrokeInfo(strokeStyle, srp.meshWidth), instance);
            byte dcc          = pendingCalls.Item1.drawInfo.drawCallsCount;

            dcc += pendingCalls.Item2.drawInfo.drawCallsCount;
            flushIfNeeded(dcc);

            o = order();
            drawMeshes.meshes.add(ref pendingCalls.Item1);
            calls.add(sDrawCall.solidColorFill(o, ref tform, fill.Value.paletteIndex));

            o = order();
            drawMeshes.meshes.add(ref pendingCalls.Item2);
            calls.add(sDrawCall.solidColorStroke(o, ref tform, ref srp));
        }
コード例 #3
0
        protected void strokeGeometry(iPathGeometry path, SolidColorData color, SolidColorData?filledColor, float width, ref sStrokeStyle strokeStyle, int instance = 0)
        {
            getCurrentTransform(out Matrix3x2 tform, out float pixel);
            if (!path.testApproximateBounds(ref tform, width) || color.brushType == eBrushType.Null)
            {
                return;
            }

            int fillColorIndex     = filledColor?.paletteIndex ?? (int)eNamedColor.Transparent;
            StrokeRenderParams srp = StrokeRenderParams.strokedPath(color.paletteIndex, width, pixel, fillColorIndex);
            sPendingDrawCall   pdc = tesselatorThread.stroke(path, ref tform, pixel, new sStrokeInfo(strokeStyle, srp.meshWidth), instance);

            flushIfNeeded(pdc.drawInfo.drawCallsCount);

            Order o = order();

            drawMeshes.meshes.add(ref pdc);
            calls.add(sDrawCall.solidColorStroke(o, ref tform, ref srp));
        }