public GeometryPlotElement() { // init the lists listGeometry = new List<IBaseGeometry>(); // set the position and the size of the element this.Position = new Vector.FxVector2f( 0 ); this.Size = new Vector.FxVector2f( 10, 10 ); // set the origin position OriginPosition = new Vector.FxVector2f( 0 ); }
public Triangle(GMaps.IVertex<float> vec1, GMaps.IVertex<float> vec2, GMaps.IVertex<float> vec3) { // set the local positions m_P1 = vec1 as Vector.FxVector2f? ?? new Vector.FxVector2f(vec1.X, vec1.Y); m_P2 = vec2 as Vector.FxVector2f? ?? new Vector.FxVector2f(vec2.X, vec2.Y); m_P3 = vec3 as Vector.FxVector2f? ?? new Vector.FxVector2f(vec3.X, vec3.Y); mp_P1 = new Vector2(m_P1.x, m_P1.y); mp_P2 = new Vector2(m_P2.x, m_P2.y); mp_P3 = new Vector2(m_P3.x, m_P3.y); // set that the geometry is dirty isGeometryDirty = true; }
public Triangle( Vector.FxVector2f p1, Vector.FxVector2f p2 , Vector.FxVector2f p3) { // set the local positions m_P1 = p1; m_P2 = p2; m_P3 = p3; mp_P1 = new Vector2(m_P1.x, m_P1.y); mp_P2 = new Vector2(m_P2.x, m_P2.y); mp_P3 = new Vector2(m_P3.x, m_P3.y); // set that the geometry is dirty isGeometryDirty = true; }
public ImageElement(Matrix.FxMatrixF mat, ColorMap map) { InitToolStrips(); // set the position and the size of the element Position = new Vector.FxVector2f(0); Size = new Vector.FxVector2f(mat.Width, mat.Height); // set the size of the image Width = mat.Width; Height = mat.Height; // allocate the memory for the internal image internalImage = new byte[mat.Width * mat.Height * 4]; Pitch = mat.Width * 4; UpdateInternalImage(mat, map); }
public ImageElement(FxImages image) { InitToolStrips(); // set the position and the size of the element Position = new Vector.FxVector2f(0); Size = new Vector.FxVector2f(image.Image.Width, image.Image.Height); // set the size of the image Width = image.Image.Width; Height = image.Image.Height; // allocate the memory for the internal image internalImage = new byte[Width * Height * 4]; Pitch = Width * 4; image.LockImage(); image.Copy_to_Array(ref internalImage, ColorChannels.RGBA); image.UnLockImage(); }
public override void Load( CanvasRenderArguments args ) { if ( lineBrush != null && !lineBrush.IsDisposed ) lineBrush.Dispose(); if (DW_textFormat != null && !DW_textFormat.IsDisposed) DW_textFormat.Dispose(); // init the lines brushs lineBrush = new SolidColorBrush( args.renderTarget, _FontColor ); _TextFormat.fontCollection = args.WriteFactory.GetSystemFontCollection(false); // init the text format DW_textFormat = new SharpDX.DirectWrite.TextFormat( args.WriteFactory, _TextFormat.familyName, _TextFormat.fontCollection, _TextFormat.weight, _TextFormat.fontStyle, _TextFormat.fontStretch, _TextFormat.fontSize, "en-us" ); // get the size of the string SharpDX.DirectWrite.TextLayout textL= new SharpDX.DirectWrite.TextLayout( args.WriteFactory, Internal_String, DW_textFormat, 1500, 1500 ); Size = new Vector.FxVector2f(textL.GetFontSize(0) * Internal_String.Length, textL.GetFontSize(0)); textL.Dispose(); // init text rectangle textRectangle = new RectangleF( 0, 0, Size.x, Size.y ); }
private void InitPlotter(Vector.FxVectorF vec, PlotType plotType, Color color) { // init the lists listPlotsGeometry = new List<PlotGeometry>(); // set the position and the size of the element this.Position = new Vector.FxVector2f(0); this.Size = new Vector.FxVector2f(750, 500); // add the vector to the list PlotGeometry plot = new PlotGeometry(); plot.OrigVectorY = vec; plot.Color = color.ToColor4(); plot.Type = plotType; plot.StepType = XStepType.ZeroToMax; // add the plot to the list listPlotsGeometry.Add(plot); // set the origin position { float max = vec.Max(); float min = vec.Min(); float orig_y = Size.Y / 2; if(max >0 && min<0) { orig_y = Size.Y * (min / (max - min)); } if(max >0 && min >= 0) { orig_y = -min; } if(max <=0 && min <0) { orig_y = Size.Y + max; } OriginPosition = new Vector.FxVector2f(5, orig_y); } // allocate scale _scale = new Vector.FxVector2f(1.0f); // fit the plots to the view FitPlots(); // set the x_step base on the size of vec and the width X_Space = this.Size.x / vec.Size; // init format _TextFormat = new TextElementFormat(); _TextFormat.familyName = "Calibri"; _TextFormat.weight = SharpDX.DirectWrite.FontWeight.Black; _TextFormat.fontStyle = SharpDX.DirectWrite.FontStyle.Normal; _TextFormat.fontStretch = SharpDX.DirectWrite.FontStretch.Normal; _TextFormat.fontSize = 8.0f; // init toolstrip InitToolStrips(); }