private void LayerShape(FastString Page, ShapeObject obj, FastString text) { int styleindex = UpdateCSSTable(obj); string style = GetStyleTag(styleindex); string old_text = String.Empty; float Width, Height; string pic = GetLayerPicture(obj, out Width, out Height); FastString addstyle = new FastString(64); if (obj.Shape == ShapeKind.Rectangle || obj.Shape == ShapeKind.RoundRectangle) { if (obj.FillColor.A != 0) { addstyle.Append("background:").Append(System.Drawing.ColorTranslator.ToHtml(obj.FillColor)).Append(";"); } addstyle.Append("border-style:solid;"); if (obj.Border.Width != 3) { addstyle.Append("border-width:").Append(ExportUtils.FloatToString(obj.Border.Width)).Append("px;"); } addstyle.Append("border-color:").Append(System.Drawing.ColorTranslator.ToHtml(obj.Border.Color)).Append(";"); if (obj.Shape == ShapeKind.RoundRectangle) { addstyle.Append("border-radius:15px;"); } } float x = obj.Width > 0 ? obj.AbsLeft : (obj.AbsLeft + obj.Width); float y = obj.Height > 0 ? hPos + obj.AbsTop : (hPos + obj.AbsTop + obj.Height); Layer(Page, obj, x, y, obj.Width, obj.Height, text, style, addstyle); addstyle.Clear(); }
public override void Execute() { int w = (int)(((ParameterGroup)paramGroups["Width"]).parameters[0].Value); int h = (int)(((ParameterGroup)paramGroups["Height"]).parameters[0].Value); //Debug.LogFormat("inputs.shapes.Count={0}", inputs.shapes.Count); if (inputs.shapes.Count <= 0) { return; } List <ShapeObject> outSos = new List <ShapeObject>(); for (int i = 0; i < inputs.shapes.Count; i++) { ShapeObject so = inputs.shapes[i].Clone(); so.parentRule = inputs.shapes[i].parentRule; outSos.Add(so); //Debug.LogFormat("mesable type={0}", so.meshable.GetType()); ShapeObjectM som = ShapeObjectM.CreateSchemeA((CompositMeshable)so.meshable); outSos.Add(som); } if (outputs.shapes != null) { foreach (ShapeObject o in outputs.shapes) { GameObject.Destroy(o.gameObject); } } outputs.shapes = outSos; }
//Add public void AddShape(ShapeObject checkShape) { if (!IsShapeOverlapTreeRect(checkShape)) { return; } if (chiledShapes.Count < maxAmount || TreeDepth >= maxDepth) { chiledShapes.Add(checkShape); Color color = (TreeDepth == 0) ? Color.blue : (TreeDepth == 1) ? Color.red : (TreeDepth == 2) ? Color.green : (TreeDepth == 3) ? Color.yellow : Color.black; if (ShapeQuadTree.DrawTreeDebug) { checkShape.SetColor(color); } } else { if (TreeDepth >= maxDepth) { return; } if (chiledTrees == null) { CreateChiledTree(); } for (int i = 0; i < chiledTrees.Length; i++) { chiledTrees[i].AddShape(checkShape); } } }
public void updateDesign() { if (initShape == null) { initShape = ShapeObject.CreateBasic(); } Polygon pg = new Polygon(boundaryPts); initShape.SetMeshable(pg); if (grammar == null) { grammar = new Grammar(); grammar.inputs.shapes.Add(initShape); grammar.AddRule(new Rules.PivotTurn("A", "A", 2)); grammar.AddRule(new Rules.DivideTo("A", new string[] { "A", "B" }, 30, 2), false); grammar.AddRule(new Rules.DivideTo("A", new string[] { "A", "A" }, 60, 0), false); grammar.AddRule(new Rules.Hide(new string[] { "B" }), false); grammar.AddRule(new Rules.Extrude("A", "A", 30), false); grammar.AddRule(new Rules.CreateBuilding("A", pm3, particleSystem), false); } grammar.Execute(); }
private void method_3() { int num = 0; if (this.field_0.OwnerParagraph != null) { bool flag = false; Paragraph ownerParagraph = this.field_0.OwnerParagraph; int num2 = this.method_7(ref ownerParagraph); if (num2 != -1) { for (ParagraphBase base2 = ownerParagraph.Items[num2]; !(base2 is FieldMark); base2 = ownerParagraph.Items[num2]) { base2 = ownerParagraph.Items[num2]; if ((base2 is TextRange) && !(base2 is Spire.Doc.Fields.Field)) { this.string_3 = this.string_3 + (base2 as TextRange).Text; } else if (base2 is ShapeObject) { this.shapeObject_0 = base2 as ShapeObject; } else if ((base2 is Break) && ((base2 as Break).BreakType == BreakType.LineBreak)) { this.string_3 = this.string_3 + BookmarkStart.b("ⴥ", num); } num2++; if (ownerParagraph.Items.Count <= num2) { if ((ownerParagraph.NextSibling == null) || !(ownerParagraph.NextSibling is Paragraph)) { break; } if (!flag) { flag = true; this.string_4 = this.string_3; } this.string_3 = this.string_3 + BookmarkStart.b("⬥∧", num); if (ownerParagraph.LastItem is Spire.Doc.Fields.Field) { num2 = 1; } else { num2 = 0; } for (ownerParagraph = ownerParagraph.NextSibling as Paragraph; ownerParagraph.ChildObjects.Count == 0; ownerParagraph = ownerParagraph.NextSibling as Paragraph) { if ((ownerParagraph.NextSibling == null) || !(ownerParagraph.NextSibling is Paragraph)) { break; } this.string_3 = this.string_3 + BookmarkStart.b("⬥∧", num); } } } } } }
internal bool method_34() { bool flag; if (this.DocumentObjectType == Spire.Doc.Documents.DocumentObjectType.Shape) { return(this.ChildObjects.Count > 0); } using (List <ShapeObject> .Enumerator enumerator = this.method_35(Spire.Doc.Documents.DocumentObjectType.Shape).GetEnumerator()) { while (enumerator.MoveNext()) { ShapeObject current = enumerator.Current; if (current.ChildObjects.Count > 0) { goto Label_004B; } } return(false); Label_004B: flag = true; } return(flag); }
internal ShapeObject method_4(PictureWatermark A_0) { int num = 4; if (A_0 == null) { return(null); } ShapeObject obj2 = A_0.WordPicture.Clone() as ShapeObject; if (A_0.IsWashout && (!obj2.ShapePr.method_6(0x108) || !obj2.ShapePr.method_6(0x109))) { obj2.SetShapeAttribute(0x108, 0x4ccd); obj2.SetShapeAttribute(0x109, 0x599a); } else if (!A_0.IsWashout) { obj2.ShapePr.Remove(0x108); obj2.ShapePr.Remove(0x109); } int num2 = this.method_9(); obj2.Id = num2; obj2.Name = BookmarkStart.b("紩䌫尭启戱崳唵䰷伹主嬽⍁ぃ⍅㩇❉ⵋ㱍㭏", num) + num2.ToString(); obj2.TextWrappingStyle = TextWrappingStyle.InFrontOfText; obj2.SetShapeAttribute(0x3ba, true); return(obj2); }
private void method_6(ShapeObject A_0) { this.class423_0.method_53(Class813.smethod_21(this.class423_0.method_60())); Class480 class2 = new Class480 { int_1 = 1, int_3 = -1, int_4 = A_0.Id }; int num = this.class423_0.method_51(class2); Class811 class3 = new Class811 { int_1 = num }; this.class423_0.method_52(class3); int num2 = Convert.ToInt32((int)((num + 1) << 0x10)); if (A_0.IsOle) { A_0.OleFormat.OleTxid = num2; } else { while (A_0 != null) { A_0.Txid = num2++; int textboxNextShapeId = A_0.TextboxNextShapeId; A_0 = (textboxNextShapeId != 0) ? ((ShapeObject)this.class423_0.method_62().hashtable_0[textboxNextShapeId]) : null; } } }
private Class551 method_2(ShapeObject A_0) { float num; float num2; Class1076 textBox = A_0.TextBox; switch (textBox.method_10()) { case LayoutFlow.TopToBottomIdeographic: case LayoutFlow.TopToBottom: num = (float)textBox.method_4(); num2 = (float)textBox.method_6(); break; case LayoutFlow.BottomToTop: num = (float)textBox.method_6(); num2 = (float)textBox.method_4(); break; default: num = (float)textBox.method_0(); num2 = (float)textBox.method_2(); break; } float num3 = (float)(5.0 + A_0.StrokeWeight); return(new Class551(num + num3, num2 + num3)); }
private void method_16(ShapeBase A_0) { Stream baseStream = this.class423_0.method_59().BaseStream; BinaryWriter writer = this.class423_0.method_59(); int position = (int)baseStream.Position; Class1107 class2 = new Class1107 { bool_0 = true, int_1 = position }; this.class423_0.method_38(Class816.string_13, A_0.CharacterFormat, class2); Class262 class3 = new Class262(A_0); class3.method_1(writer); if (A_0.CanHaveImage) { ShapeObject obj2 = (ShapeObject)A_0; if (obj2.ImageData.IsLink && !obj2.HasImageBytes) { Class813.smethod_2(obj2.ImageData.SourceFullName, 0x7fffffff, writer, false, false); } } Class931.smethod_1(A_0, writer); int num2 = (int)baseStream.Position; class3.int_2 = num2 - position; baseStream.Position = position; class3.method_1(writer); baseStream.Position = num2; }
public void UpdateOutputShapes() { //List<string> newNames = new List<string>(); //destroy extra shapes //Debug.Log(string.Format("{0} outputShapes:{1}, mesable:{2}", name, outputs.shapes.Count, outMeshables.Count)); removeExtraOutputs(); //update output shapes int shapeCount = outputs.shapes.Count; for (int i = 0; i < outMeshables.Count; i++) { Meshable mb = outMeshables[i]; if (i < shapeCount) { outputs.shapes[i].SetMeshable(mb); outputs.shapes[i].name = mb.name; outputs.shapes[i].parentRule = this; outputs.shapes[i].step = step; outputs.shapes[i].Invalidate(); }//end if else { ShapeObject so = ShapeObject.CreateMeshable(mb); so.name = mb.name; so.parentRule = this; so.step = step; outputs.shapes.Add(so); } }//end for i //Debug.Log(string.Format("{0} outputShapes:{1}, mesable:{2}", name, outputs.shapes.Count, outMeshables.Count)); }
private void button1_Click(object sender, EventArgs e) { //Create Word document. Document doc = new Document(); //Load Word document. doc.LoadFromFile(@"..\..\..\..\..\..\Data\InsertWordArt.docx"); //Add a paragraph. Paragraph paragraph = doc.Sections[0].AddParagraph(); //Add a shape. ShapeObject shape = paragraph.AppendShape(250, 70, ShapeType.TextWave4); //Set the position of the shape. shape.VerticalPosition = 20; shape.HorizontalPosition = 80; //set the text of WordArt. shape.WordArt.Text = "Thanks for reading."; //Set the fill color. shape.FillColor = System.Drawing.Color.Red; //Set the border color of the text. shape.StrokeColor = System.Drawing.Color.Yellow; //Save docx file. doc.SaveToFile("WordArt.docx", FileFormat.Docx2013); //Launch the Word file. FileViewer("WordArt.docx"); }
internal static bool smethod_21(DocumentObject A_0) { if (A_0.DocumentObjectType != DocumentObjectType.Paragraph) { return(false); } Paragraph paragraph = (Paragraph)A_0; for (DocumentObject obj2 = paragraph.FirstNonMarkupDescendant; obj2 != null; obj2 = obj2.NextNonMarkupElementLimited) { if (obj2.DocumentObjectType == DocumentObjectType.Shape) { ShapeObject obj3 = (ShapeObject)obj2; if ((obj3.TextWrappingStyle == TextWrappingStyle.Inline) && !obj3.Hidden) { return(false); } } else if (obj2.DocumentObjectType == DocumentObjectType.Paragraph) { return((obj2 as Paragraph).method_97()); } } return(true); }
public override void Execute() { //remove extra or add new int count = (int)((ParameterGroup)paramGroups["Count"]).parameters[0].Value; int diff = outputs.shapes.Count - inputs.shapes.Count; int absDiff = Mathf.Abs(diff); removeExtraOutputs(); //update each output for (int i = 0; i < inputs.shapes.Count; i++) { if (i >= outputs.shapes.Count) { outputs.shapes.Add(ShapeObject.CreateBasic()); } //Debug.Log("cloning shapeobject, has bbox=" + (inputs.shapes[i].meshable.bbox != null)); inputs.shapes[i].CloneTo(outputs.shapes[i]); //outputs.shapes[i].meshable.bbox = inputs.shapes[i].meshable.bbox; //Debug.Log("cloned, has bbox=" + (outputs.shapes[i].meshable.bbox != null)); outputs.shapes[i].PivotTurn(count); outputs.shapes[i].parentRule = this; } AssignNames(outputs.shapes); }//end execute
public override List <Meshable> ExecuteShape(ShapeObject so) { float d = ((ParameterGroup)paramGroups["Position"]).parameters[0].Value; int axis = (int)((ParameterGroup)paramGroups["Axis"]).parameters[0].Value; //get scale Vector3 scale = new Vector3(1, 1, 1); scale[axis] = d; Vector3[] vects = so.Vects; Vector3 origin = so.transform.position; //get the splited meshables Meshable mb = so.meshable; Meshable scaledMb = mb.Scale(scale, vects, origin, true); //TODO: just scale the bbox scaledMb.bbox = BoundingBox.CreateFromPoints(scaledMb.vertices, so.meshable.bbox); //outMeshables.Add(scaledMb); List <Meshable> outs = new List <Meshable>(); outs.Add(scaledMb); AssignNames(outs); //AssignNames(outMeshables.ToArray()); return(outs); //Rule.Execute() will take care of the outMeshables }
private string method_9(ShapeObject A_0, Class72 A_1, bool A_2) { int num = 7; switch (A_1.method_1()) { case HandlePositionType.LeftTop: if (A_2) { return(BookmarkStart.b("䄬䨮地䜲", num)); } return(BookmarkStart.b("夬䀮䄰", num)); case HandlePositionType.RightBottom: if (A_2) { return(BookmarkStart.b("弬䘮嘰嬲䄴", num)); } return(BookmarkStart.b("伬䀮䔰䜲娴娶", num)); case HandlePositionType.Center: return(Class1041.smethod_8(A_2 ? (A_0.CoordOriginX + (A_0.CoordSizeWidth / 2)) : (A_0.CoordOriginY + (A_0.CoordSizeHeight / 2)))); case HandlePositionType.Formula: return(Class1041.smethod_8(this.int_0[A_1.method_2()])); case HandlePositionType.Adjust: return(string.Format(BookmarkStart.b("ब吮İ串", num), Class1041.smethod_8(A_1.method_2()))); } return(Class1041.smethod_8(A_1.method_2())); }
public void SetMeshables(List <Meshable> mbs) { int diff = forms.Count - mbs.Count; for (int i = 0; i < diff; i++) { try { int index = forms.Count - 1; GameObject.Destroy(forms[index].gameObject); forms.RemoveAt(index); } catch { Debug.Log("Exception"); } } for (int i = 0; i < mbs.Count; i++) { if (i >= forms.Count) { forms.Add(ShapeObject.CreateMeshable(mbs[i])); } else { forms[i].SetMeshable(mbs[i]); } forms[i].name = "floor"; } }
private void method_1(ShapeObject A_0) { int num = 0x11; this.class400_0.method_40(BookmarkStart.b("匶䬸娺䨼Ծ㕀㩂㕄≆", 0x11), BookmarkStart.b("夶嘸唺ြ伾㍀⩂⡄⹆㵈≊㭌⩎", 0x11)); object obj2 = A_0.ShapePr.method_31(0xf1); if ((obj2 != null) && ((bool)obj2)) { this.class400_0.method_40(BookmarkStart.b("匶䬸娺䨼Ծ㕀♂㵄㍆摈㭊ⱌ㭎㥐", num), BookmarkStart.b("䌶䬸为堼", num)); } this.method_11(A_0); this.method_12(A_0); this.method_13(A_0); this.method_10(A_0); if ((A_0.FlipOrientation == FlipOrientation.Horizontal) || (A_0.FlipOrientation == FlipOrientation.Both)) { this.class400_0.method_40(BookmarkStart.b("匶䬸娺䨼Ծⱀ⩂㝄㕆♈㥊恌❎㹐⅒㱔ⵖ㙘㕚⥜㹞ൠ", num), BookmarkStart.b("䌶䬸为堼", num)); } if ((A_0.FlipOrientation == FlipOrientation.Vertical) || (A_0.FlipOrientation == FlipOrientation.Both)) { this.class400_0.method_40(BookmarkStart.b("匶䬸娺䨼Ծⱀ⩂㝄㕆♈㥊恌㥎㑐⅒⅔㹖㩘㩚ㅜ", num), BookmarkStart.b("䌶䬸为堼", num)); } this.method_4(A_0.ShapePr); object obj3 = A_0.ShapePr.method_31(0x158); if (obj3 != null) { this.class400_0.method_40(BookmarkStart.b("匶䬸娺䨼Ծ♀⽂い≆摈㭊≌♎㽐❒硔⍖⁘⭚㡜", num), Class922.smethod_3((ConnectionSiteType)obj3)); } this.method_2(A_0.GetShapeAttribute(0x151)); this.method_3(A_0.GetShapeAttribute(0x152)); }
void DragShape() { if (select != null) { select.Position = mouseOffset + mousePoint; select.SetColor(Color.white); select.RigidbodyType = RigidbodyType.Kinmatic; } else { ShapeObject[] shapes = ShapesCollision.OverlapPoint(mousePoint); if (shapes.Length <= 0) { return; } if (shapes[0].RigidbodyType == RigidbodyType.Static) { return; } select = shapes[0]; selectType = select.RigidbodyType; mouseOffset = select.Position - mousePoint; } }
void PushVecocityShape() { if (select == null) { if (Input.GetMouseButtonDown(0)) { ShapeObject[] shapes = ShapesCollision.OverlapPoint(mousePoint); if (shapes.Length <= 0) { return; } select = shapes[0]; } } else { mouseOffset = mousePoint - select.Position; text.text = mouseOffset.magnitude.ToString(); text.transform.position = mousePoint; Debug.DrawLine(select.Position, mousePoint); if (Input.GetMouseButtonUp(0)) { select.Velocity = (-mouseOffset); select = null; } } }
// Use this for initialization void Start() { Vector3[] pts = new Vector3[] { new Vector3(), new Vector3(100, 0, 0), new Vector3(100, 0, 100), new Vector3(0, 0, 100) }; Meshable ext = new Extrusion(pts, 100); ext.bbox = BoundingBox.CreateFromPoints(ext.vertices, new Vector3(1, 0, 0)); Meshable[] splits = ext.SplitByPlane(new Plane(Vector3.up, new Vector3(0, 20, 0))); ShapeObject A = ShapeObject.CreateMeshable(splits[0]); ShapeObject B = ShapeObject.CreateMeshable(splits[1]); A.name = "A"; B.name = "B"; Debug.Log("A=" + A.meshable.ToString() + " " + A.meshable.GetType().ToString() + A.meshable.bbox.position); Debug.Log("B=" + B.meshable.ToString() + " " + B.meshable.GetType().ToString() + B.meshable.bbox.position); splits = SGUtility.DivideFormToLength(B.meshable, 4, 1); foreach (Meshable m in splits) { ShapeObject.CreateMeshable(m); } }
public override List <Meshable> ExecuteShape(ShapeObject so) { float[] pos = new float[3]; float[] size = new float[3]; for (int i = 0; i < 3; i++) { pos[i] = ((ParameterGroup)paramGroups["Position"]).parameters[i].Value; size[i] = ((ParameterGroup)paramGroups["Size"]).parameters[i].Value; } Vector3 vpos = new Vector3(pos[0], pos[1], pos[2]); Vector3 vsize = new Vector3(size[0], size[1], size[2]); Vector3[] pts = new Vector3[4]; Vector3 vx = new Vector3(size[0], 0, 0); Vector3 vy = new Vector3(0, size[1], 0); Vector3 vz = new Vector3(0, 0, size[2]); pts[0] = vpos; pts[1] = vpos + vx; pts[2] = pts[1] + vz; pts[3] = pts[0] + vz; Polygon pg = new Polygon(pts); Form f = pg.ExtrudeToForm(vy); List <Meshable> outs = new List <Meshable>(); outs.Add(f); AssignNames(outs); return(outs); }
internal static spr᧢ smethod_13(ShapeObject A_0, SizeF A_1) { PointF tf; VMLFill fill = A_0.Fill; sprᲆ rᲆ = new sprᲆ(); sprᧂ rᧂ = new sprᧂ(); rᧂ.ᜀ(true); rᲆ.ᜁ(rᧂ); RectangleF ef = new RectangleF(0f, 0f, A_1.Width, A_1.Height); if (A_0.IsTextureRotated) { tf = spr.ᜁ(spr.ᜀ((float)fill.FocusLeft, (float)fill.FocusTop, ef), spr.ᜁ(ef), (float)A_0.Rotation); PointF[] tfArray = spr.ᜀ(ef, (float)A_0.Rotation); rᧂ.ᜃ(tfArray); } else { RectangleF ef2 = spr.ᜁ(ef, (float)A_0.Rotation); tf = spr.ᜀ((float)fill.FocusLeft, (float)fill.FocusTop, ef2); rᧂ.ᜁ(ef2); } return(smethod_6(rᲆ, fill, tf)); }
internal static spr᧢ smethod_14(ShapeObject A_0, SizeF A_1) { VMLFill fill = A_0.Fill; if (Class1022.smethod_0(A_1)) { return(null); } if (smethod_4(fill)) { return(smethod_1(sprⓚ.ᜀ(fill.ColorInternal), fill.Opacity)); } RectangleF ef = new RectangleF(0f, 0f, A_1.Width, A_1.Height); float num = -((float)fill.Angle) - 90f; float totalRotation = (float)A_0.TotalRotation; RectangleF empty = RectangleF.Empty; spr➂ r➂ = new spr➂(); if (A_0.IsTextureRotated) { r➂.ᜀ(totalRotation + num, spr.ᜁ(ef)); empty = spr.ᜁ(ef, -num); } else { r➂.ᜀ(num, spr.ᜁ(ef)); empty = spr.ᜁ(spr.ᜁ(ef, totalRotation), -num); } spr⡀ r⡀ = new spr⡀(empty); r⡀.ᜀ(r➂); smethod_7(fill, r⡀); return(r⡀); }
// Use this for initialization void Start() { Vector3[] pts = new Vector3[5]; pts[0] = new Vector3(-80, 0, 46); pts[1] = new Vector3(-80, 0, -11); pts[2] = new Vector3(-10, 0, -54); pts[3] = new Vector3(103, 0, 25); pts[4] = new Vector3(96, 0, 70); Polygon pg = new Polygon(pts); Form f = pg.ExtrudeToForm(new Vector3(0, 30, 0)); Vector3 nml = pts[4] - pts[0]; nml.Normalize(); Plane pln = new Plane(nml, new Vector3()); Meshable[] forms = f.SplitByPlane(pln); ShapeObject so0 = ShapeObject.CreateBasic(); so0.SetMeshable(forms[0]); so0.transform.position -= new Vector3(-20, 0, -20); ShapeObject so1 = ShapeObject.CreateBasic(); so1.SetMeshable(forms[1]); }
private static void smethod_9(Class857 A_0, Class101 A_1, ListLevel A_2) { int num = 5; Class396 class2 = A_0.method_11(); A_2.PatternType = ListPatternType.Bullet; A_2.BulletCharacter = BookmarkStart.b("鳚", 5); ShapeObject obj2 = new ShapeObject(A_0.method_9(), ShapeType.Image); obj2.SetShapeAttribute(0x1001, TextWrappingStyle.Inline); Class798.smethod_1(A_0, obj2, BookmarkStart.b("䜪䐬尮䔰Ḳ头制伸帺儼ሾ㉀㝂㱄⭆ⱈ晊≎ぐ㑒ご", 5)); A_2.PicBullet = obj2.ImageData; while (class2.method_9(BookmarkStart.b("䜪䐬尮䔰Ḳ头制伸帺儼ሾ㉀㝂㱄⭆ⱈ晊≎ぐ㑒ご", num))) { string str; if (((str = class2.method_1()) != null) && (str == BookmarkStart.b("䜪䐬尮䔰Ḳ头制伸帺儼ሾㅀㅂ⩄㝆ⱈ㥊㥌♎㑐⁒", num))) { Class693.smethod_0(A_0, A_2); } else { class2.vmethod_1(); } } }
internal void method_0(string A_0, ShapeObject A_1) { if (this.class422_0.method_23() != OpenDocumentWritingStage.MathML) { this.method_1(A_0, A_1.ImageData); } }
public virtual ShapeObject Clone(bool geometryOnly = true) { ShapeObject so = ShapeObject.CreateBasic(); CloneTo(so); return(so); }
internal ShapeObject method_4(Class273 A_0) { ShapeObject obj2 = new ShapeObject(this.class658_0.document_0); this.method_5(A_0, obj2); return(obj2); }
public override List <Meshable> ExecuteShape(ShapeObject so) { if (so.meshable.GetType() != typeof(Polygon)) { return(new List <Meshable>()); } float up = ((ParameterGroup)paramGroups["Up"]).parameters[0].Value; //get scale Vector3 extrudeVect = new Vector3(0, up, 0); if (randRange.HasValue) { float min = randRange.Value[0]; float max = randRange.Value[1]; extrudeVect[1] = extrudeVect[1] * (1 + Random.Range(min, max)); } //get the splited meshables Polygon pg = (Polygon)so.meshable; Extrusion exts = pg.Extrude(extrudeVect); List <Meshable> outs = new List <Meshable>(); outs.Add(exts); AssignNames(outs); //AssignNames(outMeshables.ToArray()); return(outs); //Rule.Execute() will take care of the outMeshables }
private static void DistressMethod2() { VectorDesign design = VectorDesign.Load(@"DistressDesign.PV", VectorDesignFileTypes.Pv); design.Render(@"DistressDesign-Method2-Original.PNG", RenderFormats.Png, 300, design.ColourContext); // Distress method #2 is similar to method #1, // however, in this case: // 1. Create a distress pattern. This must be a vector design. // It is simply white "random" objects on a transparent background. // 2. Combine the distress objects with a bounding rectangle to "invert" them from // a bunch of filled objects, to a bunch of holes in a rectangle. // 3. Use the new distress object as a clipping mask over the design. // Some scaling of the distress pattern may be necessary to make it look good. // 4. Rendering the merged design. // // Unlike method #1, this method will work when rendering onto a transparent background. var designBounds = design.GetBounds(); VectorDesign distress = VectorDesign.Load(@"DistressPattern.PV", VectorDesignFileTypes.Pv); var distressBounds = distress.GetBounds(); // Create a new rectangle shape into which we'll add the distress shapes as "holes". Path rectangle = new Path(); rectangle.Triples.Add(new PathTriple(distressBounds.TopLeft)); rectangle.Triples.Add(new PathTriple(distressBounds.TopRight)); rectangle.Triples.Add(new PathTriple(distressBounds.BottomRight)); rectangle.Triples.Add(new PathTriple(distressBounds.BottomLeft)); rectangle.IsClosed = true; var distressShape = new PathShape(); distressShape.AddPath(rectangle); // Take all the objects from the distress design // and copy them to our PathShape instead. var distressFirstPage = distress.Pages.First(); var distressFirstLayer = distressFirstPage.Layers.First(); foreach (var shapeObject in distress.ShapeObjects) { PathShape pathShape = shapeObject.Shape as PathShape; if (pathShape != null) { distressShape.AddPaths(pathShape.Paths); } } // At this point, distressShape should be a rectangle with a bunch of "holes" in it. // Move the distress so it's center is at the same location as the design's center var translate = Matrix3x2.Translate(designBounds.Center.X - distressBounds.Center.X, designBounds.Center.Y - distressBounds.Center.Y); distressShape.ApplyTransform(translate); // Depending on the distress, you may need to scale it. // Calculate an appropriate scaling factor based on your use case. //var scale = Matrix3x2.Scale(...); //distressShape.ApplyTransform(scale); // This will be our clipping mask ShapeObject distressObject = new ShapeObject(); distressObject.Shape = distressShape; //distressObject.Fill = new SolidFill(new RGBColour(0, 0, 0)); // Create a new design to act as our resulting "distressed" design VectorDesign result = new VectorDesign(); result.ColourContext = design.ColourContext; design.ResourceManager.CopyContentsTo(result.ResourceManager); var resultPage = result.NewPage(); var resultLayer = resultPage.NewLayer(); // Copy all items from the source design to our new group object GroupObject newGroup = new GroupObject(); design.ProcessObjects(obj => { newGroup.AddObject(obj); return obj; }); // Add the clipping mask to the group as our clipping mask newGroup.AddObject(distressObject); newGroup.IsClipped = true; resultLayer.AddObject(newGroup); // Render on a white background result.Render(@"DistressDesign-Method2-Final.PNG", RenderFormats.Png, 300, design.ColourContext); }
static void ClipObjectTo(GroupObject groupObject, Bounds boundingBox) { List<PathTriple> triples = new List<PathTriple>() { new PathTriple(boundingBox.TopLeft), new PathTriple(boundingBox.TopRight), new PathTriple(boundingBox.BottomRight), new PathTriple(boundingBox.BottomLeft) }; PathShape clipPathShape = new PathShape(); clipPathShape.AddPath(new Path(triples) { IsClosed = true }); // clipPathShape is now a rectangle with coordinates matching our bounding box. // We turn that into a ShapeObject ShapeObject clipShape = new ShapeObject(); clipShape.Shape = clipPathShape; // Add it to the group object and turn on clipping. groupObject.IsClipped = true; groupObject.AddObject(clipShape); }