Files
2026-06-04 11:42:34 +02:00

96 lines
3.1 KiB
C#

using System;
namespace Hjg.Pngcs.Chunks
{
// Token: 0x02000025 RID: 37
public class PngChunkICCP : PngChunkSingle
{
// Token: 0x0600014D RID: 333 RVA: 0x000062FA File Offset: 0x000044FA
public PngChunkICCP(ImageInfo info)
: base("iCCP", info)
{
}
// Token: 0x0600014E RID: 334 RVA: 0x00006308 File Offset: 0x00004508
public override PngChunk.ChunkOrderingConstraint GetOrderingConstraint()
{
return PngChunk.ChunkOrderingConstraint.BEFORE_PLTE_AND_IDAT;
}
// Token: 0x0600014F RID: 335 RVA: 0x0000630C File Offset: 0x0000450C
public override ChunkRaw CreateRawChunk()
{
ChunkRaw chunkRaw = base.createEmptyChunk(this.profileName.Length + this.compressedProfile.Length + 2, true);
Array.Copy(ChunkHelper.ToBytes(this.profileName), 0, chunkRaw.Data, 0, this.profileName.Length);
chunkRaw.Data[this.profileName.Length] = 0;
chunkRaw.Data[this.profileName.Length + 1] = 0;
Array.Copy(this.compressedProfile, 0, chunkRaw.Data, this.profileName.Length + 2, this.compressedProfile.Length);
return chunkRaw;
}
// Token: 0x06000150 RID: 336 RVA: 0x000063AC File Offset: 0x000045AC
public override void ParseFromRaw(ChunkRaw chunk)
{
int num = ChunkHelper.PosNullByte(chunk.Data);
this.profileName = PngHelperInternal.charsetLatin1.GetString(chunk.Data, 0, num);
int num2 = (int)(chunk.Data[num + 1] & byte.MaxValue);
if (num2 != 0)
{
throw new Exception("bad compression for ChunkTypeICCP");
}
int num3 = chunk.Data.Length - (num + 2);
this.compressedProfile = new byte[num3];
Array.Copy(chunk.Data, num + 2, this.compressedProfile, 0, num3);
}
// Token: 0x06000151 RID: 337 RVA: 0x0000642C File Offset: 0x0000462C
public override void CloneDataFromRead(PngChunk other)
{
PngChunkICCP pngChunkICCP = (PngChunkICCP)other;
this.profileName = pngChunkICCP.profileName;
this.compressedProfile = new byte[pngChunkICCP.compressedProfile.Length];
Array.Copy(pngChunkICCP.compressedProfile, this.compressedProfile, this.compressedProfile.Length);
}
// Token: 0x06000152 RID: 338 RVA: 0x00006478 File Offset: 0x00004678
public void SetProfileNameAndContent(string name, string profile)
{
this.SetProfileNameAndContent(name, ChunkHelper.ToBytes(this.profileName));
}
// Token: 0x06000153 RID: 339 RVA: 0x0000648C File Offset: 0x0000468C
public void SetProfileNameAndContent(string name, byte[] profile)
{
this.profileName = name;
this.compressedProfile = ChunkHelper.compressBytes(profile, true);
}
// Token: 0x06000154 RID: 340 RVA: 0x000064A2 File Offset: 0x000046A2
public string GetProfileName()
{
return this.profileName;
}
// Token: 0x06000155 RID: 341 RVA: 0x000064AA File Offset: 0x000046AA
public byte[] GetProfile()
{
return ChunkHelper.compressBytes(this.compressedProfile, false);
}
// Token: 0x06000156 RID: 342 RVA: 0x000064B8 File Offset: 0x000046B8
public string GetProfileAsString()
{
return ChunkHelper.ToString(this.GetProfile());
}
// Token: 0x040000B6 RID: 182
public const string ID = "iCCP";
// Token: 0x040000B7 RID: 183
private string profileName;
// Token: 0x040000B8 RID: 184
private byte[] compressedProfile;
}
}