// Gradient Fills //public override void DrawGradientRectangle(GradientRect gRect) //{ // BufferChunk chunk = new BufferChunk(1024); // chunk += GDI32.EMR_GRADIENTFILL; // // Pack the vertices // ChunkUtils.Pack(chunk, gRect.Vertices); // // Pack the gradient mesh // ChunkUtils.Pack(chunk, gRect.Boundary); // // pack the mode // chunk += (int)gRect.Direction; // SendCommand(chunk); //} /// DrawEllipse /// public override void DrawEllipse(IPen aPen, Rectangle rect) { BufferChunk chunk = new BufferChunk(128); chunk += GDI32.EMR_ELLIPSE; ChunkUtils.Pack(chunk, rect.X, rect.Y, rect.Width, rect.Height); SendCommand(chunk); }
// Drawing Primitives /// Our first pass will be to implement everything as /// taking explicit int parameters. /// We'll assume that drawing with a different pen will /// be accomplished by setting the Pen property on the /// port before drawing. This will keep our API count /// low and alleviate the need to pass the same /// parameter every time. We can add more later. /// public override void SetPixel(int x, int y, Color colorref) { BufferChunk chunk = new BufferChunk(128); chunk += GDI32.EMR_SETTEXTCOLOR; ChunkUtils.Pack(chunk, x, y); chunk += colorref.ToArgb(); SendCommand(chunk); }
// Draw a Polygon public override void Polygon(Point[] points) { BufferChunk chunk = new BufferChunk(points.Length * 8 + 16); chunk += GDI32.EMR_POLYGON; ChunkUtils.Pack(chunk, points); SendCommand(chunk); }
public override void DrawRoundRect(IPen aPen, Rectangle rect, int xRadius, int yRadius) { BufferChunk chunk = new BufferChunk(128); chunk += GDI32.EMR_ROUNDRECT; ChunkUtils.Pack(chunk, rect.X, rect.Y, rect.Width, rect.Height); ChunkUtils.Pack(chunk, xRadius, yRadius); ChunkUtils.Pack(chunk, aPen); SendCommand(chunk); }
public override void DrawString(int x, int y, string aString) { BufferChunk chunk = new BufferChunk(128); chunk += GDI32.EMR_EXTTEXTOUTW; ChunkUtils.Pack(chunk, x, y); chunk += aString.Length; chunk += aString; //chunk += GDI32.GM_ADVANCED; SendCommand(chunk); }
//public override void DrawBezier(GDIPen aPen, Point[] points) //{ // BufferChunk chunk = new BufferChunk(points.Length * 8 + 16); // chunk += GDI32.EMR_POLYBEZIER; // Pack(chunk, points); // SendCommand(chunk); //} public override void DrawLine(IPen aPen, Point startPoint, Point endPoint) { BufferChunk chunk = new BufferChunk(1024); chunk += GDI32.EMR_LINETO; ChunkUtils.Pack(chunk, startPoint); ChunkUtils.Pack(chunk, endPoint); // Pack the pen ChunkUtils.Pack(chunk, aPen); SendCommand(chunk); }
public override void DrawLines(IPen aPen, Point[] points) { BufferChunk chunk = new BufferChunk(points.Length * 8 + 128); chunk += GDI32.EMR_POLYLINE; // Pack the pen ChunkUtils.Pack(chunk, aPen); // Pack the points ChunkUtils.Pack(chunk, points); SendCommand(chunk); }
// Generalized bit block transfer public override void PixBlt(PixelArray pixBuff, int x, int y) { // Create a buffer // It has to be big enough for the bitmap data, as well as the x,y, and command int dataSize = pixBuff.BytesPerRow * pixBuff.Height; BufferChunk chunk = new BufferChunk(dataSize + 128); // now put the basic command and simple components in chunk += GDI32.EMR_BITBLT; ChunkUtils.Pack(chunk, x, y); ChunkUtils.Pack(chunk, pixBuff.Width, pixBuff.Height); chunk += dataSize; // Finally, copy in the data chunk.CopyFrom(pixBuff.PixelData, dataSize); SendCommand(chunk); }
public override void DrawPath(IPen aPen, GPath aPath) { BufferChunk chunk = new BufferChunk(aPath.Vertices.Length * 8 + 128); chunk += GDI32.EMR_POLYDRAW; ChunkUtils.Pack(chunk, aPath.Vertices); for (int i = 0; i < aPath.Vertices.Length; i++) { chunk += aPath.Commands[i]; } // Pack the pen ChunkUtils.Pack(chunk, aPen); SendCommand(chunk); }