Exemple #1
0
 internal D2DSpriteBitmap(D2DSpriteBatch batch, Stream fs)
 {
     this.batch            = batch;
     batch.BatchDisposing += batch_BatchDisposing;
     orgBitmap             = (Bitmap)Bitmap.FromStream(fs);
     CreateBitmap();
 }
Exemple #2
0
        /// <summary>
        /// Handle the completion of our map tile download
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void MM_MapTile_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            try
            {
                MM_MapTile Sender = (MM_MapTile)e.UserState;
                if (e.Cancelled || e.Error != null)
                {
                    Sender.Failed = true;
                }
                else
                {
                    byte[] InBytes = e.Result;
                    using (MemoryStream mS = new MemoryStream(InBytes))
                        Sender.Tile = (Bitmap)Bitmap.FromStream(mS);

                    //If we're cacheing tiles, save it
                    if (!String.IsNullOrEmpty(MM_Repository.OverallDisplay.MapTileCache))
                    {
                        File.WriteAllBytes(Sender.GetFileName(), InBytes);
                    }
                }
                Sender.Saving = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error retrieving map tile: " + ex.ToString());
            }
        }
Exemple #3
0
 public ImageStimulus(string name)
 {
  
  Name = name;
  Image = new Bitmap(name);
  return;
  System.Reflection.Assembly thisExe;
  thisExe = System.Reflection.Assembly.GetExecutingAssembly();
  System.IO.Stream file = thisExe.GetManifestResourceStream("ABVFeedback.Resources.ABMT.A." + name);
  Image = Image.FromStream(file);
 }
        private void button1_Click(object sender, EventArgs e)
        {
            //DialogResult D = openFileDialog1.ShowDialog();
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "Select an image file.";
            ofd.Filter = "Png Images(*.png)|*.png|Jpeg Images(*.jpg)|*.jpg";
            ofd.Filter += "|Bitmap Images(*.bmp)|*.bmp";

            if /*(D == DialogResult.OK)*/ (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                radioButton1.Checked = true;
                //pictureBox1.Visible = true;
                ListOfCurveArray = null;
                //if (Bitmap != null) Bitmap.Dispose();
                Bitmap = new Bitmap(ofd.FileName);

                StreamReader streamReader = new StreamReader(ofd.FileName);
                originalBitmap = (Bitmap)Bitmap.FromStream(streamReader.BaseStream);
                streamReader.Close();

                previewBitmap = originalBitmap.CopyToThisCanvas(pictureBox1.Width);
                pictureBox1.Image = previewBitmap;
                //refreshMatrix();
                ApplyFilter(true);

            }
        }