📄 pdfimage.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using AnotherPDFLib.PdfGraphics;
namespace AnotherPDFLib
{
/// <summary>
/// An image XObject is a stream object whose dictionary specifies attributes of the image and whose data contains the image samples.
/// </summary>
public partial class PdfImage : XObject
{
public PdfImage() : base("Image")
{
}
/// <summary>
/// The width of the image, in samples.
/// </summary>
public int Width
{
get
{
PdfInteger width = this["Width"] as PdfInteger;
if (width != null)
{
return width.Value;
}
return 0;
}
set
{
this["Width"] = new PdfInteger(value);
}
}
/// <summary>
/// The height of the image, in samples.
/// </summary>
public int Height
{
get
{
PdfInteger height = this["Height"] as PdfInteger;
if (height != null)
{
return height.Value;
}
return 0;
}
set
{
this["Height"] = new PdfInteger(value);
}
}
/// <summary>
/// The color space in which image samples are specified; it can be any type of color space except Pattern.
/// </summary>
public ColorSpace ColorSpace
{
get
{
PdfName colorspace = this["ColorSpace"] as PdfName;
if (colorspace != null)
{
return (ColorSpace)Enum.Parse(typeof(ColorSpace), colorspace.Name);
}
return default(ColorSpace);
}
set
{
this["ColorSpace"] = new PdfName(value.ToString());
}
}
/// <summary>
/// The number of bits used to represent each color component. Valid values are 1, 2, 4, 8, and (in PDF 1.5) 16. If ImageMask is true, this entry is optional, and if specified, its value must be 1.
/// </summary>
public int BitsPerComponent
{
get
{
PdfInteger bitspercomponent = this["BitsPerComponent"] as PdfInteger;
if (bitspercomponent != null)
{
return bitspercomponent.Value;
}
return 0;
}
set
{
this["BitsPerComponent"] = new PdfInteger(value);
}
}
/// <summary>
/// A flag indicating whether the image is to be treated as an image mask.
/// </summary>
public bool ImageMask
{
get
{
PdfBoolean imagemask = this["ImageMask"] as PdfBoolean;
if (imagemask != null)
{
return imagemask.Value;
}
return false;
}
set
{
this["ImageMask"] = new PdfBoolean(value);
}
}
/// <summary>
/// An array of numbers describing how to map image samples into the range of values appropriate for the image’s color space.
/// </summary>
public PdfArray Decode
{
get
{
return this["Decode"] as PdfArray;
}
set
{
this["Decode"] = value;
}
}
/// <summary>
/// A flag indicating whether image interpolation is to be performed.
/// </summary>
public bool Interpolate
{
get
{
PdfBoolean interpolate = this["Interpolate"] as PdfBoolean;
if (interpolate != null)
{
return interpolate.Value;
}
return false;
}
set
{
this["Interpolate"] = new PdfBoolean(value);
}
}
/// <summary>
/// A metadata stream containing metadata for the image.
/// </summary>
public PdfStream Metadata
{
get
{
return this["Metadata"] as PdfStream;
}
set
{
this["Metadata"] = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -