本文整理汇总了C#中System.Drawing.PointF类的典型用法代码示例。如果您正苦于以下问题:C# PointF类的具体用法?C# PointF怎么用?C# PointF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointF类属于System.Drawing命名空间,在下文中一共展示了PointF类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StylusAsyncPlugin
internal StylusAsyncPlugin(IStylusReaderHooks subject, Control attached)
{
Graphics g = subject.CreateGraphics();
attachedControl = attached;
this.ratio = new PointF(g.DpiX / 2540.0f, g.DpiY / 2540.0f);
this.subject = subject;
}
开发者ID:nkaligin,项目名称:paint-mono,代码行数:7,代码来源:StylusAsyncPlugin.cs
示例2: GetNextPoint
public unsafe Point GetNextPoint(Rectangle rectTrack, byte* pIn, Size sizeIn, double[] Qu, double[] PuY0)
{
double[] w = new double[256];//方向权值
for (int i = 0; i < 256; i++)
{
w[i] = Math.Sqrt(Qu[i] / PuY0[i]);
}
PointF center = new PointF(
(float)rectTrack.Left + (float)rectTrack.Width / 2,
(float)rectTrack.Top + (float)rectTrack.Height / 2);
SizeF H = new SizeF((float)rectTrack.Width / 2, (float)rectTrack.Height / 2);
double numeratorX = 0, numeratorY = 0;//分子
double denominatorX = 0, denominatorY = 0;//分母
for (int y = rectTrack.Top; y < rectTrack.Bottom; y++)
{
for (int x = rectTrack.Left; x < rectTrack.Right; x++)
{
int index = DataManager.GetIndex(x, y, sizeIn.Width);
byte u = pIn[index];
//计算以高斯分布为核函数自变量X的值
double X = ((Math.Pow((x - center.X), 2) + Math.Pow((y - center.Y), 2))
/ (Math.Pow(H.Width, 2) + Math.Pow(H.Height, 2)));
//负的高斯分布核函数的值
double Gi = -Math.Exp(-Math.Pow(X, 2) / 2) / Math.Sqrt(2 * Math.PI);
numeratorX += x * w[u] * Gi;
numeratorY += y * w[u] * Gi;
denominatorX += w[u] * Gi;
denominatorY += w[u] * Gi;
}
}
return new Point((int)(numeratorX / denominatorX), (int)(numeratorY / denominatorY));
}
开发者ID:dalinhuang,项目名称:my-computer-vision,代码行数:34,代码来源:MeanShift.cs
示例3: TestCalibration
private static void TestCalibration(string pixelShape, bool uncalibrated, PointF pt1, PointF pt2, double calibrationValue, double expectedRowSpacing, double expectedColSpacing)
{
using (IPresentationImage image = ProtractorRoiTests.GetCalibrationTestImage(pixelShape, uncalibrated))
{
Trace.WriteLine(string.Format("TEST {0} image with {1} pixels", uncalibrated ? "uncalibrated" : "calibrated", pixelShape));
Trace.WriteLine(string.Format("calibrating [{0}, {1}] to {2} mm", pt1, pt2, calibrationValue));
PolylineGraphic lineGraphic;
IOverlayGraphicsProvider overlayGraphicsProvider = (IOverlayGraphicsProvider) image;
overlayGraphicsProvider.OverlayGraphics.Add(new VerticesControlGraphic(lineGraphic = new PolylineGraphic()));
lineGraphic.CoordinateSystem = CoordinateSystem.Source;
lineGraphic.Points.Add(pt1);
lineGraphic.Points.Add(pt2);
lineGraphic.ResetCoordinateSystem();
CalibrationTool.TestCalibration(calibrationValue, lineGraphic);
IImageSopProvider imageSopProvider = (IImageSopProvider) image;
Trace.WriteLine(string.Format("Pixel Spacing (Actual)/(Expected): ({0:F4}:{1:F4})/({2:F4}:{3:F4})",
imageSopProvider.Frame.NormalizedPixelSpacing.Row, imageSopProvider.Frame.NormalizedPixelSpacing.Column,
expectedRowSpacing, expectedColSpacing));
float percentErrorRow = Math.Abs((float)((imageSopProvider.Frame.NormalizedPixelSpacing.Row - expectedRowSpacing) / expectedRowSpacing * 100F));
float percentErrorCol = Math.Abs((float)((imageSopProvider.Frame.NormalizedPixelSpacing.Column - expectedColSpacing) / expectedColSpacing * 100F));
Trace.WriteLine(String.Format("Percent Error (Row/Column): {0:F3}%/{1:F3}%", percentErrorRow, percentErrorCol));
Assert.AreEqual(expectedColSpacing, imageSopProvider.Frame.NormalizedPixelSpacing.Column, 0.005, "Column Spacing appears to be wrong");
Assert.AreEqual(expectedRowSpacing, imageSopProvider.Frame.NormalizedPixelSpacing.Row, 0.005, "Row Spacing appears to be wrong");
Assert.IsTrue(percentErrorCol < 1.5, "Column Spacing appears to be wrong");
Assert.IsTrue(percentErrorRow < 1.5, "Row Spacing appears to be wrong");
}
}
开发者ID:nhannd,项目名称:Xian,代码行数:35,代码来源:CalibrationTest.cs
示例4: SvgCubicCurveSegment
public SvgCubicCurveSegment(PointF start, PointF firstControlPoint, PointF secondControlPoint, PointF end)
{
this.Start = start;
this.End = end;
this._firstControlPoint = firstControlPoint;
this._secondControlPoint = secondControlPoint;
}
开发者ID:DnevnikRu,项目名称:SVG,代码行数:7,代码来源:SvgCubicCurveSegment.cs
示例5: LoadPath
public void LoadPath(string filename)
{
using (StreamReader sr = new StreamReader(filename))
{
string line;
while ((line = sr.ReadLine()) != null)
{
if (line == "start" || line == "end")
continue;
string[] str = line.Split(' ');
if (str.Length < 5)
break;
PointF p = new PointF();
p.X = float.Parse(str[4]);
p.Y = float.Parse(str[3]);
m_pointsF.Add(p);
string [] time = str[1].Split(':');
float secs = float.Parse( time[1] ) * 60 + float.Parse( time[2] );
float vel = float.Parse( str[5] ) * 1.852f;
m_velTime.Add(new PointF(secs, vel));
}
}
}
开发者ID:Aswanthsb,项目名称:aguaviva-libs,代码行数:28,代码来源:Path.cs
示例6: drawRandomTree
void drawRandomTree()
{
t=Tree.Generate(gen_type,
depth: tree_depth,
max_breadth: tree_breadth, // 40,100
num_first_children : -1,
max_nodes : -1);
//t.root.Visible=false;
depthMap=DepthMap.Generate(t.MaxDepth, rand);
t.Root.Point.X = this.splitContainer1.Panel2.Width / 2;
t.Root.Point.Y = this.splitContainer1.Panel2.Height / 2;
radius = new PointF();
radius.Y = (float)branch_radius;
radius.X=radius.Y;
#if RADIAL
t.LayoutRadial2D(radius, edge_length, layout_type, chkGrow.Checked);
#else
t.LayoutTopDown2D(radius, edge_length, layout_type, chkGrow.Checked);
#endif
Render();
}
开发者ID:RealityDaemon,项目名称:RadialTreeGraph,代码行数:27,代码来源:GraphView.cs
示例7: updateModify
internal override void updateModify(PointF current, InteractionState ist)
{
base.updateModify(current, ist);
PointF pt1 = flowChart.InteractionStartPoint;
PointF pt2 = current;
PointF ptTLA = new PointF(rcSaved.Left, rcSaved.Top);
ptTLA.X += pt2.X - pt1.X;
ptTLA.Y += pt2.Y - pt1.Y;
ptTLA = flowChart.AlignPointToGrid(ptTLA);
base.modifyDX = ptTLA.X - ptLastTopLeft.X;
base.modifyDY = ptTLA.Y - ptLastTopLeft.Y;
ptLastTopLeft = ptTLA;
if (base.modifyHandle == 8)
{
// translate all points of arrows having both their ends selected
foreach (Arrow arrow in arrowsToMove)
arrow.translatePoints(base.modifyDX, base.modifyDY);
// modify selected objects
foreach (ChartObject obj in selectedItems)
if (!ignoreItem(obj, ist) && obj.canModify(base.modifyHandle) &&
!(obj is Arrow && arrowsToMove.Contains(obj)))
obj.modifyTranslate(base.modifyDX, base.modifyDY, true);
rect.Offset(base.modifyDX, base.modifyDY);
}
}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:29,代码来源:Selection.cs
示例8: ShipSprite
public ShipSprite(PointF initialPosition)
: base(NSBundle.MainBundle.PathForResource ("spaceship", "png"))
{
CGPath boundingPath = new CGPath ();
boundingPath.MoveToPoint (-12f, -38f);
boundingPath.AddLineToPoint (12f, -38f);
boundingPath.AddLineToPoint (9f, 18f);
boundingPath.AddLineToPoint (2f, 38f);
boundingPath.AddLineToPoint (-2f, 38f);
boundingPath.AddLineToPoint (-9f, 18f);
boundingPath.AddLineToPoint (-12f, -38f);
#if false
// Debug overlay
SKShapeNode shipOverlayShape = new SKShapeNode () {
Path = boundingPath,
StrokeColor = UIColor.Clear,
FillColor = UIColor.FromRGBA (0f, 1f, 0f, 0.5f)
};
ship.AddChild (shipOverlayShape);
#endif
var body = SKPhysicsBody.BodyWithPolygonFromPath (boundingPath);
body.CategoryBitMask = Category.Ship;
body.CollisionBitMask = Category.Ship | Category.Asteroid | Category.Planet | Category.Edge;
body.ContactTestBitMask = body.CollisionBitMask;
body.LinearDamping = 0;
body.AngularDamping = 0.5f;
PhysicsBody = body;
Position = initialPosition;
}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:30,代码来源:ShipSprite.cs
示例9: Draw
public new void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons) {
GraphicsPath gpSeekPosition = new GraphicsPath();
gpSeekPosition.AddLine(new PointF(6.0F, 2), new PointF(this.SeekerBounds.Width - this.SeekerPosition * (this.SeekerBounds.Width - 15) - 5, 2));
gpSeekPosition.Widen(this.m_pOneWidth);
this.DrawBwShape(g, gpSeekPosition, this.ButtonOpacity, 4.0F, Color.Black, ControlPaint.LightLight(Color.LightSeaGreen));
if (this.m_isMouseDown == true) {
if (pntMouseLocation.X < pntDrawOffset.X) {
this.SeekerPosition = 0.0F;
}
else if (pntMouseLocation.X > pntDrawOffset.X + this.SeekerBounds.Width - 15) {
this.SeekerPosition = 1.0F;
}
else {
this.SeekerPosition = (pntMouseLocation.X - pntDrawOffset.X - 6) / (this.SeekerBounds.Width - 15);
}
}
float xBeginningOffset = pntDrawOffset.X;
pntDrawOffset.X += this.SeekerPosition * (this.SeekerBounds.Width - 15);
this.HotSpot = new RectangleF(-pntDrawOffset.X + xBeginningOffset, -15, this.SeekerBounds.Width, 20);
base.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);
gpSeekPosition.Dispose();
}
开发者ID:EBassie,项目名称:Procon-1,代码行数:30,代码来源:MapTimelineSeekButton.cs
示例10: KeyPressed
private void KeyPressed(object sender, KeyPressEventArgs e)
{
var graphics = Graphics.FromImage(bitmap);
if (previousCharacterPoint == previousPoint)
characterCounter++;
else
{
characterCounter = 0;
line = 0;
}
if (e.KeyChar == (char)Keys.Delete || e.KeyChar == (char)Keys.Back)
characterCounter -= 2;
if (e.KeyChar == (char)Keys.Return || e.KeyChar == (char)Keys.Enter)
{
line++;
characterCounter = 0;
}
var p = new PointF(previousPoint.X + (10 * characterCounter), previousPoint.Y - 5 + (10 * line));
if ((p.X + 10) > totalScreen.Width)
{
characterCounter = 0;
line++;
}
graphics.DrawString(e.KeyChar.ToString(), new Font("Courier New", 12), new SolidBrush(Color.FromArgb(128, Color.Black)), p);
previousCharacterPoint = previousPoint;
}
开发者ID:andrewburgess,项目名称:MouseTracker,代码行数:33,代码来源:MainForm.cs
示例11: GetSlope
private double GetSlope (PointF p1, PointF p2)
{
if ((p2.Y - p1.Y) != 0)
return (p1.X - p2.X) / (p2.Y - p1.Y);
else
return double.PositiveInfinity;
}
开发者ID:jdstroy,项目名称:c-sharp,代码行数:7,代码来源:GraphHeaderView.cs
示例12: CalloutView
public CalloutView (string text, PointF pt, NSObject target, Selector sel) : base(_initframe)
{
SetAnchorPoint (pt);
Initialize ();
Text = text;
AddButtonTarget (target, sel);
}
开发者ID:21Off,项目名称:21Off,代码行数:7,代码来源:CalloutView.cs
示例13: FillPolygon_TriangleList
/// <summary>
/// Generates a list of triangles from an interior point (<paramref name="cx"/>;<paramref name="cy"/>)
/// to each point of the source <paramref name="points"/>. The path must be closed and describe a simple polygon,
/// where no connection between (cx; cy) and any path point crosses the border (this means, from (cx; cy),
/// each path point must be reached directly).
/// The generated triangles are in the same form as if we would have generated a triangle fan,
/// but this method returns them in the form of a triangle list.
/// </summary>
/// <param name="points">The source points which enclose the shape to triangulate.</param>
/// <param name="cx">X coordinate of an interior point of the <paramref name="points"/>.</param>
/// <param name="cy">Y coordinate of an interior point of the <paramref name="points"/>.</param>
/// <param name="zCoord">Z coordinate of the returned vertices.</param>
/// <param name="verts">Returns a list of vertices describing a triangle list.</param>
public static void FillPolygon_TriangleList(PointF[] points, float cx, float cy, float zCoord, out PositionColoredTextured[] verts)
{
verts = null;
PointF[] pathPoints = AdjustPoints(points);
int pointCount = pathPoints.Length;
if (pointCount <= 2) return;
if (pointCount == 3)
{
verts = new PositionColoredTextured[3];
verts[0].Position = new Vector3(pathPoints[0].X, pathPoints[0].Y, zCoord);
verts[1].Position = new Vector3(pathPoints[1].X, pathPoints[1].Y, zCoord);
verts[2].Position = new Vector3(pathPoints[2].X, pathPoints[2].Y, zCoord);
return;
}
bool closed = pathPoints[0] == pathPoints[pointCount - 1];
if (closed)
pointCount--;
int verticeCount = pointCount * 3;
verts = new PositionColoredTextured[verticeCount];
for (int i = 0; i < pointCount; i++)
{
int offset = i * 3;
verts[offset].Position = new Vector3(cx, cy, zCoord);
verts[offset + 1].Position = new Vector3(pathPoints[i].X, pathPoints[i].Y, zCoord);
if (i + 1 < pointCount)
verts[offset + 2].Position = new Vector3(pathPoints[i + 1].X, pathPoints[i + 1].Y, zCoord);
else
verts[offset + 2].Position = new Vector3(pathPoints[0].X, pathPoints[0].Y, zCoord);
}
}
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:44,代码来源:TriangulateHelper.cs
示例14: Rotate
public virtual void Rotate(float angle, PointF center)
{
Matrix tempMatrix = new Matrix();
tempMatrix.RotateAt(angle, center);
tempMatrix.Multiply(TransformationMatrix);
TransformationMatrix = tempMatrix;
}
开发者ID:ferry2,项目名称:2D-Vector-Graphics,代码行数:7,代码来源:MatrixHandler.cs
示例15: nCharacter
//for building characters from xml file
public nCharacter(string hexName, float anchorX, float anchorY, float width)
{
_Name = hexName;
_AnchorPoint = new PointF(anchorX, anchorY);
_Width = width;
//guessValues(false, true, true, false);
}
开发者ID:xtremas,项目名称:FontTool,代码行数:8,代码来源:nCharacter.cs
示例16: Transform
public static PointF Transform(float[, ] matrix, float X, float Y)
{
PointF result = new PointF();
result.X = (X * matrix[0, 0]) + (Y * matrix[0, 1]) + (matrix[0, 2]);
result.Y = (X * matrix[1, 0]) + (Y * matrix[1, 1]) + (matrix[1, 2]);
return result;
}
开发者ID:AymanShawky,项目名称:niko78csharp,代码行数:7,代码来源:Matrix3x3.cs
示例17: LabelSymbolizer
/// <summary>
/// Creates a new instance of TextSymbolizer
/// </summary>
public LabelSymbolizer()
{
Angle = 0;
UseAngle = false;
LabelAngleField = null;
UseLabelAngleField = false;
BorderVisible = false;
BorderColor = Color.Black;
BackColor = Color.AntiqueWhite;
BackColorEnabled = false;
DropShadowColor = Color.FromArgb(20, 0, 0, 0);
DropShadowEnabled = false;
DropShadowGeographicOffset = new Coordinate(0, 0);
DropShadowPixelOffset = new PointF(2F, 2F);
FontSize = 10F;
FontFamily = "Arial Unicode MS";
FontStyle = FontStyle.Regular;
FontColor = Color.Black;
HaloColor = Color.White;
HaloEnabled = false;
ScaleMode = ScaleMode.Symbolic;
LabelPlacementMethod = LabelPlacementMethod.Centroid;
PartsLabelingMethod = PartLabelingMethod.LabelLargestPart;
PreventCollisions = true;
PriorityField = "FID";
Orientation = ContentAlignment.MiddleCenter;
}
开发者ID:hanchao,项目名称:DotSpatial,代码行数:30,代码来源:LabelSymbolizer.cs
示例18: AbsoluteMouseEventArgs
public AbsoluteMouseEventArgs(MouseButtons button, PointF location, float zoom)
{
this.button = button;
this.x = location.X;
this.y = location.Y;
this.zoom = zoom;
}
开发者ID:gbaychev,项目名称:NClass,代码行数:7,代码来源:AbsoluteMouseEventArgs.cs
示例19: CreateRoundedRectangle
public static GraphicsPath CreateRoundedRectangle(SizeF size, PointF location)
{
int cornerSize = (int)GraphConstants.CornerSize * 2;
int connectorSize = (int)GraphConstants.ConnectorSize;
int halfConnectorSize = (int)Math.Ceiling(connectorSize / 2.0f);
var height = size.Height;
var width = size.Width;
var halfWidth = width / 2.0f;
var halfHeight = height / 2.0f;
var connectorOffset = (int)Math.Floor((GraphConstants.MinimumItemHeight - GraphConstants.ConnectorSize) / 2.0f);
var left = location.X;
var top = location.Y;
var right = location.X + width;
var bottom = location.Y + height;
var path = new GraphicsPath(FillMode.Winding);
path.AddArc(left, top, cornerSize, cornerSize, 180, 90);
path.AddArc(right - cornerSize, top, cornerSize, cornerSize, 270, 90);
path.AddArc(right - cornerSize, bottom - cornerSize, cornerSize, cornerSize, 0, 90);
path.AddArc(left, bottom - cornerSize, cornerSize, cornerSize, 90, 90);
path.CloseFigure();
return path;
}
开发者ID:fluffyfreak,项目名称:Graph,代码行数:25,代码来源:GraphRenderer.cs
示例20: GetConvexHull
/// <summary>
/// Vytvoří konvexní obal z daných vertexů
/// </summary>
/// <param name="Vertices">Vertexy</param>
/// <returns>Pole vertexů tvořící konvexní obal</returns>
public static PointF[] GetConvexHull(PointF[] Vertices)
{
int n = Vertices.Length, k = 0;
PointF[] Hull = new PointF[2 * n],Sorted = new PointF[Vertices.Length];
Vertices.CopyTo(Sorted, 0);
Array.Sort<PointF>(Sorted, new Comparison<PointF>(LexicalPointComparison));
for (int i = 0; i < n; i++)
{
while (k >= 2 && zc((PointF)Hull[k - 2],(PointF)Hull[k - 1], Sorted[i]) <= 0) k--;
Hull[k++] = Sorted[i];
}
for (int i = n - 2, t = k + 1; i >= 0; i--)
{
while (k >= t && zc((PointF)Hull[k - 2], (PointF)Hull[k - 1], Sorted[i]) <= 0) k--;
Hull[k++] = Sorted[i];
}
PointF[] Ret = new PointF[k-1];
for (int i = 0; i < k - 1; i++)
{
Ret[i].X = Hull[i].X;
Ret[i].Y = Hull[i].Y;
}
return Ret;
}
开发者ID:NumberFour8,项目名称:PhysBox,代码行数:33,代码来源:Geometry.cs
注:本文中的System.Drawing.PointF类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论