Esempio n. 1
0
		public void SetData(byte[] data, string filename) {
			mName = filename;
			try {
				using (MemoryStream ms = new MemoryStream(data)) {
					if (mIsTga) {
						using (TargaImage tga = new TargaImage(ms)) {
							ImagePreview = tga.Image.Clone() as Image;
						}
					} else {
						ImagePreview = Image.FromStream(ms);
					}
				}
			} catch {
				ImagePreview = GrfEditor.Library.Properties.Resources.image_error;
			}
		}
Esempio n. 2
0
		/// <summary>
		/// Loads a Targa image file into a Bitmap object.
		/// </summary>
		/// <param name="sFileName">The Targa image filename</param>
		/// <returns>A Bitmap object with the Targa image loaded into it.</returns>
		public static Bitmap LoadTargaImage(string sFileName) {
			Bitmap b = null;
			using (TargaImage ti = new TargaImage(sFileName)) {
				b = new Bitmap(ti.Image);
			}

			return b;
		}