Browse Source

consistent method naming (Ascii, not ASCII)

af/merge-core
Johannes Bildstein 9 years ago
parent
commit
8da00e38f0
  1. 20
      src/ImageSharp/MetaData/Profiles/ICC/IccDataReader.cs
  2. 6
      src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs

20
src/ImageSharp/MetaData/Profiles/ICC/IccDataReader.cs

@ -128,7 +128,7 @@ namespace ImageSharp
/// </summary> /// </summary>
/// <param name="length">number of bytes to read</param> /// <param name="length">number of bytes to read</param>
/// <returns>The value as a string</returns> /// <returns>The value as a string</returns>
public string ReadASCIIString(int length) public string ReadAsciiString(int length)
{ {
string value = AsciiEncoding.GetString(this.data, this.AddIndex(length), length); string value = AsciiEncoding.GetString(this.data, this.AddIndex(length), length);
@ -323,7 +323,7 @@ namespace ImageSharp
/// <returns>the named color</returns> /// <returns>the named color</returns>
public IccNamedColor ReadNamedColor(uint deviceCoordCount) public IccNamedColor ReadNamedColor(uint deviceCoordCount)
{ {
string name = this.ReadASCIIString(32); string name = this.ReadAsciiString(32);
ushort[] pcsCoord = new ushort[3] { this.ReadUInt16(), this.ReadUInt16(), this.ReadUInt16() }; ushort[] pcsCoord = new ushort[3] { this.ReadUInt16(), this.ReadUInt16(), this.ReadUInt16() };
ushort[] deviceCoord = new ushort[deviceCoordCount]; ushort[] deviceCoord = new ushort[deviceCoordCount];
@ -366,7 +366,7 @@ namespace ImageSharp
public IccColorantTableEntry ReadColorantTableEntry() public IccColorantTableEntry ReadColorantTableEntry()
{ {
return new IccColorantTableEntry( return new IccColorantTableEntry(
name: this.ReadASCIIString(32), name: this.ReadAsciiString(32),
pcs1: this.ReadUInt16(), pcs1: this.ReadUInt16(),
pcs2: this.ReadUInt16(), pcs2: this.ReadUInt16(),
pcs3: this.ReadUInt16()); pcs3: this.ReadUInt16());
@ -826,7 +826,7 @@ namespace ImageSharp
for (int i = 0; i < recordCount; i++) for (int i = 0; i < recordCount; i++)
{ {
culture[i] = $"{this.ReadASCIIString(2)}-{this.ReadASCIIString(2)}"; culture[i] = $"{this.ReadAsciiString(2)}-{this.ReadAsciiString(2)}";
length[i] = this.ReadUInt32(); length[i] = this.ReadUInt32();
offset[i] = this.ReadUInt32(); offset[i] = this.ReadUInt32();
} }
@ -877,8 +877,8 @@ namespace ImageSharp
int vendorFlag = this.ReadDirect32(); int vendorFlag = this.ReadDirect32();
uint colorCount = this.ReadUInt32(); uint colorCount = this.ReadUInt32();
uint coordCount = this.ReadUInt32(); uint coordCount = this.ReadUInt32();
string prefix = this.ReadASCIIString(32); string prefix = this.ReadAsciiString(32);
string suffix = this.ReadASCIIString(32); string suffix = this.ReadAsciiString(32);
IccNamedColor[] colors = new IccNamedColor[colorCount]; IccNamedColor[] colors = new IccNamedColor[colorCount];
for (int i = 0; i < colorCount; i++) for (int i = 0; i < colorCount; i++)
@ -990,7 +990,7 @@ namespace ImageSharp
/// <returns>The read entry</returns> /// <returns>The read entry</returns>
public IccSignatureTagDataEntry ReadSignatureTagDataEntry() public IccSignatureTagDataEntry ReadSignatureTagDataEntry()
{ {
return new IccSignatureTagDataEntry(this.ReadASCIIString(4)); return new IccSignatureTagDataEntry(this.ReadAsciiString(4));
} }
/// <summary> /// <summary>
@ -1000,7 +1000,7 @@ namespace ImageSharp
/// <returns>The read entry</returns> /// <returns>The read entry</returns>
public IccTextTagDataEntry ReadTextTagDataEntry(uint size) public IccTextTagDataEntry ReadTextTagDataEntry(uint size)
{ {
return new IccTextTagDataEntry(this.ReadASCIIString((int)size - 8)); // 8 is the tag header size return new IccTextTagDataEntry(this.ReadAsciiString((int)size - 8)); // 8 is the tag header size
} }
/// <summary> /// <summary>
@ -1126,7 +1126,7 @@ namespace ImageSharp
int asciiCount = (int)this.ReadUInt32(); int asciiCount = (int)this.ReadUInt32();
if (asciiCount > 0) if (asciiCount > 0)
{ {
asciiValue = this.ReadASCIIString(asciiCount - 1); asciiValue = this.ReadAsciiString(asciiCount - 1);
this.AddIndex(1); // Null terminator this.AddIndex(1); // Null terminator
} }
@ -1142,7 +1142,7 @@ namespace ImageSharp
int scriptcodeCount = Math.Min(this.data[this.AddIndex(1)], (byte)67); int scriptcodeCount = Math.Min(this.data[this.AddIndex(1)], (byte)67);
if (scriptcodeCount > 0) if (scriptcodeCount > 0)
{ {
scriptcodeValue = this.ReadASCIIString(scriptcodeCount - 1); scriptcodeValue = this.ReadAsciiString(scriptcodeCount - 1);
this.AddIndex(1); // Null terminator this.AddIndex(1); // Null terminator
} }

6
src/ImageSharp/MetaData/Profiles/ICC/IccReader.cs

@ -59,13 +59,13 @@ namespace ImageSharp
return new IccProfileHeader return new IccProfileHeader
{ {
Size = reader.ReadUInt32(), Size = reader.ReadUInt32(),
CmmType = reader.ReadASCIIString(4), CmmType = reader.ReadAsciiString(4),
Version = reader.ReadVersionNumber(), Version = reader.ReadVersionNumber(),
Class = (IccProfileClass)reader.ReadUInt32(), Class = (IccProfileClass)reader.ReadUInt32(),
DataColorSpace = (IccColorSpaceType)reader.ReadUInt32(), DataColorSpace = (IccColorSpaceType)reader.ReadUInt32(),
ProfileConnectionSpace = (IccColorSpaceType)reader.ReadUInt32(), ProfileConnectionSpace = (IccColorSpaceType)reader.ReadUInt32(),
CreationDate = reader.ReadDateTime(), CreationDate = reader.ReadDateTime(),
FileSignature = reader.ReadASCIIString(4), FileSignature = reader.ReadAsciiString(4),
PrimaryPlatformSignature = (IccPrimaryPlatformType)reader.ReadUInt32(), PrimaryPlatformSignature = (IccPrimaryPlatformType)reader.ReadUInt32(),
Flags = (IccProfileFlag)reader.ReadDirect32(), Flags = (IccProfileFlag)reader.ReadDirect32(),
DeviceManufacturer = reader.ReadUInt32(), DeviceManufacturer = reader.ReadUInt32(),
@ -73,7 +73,7 @@ namespace ImageSharp
DeviceAttributes = (IccDeviceAttribute)reader.ReadDirect64(), DeviceAttributes = (IccDeviceAttribute)reader.ReadDirect64(),
RenderingIntent = (IccRenderingIntent)reader.ReadUInt32(), RenderingIntent = (IccRenderingIntent)reader.ReadUInt32(),
PcsIlluminant = reader.ReadXyzNumber(), PcsIlluminant = reader.ReadXyzNumber(),
CreatorSignature = reader.ReadASCIIString(4), CreatorSignature = reader.ReadAsciiString(4),
Id = reader.ReadProfileId(), Id = reader.ReadProfileId(),
}; };
} }

Loading…
Cancel
Save