Пример #1
0
        private static void AddDataMatrixBarcode(VectorImage vectorImage, DataMatrixBarcode dataMatrixBarcode, DistanceUnit currentUnit)
        {
            DataMatrixBarcodeShape barcode = new DataMatrixBarcodeShape();

            barcode.Text = dataMatrixBarcode.Text;

            barcode.DataMatrixFormat = dataMatrixBarcode.DataMatrixFormat;
            barcode.DataMatrixSize   = dataMatrixBarcode.DataMatrixSize;

            barcode.Height      = dataMatrixBarcode.Height;
            barcode.InvertImage = dataMatrixBarcode.InvertImage;
            barcode.QuietZone   = dataMatrixBarcode.QuietZone;
            barcode.Height      = dataMatrixBarcode.Height;
            barcode.AutoExpand  = dataMatrixBarcode.AutoExpand;

            barcode.FlipHorizontally = dataMatrixBarcode.FlipHorizontally;
            barcode.FlipVertically   = dataMatrixBarcode.FlipVertically;
            barcode.MarkingOrder     = dataMatrixBarcode.MarkingOrder;

            barcode.Angle = dataMatrixBarcode.Angle;

            barcode.HatchPattern = dataMatrixBarcode.HatchPattern;
            barcode.Location     = dataMatrixBarcode.Location.Clone();
            vectorImage.AddBarcodeShape(barcode);
        }
        public void RemoveUser(VectorImage vi)
        {
            bool disposed = this.disposed;

            if (disposed)
            {
                DisposeHelper.NotifyDisposedUsed(this);
            }
            else
            {
                bool flag = vi == null;
                if (!flag)
                {
                    VectorImageRenderInfo vectorImageRenderInfo;
                    bool flag2 = this.m_Registered.TryGetValue(vi, out vectorImageRenderInfo);
                    if (flag2)
                    {
                        vectorImageRenderInfo.useCount--;
                        bool flag3 = vectorImageRenderInfo.useCount == 0;
                        if (flag3)
                        {
                            this.Unregister(vi, vectorImageRenderInfo);
                        }
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 显示一个错误弹窗
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public ButtonResult ShowError(string message)
        {
            VectorImage image = SystemIcon.Instance().Error;
            string      title = DictionaryResource.GetString("Error");

            return(ShowMessage(image, title, message));
        }
Пример #4
0
        private void toolStripButton1_Click(object sender, System.EventArgs e)
        {
            VectorImage img = layeredVectorImage.AddLayer();

            layeredVectorImage.Set(img);
            toolStripLayerComboBox.Items.Add(new ComboboxLayer(img));
        }
Пример #5
0
        private static void AddQRCodeBarcode(VectorImage vectorImage, QRCodeBarcode qrCodeBarcode, DistanceUnit currentUnit)
        {
            QRCodeBarcodeShape barcode = new QRCodeBarcodeShape();

            barcode.Text = qrCodeBarcode.Text;

            barcode.ErrorCorrectionLevel = qrCodeBarcode.ErrorCorrectionLevel;
            barcode.CodeSize             = qrCodeBarcode.CodeSize;
            barcode.EncodingMode         = qrCodeBarcode.EncodingMode;
            barcode.MaskPattern          = qrCodeBarcode.MaskPattern;

            barcode.Height      = qrCodeBarcode.Height;
            barcode.InvertImage = qrCodeBarcode.InvertImage;
            barcode.QuietZone   = qrCodeBarcode.QuietZone;
            barcode.Height      = qrCodeBarcode.Height;
            barcode.AutoExpand  = qrCodeBarcode.AutoExpand;

            barcode.FlipHorizontally = qrCodeBarcode.FlipHorizontally;
            barcode.FlipVertically   = qrCodeBarcode.FlipVertically;
            barcode.MarkingOrder     = qrCodeBarcode.MarkingOrder;

            barcode.Angle = qrCodeBarcode.Angle;

            barcode.HatchPattern = qrCodeBarcode.HatchPattern;
            barcode.Location     = qrCodeBarcode.Location.Clone();
            vectorImage.AddBarcodeShape(barcode);
        }
Пример #6
0
        public NavigationIcon()
        {
            ArrowBack = new VectorImage
            {
                Height = 24,
                Width  = 24,
                Data   = @"M16.62 2.99c-.49-.49-1.28-.49-1.77 0L6.54 11.3c-.39.39-.39 1.02 0 1.41l8.31 8.31c.49.49 1.28.49 1.77
                         0s.49-1.28 0-1.77L9.38 12l7.25-7.25c.48-.48.48-1.28-.01-1.76z",
                Fill   = "#FF000000"
            };

            Logout = new VectorImage
            {
                Height = 18.75, //100,
                Width  = 24,    //128,
                Data   = @"M21.5,11.3l-2.8-2.7c-0.2-0.2-0.2-0.4-0.2-0.7c0.1-0.3,0.2-0.4,0.5-0.5c0.3-0.1,0.5,0,0.7,0.2l4,3.9
                         c0.1,0.1,0.2,0.3,0.2,0.5c0,0.2-0.1,0.4-0.2,0.5l-4,3.9c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3-0.1-0.4-0.2-0.5-0.5c-0.1-0.3,0-0.5,0.2-0.7
                         l2.8-2.7h-8.7c-0.2,0-0.4-0.1-0.5-0.2c-0.1-0.1-0.2-0.3-0.2-0.5c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2
                         C12.8,11.3,21.5,11.3,21.5,11.3z M16,18.2c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2c0.2,0,0.4,0.1,0.5,0.2
                         c0.1,0.1,0.2,0.3,0.2,0.5v0.4c0,0.8-0.3,1.5-0.9,2c-0.6,0.5-1.2,0.8-2,0.8H2.9c-0.8,0-1.5-0.3-2-0.8S0,19.3,0,18.5V5.4
                         c0-0.8,0.3-1.5,0.8-2s1.2-0.8,2-0.8h11.7c0.8,0,1.5,0.3,2,0.8c0.5,0.5,0.8,1.2,0.8,2v0.4c0,0.3-0.1,0.5-0.4,0.6
                         c-0.2,0.1-0.5,0.1-0.7,0C16.1,6.3,16,6.1,16,5.8V5.4c0-0.4-0.1-0.7-0.4-1c-0.3-0.3-0.6-0.4-1-0.4H2.9c-0.4,0-0.7,0.1-1,0.4
                         C1.6,4.7,1.4,5,1.4,5.4v13.1c0,0.4,0.2,0.7,0.4,1c0.3,0.3,0.6,0.4,1,0.4h11.7c0.4,0,0.7-0.1,1-0.4c0.3-0.3,0.4-0.6,0.4-1L16,18.2
                         L16,18.2z",
                Fill   = "#FF000000"
            };
        }
        public GradientRemap AddUser(VectorImage vi)
        {
            bool          disposed = this.disposed;
            GradientRemap result;

            if (disposed)
            {
                DisposeHelper.NotifyDisposedUsed(this);
                result = null;
            }
            else
            {
                bool flag = vi == null;
                if (flag)
                {
                    result = null;
                }
                else
                {
                    VectorImageRenderInfo vectorImageRenderInfo;
                    bool flag2 = this.m_Registered.TryGetValue(vi, out vectorImageRenderInfo);
                    if (flag2)
                    {
                        vectorImageRenderInfo.useCount++;
                    }
                    else
                    {
                        vectorImageRenderInfo = this.Register(vi);
                    }
                    result = vectorImageRenderInfo.firstGradientRemap;
                }
            }
            return(result);
        }
Пример #8
0
 public VectorImage(VectorImage other) : this(PapillonPINVOKE.new_VectorImage__SWIG_1(VectorImage.getCPtr(other)), true)
 {
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #9
0
        internal static void MakeVectorGraphics(MeshGenerationContextUtils.RectangleParams rectParams, int settingIndexOffset, MeshBuilder.AllocMeshData meshAlloc, out int finalVertexCount, out int finalIndexCount)
        {
            VectorImage vectorImage = rectParams.vectorImage;

            Debug.Assert(vectorImage != null);
            finalVertexCount = 0;
            finalIndexCount  = 0;
            int num = vectorImage.vertices.Length;

            Vertex[] array = new Vertex[num];
            for (int i = 0; i < num; i++)
            {
                VectorImageVertex vectorImageVertex = vectorImage.vertices[i];
                array[i] = new Vertex
                {
                    position = vectorImageVertex.position,
                    tint     = vectorImageVertex.tint,
                    uv       = vectorImageVertex.uv,
                    opacityPageSVGSettingIndex = new Color32(0, 0, (byte)(vectorImageVertex.settingIndex >> 8), (byte)vectorImageVertex.settingIndex)
                };
            }
            bool flag = (float)rectParams.leftSlice <= Mathf.Epsilon && (float)rectParams.topSlice <= Mathf.Epsilon && (float)rectParams.rightSlice <= Mathf.Epsilon && (float)rectParams.bottomSlice <= Mathf.Epsilon;

            if (flag)
            {
                MeshBuilder.MakeVectorGraphicsStretchBackground(array, vectorImage.indices, vectorImage.size.x, vectorImage.size.y, rectParams.rect, rectParams.uv, rectParams.scaleMode, rectParams.color, settingIndexOffset, meshAlloc, out finalVertexCount, out finalIndexCount);
            }
            else
            {
                Vector4 sliceLTRB = new Vector4((float)rectParams.leftSlice, (float)rectParams.topSlice, (float)rectParams.rightSlice, (float)rectParams.bottomSlice);
                MeshBuilder.MakeVectorGraphics9SliceBackground(array, vectorImage.indices, vectorImage.size.x, vectorImage.size.y, rectParams.rect, sliceLTRB, true, rectParams.color, settingIndexOffset, meshAlloc);
            }
        }
Пример #10
0
 public VectorImageEnumerator(VectorImage collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
Пример #11
0
 private void CreateLinesFromPointCloud(VectorImage image, VectorCloud2D cloud)
 {
     for (int i = 0; i < cloud.Count - 1; i++)
     {
         image.Add(new Line2D(cloud[i], cloud[i + 1]));
     }
 }
Пример #12
0
        public GradientRemap AddUser(VectorImage vi, VisualElement context)
        {
            if (disposed)
            {
                DisposeHelper.NotifyDisposedUsed(this);
                return(null);
            }

            if (vi == null)
            {
                return(null);
            }

            VectorImageRenderInfo renderInfo;

            if (m_Registered.TryGetValue(vi, out renderInfo))
            {
                ++renderInfo.useCount;
            }
            else
            {
                renderInfo = Register(vi, context);
            }

            return(renderInfo.firstGradientRemap);
        }
Пример #13
0
        private void toolStripLayerComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            VectorImage vi = ((ComboboxLayer)toolStripLayerComboBox.Items[toolStripLayerComboBox.SelectedIndex]).image;

            layeredVectorImage.Set(vi);
            selection.Clear();
            UpdateGUI();
        }
Пример #14
0
 public void SetRange(int index, VectorImage values)
 {
     PapillonPINVOKE.VectorImage_SetRange(swigCPtr, index, VectorImage.getCPtr(values));
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
    private void UpdateFavoriteIcon()
    {
        VectorImage vectorImage = IsFavorite(SelectedSong)
            ? favoriteImageAsset
            : noFavoriteImageAsset;

        favoriteIcon.style.backgroundImage = new StyleBackground(vectorImage);
    }
Пример #16
0
        public void DrawVectorImage(MeshGenerationContextUtils.RectangleParams rectParams)
        {
            VectorImage vectorImage = rectParams.vectorImage;

            Debug.Assert(vectorImage != null);
            VertexFlags vertexFlags        = (vectorImage.atlas != null) ? VertexFlags.IsSVGGradients : VertexFlags.IsSolid;
            int         settingIndexOffset = 0;
            bool        flag = vectorImage.atlas != null && this.m_VectorImageManager != null;

            if (flag)
            {
                GradientRemap gradientRemap = this.m_VectorImageManager.AddUser(vectorImage);
                vertexFlags        = (gradientRemap.isAtlassed ? VertexFlags.IsSVGGradients : VertexFlags.IsCustomSVGGradients);
                settingIndexOffset = gradientRemap.destIndex;
            }
            int count = this.m_Entries.Count;

            MeshGenerationContext.MeshFlags flags = MeshGenerationContext.MeshFlags.None;
            bool flag2 = vertexFlags == VertexFlags.IsSVGGradients;

            if (flag2)
            {
                flags = MeshGenerationContext.MeshFlags.IsSVGGradients;
            }
            else
            {
                bool flag3 = vertexFlags == VertexFlags.IsCustomSVGGradients;
                if (flag3)
                {
                    flags = MeshGenerationContext.MeshFlags.IsCustomSVGGradients;
                }
            }
            MeshBuilder.AllocMeshData meshAlloc = new MeshBuilder.AllocMeshData
            {
                alloc   = this.m_AllocThroughDrawMeshDelegate,
                texture = ((vertexFlags == VertexFlags.IsCustomSVGGradients) ? vectorImage.atlas : null),
                flags   = flags
            };
            int num;
            int num2;

            MeshBuilder.MakeVectorGraphics(rectParams, settingIndexOffset, meshAlloc, out num, out num2);
            Debug.Assert(count <= this.m_Entries.Count + 1);
            bool flag4 = count != this.m_Entries.Count;

            if (flag4)
            {
                this.m_SVGBackgroundEntryIndex = this.m_Entries.Count - 1;
                bool flag5 = num != 0 && num2 != 0;
                if (flag5)
                {
                    UIRStylePainter.Entry entry = this.m_Entries[this.m_SVGBackgroundEntryIndex];
                    entry.vertices = entry.vertices.Slice(0, num);
                    entry.indices  = entry.indices.Slice(0, num2);
                    this.m_Entries[this.m_SVGBackgroundEntryIndex] = entry;
                }
            }
        }
Пример #17
0
 private static void MakeShapesFromSectors(VectorImage image, Dictionary <int, List <Line2D> > sectors)
 {
     foreach (KeyValuePair <int, List <Line2D> > lines in sectors)
     {
         Shape2D shape = Shape2DFunctions.CreateShapesFromLines(lines.Value);
         PrimitiveRenderData.Get(shape).Text = "Sector: " + lines.Key;
         image.Add(shape);
     }
 }
Пример #18
0
        internal void RemoveFromImage(VectorImage img)
        {
            for (int i = 0; i < primitives.Count; i++)
            {
                PrimitiveRenderData.Get(primitives[i]).isSelected = false;
                img.primitives.Remove(primitives[i]);
            }

            primitives.Clear();
        }
Пример #19
0
    public VectorImage GetRange(int index, int count)
    {
        global::System.IntPtr cPtr = PapillonPINVOKE.VectorImage_GetRange(swigCPtr, index, count);
        VectorImage           ret  = (cPtr == global::System.IntPtr.Zero) ? null : new VectorImage(cPtr, true);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #20
0
    public static VectorImage Repeat(PImage value, int count)
    {
        global::System.IntPtr cPtr = PapillonPINVOKE.VectorImage_Repeat(PImage.getCPtr(value), count);
        VectorImage           ret  = (cPtr == global::System.IntPtr.Zero) ? null : new VectorImage(cPtr, true);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #21
0
 private void toolStripButton2_Click(object sender, System.EventArgs e)
 {
     if (toolStripLayerComboBox.SelectedIndex != -1)
     {
         VectorImage vi = ((ComboboxLayer)toolStripLayerComboBox.Items[toolStripLayerComboBox.SelectedIndex]).image;
         layeredVectorImage.RemoveLayer(vi);
         toolStripLayerComboBox.Items.RemoveAt(toolStripLayerComboBox.SelectedIndex);
         selection.Clear();
     }
     UpdateGUI();
 }
Пример #22
0
 public void LoadIntoImage(VectorImage image, bool invertY)
 {
     using (WkbStreamReader wkbReader = new WkbStreamReader(new MemoryStream(data)))
     {
         wkbReader.InvertY = invertY;
         while (wkbReader.BaseStream.Position < data.Length)
         {
             wkbReader.SetByteOrder(wkbReader.ReadByte());
             ReadGeometry(wkbReader, image);
         }
     }
 }
Пример #23
0
        protected virtual void DrawImage(VectorImage image, Context ctx, Rectangle bounds, double ratio)
        {
            ctx.Save();
            ctx.Translate(bounds.Location);
            var size = image.Size;

            var data   = image.Data;
            var engine = ((IFrontend)image).ToolkitEngine;

            engine.VectorImageRecorderContextHandler.Draw(ctx.Handler, Toolkit.GetBackend(ctx), data);
            ctx.Restore();
        }
Пример #24
0
        public BaseDialogViewModel()
        {
            #region 属性初始化

            Title     = new AppInfo().Name;
            CloseIcon = new VectorImage
            {
                Height = SystemIcon.Instance().Close.Height,
                Width  = SystemIcon.Instance().Close.Width,
                Data   = SystemIcon.Instance().Close.Data,
                Fill   = SystemIcon.Instance().Close.Fill
            };

            #endregion
        }
Пример #25
0
        private void RebuildList(VectorImage img)
        {
            overlayPoints.Clear();
            List <Vector2D> vertices = img.GetPrimitives <Vector2D>();

            foreach (Vector2D v in vertices)
            {
                if (PrimitiveRenderData.Get(v).Text != "")
                {
                    double dist = GetClosestDistance(v, vertices);
                    overlayPoints.Add(new OverlayVector2D(v, dist));
                }
            }
            overlayPoints.Sort((a, b) => b.distance.CompareTo(a.distance));
        }
Пример #26
0
 private void SetBallonData(TextMeshProUGUI txtField, VectorImage imgBallon, int value)
 {
     if (value <= 0)
     {
         imgBallon.color    = Color.gray;
         txtField.faceColor = Color.white;
         txtField.SetText("0");
     }
     else
     {
         imgBallon.color    = Color.white;
         txtField.faceColor = Color.red;
         txtField.SetText(value.ToString());
     }
 }
Пример #27
0
        public bool TryGetValue(CustomStyleProperty <VectorImage> property, out VectorImage value)
        {
            CustomPropertyHandle propertyHandle;
            var tmp = new StyleBackground();

            if (m_CustomProperties != null && m_CustomProperties.TryGetValue(property.name, out propertyHandle))
            {
                s_StyleSheetApplicator.ApplyImage(propertyHandle.data, propertyHandle.handles, propertyHandle.specificity, ref tmp);
                value = tmp.value.vectorImage;
                return(true);
            }

            value = null;
            return(false);
        }
Пример #28
0
    private void InitalizeVariables()
    {
        canvas = GetComponentInChildren <Canvas>();

        txtSampleNotificationCount = sampleNotificationBallon.GetComponentInChildren <TextMeshProUGUI>();
        imgSampleBallon            = sampleNotificationBallon.GetComponent <VectorImage>();

        txtPanoramicNotificationCount = panoramicNotificationBallon.GetComponentInChildren <TextMeshProUGUI>();
        imgPanoramicBallon            = panoramicNotificationBallon.GetComponent <VectorImage>();

        txtFileNotificationCount = fileNotificationBallon.GetComponentInChildren <TextMeshProUGUI>();
        imgFileBallon            = fileNotificationBallon.GetComponent <VectorImage>();

        sampleCount    = 0;
        panoramicCount = 0;
        fileCount      = 0;
    }
Пример #29
0
        private static void AddHatch(VectorImage vectorImage, Hatch hatch, DistanceUnit currentUnit)
        {
            HatchShape hatchShape = new HatchShape();

            List <HatchPattern> hatchPatternList = new List <HatchPattern>();

            foreach (HatchPattern hatchPattern in hatch.HatchPatternList)
            {
                hatchShape.AddHatchPattern(hatchPattern);
            }

            foreach (ShapeBase boundryShape in hatch.BoundaryShapeList)
            {
                AddToHatchBoundaries(boundryShape, hatchShape);
            }
            vectorImage.AddHatchShape(hatchShape, 0);
        }
Пример #30
0
        public static void PointInTriangleTest(VectorImage image)
        {
            Triangle2D t = new Triangle2D(new Vector2D(25, 150), new Vector2D(200, 200), new Vector2D(60, 80));

            image.Add(t);
            VectorCloud2D pc = PointCloudCreator.Create(new Rectangle2D(new Vector2D(10, 10), new Vector2D(300, 300)), 500);

            pc.Add(t.a);
            pc.Add(t.b);
            pc.Add(t.c);

            foreach (Vector2D p in pc)
            {
                p.SetData(new PrimitiveRenderData(t.IsInside(p) ? Color.DarkGreen : Color.DarkRed));
            }

            image.Add(pc);
        }