Esempio n. 1
0
 public DAuthorProperties()
 {
     fill = DColor.White;
     stroke = DColor.Black;
     strokeWidth = 1;
     strokeStyle = DStrokeStyle.Solid;
     startMarker = DMarker.None;
     endMarker = DMarker.None;
     alpha = 1;
     fontName = "Arial";
     fontSize = 14;
     bold = false;
     italics = false;
     underline = false;
     strikethrough = false;
 }
Esempio n. 2
0
 void CreatePen(uint objectIndex, double sw, DColor col, DStrokeStyle ss, DStrokeJoin sj, DStrokeCap sc)
 {
     WriteRecordHeader(Emf.RecordType.EMR_CREATEPEN, 28);
     WriteUInt(objectIndex);
     WriteUInt(StrokePenStyle(ss, sj, sc));
     WriteUInt((uint)sw);
     WriteUInt((uint)sw);
     WriteColor(col);
 }
Esempio n. 3
0
 void MenuItem_OnClick(object sender, EventArgs e)
 {
     Value = ((StrokeStyleMenuItem)sender).Value;
     if (StrokeStyleChanged != null)
         StrokeStyleChanged(this, ((StrokeStyleMenuItem)sender).Value);
 }
Esempio n. 4
0
 public StrokeStyleMenuItem(DStrokeStyle strokeStyle, EventHandler onClick)
     : base()
 {
     DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
     Text = "XXXXXXX";
     Click += onClick;
     this.value = strokeStyle;
 }
Esempio n. 5
0
 public void SetProperties(Type figureClass, DAuthorProperties dap)
 {
     if (typeof(IFillable).IsAssignableFrom(figureClass))
         this.fill = dap.Fill;
     if (typeof(IStrokeable).IsAssignableFrom(figureClass))
     {
         this.stroke = dap.Stroke;
         this.strokeWidth = dap.StrokeWidth;
         this.strokeStyle = dap.StrokeStyle;
     }
     if (typeof(IMarkable).IsAssignableFrom(figureClass))
     {
         this.startMarker = dap.StartMarker;
         this.endMarker = dap.EndMarker;
     }
     if (typeof(IAlphaBlendable).IsAssignableFrom(figureClass))
         this.alpha = dap.Alpha;
     if (typeof(ITextable).IsAssignableFrom(figureClass))
     {
         this.fontName = dap.FontName;
         this.fontSize = dap.FontSize;
         this.bold = dap.Bold;
         this.italics = dap.Italics;
         this.underline = dap.Underline;
         this.strikethrough = dap.Strikethrough;
     }
     DoPropertyChanged();
 }
Esempio n. 6
0
 public void SetProperties(DColor fill, DColor stroke, double strokeWidth, DStrokeStyle strokeStyle, 
     DMarker startMarker, DMarker endMarker, double alpha, string fontName, double fontSize, bool bold,
     bool italics, bool underline, bool strikethrough)
 {
     this.fill = fill;
     this.stroke = stroke;
     this.strokeWidth = strokeWidth;
     this.strokeStyle = strokeStyle;
     this.startMarker = startMarker;
     this.endMarker = endMarker;
     this.alpha = alpha;
     this.fontName = fontName;
     this.fontSize = fontSize;
     this.bold = bold;
     this.italics = italics;
     this.underline = underline;
     this.strikethrough = strikethrough;
     DoPropertyChanged();
 }
Esempio n. 7
0
 public override void DrawRect(DRect rect, DColor color, double alpha, DStrokeStyle strokeStyle)
 {
     cr.SetSource(MakeColor(color, alpha));
     cr.LineWidth = 1;
     CairoStrokeStyle(cr, strokeStyle, 1);
     cr.Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
     cr.Stroke();
 }
Esempio n. 8
0
 public override void DrawPolyline(DPoints pts, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin, DStrokeCap strokeCap)
 {
     if (pts.Count > 1)
     {
         cr.SetSource(MakeColor(color, alpha));
         CairoStrokeStyle(cr, strokeStyle, strokeWidth);
         cr.LineWidth = strokeWidth;
         cr.LineJoin = MakeLineJoin(strokeJoin);
         cr.LineCap = MakeLineCap(strokeCap);
         cr.MoveTo(pts[0].X, pts[0].Y);
         for (int i = 1; i < pts.Count; i++)
             cr.LineTo(pts[i].X, pts[i].Y);
         cr.Stroke();
     }
 }
Esempio n. 9
0
 public abstract void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle, double strokeWidth, DStrokeCap strokeCap);
Esempio n. 10
0
 public abstract void DrawLine(DPoint pt1, DPoint pt2, DColor color, DStrokeStyle strokeStyle);
Esempio n. 11
0
 public abstract void DrawEllipse(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle);
Esempio n. 12
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle, double strokeWidth, DStrokeCap strokeCap)
 {
     CreatePenIndirect(strokeWidth, color, strokeStyle, DStrokeJoin.Round, strokeCap);
     SelectObject(0);
     CreateBrushIndirect();
     SelectObject(1);
     MoveTo(pt1);
     LineTo(pt2);
     DeleteObject(1);
     DeleteObject(0);
 }
Esempio n. 13
0
 public override void DrawEllipse(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle)
 {
     CreatePenIndirect(strokeWidth, color, strokeStyle, DStrokeJoin.Round, DStrokeCap.Round);
     SelectObject(0);
     CreateBrushIndirect();
     SelectObject(1);
     RectShape(Wmf.Ellipse, (ushort)x, (ushort)y, (ushort)width, (ushort)height);
     DeleteObject(1);
     DeleteObject(0);
 }
Esempio n. 14
0
 uint StrokePenStyle(DStrokeStyle ss, DStrokeJoin sj, DStrokeCap sc)
 {
     Emf.PenStyle _ss = 0;
     switch (ss)
     {
         case DStrokeStyle.Dash:
             _ss = Emf.PenStyle.PS_DASH;
             break;
         case DStrokeStyle.DashDot:
             _ss = Emf.PenStyle.PS_DASHDOT;
             break;
         case DStrokeStyle.DashDotDot:
             _ss = Emf.PenStyle.PS_DASHDOTDOT;
             break;
         case DStrokeStyle.Dot:
             _ss = Emf.PenStyle.PS_DOT;
             break;
         case DStrokeStyle.Solid:
             _ss = Emf.PenStyle.PS_SOLID;
             break;
     }
     Emf.PenStyle _sj = 0;
     switch (sj)
     {
         case DStrokeJoin.Bevel:
             _sj = Emf.PenStyle.PS_JOIN_BEVEL;
             break;
         case DStrokeJoin.Mitre:
             _sj = Emf.PenStyle.PS_JOIN_MITER;
             break;
         case DStrokeJoin.Round:
             _sj = Emf.PenStyle.PS_JOIN_ROUND;
             break;
     }
     Emf.PenStyle _sc = 0;
     switch (sc)
     {
         case DStrokeCap.Butt:
             _sc = Emf.PenStyle.PS_ENDCAP_FLAT;
             break;
         case DStrokeCap.Round:
             _sc = Emf.PenStyle.PS_ENDCAP_ROUND;
             break;
         case DStrokeCap.Square:
             _sc = Emf.PenStyle.PS_ENDCAP_SQUARE;
             break;
     }
     return (uint)(_ss | _sj | _sc);
 }
Esempio n. 15
0
 void ExtCreatePen(uint objectIndex, double sw, DColor col, DStrokeStyle ss, DStrokeJoin sj, DStrokeCap sc)
 {
     WriteRecordHeader(Emf.RecordType.EMR_EXTCREATEPEN, 52);
     WriteUInt(objectIndex);
     WriteUInt(0);
     WriteUInt(0);
     WriteUInt(0);
     WriteUInt(0);
     // LogPenEx
     WriteUInt(StrokePenStyle(ss, sj, sc));
     WriteUInt((uint)sw);
     WriteUInt(Wmf.BS_SOLID);
     WriteColor(col);
     WriteUInt(0);
     WriteUInt(0);
 }
Esempio n. 16
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle)
 {
     DrawLine(pt1, pt2, color, alpha, strokeStyle, 1, DStrokeCap.Round);
 }
Esempio n. 17
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle, double strokeWidth, DStrokeCap strokeCap)
 {
     cr.SetSource(MakeColor(color, alpha));
     cr.LineWidth = strokeWidth;
     CairoStrokeStyle(cr, strokeStyle, strokeWidth);
     cr.LineCap = MakeLineCap(strokeCap);
     cr.MoveTo(pt1.X, pt1.Y);
     cr.LineTo(pt2.X, pt2.Y);
     cr.Stroke();
 }
Esempio n. 18
0
 public abstract void DrawPolyline(DPoints pts, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin, DStrokeCap strokeCap);
Esempio n. 19
0
 public override void DrawRect(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin)
 {
     cr.SetSource(MakeColor(color, alpha));
     cr.LineWidth = strokeWidth;
     CairoStrokeStyle(cr, strokeStyle, strokeWidth);
     cr.LineJoin = MakeLineJoin(strokeJoin);
     cr.Rectangle(x, y, width, height);
     cr.Stroke();
 }
Esempio n. 20
0
 public abstract void DrawRect(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin);
Esempio n. 21
0
 void CairoStrokeStyle(Context cr, DStrokeStyle strokeStyle, double strokeWidth)
 {
     double dot = strokeWidth;
     double space = 2 * strokeWidth;
     double dash = 3 * strokeWidth;
     switch (strokeStyle)
     {
         case DStrokeStyle.Solid:
             cr.SetDash(new double[] { }, 0);
             break;
         case DStrokeStyle.Dash:
             cr.SetDash(new double[] { dash, space }, 0);
             break;
         case DStrokeStyle.Dot:
             cr.SetDash(new double[] { dot, space }, 0);
             break;
         case DStrokeStyle.DashDot:
             cr.SetDash(new double[] { dash, space, dot, space }, 0);
             break;
         case DStrokeStyle.DashDotDot:
             cr.SetDash(new double[] { dash, space, dot, space, dot, space }, 0);
             break;
     }
 }
Esempio n. 22
0
 public abstract void DrawRect(DRect rect, DColor color, double alpha, DStrokeStyle strokeStyle);
Esempio n. 23
0
 public void SetProperties(DAuthorProperties dap)
 {
     this.fill = dap.Fill;
     this.stroke = dap.Stroke;
     this.strokeWidth = dap.StrokeWidth;
     this.strokeStyle = dap.StrokeStyle;
     this.startMarker = dap.StartMarker;
     this.endMarker = dap.EndMarker;
     this.alpha = dap.Alpha;
     this.fontName = dap.FontName;
     this.fontSize = dap.FontSize;
     this.bold = dap.Bold;
     this.italics = dap.Italics;
     this.underline = dap.Underline;
     this.strikethrough = dap.Strikethrough;
     DoPropertyChanged();
 }
Esempio n. 24
0
 void WmfSelectGdiObject(int idx)
 {
     // this should not be happening but sometimes does?
     if (idx == WmfGdiObjects.Count)
         idx--;
     // select object and apply properties to our graphics primatives
     object o = WmfGdiObjects[idx];
     if (o is WmfGdiBrush)
         fill = ((WmfGdiBrush)o).Fill;
     else if (o is WmfGdiPen)
     {
         stroke = ((WmfGdiPen)o).Stroke;
         strokeWidth = ((WmfGdiPen)o).StrokeWidth;
         strokeStyle = ((WmfGdiPen)o).StrokeStyle;
         strokeCap = ((WmfGdiPen)o).StrokeCap;
         strokeJoin = ((WmfGdiPen)o).StrokeJoin;
     }
 }
Esempio n. 25
0
 public WmfGdiPen(DColor stroke, double strokeWidth, DStrokeStyle strokeStyle, DStrokeCap strokeCap, DStrokeJoin strokeJoin)
 {
     Stroke = stroke;
     StrokeWidth = strokeWidth;
     StrokeStyle = strokeStyle;
     StrokeCap = strokeCap;
     StrokeJoin = strokeJoin;
 }
Esempio n. 26
0
 public override void DrawEllipse(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle)
 {
     cr.SetSource(MakeColor(color, alpha));
     cr.LineWidth = strokeWidth;
     CairoStrokeStyle(cr, strokeStyle, strokeWidth);
     CairoEllipse(cr, x, y, width, height);
     cr.Stroke();
 }
Esempio n. 27
0
 public static void DrawStrokeStyleIcon(Graphics g, Rectangle r, Color color, DStrokeStyle strokeStyle)
 {
     Pen p = new Pen(color, 2);
     switch (strokeStyle)
     {
         case DStrokeStyle.Solid:
             p.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
             break;
         case DStrokeStyle.Dash:
             p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
             break;
         case DStrokeStyle.Dot:
             p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
             break;
         case DStrokeStyle.DashDot:
             p.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
             break;
         case DStrokeStyle.DashDotDot:
             p.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
             break;
     }
     PointF pt1 = new PointF(r.X, r.Height / 2 + 1);
     PointF pt2 = new PointF(r.Right, r.Height / 2 + 1);
     g.DrawLine(p, pt1, pt2);
 }
Esempio n. 28
0
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, DStrokeStyle strokeStyle)
 {
     DrawLine(pt1, pt2, color, 1, strokeStyle);
 }
Esempio n. 29
0
 void btnStrokeStyle_StrokeStyleChanged(object sender, DStrokeStyle strokeStyle)
 {
     if (de != null && de.HsmState == DHsmState.Select)
         UpdateSelectedFigures(btnStrokeStyle);
     else
         dap.StrokeStyle = btnStrokeStyle.Value;
 }
Esempio n. 30
0
 public override void DrawRect(DRect rect, DColor color, double alpha, DStrokeStyle strokeStyle)
 {
     DrawRect(rect.X, rect.Y, rect.Width, rect.Height, color, alpha, 1, strokeStyle, DStrokeJoin.Round);
 }