public override void Scan( ContentScanner.GraphicsState state ) { state.Tlm.Multiply(new Matrix(1, 0, 0, 1, 0, (float)-state.Lead)); state.Tm = state.Tlm.Clone(); }
public override void Scan( ContentScanner.GraphicsState state ) { state.FillColorSpace = DeviceGrayColorSpace.Default; base.Scan(state); }
/** * <summary>Begins a content row.</summary> */ private void BeginRow( ) { rowEnded = false; ContentScanner.GraphicsState state = baseComposer.State; double rowY = boundBox.Height; if (rowY > 0) { rowY += lineSpace.GetValue(state.Font != null ? state.Font.GetLineHeight(state.FontSize) : 0); } currentRow = new Row(rowY); if (xAlignment == XAlignmentEnum.Justify) { /* * TODO: This temporary hack forces PrimitiveComposer.showText() to insert word space * adjustments in case of justified text; when the row ends, it has to be updated with the * actual adjustment value. */ currentRow.WordSpaceAdjustment = baseComposer.Add(new SetWordSpace(.001)); } else if (state.WordSpace != 0) { baseComposer.SetWordSpace(0); } }
public override void Scan( ContentScanner.GraphicsState state ) { state.Font = state.Scanner.ContentContext.Resources.Fonts[Name]; state.FontSize = Size; }
public override void Scan( ContentScanner.GraphicsState state ) { state.Tlm = Value; state.Tm = state.Tlm.Clone(); }
public override void Scan( ContentScanner.GraphicsState state ) { state.StrokeColorSpace = DeviceCMYKColorSpace.Default; base.Scan(state); }
public override void Scan( ContentScanner.GraphicsState state ) { ContentScanner scanner = state.Scanner; GraphicsPath pathObject = scanner.RenderObject; if (pathObject != null) { Graphics context = scanner.RenderContext; if (closed) { pathObject.CloseFigure(); } if (filled) { pathObject.FillMode = fillMode.ToGdi(); context.FillPath(state.FillColorSpace.GetPaint(state.FillColor), pathObject); } if (stroked) { context.DrawPath(GetStroke(state), pathObject); } } }
private static Pen GetStroke( ContentScanner.GraphicsState state ) { Pen stroke = new Pen( state.StrokeColorSpace.GetPaint(state.StrokeColor), (float)state.LineWidth ); { LineCap lineCap = state.LineCap.ToGdi(); stroke.SetLineCap(lineCap, lineCap, lineCap.ToDashCap()); stroke.LineJoin = state.LineJoin.ToGdi(); stroke.MiterLimit = (float)state.MiterLimit; LineDash lineDash = state.LineDash; double[] dashArray = lineDash.DashArray; if (dashArray.Length > 0) { stroke.DashPattern = ConvertUtils.ToFloatArray(dashArray); stroke.DashOffset = (float)lineDash.DashPhase; } } return(stroke); }
public override void Scan( ContentScanner.GraphicsState state ) { state.Font = GetFont(state.Scanner.ContentContext); state.FontSize = Size; }
public override void Scan( ContentScanner.GraphicsState state ) { state.Tlm.Translate(0, (float)state.Lead); state.Tm = state.Tlm.Clone(); }
public override void Scan( ContentScanner.GraphicsState state ) { ExtGState extGState = GetExtGState(state.Scanner.ContentContext); extGState.ApplyTo(state); }
public override void Scan( ContentScanner.GraphicsState state ) { ExtGState extGState = state.Scanner.ContentContext.Resources.ExtGStates[Name]; extGState.ApplyTo(state); }
public override void Scan( ContentScanner.GraphicsState state ) { state.FillColor = state.FillColorSpace.GetColor( operands, state.Scanner.ContentContext ); }
public override void Scan( ContentScanner.GraphicsState state ) { ContentScanner childLevel = state.Scanner.ChildLevel; if(!Render(state)) {childLevel.MoveEnd();} // Forces the current object to its final graphics state. childLevel.State.CopyTo(state); // Copies the current object's final graphics state to the current level's. }
public override void Scan( ContentScanner.GraphicsState state ) { state.Tlm.Translate((float)OffsetX, (float)OffsetY); state.Tm = state.Tlm.Clone(); if (LeadSet) { state.Lead = OffsetY; } }
public override void Scan( ContentScanner.GraphicsState state ) { state.Tlm.Multiply(new Matrix(1, 0, 0, 1, (float)OffsetX, (float)OffsetY)); state.Tm = state.Tlm.Clone(); if (LeadSet) { state.Lead = -OffsetY; } }
public override void Scan( ContentScanner.GraphicsState state ) { GraphicsPath pathObject = state.Scanner.RenderObject; if (pathObject != null) { pathObject.CloseFigure(); } }
public override void Scan( ContentScanner.GraphicsState state ) { GraphicsPath pathObject = state.Scanner.RenderObject; if (pathObject != null) { PointF point = Point; pathObject.AddLine(pathObject.GetLastPoint(), point); } }
public override void Scan( ContentScanner.GraphicsState state ) { ContentScanner scanner = state.Scanner; GraphicsPath pathObject = scanner.RenderObject; if (pathObject != null) { pathObject.FillMode = clipMode.ToGdi(); scanner.RenderContext.SetClip(pathObject, CombineMode.Intersect); } }
public override void Scan( ContentScanner.GraphicsState state ) { state.Ctm.Multiply(Value); Graphics context = state.Scanner.RenderContext; if (context != null) { context.Transform = state.Ctm; } }
public override void Scan( ContentScanner.GraphicsState state ) { // 1. Color space. state.FillColorSpace = GetColorSpace(state.Scanner.ContentContext); // 2. Initial color. /* * NOTE: The operation also sets the current nonstroking color * to its initial value, which depends on the color space [PDF:1.6:4.5.7]. */ state.FillColor = state.FillColorSpace.DefaultColor; }
public static ModifyCTM GetResetCTM( ContentScanner.GraphicsState state ) { Matrix inverseCtm = state.Ctm.Clone(); inverseCtm.Invert(); return(new ModifyCTM( inverseCtm // TODO: inverseCtm is a simplification which assumes an identity initial ctm! // SquareMatrix.get(state.Ctm).solve( // SquareMatrix.get(state.GetInitialCtm()) // ).toTransform() )); }
/** * Begins a content row. */ private void BeginRow( ) { rowEnded = false; float rowY = boundBox.Height; if (rowY > 0) { ContentScanner.GraphicsState state = baseComposer.State; rowY += lineSpace.GetValue(state.Font.GetLineHeight(state.FontSize)); } currentRow = new Row( (ContentPlaceholder)baseComposer.Add(new ContentPlaceholder()), rowY ); }
/** <summary>Renders this container.</summary> <param name="state">Graphics state.</param> <returns>Whether the rendering has been executed.</returns> */ protected bool Render( ContentScanner.GraphicsState state ) { ContentScanner scanner = state.Scanner; Graphics context = scanner.RenderContext; if(context == null) return false; // Render the inner elements! scanner.ChildLevel.Render( context, scanner.CanvasSize, CreateRenderObject() ); return true; }
public override void Scan( ContentScanner.GraphicsState state ) { GraphicsPath pathObject = state.Scanner.RenderObject; if (pathObject != null) { float x = X, y = Y, width = Width, height = Height; pathObject.AddRectangle( new RectangleF(x, y, width, height) ); pathObject.CloseFigure(); } }
public override void Scan( ContentScanner.GraphicsState state ) { GraphicsPath pathObject = state.Scanner.RenderObject; if (pathObject != null) { PointF controlPoint1 = (Control1.HasValue ? Control1.Value : pathObject.GetLastPoint()); PointF finalPoint = Point; PointF controlPoint2 = (Control2.HasValue ? Control2.Value : finalPoint); pathObject.AddBezier( pathObject.GetLastPoint(), controlPoint1, controlPoint2, finalPoint ); } }
private static Pen GetStroke( ContentScanner.GraphicsState state ) { Pen stroke = new Pen( state.StrokeColorSpace.GetPaint(state.StrokeColor), state.LineWidth ); { LineCap lineCap = state.LineCap.ToGdi(); stroke.SetLineCap(lineCap, lineCap, lineCap.ToDashCap()); stroke.LineJoin = state.LineJoin.ToGdi(); stroke.MiterLimit = state.MiterLimit; stroke.DashPattern = state.LineDash.DashArray; stroke.DashOffset = state.LineDash.DashPhase; } return(stroke); }
public override void Scan( ContentScanner.GraphicsState state ) { Graphics context = state.Scanner.RenderContext; if (context != null) { /* * NOTE: Local graphics state is purposely isolated from surrounding graphics state, * so no inner operation can alter its subsequent scanning. */ // Save outer graphics state! GraphicsState contextState = context.Save(); Render(state); // Restore outer graphics state! context.Restore(contextState); } }
public override void Scan( ContentScanner.GraphicsState state ) { state.WordSpace = Value; }
public override void Scan( ContentScanner.GraphicsState state ) { state.LineDash = Value; }