コード例 #1
0
ファイル: DEngine.cs プロジェクト: djpnewton/ddraw
 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;
 }
コード例 #2
0
ファイル: EmfGraphics.cs プロジェクト: djpnewton/ddraw
 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);
 }
コード例 #3
0
ファイル: ToolStripExtras.cs プロジェクト: djpnewton/ddraw
 void MenuItem_OnClick(object sender, EventArgs e)
 {
     Value = ((StrokeStyleMenuItem)sender).Value;
     if (StrokeStyleChanged != null)
         StrokeStyleChanged(this, ((StrokeStyleMenuItem)sender).Value);
 }
コード例 #4
0
ファイル: ToolStripExtras.cs プロジェクト: djpnewton/ddraw
 public StrokeStyleMenuItem(DStrokeStyle strokeStyle, EventHandler onClick)
     : base()
 {
     DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
     Text = "XXXXXXX";
     Click += onClick;
     this.value = strokeStyle;
 }
コード例 #5
0
ファイル: DEngine.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #6
0
ファイル: DEngine.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #7
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #8
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 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();
     }
 }
コード例 #9
0
ファイル: DGraphics.cs プロジェクト: djpnewton/ddraw
 public abstract void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle, double strokeWidth, DStrokeCap strokeCap);
コード例 #10
0
ファイル: DGraphics.cs プロジェクト: djpnewton/ddraw
 public abstract void DrawLine(DPoint pt1, DPoint pt2, DColor color, DStrokeStyle strokeStyle);
コード例 #11
0
ファイル: DGraphics.cs プロジェクト: djpnewton/ddraw
 public abstract void DrawEllipse(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle);
コード例 #12
0
ファイル: EmfGraphics.cs プロジェクト: djpnewton/ddraw
 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);
 }
コード例 #13
0
ファイル: EmfGraphics.cs プロジェクト: djpnewton/ddraw
 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);
 }
コード例 #14
0
ファイル: EmfGraphics.cs プロジェクト: djpnewton/ddraw
 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);
 }
コード例 #15
0
ファイル: EmfGraphics.cs プロジェクト: djpnewton/ddraw
 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);
 }
コード例 #16
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, double alpha, DStrokeStyle strokeStyle)
 {
     DrawLine(pt1, pt2, color, alpha, strokeStyle, 1, DStrokeCap.Round);
 }
コード例 #17
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #18
0
ファイル: DGraphics.cs プロジェクト: djpnewton/ddraw
 public abstract void DrawPolyline(DPoints pts, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin, DStrokeCap strokeCap);
コード例 #19
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #20
0
ファイル: DGraphics.cs プロジェクト: djpnewton/ddraw
 public abstract void DrawRect(double x, double y, double width, double height, DColor color, double alpha, double strokeWidth, DStrokeStyle strokeStyle, DStrokeJoin strokeJoin);
コード例 #21
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 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;
     }
 }
コード例 #22
0
ファイル: DGraphics.cs プロジェクト: djpnewton/ddraw
 public abstract void DrawRect(DRect rect, DColor color, double alpha, DStrokeStyle strokeStyle);
コード例 #23
0
ファイル: DEngine.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #24
0
ファイル: FigureMetafile.cs プロジェクト: djpnewton/ddraw
 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;
     }
 }
コード例 #25
0
ファイル: FigureMetafile.cs プロジェクト: djpnewton/ddraw
 public WmfGdiPen(DColor stroke, double strokeWidth, DStrokeStyle strokeStyle, DStrokeCap strokeCap, DStrokeJoin strokeJoin)
 {
     Stroke = stroke;
     StrokeWidth = strokeWidth;
     StrokeStyle = strokeStyle;
     StrokeCap = strokeCap;
     StrokeJoin = strokeJoin;
 }
コード例 #26
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 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();
 }
コード例 #27
0
ファイル: ToolStripExtras.cs プロジェクト: djpnewton/ddraw
 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);
 }
コード例 #28
0
ファイル: CairoGraphics.cs プロジェクト: djpnewton/ddraw
 public override void DrawLine(DPoint pt1, DPoint pt2, DColor color, DStrokeStyle strokeStyle)
 {
     DrawLine(pt1, pt2, color, 1, strokeStyle);
 }
コード例 #29
0
ファイル: ToolStripState.cs プロジェクト: djpnewton/ddraw
 void btnStrokeStyle_StrokeStyleChanged(object sender, DStrokeStyle strokeStyle)
 {
     if (de != null && de.HsmState == DHsmState.Select)
         UpdateSelectedFigures(btnStrokeStyle);
     else
         dap.StrokeStyle = btnStrokeStyle.Value;
 }
コード例 #30
0
ファイル: EmfGraphics.cs プロジェクト: djpnewton/ddraw
 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);
 }