本文整理汇总了C#中ImageResource类的典型用法代码示例。如果您正苦于以下问题:C# ImageResource类的具体用法?C# ImageResource怎么用?C# ImageResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageResource类属于命名空间,在下文中一共展示了ImageResource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyrightInfo
public CopyrightInfo(ImageResource imgRes)
: base(imgRes)
{
BinaryPSDReader reader = imgRes.GetDataReader();
this.Value = reader.ReadByte() == 0 ? false : true;
reader.Close();
}
示例2: DeleteLayerHistoryMemento
public DeleteLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, Layer deleteMe)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
this.index = historyWorkspace.Document.Layers.IndexOf(deleteMe);
this.Data = new DeleteLayerHistoryMementoData(deleteMe);
}
示例3: FlipDocumentFunction
public FlipDocumentFunction(string historyName, ImageResource image, FlipType flipType)
: base(ActionFlags.None)
{
this.historyName = historyName;
this.undoImage = image;
this.flipType = flipType;
}
示例4: Slices
public Slices(ImageResource imgRes)
: base(imgRes)
{
BinaryPSDReader reader = imgRes.GetDataReader();
this.Version = reader.ReadUInt32();
this.Rectangle = reader.ReadPSDRectangle(); // new Rectangle(reader).ToERectangle();
this.SlicesName = reader.ReadPSDUnicodeString();
int cnt = (int)reader.ReadUInt32();
this.SliceList = new List<Slice>();
for (int i = 0; i < cnt; i++)
this.SliceList.Add(new Slice(reader));
int unknown1 = (int)reader.ReadUInt32();
int unknown2 = (int)reader.ReadUInt32();
ushort unknown3 = reader.ReadUInt16();
string unknown4 = DynVal.ReadSpecialString(reader);
int unknown5 = (int)reader.ReadUInt32();
this.Values = new List<DynVal>();
while (reader.BytesToEnd > 0)
{
DynVal val = DynVal.ReadValue(reader, false);
this.Values.Add(val);
}
//this.Values = DynVal.ReadValues(reader);
//this.Data = reader.ReadBytes((int)reader.BytesToEnd);
reader.Close();
}
示例5: FlipLayerHistoryMemento
public FlipLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex, FlipType flipType)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
this.layerIndex = layerIndex;
this.flipType = flipType;
}
示例6: ResolutionInfo
/// <summary>
/// Initializes a new instance of the <see cref="ResolutionInfo"/> class using the <see cref="ImageResource"/>.
/// </summary>
/// <param name="imgRes">The image resource to use.</param>
public ResolutionInfo(ImageResource imgRes)
: base(imgRes)
{
BinaryReverseReader dataReader = imgRes.DataReader;
// read horizontal resolution
dataReader.ReadInt16();
// read horizontal resolution units (1=pixels per inch, 2=pixels per centimeter)
dataReader.ReadInt32();
// read the width units (1=inches, 2=cm, 3=pt, 4=picas, 5=columns)
dataReader.ReadInt16();
// read vertical resolution
dataReader.ReadInt16();
// read vertical resolution units (1=pixels per inch, 2=pixels per centimeter)
dataReader.ReadInt32();
// read the height units (1=inches, 2=cm, 3=pt, 4=picas, 5=columns)
dataReader.ReadInt16();
dataReader.Close();
}
示例7: Thumbnail
public Thumbnail(ImageResource imgRes)
: base(imgRes)
{
BinaryPSDReader reader = imgRes.GetDataReader();
//m_bThumbnailFilled = true;
this.Format = reader.ReadInt32();
this.Width = reader.ReadInt32();
this.Height = reader.ReadInt32();
this.WidthBytes = reader.ReadInt32(); //padded row bytes (
this.Size = reader.ReadInt32(); //Total size widthbytes * height * planes
this.CompressedSize = reader.ReadInt32(); //used for consistancy check
this.BitPerPixel = reader.ReadInt16();
this.Planes = reader.ReadInt16();
int numBytes = (int)reader.BytesToEnd;
byte[] buffer = reader.ReadBytes(numBytes);
if (this.ID == 1033)
{
// BGR
for (int n = 0; n < numBytes - 2; n += 3)
{
byte tmp = buffer[n + 2];
buffer[n + 2] = buffer[n];
buffer[n] = tmp;
}
}
System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer);
this.Bitmap = new System.Drawing.Bitmap(stream);
reader.Close();
}
示例8: ResolutionInfo
public ResolutionInfo(ImageResource imgRes)
: base(imgRes)
{
//m_bResolutionInfoFilled = true;
BinaryReverseReader reader = imgRes.GetDataReader();
this.hRes = reader.ReadInt16();
this.hResUnit = reader.ReadInt32();
this.widthUnit = reader.ReadInt16();
this.vRes = reader.ReadInt16();
this.vResUnit = reader.ReadInt32();
this.heightUnit = reader.ReadInt16();
reader.Close();
//int ppm_x = 3780; // 96 dpi
//int ppm_y = 3780; // 96 dpi
//if (psd.ResolutionInfo != null)
//{
// int nHorzResolution = (int)psd.ResolutionInfo.hRes;
// int nVertResolution = (int)psd.ResolutionInfo.vRes;
// ppm_x = (nHorzResolution * 10000) / 254;
// ppm_y = (nVertResolution * 10000) / 254;
//}
}
示例9: LayerPropertyHistoryMemento
public LayerPropertyHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
this.layerIndex = layerIndex;
this.properties = ((Layer)this.historyWorkspace.Document.Layers[layerIndex]).SaveProperties();
}
示例10: BitmapHistoryMemento
public BitmapHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace,
int layerIndex, PdnRegion changedRegion, Surface copyFromThisSurface)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
this.layerIndex = layerIndex;
PdnRegion region = changedRegion.Clone();
this.tempFileName = FileSystem.GetTempFileName();
FileStream outputStream = null;
try
{
outputStream = FileSystem.OpenStreamingFile(this.tempFileName, FileAccess.Write);
SaveSurfaceRegion(outputStream, copyFromThisSurface, region);
}
finally
{
if (outputStream != null)
{
outputStream.Dispose();
outputStream = null;
}
}
this.tempFileHandle = new DeleteFileOnFree(this.tempFileName);
BitmapHistoryMementoData data = new BitmapHistoryMementoData(null, region);
this.Data = data;
}
示例11: FlipLayerFunction
public FlipLayerFunction(string historyName, ImageResource image, FlipType flipType, int layerIndex)
: base(ActionFlags.None)
{
this.historyName = historyName;
this.flipType = flipType;
this.undoImage = image;
this.layerIndex = layerIndex;
}
示例12: ReplaceDocumentHistoryMemento
public ReplaceDocumentHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
ReplaceDocumentHistoryMementoData data = new ReplaceDocumentHistoryMementoData(this.historyWorkspace.Document);
this.Data = data;
}
示例13: ColorTransferFunctions
public ColorTransferFunctions(ImageResource imgRes)
: base(imgRes)
{
BinaryPSDReader reader = imgRes.GetDataReader();
this.Functions = new List<ColorTransferFunction>();
for (int i = 0; i < 4; i++)
this.Functions.Add(new ColorTransferFunction(reader));
reader.Close();
}
示例14: MetaDataHistoryMemento
public MetaDataHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace)
: base(name, image)
{
this.historyWorkspace = historyWorkspace;
Document document = new Document(1, 1); // we need some place to store the metadata...
document.ReplaceMetaDataFrom(historyWorkspace.Document);
MetaDataHistoryMementoData data = new MetaDataHistoryMementoData(document);
this.Data = data;
}
示例15: LayersGroupInfo
public LayersGroupInfo(ImageResource imgRes)
: base(imgRes)
{
BinaryPSDReader reader = imgRes.GetDataReader();
this.GroupIds = new List<ushort>();
while (reader.BytesToEnd > 0)
this.GroupIds.Add(reader.ReadUInt16());
reader.Close();
}