示例#1
0
		private void ParseDefineBitsLossless(DefineBitsLosslessTag tag)
		{
			DDW.Vex.ImageFill bf = new DDW.Vex.ImageFill();
			string path = v.ResourceFolder + @"/" + VexObject.BitmapPrefix + tag.CharacterId + ".png";

			WriteLosslessBitmapToDisk(path, tag);

			Image img = new Vex.Image(path, v.NextId());
			img.Id = tag.CharacterId;
			img.StrokeBounds = new Rectangle(0, 0, tag.Width, tag.Height);

			bitmapPaths.Add(img.Id, path);
			v.Definitions.Add(img.Id, img);
		}
示例#2
0
		private void ParseDefineBits(DefineBitsTag tag)
		{
			DDW.Vex.ImageFill bf = new DDW.Vex.ImageFill();
			string path = v.ResourceFolder + @"/" + VexObject.BitmapPrefix + tag.CharacterId + ".jpg";
			WriteJpegToDisk(path, tag);
			Size sz = Utils.GetJpgSize(path);

			if (tag.HasAlphaData) // this is an alpha jpg, convert to png
			{
				byte[] alphaData = SwfReader.Decompress(tag.CompressedAlphaData, (uint)(sz.Width * sz.Height));

				string bmpPath = path;
				System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(bmpPath, false);
				path = v.ResourceFolder + @"/" + VexObject.BitmapPrefix + tag.CharacterId + ".png";

				Utils.WriteAlphaJpg(alphaData, bmp, path);

				bmp.Dispose();
				File.Delete(bmpPath);
			}

			Image img = new Vex.Image(path, v.NextId());
			img.Id = tag.CharacterId;
			img.StrokeBounds = new Rectangle(0, 0, sz.Width, sz.Height);

			bitmapPaths.Add(img.Id, path);
			v.Definitions.Add(img.Id, img);
		}