本文整理汇总了C#中IVertexSource.vertex方法的典型用法代码示例。如果您正苦于以下问题:C# IVertexSource.vertex方法的具体用法?C# IVertexSource.vertex怎么用?C# IVertexSource.vertex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVertexSource
的用法示例。
在下文中一共展示了IVertexSource.vertex方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public static void Save(IVertexSource vertexSource, string pathAndFileName, bool oldStyle = true)
{
if (oldStyle)
{
using (StreamWriter outFile = new StreamWriter(pathAndFileName))
{
vertexSource.rewind(0);
double x;
double y;
ShapePath.FlagsAndCommand flagsAndCommand = vertexSource.vertex(out x, out y);
do
{
outFile.WriteLine("{0}, {1}, {2}", x, y, flagsAndCommand.ToString());
flagsAndCommand = vertexSource.vertex(out x, out y);
}
while (flagsAndCommand != ShapePath.FlagsAndCommand.CommandStop);
}
}
else
{
using (StreamWriter outFile = new StreamWriter(pathAndFileName))
{
foreach (VertexData vertexData in vertexSource.Vertices())
{
outFile.WriteLine("{0}, {1}, {2}", vertexData.position.x, vertexData.position.y, vertexData.command.ToString());
}
}
}
}
示例2: SendShapeToTesselator
public static void SendShapeToTesselator(VertexTesselatorAbstract tesselator, IVertexSource vertexSource)
{
#if !DEBUG
try
#endif
{
tesselator.BeginPolygon();
ShapePath.FlagsAndCommand PathAndFlags = 0;
double x, y;
bool haveBegunContour = false;
while (!ShapePath.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
{
if (ShapePath.is_close(PathAndFlags)
|| (haveBegunContour && ShapePath.is_move_to(PathAndFlags)))
{
tesselator.EndContour();
haveBegunContour = false;
}
if (!ShapePath.is_close(PathAndFlags))
{
if (!haveBegunContour)
{
tesselator.BeginContour();
haveBegunContour = true;
}
tesselator.AddVertex(x, y);
}
}
if (haveBegunContour)
{
tesselator.EndContour();
}
tesselator.EndPolygon();
}
#if !DEBUG
catch
{
}
#endif
}
示例3: SendShapeToTeselator
void SendShapeToTeselator(VertexCachedTesselator teselator, IVertexSource vertexSource)
{
teselator.BeginPolygon();
Path.FlagsAndCommand PathAndFlags = 0;
double x, y;
bool haveBegunContour = false;
while (!Path.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
{
if (Path.is_close(PathAndFlags)
|| (haveBegunContour && Path.is_move_to(PathAndFlags)))
{
teselator.EndContour();
haveBegunContour = false;
}
if (!Path.is_close(PathAndFlags))
{
if (!haveBegunContour)
{
teselator.BeginContour();
haveBegunContour = true;
}
teselator.AddVertex(x, y);
}
}
if (haveBegunContour)
{
teselator.EndContour();
}
#if use_timers
OpenGLEndPolygonTimer.Start();
#endif
teselator.EndPolygon();
#if use_timers
OpenGLEndPolygonTimer.Stop();
#endif
}
示例4: concat_path
public void concat_path(IVertexSource vs, int path_id)
{
double x, y;
ShapePath.FlagsAndCommand PathAndFlags;
vs.rewind(path_id);
while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
{
vertices.AddVertex(x, y, PathAndFlags);
}
}
示例5: OldEqualsNewStyle
static public bool OldEqualsNewStyle(IVertexSource control, IVertexSource test, double maxError = .0001)
{
control.rewind(0);
double controlX;
double controlY;
ShapePath.FlagsAndCommand controlFlagsAndCommand = control.vertex(out controlX, out controlY);
int index = 0;
foreach (VertexData vertexData in test.Vertices())
{
if (controlFlagsAndCommand != vertexData.command
|| controlX < vertexData.position.x - maxError || controlX > vertexData.position.x + maxError
|| controlY < vertexData.position.y - maxError || controlY > vertexData.position.y + maxError)
{
return false;
}
controlFlagsAndCommand = control.vertex(out controlX, out controlY);
index++;
}
if (controlFlagsAndCommand == ShapePath.FlagsAndCommand.CommandStop)
{
return true;
}
return false;
}
示例6: OldEqualsOldStyle
static public bool OldEqualsOldStyle(IVertexSource control, IVertexSource test, double maxError = .0001)
{
control.rewind(0);
double controlX;
double controlY;
ShapePath.FlagsAndCommand controlFlagsAndCommand = control.vertex(out controlX, out controlY);
test.rewind(0);
double testX;
double testY;
ShapePath.FlagsAndCommand otherFlagsAndCommand = test.vertex(out testX, out testY);
int index = 1;
if (controlFlagsAndCommand == otherFlagsAndCommand && controlX == testX && agg_basics.is_equal_eps(controlY, testY, .000000001))
{
while (controlFlagsAndCommand != ShapePath.FlagsAndCommand.CommandStop)
{
controlFlagsAndCommand = control.vertex(out controlX, out controlY);
otherFlagsAndCommand = test.vertex(out testX, out testY);
if (controlFlagsAndCommand != otherFlagsAndCommand
|| controlX < testX - maxError || controlX > testX + maxError
|| controlY < testY - maxError || controlY > testY + maxError)
{
return false;
}
index++;
}
return true;
}
return false;
}
示例7: Render
public override void Render(IVertexSource vertexSource, uint pathIndexToRender, RGBA_Bytes colorBytes)
{
#if use_timers
OpenGLRenderTimer.Start();
#endif
PushOrthoProjection();
vertexSource.rewind(pathIndexToRender);
RGBA_Doubles color = colorBytes.GetAsRGBA_Doubles();
Gl.glColor4d(color.m_r, color.m_g, color.m_b, color.m_a);
m_Tesselator.BeginPolygon();
uint PathAndFlags = 0;
double x, y;
bool haveBegunContour = false;
while (!Path.is_stop(PathAndFlags = vertexSource.vertex(out x, out y)))
{
if (Path.is_close(PathAndFlags)
|| (haveBegunContour && Path.is_move_to(PathAndFlags)))
{
m_Tesselator.EndContour();
haveBegunContour = false;
}
if(!Path.is_close(PathAndFlags))
{
if (!haveBegunContour)
{
m_Tesselator.BeginContour();
haveBegunContour = true;
}
m_Tesselator.AddVertex(x, y);
}
}
if (haveBegunContour)
{
m_Tesselator.EndContour();
}
#if use_timers
OpenGLEndPolygonTimer.Start();
#endif
m_Tesselator.EndPolygon();
#if use_timers
OpenGLEndPolygonTimer.Stop();
#endif
PopOrthoProjection();
#if use_timers
OpenGLRenderTimer.Stop();
#endif
}
示例8: add_path
public void add_path(IVertexSource vs, int path_id)
{
double x;
double y;
ShapePath.FlagsAndCommand cmd;
vs.rewind(path_id);
if(m_Rasterizer.sorted()) reset();
while(!ShapePath.is_stop(cmd = vs.vertex(out x, out y)))
{
add_vertex(x, y, cmd);
}
}
示例9: bounding_rect_single
//-----------------------------------------------------bounding_rect_single
//template<class VertexSource, class CoordT>
public static bool bounding_rect_single(IVertexSource vs, int path_id,
out double x1, out double y1, out double x2, out double y2)
{
double x = 0;
double y = 0;
bool first = true;
x1 = 1;
y1 = 1;
x2 = 0;
y2 = 0;
vs.rewind(path_id);
ShapePath.FlagsAndCommand PathAndFlags;
while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
{
if (ShapePath.is_vertex(PathAndFlags))
{
if (first)
{
x1 = x;
y1 = y;
x2 = x;
y2 = y;
first = false;
}
else
{
if (x < x1) x1 = x;
if (y < y1) y1 = y;
if (x > x2) x2 = x;
if (y > y2) y2 = y;
}
}
}
return x1 <= x2 && y1 <= y2;
}
示例10: add_path
public void add_path(IVertexSource vs, int pathID)
{
#if false
if (m_outline.sorted())
{
reset();
}
foreach (VertexData vertexData in vs.Vertices())
{
if(!ShapePath.is_stop(vertexData.command))
{
AddVertex(new VertexData(vertexData.command, new Vector2(vertexData.position.x, vertexData.position.y)));
}
}
#else
double x = 0;
double y = 0;
ShapePath.FlagsAndCommand PathAndFlags;
vs.rewind(pathID);
if (m_outline.sorted())
{
reset();
}
while (!ShapePath.is_stop(PathAndFlags = vs.vertex(out x, out y)))
{
AddVertex(new VertexData(PathAndFlags, new Vector2(x, y)));
}
#endif
}