This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+117
View File
@@ -0,0 +1,117 @@
using System;
namespace Hjg.Pngcs.Chunks
{
// Token: 0x0200002D RID: 45
public class PngChunkPHYS : PngChunkSingle
{
// Token: 0x17000027 RID: 39
// (get) Token: 0x0600018C RID: 396 RVA: 0x00006AC8 File Offset: 0x00004CC8
// (set) Token: 0x0600018D RID: 397 RVA: 0x00006AD0 File Offset: 0x00004CD0
public long PixelsxUnitX { get; set; }
// Token: 0x17000028 RID: 40
// (get) Token: 0x0600018E RID: 398 RVA: 0x00006AD9 File Offset: 0x00004CD9
// (set) Token: 0x0600018F RID: 399 RVA: 0x00006AE1 File Offset: 0x00004CE1
public long PixelsxUnitY { get; set; }
// Token: 0x17000029 RID: 41
// (get) Token: 0x06000190 RID: 400 RVA: 0x00006AEA File Offset: 0x00004CEA
// (set) Token: 0x06000191 RID: 401 RVA: 0x00006AF2 File Offset: 0x00004CF2
public int Units { get; set; }
// Token: 0x06000192 RID: 402 RVA: 0x00006AFB File Offset: 0x00004CFB
public PngChunkPHYS(ImageInfo info)
: base("pHYs", info)
{
}
// Token: 0x06000193 RID: 403 RVA: 0x00006B09 File Offset: 0x00004D09
public override PngChunk.ChunkOrderingConstraint GetOrderingConstraint()
{
return PngChunk.ChunkOrderingConstraint.BEFORE_IDAT;
}
// Token: 0x06000194 RID: 404 RVA: 0x00006B0C File Offset: 0x00004D0C
public override ChunkRaw CreateRawChunk()
{
ChunkRaw chunkRaw = base.createEmptyChunk(9, true);
PngHelperInternal.WriteInt4tobytes((int)this.PixelsxUnitX, chunkRaw.Data, 0);
PngHelperInternal.WriteInt4tobytes((int)this.PixelsxUnitY, chunkRaw.Data, 4);
chunkRaw.Data[8] = (byte)this.Units;
return chunkRaw;
}
// Token: 0x06000195 RID: 405 RVA: 0x00006B5C File Offset: 0x00004D5C
public override void CloneDataFromRead(PngChunk other)
{
PngChunkPHYS pngChunkPHYS = (PngChunkPHYS)other;
this.PixelsxUnitX = pngChunkPHYS.PixelsxUnitX;
this.PixelsxUnitY = pngChunkPHYS.PixelsxUnitY;
this.Units = pngChunkPHYS.Units;
}
// Token: 0x06000196 RID: 406 RVA: 0x00006B94 File Offset: 0x00004D94
public override void ParseFromRaw(ChunkRaw chunk)
{
if (chunk.Length != 9)
{
throw new PngjException("bad chunk length " + chunk);
}
this.PixelsxUnitX = (long)PngHelperInternal.ReadInt4fromBytes(chunk.Data, 0);
if (this.PixelsxUnitX < 0L)
{
this.PixelsxUnitX += 4294967296L;
}
this.PixelsxUnitY = (long)PngHelperInternal.ReadInt4fromBytes(chunk.Data, 4);
if (this.PixelsxUnitY < 0L)
{
this.PixelsxUnitY += 4294967296L;
}
this.Units = PngHelperInternal.ReadInt1fromByte(chunk.Data, 8);
}
// Token: 0x06000197 RID: 407 RVA: 0x00006C34 File Offset: 0x00004E34
public double GetAsDpi()
{
if (this.Units != 1 || this.PixelsxUnitX != this.PixelsxUnitY)
{
return -1.0;
}
return (double)this.PixelsxUnitX * 0.0254;
}
// Token: 0x06000198 RID: 408 RVA: 0x00006C68 File Offset: 0x00004E68
public double[] GetAsDpi2()
{
if (this.Units != 1)
{
return new double[] { -1.0, -1.0 };
}
return new double[]
{
(double)this.PixelsxUnitX * 0.0254,
(double)this.PixelsxUnitY * 0.0254
};
}
// Token: 0x06000199 RID: 409 RVA: 0x00006CCF File Offset: 0x00004ECF
public void SetAsDpi(double dpi)
{
this.Units = 1;
this.PixelsxUnitX = (long)(dpi / 0.0254 + 0.5);
this.PixelsxUnitY = this.PixelsxUnitX;
}
// Token: 0x0600019A RID: 410 RVA: 0x00006D00 File Offset: 0x00004F00
public void SetAsDpi2(double dpix, double dpiy)
{
this.Units = 1;
this.PixelsxUnitX = (long)(dpix / 0.0254 + 0.5);
this.PixelsxUnitY = (long)(dpiy / 0.0254 + 0.5);
}
// Token: 0x040000DD RID: 221
public const string ID = "pHYs";
}
}