// Token: 0x06002D1B RID: 11547 RVA: 0x000ADAC0 File Offset: 0x000ABCC0 public unsafe Class150(Struct54[] pixels, Size sz) : this() { if (pixels == null) { throw new ArgumentNullException("pixels"); } this.size_0 = sz; this.class125_0 = new Class125(sz); this.class125_0.method_4(); Struct33 *ptr = this.class125_0.pBase; Struct54 *ptr2; if (pixels != null && pixels.Length != 0) { fixed(Struct54 *ptr2 = &pixels[0]) { } } else { ptr2 = null; } Struct54 *ptr3 = ptr2; for (int i = 0; i < sz.Width * sz.Height; i++) { *ptr = Struct33.smethod_2(*ptr3); ptr++; ptr3++; } ptr2 = null; }
uint Interface67.imethod_0(ref Struct34 A_0, ref Struct33 A_1) { if (this.class941_0.Count > 0) { Class940 class2 = (Class940)this.class941_0[0]; A_0 = class2.method_1(); A_1 = class2.method_0(); return(0); } return(0x80040064); }
// Token: 0x06001E86 RID: 7814 RVA: 0x00062E04 File Offset: 0x00061004 protected override void vmethod_0(BinaryWriter writer) { writer.smethod_15(this.size_0); if (this.array_0 == null) { writer.Write(false); } else { writer.Write(true); writer.Write((short)this.rectangle_0.Left); writer.Write((short)this.rectangle_0.Top); writer.Write((short)this.rectangle_0.Right); writer.Write((short)this.rectangle_0.Bottom); foreach (Array[] array in this.array_0) { writer.Write((short)array.Length); Array[] array2 = array; int i = 0; while (i < array2.Length) { Array array3 = array2[i]; writer.Write((short)array3.GetLowerBound(0)); writer.Write((short)array3.Length); if (this.bool_0) { using (IEnumerator enumerator2 = array3.GetEnumerator()) { while (enumerator2.MoveNext()) { object obj = enumerator2.Current; Struct33 color = (Struct33)obj; writer.smethod_19(color); } goto IL_155; } goto IL_116; } goto IL_116; IL_155: i++; continue; IL_116: foreach (object obj2 in array3) { Struct54 color2 = (Struct54)obj2; writer.smethod_17(color2); } goto IL_155; } } } base.vmethod_0(writer); }
// Token: 0x060016B2 RID: 5810 RVA: 0x00036C90 File Offset: 0x00034E90 public unsafe static void smethod_1(Bitmap original) { using (Class125 @class = new Class125(original)) { using (new Class125.Class153(@class)) { Struct33 *ptr = @class.pStruct33_0; int num = original.Height * original.Width; for (int i = 0; i < num; i++) { byte b = (byte)((double)ptr->R * 0.3 + (double)ptr->G * 0.59 + (double)ptr->B * 0.11); * ptr = new Struct33(b, b, b, ptr->A); ptr++; } } } }
// Token: 0x060017A1 RID: 6049 RVA: 0x0003DFE0 File Offset: 0x0003C1E0 protected unsafe bool method_21(ManualResetEventSlim waitHandle = null) { int num = 0; do { Size size = new Size(20, 20); using (Bitmap bitmap = Class364.smethod_3(this.intptr_0, new Rectangle(Point.Empty, size))) { using (Class125 @class = new Class125(bitmap, false)) { using (new Class125.Class153(@class)) { Struct33 *ptr = @class.pBase; Struct33 right = new Struct33(0, 0, 0, byte.MaxValue); for (int i = 0; i < base.Size.Height; i++) { for (int j = 0; j < base.Size.Width; j++) { if (Struct33.smethod_4(*ptr, right)) { return(true); } ptr++; } } } } } if (waitHandle != null) { waitHandle.Wait(100); } else { Thread.Sleep(100); } num++; }while (num < 100 && (waitHandle == null || !waitHandle.IsSet)); return(false); }
// Token: 0x06002B5D RID: 11101 RVA: 0x000A8F14 File Offset: 0x000A7114 private unsafe static void smethod_5(Bitmap original, Color[,] data) { int width = original.Width; int height = original.Height; using (Class125 @class = new Class125(original)) { using (new Class125.Class153(@class)) { Struct33 *ptr = @class.pBase; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { data[j, i] = Struct33.smethod_0(*ptr); ptr++; } } } } }
public uint imethod_4(ref Struct34 A_0, ref Struct33 A_1, int A_2) { Struct34 struct2 = A_0; Struct33 struct3 = A_1; if (IntPtr.Zero != struct3.intptr_0) { Marshal.AddRef(struct3.intptr_0); } struct3.intptr_1 = IntPtr.Zero; if (A_2 > 0) { if (IntPtr.Zero != A_1.intptr_0) { Marshal.Release(A_1.intptr_0); } if (IntPtr.Zero != A_1.intptr_1) { Marshal.Release(A_1.intptr_1); } } this.class941_0.Add(new Class940(DATADIR.DATADIR_SET, struct3, struct2)); return(0); }
uint Interface67.imethod_1(ref Struct34 A_0, ref Struct33 A_1) { return(0x80000001); }
public Class940(DATADIR A_0, Struct33 A_1, Struct34 A_2) { this.struct33_0 = A_1; this.struct34_0 = A_2; this.datadir_0 = A_0; }
// Token: 0x06002DA0 RID: 11680 RVA: 0x00015DED File Offset: 0x00013FED public static Struct54 smethod_2(Struct33 c) { return(new Struct54(c.R, c.G, c.B)); }
// Token: 0x06001E94 RID: 7828 RVA: 0x00063DB8 File Offset: 0x00061FB8 public unsafe void method_0() { try { Struct24 @struct = new Struct24(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue); Struct24 struct2 = new Struct24(int.MaxValue, int.MaxValue, int.MinValue, int.MinValue); bool * ptr = stackalloc bool[(UIntPtr)(this.class95_0.rectangle_0.Height * this.class95_0.rectangle_0.Width)]; bool * ptr2 = stackalloc bool[(UIntPtr)(this.class95_0.rectangle_0.Height * this.class95_0.rectangle_0.Width)]; Struct24 *ptr3 = &@struct; Struct24 *ptr4 = &struct2; using (Class125 @class = new Class125(this.bitmap_0)) { using (new Class125.Class153(@class)) { Array[][] array = new Array[this.class95_0.array_0.Length][]; this.class95_0.array_0.CopyTo(array, 0); for (int i = 0; i < this.class95_0.rectangle_0.Height; i++) { Array[] array2 = array[i]; Array[] array3 = array2; int j = 0; while (j < array3.Length) { Array array4 = array3[j]; int k = array4.GetLowerBound(0); int length = array4.GetLength(0); int num = k + length - 1; bool flag = false; if (this.class95_0.bool_0) { Struct33[] array5 = new Struct33[length]; array4.CopyTo(array5, 0); try { Struct33[] array6; Struct33 * ptr5; if ((array6 = array5) != null && array6.Length != 0) { fixed(Struct33 *ptr5 = &array6[0]) { } } else { ptr5 = null; } Struct33 *ptr6 = ptr5; Struct33 *ptr7 = @class.pBase + @class.Width * i + k; bool * ptr8 = ptr + k + (IntPtr)this.class95_0.rectangle_0.Width * (IntPtr)i; while (k <= num) { if (ptr7->A != ptr6->A || ptr7->R != ptr6->R || ptr7->G != ptr6->G || ptr7->B != ptr6->B) { *ptr8 = true; flag = true; if (ptr3->int_0 > k) { ptr3->int_0 = k; } if (ptr3->int_2 < k) { ptr3->int_2 = k; } } ptr7++; ptr6++; ptr8++; k++; } goto IL_3B8; } finally { Struct33 *ptr5 = null; } goto IL_25F; } goto IL_25F; IL_395: j++; continue; IL_36D: if (ptr3->int_1 > i) { ptr3->int_1 = i; } if (ptr3->int_3 < i) { ptr3->int_3 = i; goto IL_395; } goto IL_395; IL_25F: Struct54[] array7 = new Struct54[length]; array4.CopyTo(array7, 0); try { Struct54[] array8; Struct54 * ptr9; if ((array8 = array7) != null && array8.Length != 0) { fixed(Struct54 *ptr9 = &array8[0]) { } } else { ptr9 = null; } Struct54 *ptr10 = ptr9; Struct33 *ptr11 = @class.pBase + @class.Width * i + k; bool * ptr12 = ptr + k + (IntPtr)this.class95_0.rectangle_0.Width * (IntPtr)i; while (k <= num) { if (ptr11->R != ptr10->R || ptr11->G != ptr10->G || ptr11->B != ptr10->B) { *ptr12 = true; flag = true; if (ptr3->int_0 > k) { ptr3->int_0 = k; } if (ptr3->int_2 < k) { ptr3->int_2 = k; } } ptr11++; ptr10++; ptr12++; k++; } goto IL_3B8; } finally { Struct54 *ptr9 = null; } goto IL_36D; IL_3B8: if (flag) { goto IL_36D; } goto IL_395; } if (this.cancellationToken_0.IsCancellationRequested) { return; } } } } for (int l = ptr3->int_1; l < ptr3->int_3; l++) { bool flag2 = false; bool *ptr13 = ptr + ptr3->int_0 + (IntPtr)l * (IntPtr)this.class95_0.rectangle_0.Width; bool *ptr14 = ptr2 + ptr3->int_0 + (IntPtr)l * (IntPtr)this.class95_0.rectangle_0.Width; for (int m = ptr3->int_0; m < ptr3->int_2; m++) { if (*ptr13 && (m + 1 == this.class95_0.rectangle_0.Width || ptr13[1]) && (m == 0 || *(ptr13 - 1)) && (l + 1 == this.class95_0.rectangle_0.Height || ptr13[this.class95_0.rectangle_0.Width]) && (l == 0 || *(ptr13 - this.class95_0.rectangle_0.Width))) { *ptr14 = true; flag2 = true; if (ptr4->int_0 > m) { ptr4->int_0 = m; } if (ptr4->int_2 < m) { ptr4->int_2 = m; } } ptr13++; ptr14++; } if (flag2) { if (ptr4->int_1 > l) { ptr4->int_1 = l; } if (ptr4->int_3 < l) { ptr4->int_3 = l; } } if (this.cancellationToken_0.IsCancellationRequested) { return; } } for (int n = ptr4->int_1; n < ptr4->int_3; n++) { bool *ptr15 = ptr2 + ptr4->int_0 + (IntPtr)n * (IntPtr)this.class95_0.rectangle_0.Width; for (int num2 = ptr4->int_0; num2 < ptr4->int_2; num2++) { if (*ptr15) { Struct24 struct3 = this.class95_0.method_9(ptr15, num2, n); struct3.int_2++; struct3.int_3++; Rectangle rectangle = struct3.method_0(); Size size = rectangle.Size; Class335.smethod_3(Class95 <ColorType> .string_1, new object[] { rectangle }); if (size.Width > this.size_0.Width && size.Height > this.size_0.Height && size.Width < this.size_1.Width && size.Height < this.size_1.Height) { bool flag3 = true; for (int num3 = rectangle.Y; num3 < rectangle.Bottom; num3++) { int[] array9 = this.class95_0.int_1[num3]; if (array9.Length > 0) { foreach (int num5 in array9) { if (num5 >= rectangle.Left && num5 <= rectangle.Right) { flag3 = false; break; } } } else { flag3 = false; } if (!flag3) { break; } if (this.cancellationToken_0.IsCancellationRequested) { return; } } if (flag3) { Rectangle rectangle2 = rectangle.smethod_4(this.class95_0.rectangle_0.X, this.class95_0.rectangle_0.Y); Class335.smethod_3(Class95 <ColorType> .string_0, new object[] { rectangle2 }); this.list_0.Add(rectangle2); } } for (int num6 = struct3.int_1; num6 < struct3.int_3; num6++) { bool *ptr16 = ptr2 + struct3.int_0 + (IntPtr)num6 * (IntPtr)this.class95_0.rectangle_0.Width; for (int num7 = struct3.int_0; num7 < struct3.int_2; num7++) { *ptr16 = false; ptr16++; } } } ptr15++; } if (this.cancellationToken_0.IsCancellationRequested) { break; } } } catch (Exception ex) { this.exception_0 = ex; } }
// Token: 0x06001E8F RID: 7823 RVA: 0x000638A0 File Offset: 0x00061AA0 public unsafe bool method_10(Bitmap bmp, float minimum_percent) { int num = this.int_0 - (int)Math.Ceiling((double)(minimum_percent * (float)this.int_0)); Size size = bmp.Size; bool result; using (Class125 @class = new Class125(bmp)) { using (new Class125.Class153(@class)) { int num2 = 0; Array[][] array = new Array[this.array_0.Length][]; this.array_0.CopyTo(array, 0); int i = 0; int num3 = this.rectangle_0.Y; while (i < this.rectangle_0.Height) { Array[] array2 = array[i]; Array[] array3 = array2; int j = 0; while (j < array3.Length) { Array array4 = array3[j]; int k = array4.GetLowerBound(0) + this.rectangle_0.Left; int length = array4.GetLength(0); int num4 = k + length; Struct33 *ptr = @class.pBase + k + num3 * size.Width; if (this.bool_0) { Struct33[] array5 = new Struct33[length]; array4.CopyTo(array5, 0); try { Struct33[] array6; Struct33 * ptr2; if ((array6 = array5) != null && array6.Length != 0) { fixed(Struct33 *ptr2 = &array6[0]) { } } else { ptr2 = null; } Struct33 *ptr3 = ptr2; while (k < num4) { if (ptr->R != ptr3->R || ptr->G != ptr3->G || ptr->B != ptr3->B || ptr->A != ptr3->A) { num2++; } ptr3++; ptr++; k++; } goto IL_23F; } finally { Struct33 *ptr2 = null; } goto IL_193; } goto IL_193; IL_23F: j++; continue; IL_193: Struct54[] array7 = new Struct54[length]; array4.CopyTo(array7, 0); try { Struct54[] array8; Struct54 * ptr4; if ((array8 = array7) != null && array8.Length != 0) { fixed(Struct54 *ptr4 = &array8[0]) { } } else { ptr4 = null; } Struct54 *ptr5 = ptr4; while (k < num4) { if (ptr->R != ptr5->R || ptr->G != ptr5->G || ptr->B != ptr5->B) { num2++; } ptr5++; ptr++; k++; } goto IL_23F; } finally { Struct54 *ptr4 = null; } break; } if (num2 > num) { break; } i++; num3++; } result = (num2 <= num); } } return(result); }
// Token: 0x06001E87 RID: 7815 RVA: 0x00062FB8 File Offset: 0x000611B8 public unsafe Bitmap method_5(Color?replaceColor = null) { Bitmap bitmap = null; Bitmap result; try { bitmap = new Bitmap(this.size_0.Width, this.size_0.Height); if (this.array_0 != null) { using (Class125 @class = new Class125(bitmap)) { using (new Class125.Class153(@class)) { for (int i = this.rectangle_0.Top; i < this.rectangle_0.Bottom; i++) { Array[] array = (Array[])this.array_0.GetValue(i); short num = 0; while ((int)num < array.Length) { Array array2 = (Array)array.GetValue((int)num); int lowerBound = array2.GetLowerBound(0); int num2 = lowerBound + array2.Length - 1; Struct33 *ptr = @class.pBase + i * this.size_0.Width + lowerBound + this.rectangle_0.Left; if (replaceColor != null) { Struct33 @struct = Struct33.smethod_1(replaceColor.Value); for (int j = lowerBound; j <= num2; j++) { *ptr = @struct; ptr++; } } else if (this.bool_0) { for (int k = lowerBound; k <= num2; k++) { *ptr = (Struct33)array2.GetValue(k); ptr++; } } else { for (int l = lowerBound; l <= num2; l++) { *ptr = Struct33.smethod_2((Struct54)array2.GetValue(l)); ptr++; } } num += 1; } } } } } result = bitmap; } catch { if (bitmap != null) { bitmap.Dispose(); } throw; } return(result); }
// Token: 0x06002B5A RID: 11098 RVA: 0x000A88D0 File Offset: 0x000A6AD0 public static Bitmap smethod_2(Stream data_stream) { Bitmap result; using (Stream3 stream = new Stream3(data_stream)) { using (BinaryReader binaryReader = new BinaryReader(stream)) { stream.smethod_36(); byte b = binaryReader.ReadByte(); binaryReader.ReadByte(); short num = stream.smethod_36(); short num2 = stream.smethod_36(); short num3 = stream.smethod_36(); short num4 = stream.smethod_36(); stream.smethod_34(); stream.smethod_34(); stream.smethod_34(); binaryReader.ReadBytes(80); stream.smethod_34(); binaryReader.ReadBytes(404); int num5 = (int)(num3 * num4); Class486.Class487[] array = new Class486.Class487[num5]; int num6 = 0; if (b == 1) { for (int i = 0; i < num5; i++) { array[i] = new Class486.Class487(); array[i].int_0 = stream.smethod_34(); } for (int j = 0; j < num5; j++) { array[j].int_1 = stream.smethod_34(); } for (int k = 0; k < num5; k++) { array[k].byte_0 = new byte[(int)num2]; } Array.Reverse(array); if (num == 1) { Class486.smethod_6(stream, array[0]); } else { if (num != 2) { if (num != 3) { throw new InvalidDataException("Invalid SGI image format."); } } foreach (Class486.Class487 tbl in array) { Class486.smethod_6(stream, tbl); num6++; } } } Struct33[,] array3 = new Struct33[(int)num2, (int)num3]; int num7 = 0; num6 = 0; bool flag; if (num == 3) { switch (num4) { case 2: flag = true; for (int m = 0; m < (int)num4; m++) { int num8 = (int)num3 * m; num7 = 0; num6 = 0; for (int n = num8; n < num8 + (int)num3; n++) { Class486.Class487 @class = array[n]; foreach (byte b2 in @class.byte_0) { switch (m) { case 0: array3[num7, num6].A = b2; break; case 1: array3[num7, num6].R = b2; array3[num7, num6].G = b2; array3[num7, num6].B = b2; break; } num7++; } num7 = 0; num6++; } } break; case 3: case 4: flag = (num4 == 4); for (int num10 = (int)(num4 - 1); num10 >= 0; num10--) { int num11 = (int)num3 * ((int)num4 - num10 - 1); num7 = 0; num6 = 0; for (int num12 = num11; num12 < num11 + (int)num3; num12++) { Class486.Class487 class2 = array[num12]; foreach (byte b3 in class2.byte_0) { switch (num10) { case 0: array3[num7, num6].R = b3; break; case 1: array3[num7, num6].G = b3; break; case 2: array3[num7, num6].B = b3; break; case 3: array3[num7, num6].A = b3; break; } num7++; } num7 = 0; num6++; } } break; default: throw new NotSupportedException(string.Format("ZSIZE: '{0}' is not supported.", num4)); } } else { flag = true; foreach (Class486.Class487 class3 in array) { foreach (byte b4 in class3.byte_0) { array3[num7, num6].R = b4; array3[num7, num6].G = b4; array3[num7, num6].B = b4; array3[num7, num6].A = b4; num7++; } num7 = 0; num6++; } } Bitmap bitmap = null; try { if (flag) { bitmap = new Bitmap((int)num2, (int)num3, PixelFormat.Format32bppArgb); } else { bitmap = new Bitmap((int)num2, (int)num3, PixelFormat.Format32bppRgb); } Class486.smethod_3(bitmap, array3); result = bitmap; } catch { if (bitmap != null) { bitmap.Dispose(); } throw; } } } return(result); }
// Token: 0x06002B58 RID: 11096 RVA: 0x000A8164 File Offset: 0x000A6364 public static void smethod_0(Stream data_stream, Stream destination_stream, Bitmap destination_bitmap, Color?backGroundColor, bool convert_to_grayscale, Enum14 format) { using (Bitmap bitmap = (Bitmap)Image.FromStream(data_stream)) { if (destination_bitmap != null && backGroundColor != null) { if (destination_bitmap.Width == bitmap.Width) { if (destination_bitmap.Height == bitmap.Height) { using (Graphics graphics = Graphics.FromImage(destination_bitmap)) { using (SolidBrush solidBrush = new SolidBrush(backGroundColor.Value)) { graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.InterpolationMode = InterpolationMode.High; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.FillRectangle(solidBrush, 0, 0, destination_bitmap.Width, destination_bitmap.Height); graphics.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height); } goto IL_B2; } } } throw new ArgumentException("Destination dimensions do not match source image dimensions."); } IL_B2: if (convert_to_grayscale) { Class125.smethod_1(bitmap); } using (Stream3 stream = new Stream3(destination_stream)) { using (BinaryWriter binaryWriter = new BinaryWriter(stream)) { stream.smethod_37(Class486.short_0); stream.WriteByte(1); stream.WriteByte(1); short num; short value; switch (format) { case Enum14.const_0: num = 4; value = 3; break; case Enum14.const_1: num = 3; value = 3; break; case Enum14.const_2: num = 2; value = 3; break; case Enum14.const_3: num = 1; value = 2; break; default: throw new NotSupportedException(string.Format("The specified format: '{0}' is not supported.", format)); } stream.smethod_37(value); stream.smethod_37((short)bitmap.Width); stream.smethod_37((short)bitmap.Height); stream.smethod_37(num); stream.smethod_35(0); stream.smethod_35(255); binaryWriter.Write(new byte[4]); binaryWriter.Write(new byte[80]); stream.smethod_35(0); binaryWriter.Write(new byte[404]); for (int i = 0; i < (int)num; i++) { for (int j = 0; j < bitmap.Height; j++) { stream.smethod_35(0); } for (int k = 0; k < bitmap.Height; k++) { stream.smethod_35(0); } } Class486.Class487[] array = new Class486.Class487[bitmap.Height]; if (destination_bitmap == null) { array = new Class486.Class487[bitmap.Height * (int)num]; Struct33[,] array2 = new Struct33[bitmap.Width, bitmap.Height]; Class486.smethod_4(bitmap, array2); switch (format) { case Enum14.const_0: case Enum14.const_1: for (int l = (int)(num - 1); l >= 0; l--) { int num2 = ((int)(num - 1) - l) * bitmap.Height; for (int m = 0; m < bitmap.Height; m++) { Class486.Class487 @class = array[num2 + m] = new Class486.Class487(); @class.byte_0 = new byte[bitmap.Width]; for (int n = 0; n < bitmap.Width; n++) { switch (l) { case 0: @class.byte_0[n] = array2[n, m].R; break; case 1: @class.byte_0[n] = array2[n, m].G; break; case 2: @class.byte_0[n] = array2[n, m].B; break; case 3: @class.byte_0[n] = array2[n, m].A; break; } } } } break; case Enum14.const_2: for (int num3 = (int)(num - 1); num3 >= 0; num3--) { int num4 = ((int)(num - 1) - num3) * bitmap.Height; for (int num5 = 0; num5 < bitmap.Height; num5++) { Class486.Class487 class2 = array[num4 + num5] = new Class486.Class487(); class2.byte_0 = new byte[bitmap.Width]; for (int num6 = 0; num6 < bitmap.Width; num6++) { switch (num3) { case 0: class2.byte_0[num6] = array2[num6, num5].R; break; case 1: class2.byte_0[num6] = array2[num6, num5].A; break; } } } } break; case Enum14.const_3: for (int num7 = 0; num7 < bitmap.Height; num7++) { array[num7] = new Class486.Class487(); array[num7].byte_0 = new byte[bitmap.Width]; for (int num8 = 0; num8 < bitmap.Width; num8++) { array[num7].byte_0[num8] = array2[num8, num7].R; } } break; default: throw new NotSupportedException("Format not supported: " + format); } } else { array = new Class486.Class487[bitmap.Height]; Color[,] array3 = new Color[bitmap.Width, bitmap.Height]; Class486.smethod_5(bitmap, array3); for (int num9 = 0; num9 < bitmap.Height; num9++) { array[num9] = new Class486.Class487(); array[num9].byte_0 = new byte[bitmap.Width]; for (int num10 = 0; num10 < bitmap.Width; num10++) { array[num9].byte_0[num10] = array3[num10, num9].A; } } } foreach (Class486.Class487 tbl in array) { Class486.smethod_7(stream, tbl); } Array.Reverse(array); binaryWriter.Seek(512, SeekOrigin.Begin); foreach (Class486.Class487 class3 in array) { stream.smethod_35(class3.int_0); } foreach (Class486.Class487 class4 in array) { stream.smethod_35(class4.int_1); } } } } }