void ShowCurrentImage() { if (SlideshowImages.Count == 0 || CurrentShowingImageIndex >= SlideshowImages.Count) { return; } var img = SlideshowImages[CurrentShowingImageIndex]; Next.Source = img; if (Next == Image1) { Image1.FadeIn(500); Image2.FadeOut(500); Next = Image2; } else { Image2.FadeIn(500); Image1.FadeOut(500); Next = Image1; } CurrentShowingImageIndex++; }
private void WriteLogicalScreenDescriptor(Image2 image, EndianBinaryWriter writer, int tranparencyIndex) { GifLogicalScreenDescriptor descriptor = new GifLogicalScreenDescriptor { Width = (short)image.Width, Height = (short)image.Height, GlobalColorTableFlag = false, // Always false for now. GlobalColorTableSize = bitDepth - 1, BackgroundColorIndex = (byte)(tranparencyIndex > -1 ? tranparencyIndex : 255) }; writer.Write((ushort)descriptor.Width); writer.Write((ushort)descriptor.Height); PackedField field = new PackedField(); field.SetBit(0, descriptor.GlobalColorTableFlag); // 1 : Global color table flag = 1 || 0 (GCT used/ not used) field.SetBits(1, 3, descriptor.GlobalColorTableSize); // 2-4 : color resolution field.SetBit(4, false); // 5 : GCT sort flag = 0 field.SetBits(5, 3, descriptor.GlobalColorTableSize); // 6-8 : GCT size. 2^(N+1) // Reduce the number of writes byte[] arr = { field.Byte, descriptor.BackgroundColorIndex, // Background Color Index descriptor.PixelAspectRatio // Pixel aspect ratio. Assume 1:1 }; writer.Write(arr); }
private void ccw_Click(object sender, EventArgs e) { ImageData = Image.LockBits(new Rectangle(0, 0, Image.Width, Image.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); ImageData2 = Image2.LockBits(new Rectangle(0, 0, Image2.Width, Image2.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); buffer = new byte[ImageData.Stride * Image.Height]; buffer2 = new byte[ImageData2.Stride * Image2.Height]; pointer = ImageData.Scan0; pointer2 = ImageData2.Scan0; Marshal.Copy(pointer, buffer, 0, buffer.Length); for (int y = 0, xx = 0; y < Image.Height; y++, xx += 3) { for (int x = 0, yy = Image2.Height - 1; x < Image.Width * 3; x += 3, yy--) { location = x + y * ImageData.Stride; location2 = xx + yy * ImageData2.Stride; buffer2[location2] = buffer[location]; buffer2[location2 + 1] = buffer[location + 1]; buffer2[location2 + 2] = buffer[location + 2]; } } Marshal.Copy(buffer2, 0, pointer2, buffer.Length); Image.UnlockBits(ImageData); Image2.UnlockBits(ImageData2); pictureBox1.Image = Image2; }
private void initWorldUITransformFactor(Vector2 mapImgSize, SLevelContext levelContext, bool bMiniMap, out Vector2 world_UI_Factor, out Vector2 UI_world_Factor) { int num = !bMiniMap ? levelContext.m_bigMapWidth : levelContext.m_mapWidth; int num2 = !bMiniMap ? levelContext.m_bigMapHeight : levelContext.m_mapHeight; float x = mapImgSize.x / ((float)num); float y = mapImgSize.y / ((float)num2); world_UI_Factor = new Vector2(x, y); float num5 = ((float)num) / mapImgSize.x; float num6 = ((float)num2) / mapImgSize.y; UI_world_Factor = new Vector2(num5, num6); if (levelContext.m_isCameraFlip) { world_UI_Factor = new Vector2(-x, -y); UI_world_Factor = new Vector2(-num5, -num6); } GameObject obj2 = !bMiniMap ? this.bmRoot : this.mmRoot; if (obj2 != null) { Image2 component = obj2.GetComponent <Image2>(); if (component != null) { float num7 = !bMiniMap ? levelContext.m_bigMapFowScale : levelContext.m_mapFowScale; float num8 = !levelContext.m_isCameraFlip ? 1f : 0f; component.SetMaterialVector("_FowParams", new Vector4(num7, num8, 1f, 1f)); } } }
IEnumerator IStart() { Hasbegin = true; Image1.DOFade(1, 1f); m_Text.DOFade(0, 1); yield return(new WaitForSeconds(1)); m_Text.text = "Your Friend: Traitor! I'll kill you!"; m_Text.DOFade(1, 1); yield return(new WaitForSeconds(4.5f)); Image1.DOFade(0, 1f); Image2.DOFade(1, 1f); m_Text.DOFade(0, 1); yield return(new WaitForSeconds(1)); m_Text.text = "You: I didin't betray you!\nIt's a misunderstanding"; m_Text.DOFade(1, 1); yield return(new WaitForSeconds(3f)); Image2.DOFade(0, 1f); Image3.DOFade(1, 1f); m_Text.DOFade(0, 1); yield return(new WaitForSeconds(1)); m_Text.text = "Your Friend: I don't believe you any moreeeeeeee"; m_Text.DOFade(1, 1); yield return(new WaitForSeconds(3f)); BeginTime = Time.unscaledTime; SceneManager.LoadScene(1); }
private void ReadPhysicalChunk(Image2 image, byte[] data) { Array.Reverse(data, 0, 4); Array.Reverse(data, 4, 4); image.HorizontalResolution = BitConverter.ToInt32(data, 0) / 39.3700787d; image.VerticalResolution = BitConverter.ToInt32(data, 4) / 39.3700787d; }
public void Decode(Image2 image, Stream stream) { if (image == null || stream == null){ throw new ArgumentNullException(); } new BmpDecoderCore().Decode(image, stream); }
public BrushImageTestPage() { InitializeComponent(); ButtonSolid.Clicked += OnClickedSolid; ButtonGradientLinear.Clicked += OnClickedLinear; ButtonGradientRadial.Clicked += OnClickedRadial; Image1.SetImage(ResourcePath + "tizen.png"); Image2.SetImage(ResourcePath + "xamarin_logo.png"); PropertyArray stopColor = new PropertyArray(); stopColor.Add(new PropertyValue(new Vector4(255.0f, 0.0f, 0.0f, 255.0f) / 255.0f)); stopColor.Add(new PropertyValue(new Vector4(0.0f, 255.0f, 0.0f, 255.0f) / 255.0f)); LinearGradient = new GradientVisual(); LinearGradient.StopColor = stopColor; LinearGradient.StartPosition = new Vector2(0.0f, 0.0f); LinearGradient.EndPosition = new Vector2(0.3f, 0.3f); LinearGradient.Origin = Visual.AlignType.TopBegin; RadialGradient = new GradientVisual(); RadialGradient.Center = new Vector2(0.0f, 0.0f); RadialGradient.Radius = 0.5f; RadialGradient.StopColor = stopColor; RadialGradient.Origin = Visual.AlignType.TopBegin; }
public virtual void ChangeDisplay(bool selected) { if ((this.m_image != null) && (this.m_selectedSprite != null)) { if (selected) { this.m_image.sprite = this.m_selectedSprite; this.m_image.color = new Color(this.m_defaultColor.r, this.m_defaultColor.g, this.m_defaultColor.b, 255f); } else { this.m_image.sprite = this.m_defaultSprite; this.m_image.color = this.m_defaultColor; } if (this.m_image is Image2) { Image2 image = this.m_image as Image2; image.alphaTexLayout = !selected ? this.m_defaultLayout : this.m_selectedLayout; } } if (this.m_selectFrontObj != null) { this.m_selectFrontObj.CustomSetActive(selected); } if (this.m_textObj != null) { this.m_textObj.color = !selected ? this.m_defaultTextColor : this.m_selectTextColor; } }
public static Image2 Quantize(this Image2 source, IQuantizer quantizer, int maxColors) { QuantizedImage quantizedImage = quantizer.Quantize(source, maxColors); source.SetPixels(source.Width, source.Height, quantizedImage.ToImage().Pixels); return(source); }
public virtual void ChangeDisplay(bool selected) { if (this.m_image != null && this.m_selectedSprite != null) { if (selected) { this.m_image.set_sprite(this.m_selectedSprite); this.m_image.set_color(new Color(this.m_defaultColor.r, this.m_defaultColor.g, this.m_defaultColor.b, 255f)); } else { this.m_image.set_sprite(this.m_defaultSprite); this.m_image.set_color(this.m_defaultColor); } if (this.m_image is Image2) { Image2 image = this.m_image as Image2; image.alphaTexLayout = (selected ? this.m_selectedLayout : this.m_defaultLayout); } } if (this.m_selectFrontObj != null) { this.m_selectFrontObj.CustomSetActive(selected); } if (this.m_textObj != null) { this.m_textObj.set_color(selected ? this.m_selectTextColor : this.m_defaultTextColor); } }
public static void SetImageSprite(Image image, GameObject prefab, bool isShowSpecMatrial = false) { if (image == null) { return; } if (prefab == null) { image.set_sprite(null); return; } SpriteRenderer component = prefab.GetComponent <SpriteRenderer>(); if (component != null) { image.set_sprite(component.sprite); if (isShowSpecMatrial && component.sharedMaterial != null && component.sharedMaterial.shader != null && !component.sharedMaterial.shader.name.Equals(CUIUtility.s_ui_defaultShaderName)) { float[] materailMaskPars = CUIUtility.GetMaterailMaskPars(image.get_material()); image.set_material(new Material(component.sharedMaterial)); image.get_material().shaderKeywords = component.sharedMaterial.shaderKeywords; CUIUtility.SetMaterailMaskPars(materailMaskPars, image.get_material()); } else if (isShowSpecMatrial) { image.set_material(null); } } if (image is Image2) { SGameSpriteSettings component2 = prefab.GetComponent <SGameSpriteSettings>(); Image2 image2 = image as Image2; image2.alphaTexLayout = ((component2 != null) ? component2.layout : ImageAlphaTexLayout.None); } }
private static bool RadialCut(Vector2[] xy, Vector2[] uv, float fill, bool invert, int corner) { if ((double)fill < 0.001) { return(false); } if ((corner & 1) == 1) { invert = !invert; } if (!invert && (double)fill > 0.999000012874603) { return(true); } float num = Mathf.Clamp01(fill); if (invert) { num = 1f - num; } float f = num * 1.570796f; float cos = Mathf.Cos(f); float sin = Mathf.Sin(f); Image2.RadialCut(xy, cos, sin, invert, corner); Image2.RadialCut(uv, cos, sin, invert, corner); return(true); }
/// <summary> /// Implements the operator |. /// </summary> /// <param name="Image1">The first image.</param> /// <param name="Image2">The second image</param> /// <returns>The result of the operator.</returns> public static SwiftBitmap operator |(SwiftBitmap Image1, SwiftBitmap Image2) { Contract.Requires <ArgumentNullException>(Image1 != null, "Image1"); Contract.Requires <ArgumentNullException>(Image2 != null, "Image2"); Image1.Lock(); Image2.Lock(); var Result = new SwiftBitmap(Image1.Width, Image1.Height); Result.Lock(); Parallel.For(0, Result.Width, x => { for (int y = 0; y < Result.Height; ++y) { var Pixel1 = Image1.GetPixel(x, y); var Pixel2 = Image2.GetPixel(x, y); Result.SetPixel(x, y, Color.FromArgb(Pixel1.R | Pixel2.R, Pixel1.G | Pixel2.G, Pixel1.B | Pixel2.B)); } }); Image2.Unlock(); Image1.Unlock(); return(Result.Unlock()); }
public void Image2_Clicked(object sender, EventArgs e) { Image2.ScaleTo(0.8); Image2.BorderWidth = 5; Image2.BorderColor = Xamarin.Forms.Color.Red; App.imsource = Image2.Source; }
public void Decode(Image2 image, Stream stream) { if (image == null || stream == null) { throw new ArgumentNullException(); } new BmpDecoderCore().Decode(image, stream); }
public void ImageChange(int n) { if (dialog.GetComponent <Dialog> ().LineNumber == n) { Image1.SetActive(false); Image2.SetActive(true); } }
public void Decode(Image2 image, Stream stream) { if (image == null || stream == null){ throw new ArgumentNullException(); } JpegDecoderCore decoder = new JpegDecoderCore(); decoder.Decode(image, stream, false); }
public void Encode(ImageBase imageBase, Stream stream) { if (imageBase == null || stream == null) { throw new ArgumentNullException(); } Image2 image = (Image2)imageBase; if (Quantizer == null) { Quantizer = new OctreeQuantizer { Threshold = Threshold }; } // Do not use IDisposable pattern here as we want to preserve the stream. EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Little, stream); // Ensure that quality can be set but has a fallback. int quality = Quality > 0 ? Quality : imageBase.Quality; Quality = quality > 0 ? NumUtils.Clamp(quality, 1, 256) : 256; // Get the number of bits. bitDepth = GetBitsNeededForColorDepth(Quality); // Quantize the image returning a palette. QuantizedImage quantized = Quantizer.Quantize(image, Quality); // Write the header. WriteHeader(writer); // Write the LSD. We'll use local color tables for now. WriteLogicalScreenDescriptor(image, writer, quantized.TransparentIndex); // Write the first frame. WriteGraphicalControlExtension(imageBase, writer, quantized.TransparentIndex); WriteImageDescriptor(image, writer); WriteColorTable(quantized, writer); WriteImageData(quantized, writer); // Write additional frames. if (image.Frames.Any()) { WriteApplicationExtension(writer, image.RepeatCount, image.Frames.Count); foreach (ImageFrame frame in image.Frames) { QuantizedImage quantizedFrame = Quantizer.Quantize(frame, Quality); WriteGraphicalControlExtension(frame, writer, quantizedFrame.TransparentIndex); WriteImageDescriptor(frame, writer); WriteColorTable(quantizedFrame, writer); WriteImageData(quantizedFrame, writer); } } // TODO: Write Comments extension etc writer.Write(GifConstants.endIntroducer); }
/* Converting The Image file: * 1-Lock the Image Bits in the memory (PixelFormat.Format24bppRgb means that the program is going to lock only red , green and blue without including the alpha channel) * 2-initializing the buffer array it's going to have all the image data (the image have height and width which leads to total pixel count = height * width and each pixel have r,g,b so the array length = height*width*3) * 3-set the pointer to the location of the red value of the first pixel of the image * 4-copy the Image Data to the Buffer Array * 5-Loop through each pixel and make the loop step = 3 (i+=3) * 6-apply the window on the current pixel * 7-sum all pixels in the window and divide them by their count * 8-assign the channels total values to output array once the you finished looping through the window * 9-unlock the image bits */ private void convertbtn_Click(object sender, EventArgs e) { ImageData = Image.LockBits(new Rectangle(0, 0, Image.Width, Image.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); ImageData2 = Image2.LockBits(new Rectangle(0, 0, Image.Width, Image.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); buffer = new byte[ImageData.Stride * Image.Height]; buffer2 = new byte[ImageData.Stride * Image.Height]; pointer = ImageData.Scan0; pointer2 = ImageData2.Scan0; Marshal.Copy(pointer, buffer, 0, buffer.Length); glid = (int)numsmooth.Value; for (int y = 0; y < Image.Height; y++) //Same idea you need to watch sharp by c# video first { for (int x = 0; x < Image.Width * 3; x += 3) { r = g = b = count = 0; //reset the channels values location = x + y * ImageData.Stride; //to get the location of any pixel >> location = x + y * Stride for (int yy = -glid, yyy = 0; yy <= glid; yy++, yyy++) { if (y + yy >= 0 && y + yy < Image.Height) //to prevent crossing the bounds of the array { for (int xx = -glid * 3, xxx = 0; xx <= glid * 3; xx += 3, xxx++) { if (x + xx >= 0 && x + xx <= Image.Width * 3 - 3) //to prevent crossing the bounds of the array { location2 = x + xx + (yy + y) * ImageData.Stride; //to get the location of any pixel >> location = x + y * Stride b += buffer[location2]; g += buffer[location2 + 1]; r += buffer[location2 + 2]; count++; } } } } b = b / count; g = g / count; r = r / count; if (b > 255) { b = 255; } if (g > 255) { g = 255; } if (r > 255) { r = 255; } buffer2[location] = (byte)b; buffer2[location + 1] = (byte)g; buffer2[location + 2] = (byte)r; } } Marshal.Copy(buffer2, 0, pointer2, buffer.Length); Image.UnlockBits(ImageData); Image2.UnlockBits(ImageData2); pictureBox1.Image = Image2; }
public override void Save() { if (_fileList1 != null) { _fileList1.IsLoaded = true; } if (_imageList1 != null) { _imageList1.IsLoaded = true; } CompletePath = GetCompletePath(); if (IsNew) { if (ParentGroup == null) { //OrderingNumber = this.DataCollection.CalculateNewRootOrderingNumber(); } else { //OrderingNumber = ParentGroup.CalculateNewOrderingNumber(); } } //zorg dat in de db altijd relatieve urls blijven bestaan //if (Image1 != null) this.Image1 = Image1.Replace(Site.DomainName + "/", ""); //if (Image2 != null) this.Image2 = Image2.Replace(Site.DomainName + "/", ""); //if (Image3 != null) this.Image3 = Image3.Replace(Site.DomainName + "/", ""); //if (Image4 != null) this.Image4 = Image4.Replace(Site.DomainName + "/", ""); //if (Image5 != null) this.Image5 = Image5.Replace(Site.DomainName + "/", ""); if (Image1 != null) { this.Image1 = Image1.Replace(Site.DomainName, ""); } if (Image2 != null) { this.Image2 = Image2.Replace(Site.DomainName, ""); } if (Image3 != null) { this.Image3 = Image3.Replace(Site.DomainName, ""); } if (Image4 != null) { this.Image4 = Image4.Replace(Site.DomainName, ""); } if (Image5 != null) { this.Image5 = Image5.Replace(Site.DomainName, ""); } //this._extraFieldsJsonString = Utils.JSONSerializer.Serialize(this.ExtraFields); base.Save(); string sql = String.Format("UPDATE DataCollection SET ModifiedDate=NOW() WHERE ID='{0}'", DataCollection.ID); DataBase.Get().Execute(sql); }
void ReleaseDesignerOutlets() { if (Button1 != null) { Button1.Dispose(); Button1 = null; } if (Button2 != null) { Button2.Dispose(); Button2 = null; } if (Button3 != null) { Button3.Dispose(); Button3 = null; } if (Button4 != null) { Button4.Dispose(); Button4 = null; } if (Button5 != null) { Button5.Dispose(); Button5 = null; } if (Button6 != null) { Button6.Dispose(); Button6 = null; } if (Image1 != null) { Image1.Dispose(); Image1 = null; } if (Image2 != null) { Image2.Dispose(); Image2 = null; } if (WebView1 != null) { WebView1.Dispose(); WebView1 = null; } }
async void animatePage1(uint duration) { await Task.WhenAll( Image1.RotateTo(307 * 360, duration), Image2.RotateXTo(251 * 360, duration), Image3.RotateYTo(199 * 360, duration) ); //await Image1.RelRotateTo(307 * 360, duration); }
public void Decode(Image2 image, Stream stream) { if (image == null || stream == null) { throw new ArgumentNullException(); } JpegDecoderCore decoder = new JpegDecoderCore(); decoder.Decode(image, stream, false); }
private void checkvalues() { Image2.Width = 280; Image2.Height = 450; if (CheckBoxListNumImagen.SelectedItem.Text == "1") { ListItem listItem = this.CheckBoxListSalida.Items.FindByText("RVPA"); if (listItem != null) { listItem.Selected = false; } listItem = this.CheckBoxListSalida.Items.FindByText("Recargas Prepago"); if (listItem != null) { listItem.Selected = false; } listItem = this.CheckBoxListSalida.Items.FindByText("Intercompany"); if (listItem != null) { listItem.Selected = false; } listItem = this.CheckBoxListSalida.Items.FindByText("Mayorista"); if (listItem != null) { listItem.Selected = false; } listItem = this.CheckBoxListSalida.Items.FindByText("Venta de Kits Callcenter"); if (listItem != null) { listItem.Selected = false; } listItem = this.CheckBoxListSalida.Items.FindByText("Venta de Kits Salesman"); if (listItem != null) { listItem.Selected = false; } Image2.Visible = true; Image2.ImageUrl = "ImageCSharp.aspx?FileName=f_sal1.jpg"; Image2.DataBind(); } if ((CheckBoxListNumImagen.SelectedItem.Text == "2") || (CheckBoxListNumImagen.SelectedItem.Text == "3") || (CheckBoxListNumImagen.SelectedItem.Text == "4") || (CheckBoxListNumImagen.SelectedItem.Text == "5") || (CheckBoxListNumImagen.SelectedItem.Text == "6")) { ListItem listItem = this.CheckBoxListSalida.Items.FindByText("Pospago"); if (listItem != null) { listItem.Selected = false; } Image2.Visible = true; Image2.ImageUrl = "ImageCSharp.aspx?FileName=f_sal2.jpg"; Image2.DataBind(); } }
public void Decode(Image2 image, Stream stream) { decodedImage = image; currentStream = stream; // Skip the identifier currentStream.Seek(6, SeekOrigin.Current); ReadLogicalScreenDescriptor(); if (logicalScreenDescriptor.GlobalColorTableFlag) { globalColorTable = new byte[logicalScreenDescriptor.GlobalColorTableSize * 3]; // Read the global color table from the stream stream.Read(globalColorTable, 0, globalColorTable.Length); } // Loop though the respective gif parts and read the data. int nextFlag = stream.ReadByte(); while (nextFlag != GifConstants.terminator) { if (nextFlag == GifConstants.imageLabel) { ReadFrame(); } else if (nextFlag == GifConstants.extensionIntroducer) { int label = stream.ReadByte(); switch (label) { case GifConstants.graphicControlLabel: ReadGraphicalControlExtension(); break; case GifConstants.commentLabel: ReadComments(); break; case GifConstants.applicationExtensionLabel: Skip(12); // No need to read. break; case GifConstants.plainTextLabel: Skip(13); // Not supported by any known decoder. break; } } else if (nextFlag == GifConstants.endIntroducer) { break; } nextFlag = stream.ReadByte(); } }
/* Converting The Image file: * 1-Lock the Image Bits in the memory (PixelFormat.Format24bppRgb means that the program is going to lock only red , green and blue without including the alpha channel) * 2-initializing the buffer array it's going to have all the image data (the image have height and width which leads to total pixel count = height * width and each pixel have r,g,b so the array length = height*width*3) * 3-set the pointer to the location of the blue value of the first pixel of the image * 4-copy the Image Data to the Buffer Array * 5-Loop through each pixel and make the loop step = 3 (i+=3) * 6-assigin each channel value to it's corresponding variable * 7-check for current pixel's channel values to find the biggest value that would be the brightness of the pixel (brightness1) * 8-check for previous pixel's channel values to find the biggest value that would be the brightness of the pixel (brightness2) * 9-subtract brightness1 and brightness2 and assigin the value to output array * 8-copy back the image Data2 from buffer to Image2 using the same pointer location * 9-unlock the image bits */ private void button4_Click(object sender, EventArgs e) { ImageData = Image.LockBits(new Rectangle(0, 0, Image.Width, Image.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); ImageData2 = Image2.LockBits(new Rectangle(0, 0, Image.Width, Image.Height), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); buffer = new byte[ImageData.Stride * Image.Height]; buffer2 = new byte[ImageData.Stride * Image.Height]; pointer = ImageData.Scan0; pointer2 = ImageData2.Scan0; Marshal.Copy(pointer, buffer, 0, buffer.Length); for (int i = 0; i < Image.Width * Image.Height * 3; i += 3) { if (i != 0) { b = buffer[i]; g = buffer[i + 1]; r = buffer[i + 2]; if (b != g | b != r | g != r) { brightness1 = Math.Max(Math.Max(r, g), b); } else { brightness1 = b; } b = buffer[i - 3]; g = buffer[i - 2]; r = buffer[i - 1]; if (b != g | b != r | g != r) { brightness2 = Math.Max(Math.Max(r, g), b); } else { brightness2 = b; } sub = (byte)Math.Abs(brightness1 - brightness2); buffer2[i] = (byte)sub; buffer2[i + 1] = (byte)sub; buffer2[i + 2] = (byte)sub; } else { buffer2[i] = buffer[i]; buffer2[i + 1] = buffer[i + 1]; buffer2[i + 2] = buffer[i + 2]; } } Marshal.Copy(buffer2, 0, pointer2, buffer.Length); Image.UnlockBits(ImageData); Image2.UnlockBits(ImageData2); pictureBox2.Image = Image2; }
public Image2 ToImage() { Image2 image = new Image2(); int pixelCount = Pixels.Length; int palletCount = Palette.Length - 1; Color2[] pixels = new Color2[pixelCount]; Parallel.For(0, pixelCount, Bootstrapper.instance.ParallelOptions, i =>{ Color2 color = Palette[Math.Min(palletCount, Pixels[i])]; pixels[i] = color; }); image.SetPixels(Width, Height, pixels); return image; }
private void Wizard_FormClosed(object sender, FormClosedEventArgs e) { if (Image1 != null) { Image1.Dispose(); } if (Image2 != null) { Image2.Dispose(); } this.Dispose(true); GC.Collect(); }
private void button3_Click(object sender, EventArgs e) { if (Image1 != null) { Image1.Dispose(); } if (Image2 != null) { Image2.Dispose(); } this.Close(); this.Dispose(); GC.Collect(); }
public static Bitmap2 GetImage(string file) { Assembly thisExe = Assembly.GetExecutingAssembly(); Stream file1 = thisExe.GetManifestResourceStream("PerseusPluginLib.img." + file); if (file1 == null) { return(null); } Bitmap2 bm = Image2.ReadImage(file1); file1.Close(); return(bm); }
void OnEnable() { if (Image1 != null) { Vector3 lifeImage2Pos = Image1.GetComponent <RectTransform>().position; lifeImage2Pos.y -= Image1.GetComponent <RectTransform>().GetHeight(); Image2.GetComponent <RectTransform>().position = lifeImage2Pos; StartingPos = Image1.GetComponent <RectTransform>().position; CutMaskStartingY = CutMask.transform.position.y; CutMaskHeight = CutMask.GetComponent <RectTransform>().GetHeight(); } }
public Image2 ToImage() { Image2 image = new Image2(); int pixelCount = Pixels.Length; int palletCount = Palette.Length - 1; Color2[] pixels = new Color2[pixelCount]; Parallel.For(0, pixelCount, Bootstrapper.instance.ParallelOptions, i => { Color2 color = Palette[Math.Min(palletCount, Pixels[i])]; pixels[i] = color; }); image.SetPixels(Width, Height, pixels); return(image); }
public void Decode(Image2 image, Stream stream) { decodedImage = image; currentStream = stream; // Skip the identifier currentStream.Seek(6, SeekOrigin.Current); ReadLogicalScreenDescriptor(); if (logicalScreenDescriptor.GlobalColorTableFlag){ globalColorTable = new byte[logicalScreenDescriptor.GlobalColorTableSize*3]; // Read the global color table from the stream stream.Read(globalColorTable, 0, globalColorTable.Length); } // Loop though the respective gif parts and read the data. int nextFlag = stream.ReadByte(); while (nextFlag != GifConstants.terminator){ if (nextFlag == GifConstants.imageLabel){ ReadFrame(); } else if (nextFlag == GifConstants.extensionIntroducer){ int label = stream.ReadByte(); switch (label){ case GifConstants.graphicControlLabel: ReadGraphicalControlExtension(); break; case GifConstants.commentLabel: ReadComments(); break; case GifConstants.applicationExtensionLabel: Skip(12); // No need to read. break; case GifConstants.plainTextLabel: Skip(13); // Not supported by any known decoder. break; } } else if (nextFlag == GifConstants.endIntroducer){ break; } nextFlag = stream.ReadByte(); } }
public void Decode(Image2 image, Stream stream, bool configOnly) { inputStream = stream; ReadFull(tmp, 0, 2); if (tmp[0] != JpegConstants.Markers.XFF || tmp[1] != JpegConstants.Markers.SOI){ throw new Exception("Missing SOI marker."); } while (true){ ReadFull(tmp, 0, 2); while (tmp[0] != 0xff){ tmp[0] = tmp[1]; tmp[1] = ReadByte(); } byte marker = tmp[1]; if (marker == 0){ continue; } while (marker == 0xff){ marker = ReadByte(); } if (marker == JpegConstants.Markers.EOI){ break; } if (JpegConstants.Markers.RST0 <= marker && marker <= JpegConstants.Markers.RST7){ continue; } ReadFull(tmp, 0, 2); int n = (tmp[0] << 8) + tmp[1] - 2; if (n < 0){ throw new Exception("Short segment length."); } switch (marker){ case JpegConstants.Markers.SOF0: case JpegConstants.Markers.SOF1: case JpegConstants.Markers.SOF2: progressive = marker == JpegConstants.Markers.SOF2; ProcessSof(n); if (configOnly && jfif){ return; } break; case JpegConstants.Markers.DHT: if (configOnly){ Ignore(n); } else{ ProcessDht(n); } break; case JpegConstants.Markers.DQT: if (configOnly){ Ignore(n); } else{ ProcessDqt(n); } break; case JpegConstants.Markers.SOS: if (configOnly){ return; } ProcessSos(n); break; case JpegConstants.Markers.DRI: if (configOnly){ Ignore(n); } else{ ProcessDri(n); } break; case JpegConstants.Markers.APP0: ProcessApp0Marker(n); break; case JpegConstants.Markers.APP14: ProcessApp14Marker(n); break; default: if (JpegConstants.Markers.APP0 <= marker && marker <= JpegConstants.Markers.APP15 || marker == JpegConstants.Markers.COM){ Ignore(n); } else if (marker < JpegConstants.Markers.SOF0){ throw new Exception("Unknown marker"); } else{ throw new Exception("Unknown marker"); } break; } } if (grayImage != null){ ConvertFromGrayScale(width, height, image); } else if (ycbcrImage != null){ if (IsRgb()){ ConvertFromRgb(width, height, image); } else{ ConvertFromYCbCr(width, height, image); } } else{ throw new Exception("Missing SOS marker."); } }
public void Decode(Image2 image, Stream stream) { new PngDecoderCore().Decode(image, stream); }