mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-01-18 19:51:24 +08:00
Merge pull request #569 from UglyToad/stream-processor-step-1
Make some necessary classes public
This commit is contained in:
@@ -92,11 +92,13 @@
|
|||||||
"UglyToad.PdfPig.Filters.IFilterProvider",
|
"UglyToad.PdfPig.Filters.IFilterProvider",
|
||||||
"UglyToad.PdfPig.Functions.FunctionTypes",
|
"UglyToad.PdfPig.Functions.FunctionTypes",
|
||||||
"UglyToad.PdfPig.Functions.PdfFunction",
|
"UglyToad.PdfPig.Functions.PdfFunction",
|
||||||
|
"UglyToad.PdfPig.PdfFonts.CharacterBoundingBox",
|
||||||
"UglyToad.PdfPig.PdfFonts.DescriptorFontFile",
|
"UglyToad.PdfPig.PdfFonts.DescriptorFontFile",
|
||||||
"UglyToad.PdfPig.PdfFonts.FontDescriptor",
|
"UglyToad.PdfPig.PdfFonts.FontDescriptor",
|
||||||
"UglyToad.PdfPig.PdfFonts.FontDescriptorFlags",
|
"UglyToad.PdfPig.PdfFonts.FontDescriptorFlags",
|
||||||
"UglyToad.PdfPig.PdfFonts.FontDetails",
|
"UglyToad.PdfPig.PdfFonts.FontDetails",
|
||||||
"UglyToad.PdfPig.PdfFonts.FontStretch",
|
"UglyToad.PdfPig.PdfFonts.FontStretch",
|
||||||
|
"UglyToad.PdfPig.PdfFonts.IFont",
|
||||||
"UglyToad.PdfPig.Geometry.GeometryExtensions",
|
"UglyToad.PdfPig.Geometry.GeometryExtensions",
|
||||||
"UglyToad.PdfPig.Graphics.Colors.CMYKColor",
|
"UglyToad.PdfPig.Graphics.Colors.CMYKColor",
|
||||||
"UglyToad.PdfPig.Graphics.Colors.ColorSpace",
|
"UglyToad.PdfPig.Graphics.Colors.ColorSpace",
|
||||||
@@ -199,6 +201,7 @@
|
|||||||
"UglyToad.PdfPig.Graphics.Operations.TextState.Type3SetGlyphWidth",
|
"UglyToad.PdfPig.Graphics.Operations.TextState.Type3SetGlyphWidth",
|
||||||
"UglyToad.PdfPig.Graphics.Operations.TextState.Type3SetGlyphWidthAndBoundingBox",
|
"UglyToad.PdfPig.Graphics.Operations.TextState.Type3SetGlyphWidthAndBoundingBox",
|
||||||
"UglyToad.PdfPig.Graphics.TextMatrices",
|
"UglyToad.PdfPig.Graphics.TextMatrices",
|
||||||
|
"UglyToad.PdfPig.Graphics.XObjectContentRecord",
|
||||||
"UglyToad.PdfPig.Images.ColorSpaceDetailsByteConverter",
|
"UglyToad.PdfPig.Images.ColorSpaceDetailsByteConverter",
|
||||||
"UglyToad.PdfPig.Logging.ILog",
|
"UglyToad.PdfPig.Logging.ILog",
|
||||||
"UglyToad.PdfPig.Outline.Bookmarks",
|
"UglyToad.PdfPig.Outline.Bookmarks",
|
||||||
@@ -227,7 +230,9 @@
|
|||||||
"UglyToad.PdfPig.Writer.PdfWriterType",
|
"UglyToad.PdfPig.Writer.PdfWriterType",
|
||||||
"UglyToad.PdfPig.Writer.PdfPageBuilder",
|
"UglyToad.PdfPig.Writer.PdfPageBuilder",
|
||||||
"UglyToad.PdfPig.Writer.TokenWriter",
|
"UglyToad.PdfPig.Writer.TokenWriter",
|
||||||
"UglyToad.PdfPig.XObjects.XObjectImage"
|
"UglyToad.PdfPig.XObjects.XObjectImage",
|
||||||
|
"UglyToad.PdfPig.XObjects.XObjectImage",
|
||||||
|
"UglyToad.PdfPig.XObjects.XObjectType"
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var publicTypeName in publicTypeNames)
|
foreach (var publicTypeName in publicTypeNames)
|
||||||
|
|||||||
@@ -348,8 +348,6 @@
|
|||||||
// Successive values are adjacent in the bit stream; there is no padding at byte boundaries.
|
// Successive values are adjacent in the bit stream; there is no padding at byte boundaries.
|
||||||
var bits = new BitArray(FunctionStream.Data.ToArray());
|
var bits = new BitArray(FunctionStream.Data.ToArray());
|
||||||
|
|
||||||
System.Diagnostics.Debug.Assert(bits.Length == arraySize * nOut * bitsPerSample);
|
|
||||||
|
|
||||||
for (int i = 0; i < arraySize; i++)
|
for (int i = 0; i < arraySize; i++)
|
||||||
{
|
{
|
||||||
samples[i] = new int[nOut];
|
samples[i] = new int[nOut];
|
||||||
|
|||||||
@@ -201,7 +201,6 @@
|
|||||||
|
|
||||||
private void ScanNewLine()
|
private void ScanNewLine()
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Assert(state == State.NEWLINE);
|
|
||||||
char ch = CurrentChar();
|
char ch = CurrentChar();
|
||||||
buffer.Append(ch);
|
buffer.Append(ch);
|
||||||
if (ch == CR && Peek() == LF)
|
if (ch == CR && Peek() == LF)
|
||||||
@@ -215,7 +214,6 @@
|
|||||||
|
|
||||||
private void ScanWhitespace()
|
private void ScanWhitespace()
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Assert(state == State.WHITESPACE);
|
|
||||||
buffer.Append(CurrentChar());
|
buffer.Append(CurrentChar());
|
||||||
|
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
@@ -239,7 +237,6 @@
|
|||||||
|
|
||||||
private void ScanComment()
|
private void ScanComment()
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Assert(state == State.COMMENT);
|
|
||||||
buffer.Append(CurrentChar());
|
buffer.Append(CurrentChar());
|
||||||
|
|
||||||
bool loop = true;
|
bool loop = true;
|
||||||
@@ -264,7 +261,6 @@
|
|||||||
|
|
||||||
private void ScanToken()
|
private void ScanToken()
|
||||||
{
|
{
|
||||||
System.Diagnostics.Debug.Assert(state == State.TOKEN);
|
|
||||||
char ch = CurrentChar();
|
char ch = CurrentChar();
|
||||||
buffer.Append(ch);
|
buffer.Append(ch);
|
||||||
switch (ch)
|
switch (ch)
|
||||||
|
|||||||
@@ -68,11 +68,6 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
PdfPoint? CloseSubpath();
|
PdfPoint? CloseSubpath();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add the current subpath to the path.
|
|
||||||
/// </summary>
|
|
||||||
void AddCurrentSubpath();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stroke the current path.
|
/// Stroke the current path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,20 +8,38 @@
|
|||||||
using Util.JetBrains.Annotations;
|
using Util.JetBrains.Annotations;
|
||||||
using XObjects;
|
using XObjects;
|
||||||
|
|
||||||
internal class XObjectContentRecord
|
/// <summary>
|
||||||
|
/// An XObject content record.
|
||||||
|
/// </summary>
|
||||||
|
public class XObjectContentRecord
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The XObject type.
|
||||||
|
/// </summary>
|
||||||
public XObjectType Type { get; }
|
public XObjectType Type { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The XObject stream.
|
||||||
|
/// </summary>
|
||||||
[NotNull]
|
[NotNull]
|
||||||
public StreamToken Stream { get; }
|
public StreamToken Stream { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The applied transformation.
|
||||||
|
/// </summary>
|
||||||
public TransformationMatrix AppliedTransformation { get; }
|
public TransformationMatrix AppliedTransformation { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default rendering intent.
|
||||||
|
/// </summary>
|
||||||
public RenderingIntent DefaultRenderingIntent { get; }
|
public RenderingIntent DefaultRenderingIntent { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default color space.
|
||||||
|
/// </summary>
|
||||||
public ColorSpace DefaultColorSpace { get; }
|
public ColorSpace DefaultColorSpace { get; }
|
||||||
|
|
||||||
public XObjectContentRecord(XObjectType type, StreamToken stream, TransformationMatrix appliedTransformation,
|
internal XObjectContentRecord(XObjectType type, StreamToken stream, TransformationMatrix appliedTransformation,
|
||||||
RenderingIntent defaultRenderingIntent,
|
RenderingIntent defaultRenderingIntent,
|
||||||
ColorSpace defaultColorSpace)
|
ColorSpace defaultColorSpace)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,13 +2,22 @@
|
|||||||
{
|
{
|
||||||
using Core;
|
using Core;
|
||||||
|
|
||||||
internal class CharacterBoundingBox
|
/// <summary>
|
||||||
|
/// Character bounding box.
|
||||||
|
/// </summary>
|
||||||
|
public class CharacterBoundingBox
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The glyph bounds.
|
||||||
|
/// </summary>
|
||||||
public PdfRectangle GlyphBounds { get; }
|
public PdfRectangle GlyphBounds { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// THe width.
|
||||||
|
/// </summary>
|
||||||
public double Width { get; }
|
public double Width { get; }
|
||||||
|
|
||||||
public CharacterBoundingBox(PdfRectangle bounds, double width)
|
internal CharacterBoundingBox(PdfRectangle bounds, double width)
|
||||||
{
|
{
|
||||||
GlyphBounds = bounds;
|
GlyphBounds = bounds;
|
||||||
Width = width;
|
Width = width;
|
||||||
|
|||||||
@@ -4,20 +4,44 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Tokens;
|
using Tokens;
|
||||||
|
|
||||||
internal interface IFont
|
/// <summary>
|
||||||
|
/// Font base interface.
|
||||||
|
/// </summary>
|
||||||
|
public interface IFont
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The font name.
|
||||||
|
/// </summary>
|
||||||
NameToken Name { get; }
|
NameToken Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Is the font vertical.
|
||||||
|
/// </summary>
|
||||||
bool IsVertical { get; }
|
bool IsVertical { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The font details.
|
||||||
|
/// </summary>
|
||||||
FontDetails Details { get; }
|
FontDetails Details { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read the character code.
|
||||||
|
/// </summary>
|
||||||
int ReadCharacterCode(IInputBytes bytes, out int codeLength);
|
int ReadCharacterCode(IInputBytes bytes, out int codeLength);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Try get the unicode value.
|
||||||
|
/// </summary>
|
||||||
bool TryGetUnicode(int characterCode, out string value);
|
bool TryGetUnicode(int characterCode, out string value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the font bounding box.
|
||||||
|
/// </summary>
|
||||||
CharacterBoundingBox GetBoundingBox(int characterCode);
|
CharacterBoundingBox GetBoundingBox(int characterCode);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the font transformation matrix.
|
||||||
|
/// </summary>
|
||||||
TransformationMatrix GetFontMatrix();
|
TransformationMatrix GetFontMatrix();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,9 +1,23 @@
|
|||||||
namespace UglyToad.PdfPig.XObjects
|
namespace UglyToad.PdfPig.XObjects
|
||||||
{
|
{
|
||||||
internal enum XObjectType
|
/// <summary>
|
||||||
|
/// XObject type.
|
||||||
|
/// </summary>
|
||||||
|
public enum XObjectType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Image.
|
||||||
|
/// </summary>
|
||||||
Image,
|
Image,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Form.
|
||||||
|
/// </summary>
|
||||||
Form,
|
Form,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// PostScript.
|
||||||
|
/// </summary>
|
||||||
PostScript
|
PostScript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user