public void DrawAt(IGraphPort graphPort, int x, int y, Rectangle updateRect) { int centerX = updateRect.Width/2; int centerY = updateRect.Height/2; int Radius = (updateRect.Height / 2) - 5; int N = 36; double theta = 3.14159 * 2 / N; GDIPen aPen = new GDIPen(PenType.Cosmetic, PenStyle.Solid, PenJoinStyle.Round, PenEndCap.Round, RGBColor.Red, 1, Guid.NewGuid()); for (int p = 0; p < N; p++) { byte num = (byte)(((double)p / (double)N) * 254.0); byte r = (byte)rnd.Next(0, num); byte g = (byte)rnd.Next(0, num); byte b = (byte)rnd.Next(0, num); uint color = RGBColor.RGB(r, g, b); //graphPort.PenColor = color; for (int q = 0; q < p; q++) { graphPort.DrawLine(aPen, new Point((int)(centerX + Radius * Math.Sin(p * theta)), (int)(centerY + Radius * Math.Cos(p * theta))), new Point((int)(centerX + Radius * Math.Sin(q * theta)), (int)(centerY + Radius * Math.Cos(q * theta)))); } } }
public PLCView(string name, string heading, int x, int y, int width, int height) : base(name, x, y, width, height) { //this.GraphicsUnit = GraphicsUnit.Inch; fTeamLogo = new TextBox("Team Logo","Tahoma",14,GDIFont.FontStyle.Regular,0,0,160,60,RGBColor.Black); fLegend = null; fCS = new PLCColorScheme(); //fTransitionAnimator = new CrossFade(); fDataBinder = null; fBackingPixelBuffer = new GDIDIBSection(width, height); fBackingGraphics = fBackingPixelBuffer.GraphPort; //fBackingGraphics.PageUnit = GraphicsUnit.Inch; fHeading = heading; // These are the set of virtual calls // That any subclasser will implement AddMasterHeading(); AddPhaseArrows(); AddPhaseHeadings(); AddStageHeadings(); AddDeliveryContainers(); AddImages(); AddLegend(); AddTeamLogo(); //DrawSelf(fBackingGraphics); }
void DisplayColon(IGraphPort graphPort) { graphPort.Polygon(fcolonPolies[0].Points); graphPort.Polygon(fcolonPolies[1].Points); graphPort.OffsetWindowOrigin(-12, 0); }
public GearBox(string name, int x, int y, int width, int height) : base(name, x, y, width, height) { fBacking = new GDIDIBSection(Convert.ToInt32(width * 96), Convert.ToInt32(height * 96)); fGraphPort = fBacking.GraphPort; //fGraphPort.PageUnit = GraphicsUnit.Inch; AddImages(); }
void DrawHour(IGraphPort graphPort) { if (f24Hour) DisplayTwoDigits(graphPort, fThisTime.Hour, fSuppress); else DisplayTwoDigits(graphPort, ((fThisTime.Hour %= 12) > 0) ? (int)fThisTime.Hour : 12, fSuppress); DisplayColon(graphPort); }
void DisplayTwoDigits(IGraphPort graphPort, int iNumber, bool suppress) { if (!suppress || (iNumber / 10 != 0)) SegmentedNumber.DisplayDigit(graphPort, iNumber / 10); graphPort.OffsetWindowOrigin(-42, 0); SegmentedNumber.DisplayDigit(graphPort, iNumber % 10); graphPort.OffsetWindowOrigin(-42, 0); }
public override void OnSetDestinationPixelBuffer() { if (null == DestinationPixelBuffer) return; bitmapBuffer = (GDIDIBSection)this.DestinationPixelBuffer.Clone(); bitmapGraphics = bitmapBuffer.GraphPort; bitmapBuffer.DeviceContext.ClearToWhite(); }
public static void DisplayDigit(IGraphPort graphPort, int iNumber) { int iSeg; for (iSeg = 0; iSeg < 7; iSeg++) if (fSevenSegment[iNumber, iSeg] > 0) { graphPort.Polygon(ptSegment[iSeg]); } }
public void Animate(IGraphPort graphPort) { //graphPort.PageUnit = GraphicsUnit.Inch; //graphPort.TranslateTransform(Left, Top); //RectangleF f1 = fProductWheel.Frame; //RectangleF f2 = fFeatureWheel.Frame; //float centerX = f1.Left + f1.Width / 2; //float centerY = f1.Top + f1.Height / 2; //PointF productCenter = new PointF(centerX, centerY); //PointF[] points = new PointF[] { // new PointF( f1.Left, f1.Top ), // new PointF( f1.Right, f1.Top ), // new PointF( f1.Left, f1.Bottom )}; //float featureCenterX = f2.Left + f2.Width / 2; //float featureCenterY = f2.Top + f2.Height / 2; //PointF featureCenter = new PointF(featureCenterX, featureCenterY); //PointF[] featurePoints = new PointF[] { // new PointF( f2.Left, f2.Top ), // new PointF( f2.Right, f2.Top ), // new PointF( f2.Left, f2.Bottom )}; //Matrix PX = new Matrix(); //Matrix FX = new Matrix(); //for (int angle = 0; angle <= 180; angle += 18) //{ // PX.RotateAt((float)10 / 2, productCenter); // PX.TransformPoints(points); // fGraphPort.Clear(Color.White); // fGraphPort.DrawImage(fProductWheel.Image, points); // // Do the counter clockwise rotation on the feature wheel // FX.RotateAt(-(float)10, featureCenter); // FX.TransformPoints(featurePoints); // fGraphPort.DrawImage(fFeatureWheel.Image, featurePoints); // graphPort.DrawImage(fBacking, new RectangleF(0, 0, Width, Height)); // Thread.Sleep(100); //} //// Draw one final time so we get the transparency back //DrawInto(graphPort); //graphPort.Dispose(); }
public virtual void DrawBackground(IGraphPort graphPort) { // Clear the backing buffer //GraphPort.DrawingColor = RGBColor.LtGray; graphPort.UseDefaultBrush(); graphPort.UseDefaultPen(); graphPort.SetDefaultBrushColor(RGBColor.LtGray); graphPort.SetDefaultPenColor(RGBColor.LtGray); graphPort.Rectangle(0, 0, fBounds.Width, fBounds.Height); }
public GraphicsChannel(RtpSession aSession, string participantName, IGraphPort localRenderer) { fSession = aSession; fParticipantName = participantName; fRenderer = localRenderer; fChunkDecoder = new GraphPortChunkDecoder(); fChunkDecoder.AddGraphPort(fRenderer); HookRtpEvents(); JoinSession(); }
public ImageTransition(string name, Rectangle frame, GDIDIBSection dstPixelBuffer, GDIDIBSection srcPixelBuffer, double duration) { fTimer = new NewTOAPIA.Kernel.PrecisionTimer(); fDestinationPixelBuffer = dstPixelBuffer; fSourcePixelBuffer = srcPixelBuffer; fDuration = duration; fGraphPort = null; // Do this last because others properties may need to be // setup first. Frame = frame; DestinationPixelBuffer = fDestinationPixelBuffer; SourcePixelBuffer = fSourcePixelBuffer; }
public GraphicsChannel(IGraphPort localRenderer, PayloadChannel channel) { fCollaborationChannel = channel; fRenderer = localRenderer; fChunkDecoder = new GraphPortChunkDecoder(); fChunkDecoder.AddGraphPort(fRenderer); // Create the sending graph port fChunkEncoder = new GraphPortChunkEncoder(); fChunkEncoder.ChunkPackedEvent += new GraphPortChunkEncoder.ChunkPacked(GDIChunkPacked); AddGraphPort(fChunkEncoder); // send the frame to the receiver fCollaborationChannel.FrameReceivedEvent += new RtpStream.FrameReceivedEventHandler(GDICommandReceived); }
public virtual void DrawRaisedRect(IGraphPort aPort, int x, int y, int w, int h) { aPort.FillRectangle(fBaseColorBrush, new RectangleI(x, y, w, h)); DrawFrame(aPort, x, y, w, h, FrameStyle.Raised); }
public virtual void DrawFrame(IGraphPort aPort, int x, int y, int w, int h, FrameStyle style) { int n; switch (style) { case FrameStyle.Sunken: for (n=0; n<BorderWidth; n++) { aPort.DrawLine(fHighlightPen, new Point2I(x+n, y+h-n), new Point2I(x+w-n, y+h-n)); // bottom shadow aPort.DrawLine(fHighlightPen, new Point2I(x + w - n, y + n), new Point2I(x + w - n, y + h)); // right shadow } for (n=0; n<BorderWidth; n++) { aPort.DrawLine(fShadowPen, new Point2I(x+n, y+n), new Point2I(x+w-n, y+n)); // top edge aPort.DrawLine(fShadowPen, new Point2I(x+n, y+n), new Point2I(x+n, y+h-n)); // left edge } break; case FrameStyle.Raised: for (n=0; n<BorderWidth; n++) { aPort.DrawLine(fShadowPen, new Point2I(x+n, y+h-n), new Point2I(x+w-n, y+h-n)); // bottom shadow aPort.DrawLine(fShadowPen, new Point2I(x+w-n, y+n), new Point2I(x+w-n, y+h)); // right shadow } if (BorderWidth > 0) { n = BorderWidth - 1; /* aPort.DrawingColor = fBottomShadowTopLiner; aPort.DrawLine(x+n, y+h-n, x+w-n, y+h-n); // bottom shadow aPort.DrawLine(x+w-n, y+n, x+w-n, y+h); // right shadow */ aPort.DrawLine(fBottomShadowBottomLinerPen, new Point2I(x, y + h), new Point2I(x + w, y + h)); // bottom shadow aPort.DrawLine(fBottomShadowBottomLinerPen, new Point2I(x + w, y), new Point2I(x + w, y + h)); // right shadow } for (n=0; n<BorderWidth; n++) { aPort.DrawLine(fHighlightPen, new Point2I(x+n,y+n), new Point2I(x+w-n, y+n)); // top edge aPort.DrawLine(fHighlightPen, new Point2I(x+n, y+n), new Point2I(x+n, y+h-n)); // left edge } break; } }
void FlyAGraphic(IGraphPort graphPort, GDIDIBSection srcPixelBuffer, Rectangle startFrame, GDIDIBSection dstPixelBuffer, Rectangle endFrame, int steps) { double xIncrement = (float)(endFrame.X - startFrame.X) / steps; double yIncrement = (float)(endFrame.Y - startFrame.Y) / steps; Rectangle lastFrame = startFrame; int startX = startFrame.X; int startY = startFrame.Y; int x; int y; for (int i = 0; i < steps; i++) { // Draw a section of the destination pixel buffer to // cover where the graphic was sitting before it draws // itself in the new location. if (i > 0) { graphPort.AlphaBlend(lastFrame.X, lastFrame.Y, srcPixelBuffer.Width, srcPixelBuffer.Height, dstPixelBuffer, lastFrame.X, lastFrame.Y, srcPixelBuffer.Width, srcPixelBuffer.Height, 255); } x = (int)Math.Floor((double)startX + (i * xIncrement) + 0.5); y = (int)Math.Floor((double)startY + (i * yIncrement) + 0.5); //aGraphic.MoveTo(x, y); //DrawEvent devent = new DrawEvent(graphPort, Frame); //aGraphic.Draw(devent); graphPort.PixBlt(srcPixelBuffer, x, y); //graphPort.AlphaBlend(x, y, srcPixelBuffer.Width, srcPixelBuffer.Height, srcPixelBuffer, // 0, 0, srcPixelBuffer.Width, srcPixelBuffer.Height, 127); lastFrame = new Rectangle(x, y, srcPixelBuffer.Width, srcPixelBuffer.Height); } //aGraphic.MoveTo(endFrame.X, endFrame.Y); graphPort.PixBlt(srcPixelBuffer, endFrame.X, endFrame.Y); }
public DrawEvent(IGraphPort device, Rectangle clipRect) { fClipRect = clipRect; fDevice = device; }
public Command_Render(IGraphPort graphPort) { fGraphPort = graphPort; }
void DrawMinutes(IGraphPort graphPort) { DisplayTwoDigits(graphPort, fThisTime.Minute, false); DisplayColon(graphPort); }
void DrawSeconds(IGraphPort graphPort) { DisplayTwoDigits(graphPort, fThisTime.Second, false); }
public virtual void DrawInto(IGraphPort graphPort) { }
public virtual int OnEraseBackground(IGraphPort aPort) { //GraphPort.DrawingColor = BackgroundColor; //GraphPort.FillRectangle(fOrigin.X, fOrigin.Y, fDimension.Width, fDimension.Height); return 1; }
public virtual void Run(IGraphPort grfx) { // Reset the clock Reset(); fGraphPort = grfx; OnFirstCell(); while (fTimer.GetElapsedSeconds() < Duration) { UpdateGeometryState(CompletionPercentage); Draw(new DrawEvent(GraphPort, Frame)); } OnFinalCell(); }
public void AddGraphPort(IGraphPort aPort) { SetPixelHandler += new NewTOAPIA.Drawing.SetPixel(aPort.SetPixel); DrawLineHandler += new DrawLine(aPort.DrawLine); DrawLinesHandler += new DrawLines(aPort.DrawLines); DrawRectangleHandler += new NewTOAPIA.Drawing.DrawRectangle(aPort.DrawRectangle); DrawRectanglesHandler += new NewTOAPIA.Drawing.DrawRectangles(aPort.DrawRectangles); FillRectangleHandler += new NewTOAPIA.Drawing.FillRectangle(aPort.FillRectangle); DrawEllipseHandler += new NewTOAPIA.Drawing.DrawEllipse(aPort.DrawEllipse); FillEllipseHandler += new NewTOAPIA.Drawing.FillEllipse(aPort.FillEllipse); DrawRoundRectHandler += new NewTOAPIA.Drawing.DrawRoundRect(aPort.DrawRoundRect); PolygonHandler += new NewTOAPIA.Drawing.Polygon(aPort.Polygon); DrawBeziersHandler += new NewTOAPIA.Drawing.DrawBeziers(aPort.DrawBeziers); DrawPathHandler += new NewTOAPIA.Drawing.DrawPath(aPort.DrawPath); FillPathHandler += new FillPath(aPort.FillPath); //// Gradient fills //DrawGradientRectangleHandler += new NewTOAPIA.Drawing.DrawGradientRectangle(aPort.DrawGradientRectangle); //// Drawing Text DrawStringHandler += new NewTOAPIA.Drawing.DrawString(aPort.DrawString); ///// Draw bitmaps PixBltHandler += new NewTOAPIA.Drawing.PixBlt(aPort.PixBlt); //PixmapShardBltHandler += new NewTOAPIA.Drawing.PixmapShardBlt(aPort.PixmapShardBlt); //AlphaBlendHandler += new NewTOAPIA.Drawing.AlphaBlend(aPort.AlphaBlend); // Path handling //DrawPathHandler += new NewTOAPIA.Drawing.DrawPath(aPort.DrawPath); //SetPathAsClipRegionHandler += new NewTOAPIA.Drawing.SetPathAsClipRegion(aPort.SetPathAsClipRegion); //// Setting some objects SetPenHandler += new NewTOAPIA.Drawing.SetPen(aPort.SetPen); SetBrushHandler += new SetBrush(aPort.SetBrush); SetFontHandler += new SetFont(aPort.SetFont); //SelectStockObjectHandler += new NewTOAPIA.Drawing.SelectStockObject(aPort.SelectStockObject); SelectUniqueObjectHandler += new NewTOAPIA.Drawing.SelectUniqueObject(aPort.SelectUniqueObject); //// State Management FlushHandler += new NewTOAPIA.Drawing.Flush(aPort.Flush); SaveStateHandler += new NewTOAPIA.Drawing.SaveState(aPort.SaveState); ResetStateHandler += new NewTOAPIA.Drawing.ResetState(aPort.ResetState); RestoreStateHandler += new NewTOAPIA.Drawing.RestoreState(aPort.RestoreState); //// Setting Attributes and modes SetTextColorHandler += new NewTOAPIA.Drawing.SetTextColor(aPort.SetTextColor); //// Setting some modes SetBkColorHandler += new NewTOAPIA.Drawing.SetBkColor(aPort.SetBkColor); SetBkModeHandler += new NewTOAPIA.Drawing.SetBkMode(aPort.SetBkMode); SetMappingModeHandler += new NewTOAPIA.Drawing.SetMappingMode(aPort.SetMappingMode); SetPolyFillModeHandler += new NewTOAPIA.Drawing.SetPolyFillMode(aPort.SetPolyFillMode); SetROP2Handler += new NewTOAPIA.Drawing.SetROP2(aPort.SetROP2); SetClipRectangleHandler += new SetClipRectangle(aPort.SetClipRectangle); // World transform management SetWorldTransformHandler += new NewTOAPIA.Drawing.SetWorldTransform(aPort.SetWorldTransform); TranslateTransformHandler += new TranslateTransform(aPort.TranslateTransform); ScaleTransformHandler += new ScaleTransform(aPort.ScaleTransform); RotateTransformHandler += new RotateTransform(aPort.RotateTransform); }
public virtual void DrawLine(IGraphPort aPort, int x1, int y1, int x2, int y2, int border_width) { // Vertical line if (x1 == x2) { for (int n=0; n<BorderWidth; n++) aPort.DrawLine(fShadowPen, new Point2I(x1-n, y1+n), new Point2I(x1-n, y2-n)); // left part for (int n=1; n<BorderWidth; n++) aPort.DrawLine(fHighlightPen, new Point2I(x1+n, y1+n), new Point2I(x1+n, y2-n)); // right part } else if (y1 == y2) // Horizontal line { for (int n=0; n<BorderWidth; n++) aPort.DrawLine(fShadowPen, new Point2I(x1+n, y1-n), new Point2I(x2-n, y1-n)); // top part for (int n=1; n<BorderWidth; n++) aPort.DrawLine(fHighlightPen, new Point2I(x1+n, y1+n), new Point2I(x2-n, y1+n)); // bottom part } }
void DrawBackground(IGraphPort gPort) { gPort.FillRectangle(fBackgroundBrush, ClientRectangle); }
public DrawEventArgs(IGraphPort device, PAINTSTRUCT pStruct) { fPaintStruct = pStruct; fDevice = device; }