Exemplo n.º 1
0
        public static void WatermarkText(Stream imageStream, Stream outputStream, string watermark,
                                         ImageFormats srcImageFormat, ImageFormats?destImageFormat = null, string font = "Times New Roman", float fontSize = 30.0f, int colorARGB = TransparentWhite)
        {
            Guid srcImageFormatGuid  = ImageFormatGuidMapping[srcImageFormat];
            Guid destImageFormatGuid = ImageFormatGuidMapping[destImageFormat ?? srcImageFormat];

            using (var wic = new WIC.ImagingFactory2())
                using (var d2d = new D2D.Factory())
                    using (var image = CreateWicImage(wic, imageStream, srcImageFormatGuid))
                        using (var wicBitmap = new WIC.Bitmap(wic, image.Size.Width, image.Size.Height, WIC.PixelFormat.Format32bppPBGRA, WIC.BitmapCreateCacheOption.CacheOnDemand))
                            using (var target = new D2D.WicRenderTarget(d2d, wicBitmap, new D2D.RenderTargetProperties()))
                                using (var bmpPicture = D2D.Bitmap.FromWicBitmap(target, image))
                                    using (var dwriteFactory = new DWrite.Factory())
                                        using (var brush = new D2D.SolidColorBrush(target, new Color(colorARGB)))
                                        {
                                            target.BeginDraw();
                                            {
                                                target.DrawBitmap(bmpPicture, new RectangleF(0, 0, target.Size.Width, target.Size.Height), 1.0f, D2D.BitmapInterpolationMode.Linear);
                                                target.DrawRectangle(new RectangleF(0, 0, target.Size.Width, target.Size.Height), brush);
                                                var textFormat = new DWrite.TextFormat(dwriteFactory, font, DWrite.FontWeight.Bold, DWrite.FontStyle.Normal, fontSize)
                                                {
                                                    ParagraphAlignment = DWrite.ParagraphAlignment.Far,
                                                    TextAlignment      = DWrite.TextAlignment.Trailing,
                                                };
                                                target.DrawText(watermark, textFormat, new RectangleF(0, 0, target.Size.Width, target.Size.Height), brush);
                                            }
                                            target.EndDraw();

                                            SaveD2DBitmap(wic, wicBitmap, outputStream, destImageFormatGuid);
                                        }
        }
Exemplo n.º 2
0
        private IIndexEncoding CreateIndexEncoding(ExtensionType extType)
        {
            switch (extType.Name)
            {
            case "I2":
                var bitOrder1 = extType.GetParameterValue <BitOrder>("BitOrder");
                return(ImageFormats.I2(bitOrder1));

            case "I4":
                var bitOrder2 = extType.GetParameterValue <BitOrder>("BitOrder");
                return(ImageFormats.I4(bitOrder2));

            case "I8":
                return(ImageFormats.I8());

            case "IA53":
                return(ImageFormats.Ia53());

            case "IA35":
                return(ImageFormats.Ia35());

            default:
                return(null);
            }
        }
Exemplo n.º 3
0
		protected static async void save(byte[] inData, int width, int height, Stream outStream, ImageFormats imageFormat, ImageSavedCallbackMethod imageSavedCallback)
		{
			try
			{
				using (var memoryStream = new InMemoryRandomAccessStream())
				{
					Guid encodeID = new Guid();
					switch (imageFormat)
					{
						case (ImageFormats.PNG): encodeID = BitmapEncoder.PngEncoderId; break;
						case (ImageFormats.JPG): encodeID = BitmapEncoder.PngEncoderId; break;
						case (ImageFormats.BMP): encodeID = BitmapEncoder.PngEncoderId; break;
						default: Debug.ThrowError("ImageMetro", "Unsuported image format: " + imageFormat.ToString()); break;
					}

					BitmapEncoder encoder = await BitmapEncoder.CreateAsync(encodeID, memoryStream);
					encoder.SetPixelData(BitmapPixelFormat.Rgba8, BitmapAlphaMode.Straight, (uint)width, (uint)height, 96, 96, inData);
					await encoder.FlushAsync();
				
					var stream = memoryStream.AsStream();
					stream.Position = 0;
					await stream.CopyToAsync(outStream);
				}
			}
			catch (Exception e)
			{
				if (imageSavedCallback != null) imageSavedCallback(false);
			}

			if (imageSavedCallback != null) imageSavedCallback(true);
		}
Exemplo n.º 4
0
        public static MapHeader CreateHeader(ImageFormats format)
        {
            switch (format)
            {
            case ImageFormats.MRC:
                return(new HeaderMRC());

            case ImageFormats.MRCS:
                return(new HeaderMRC());

            case ImageFormats.EM:
                return(new HeaderEM());

            case ImageFormats.K2Raw:
                return(new HeaderRaw(new int3(1, 1, 1), 0, typeof(byte)));

            case ImageFormats.FEIRaw:
                return(new HeaderRaw(new int3(1, 1, 1), 49, typeof(int)));

            case ImageFormats.DM4:
                return(new HeaderDM4());

            default:
                return(null);
            }
        }
Exemplo n.º 5
0
        public string Autofixedpath(string TemporaryPath)
        {
            Format format      = ImageFormats.FindFormatInString(ExpectedFormat);
            string newfilename = String.IsNullOrEmpty(ExpectedFormat) ? FileName : Path.ChangeExtension(FileName, ImageFormats.GetExtensionOfFormat(format.InternalFormat));

            return(Path.Combine(Path.Combine(TemporaryPath, "Autofixed"), newfilename));
        }
Exemplo n.º 6
0
        public static EncodingDefinition GetEncodingDefinition()
        {
            var formats = new Dictionary <int, IColorEncoding>
            {
                [0]  = ImageFormats.Rgba8888(),
                [1]  = ImageFormats.Rgb888(),
                [2]  = ImageFormats.Rgba5551(),
                [3]  = ImageFormats.Rgb565(),
                [4]  = ImageFormats.Rgba4444(),
                [5]  = ImageFormats.La88(),
                [6]  = ImageFormats.Rg88(),
                [7]  = ImageFormats.L8(),
                [8]  = ImageFormats.A8(),
                [9]  = ImageFormats.La44(),
                [10] = ImageFormats.L4(BitOrder.LeastSignificantBitFirst),
                [11] = ImageFormats.A4(BitOrder.LeastSignificantBitFirst),
                [12] = ImageFormats.Etc1(true),
                [13] = ImageFormats.Etc1A4(true)
            };

            var definition = EncodingDefinition.Empty;

            definition.AddColorEncodings(formats);

            return(definition);
        }
Exemplo n.º 7
0
        public async Task Save(IBitmapImage image, ImageFormats format, string fileName)
        {
            var response = await Save(image, format);

            switch (response)
            {
            case UploadResult uploadResult:
                var link = uploadResult.Url;

                // Copy path to clipboard only when clipboard writer is off
                if (_settings.CopyOutPathToClipboard && !ServiceProvider.Get <ClipboardWriter>().Active)
                {
                    link.WriteToClipboard();
                }
                break;

            case Exception e:
                if (!_diskWriter.Active)
                {
                    ServiceProvider.Get <IMainWindow>().IsVisible = true;

                    var yes = _messageProvider.ShowYesNo(
                        $"{e.Message}\n\nDo you want to Save to Disk?", _loc.ImageUploadFailed);

                    if (yes)
                    {
                        await _diskWriter.Save(image, format, fileName);
                    }
                }
                break;
            }
        }
        public static BitmapEncoder GetBitmapEncoder(ImageFormats ImageFormat)
        {
            switch (ImageFormat)
            {
            case ImageFormats.PNG:
                return(new PngBitmapEncoder());

            case ImageFormats.JPEG:
                return(new JpegBitmapEncoder());

            case ImageFormats.BMP:
                return(new BmpBitmapEncoder());

            case ImageFormats.TIFF:
                return(new TiffBitmapEncoder());

            case ImageFormats.WMP:
                return(new WmpBitmapEncoder());

            case ImageFormats.GIF:
                return(new GifBitmapEncoder());

            case ImageFormats.Unknown:
                return(null);

            default:
                return(null);
            }
        }
Exemplo n.º 9
0
        // Returns UploadResult on success, Exception on failure
        public async Task <object> Save(IBitmapImage image, ImageFormats format)
        {
            var progressItem = new ImageUploadNotification();

            _systemTray.ShowNotification(progressItem);

            try
            {
                var uploadResult = await _imgUploader.Upload(image, format, progressItemProgress => progressItem.Progress = progressItemProgress);

                var link = uploadResult.Url;

                _recentList.Add(new UploadRecentItem(link, uploadResult.DeleteLink, _imgUploader));

                progressItem.RaiseFinished(link);

                return(uploadResult);
            }
            catch (Exception e)
            {
                progressItem.RaiseFailed();

                return(e);
            }
        }
Exemplo n.º 10
0
        public string Autofixedpath(string TemporaryPath)
        {
            Format format      = new CSharpImageLibrary.General.Format(ExpectedFormat);
            string newfilename = Path.ChangeExtension(FileName, ImageFormats.GetExtensionOfFormat(format.InternalFormat));

            return(Path.Combine(Path.Combine(TemporaryPath, "Autofixed"), newfilename));
        }
Exemplo n.º 11
0
        public async Task <UploadResult> Upload(IBitmapImage Image, ImageFormats Format, Action <int> Progress)
        {
            using var w = new WebClient { Proxy = _proxySettings.GetWebProxy() };
            if (Progress != null)
            {
                w.UploadProgressChanged += (S, E) => Progress(E.ProgressPercentage);
            }

            w.Headers.Add("Authorization", await GetAuthorizationHeader());

            NameValueCollection values;

            using (var ms = new MemoryStream())
            {
                Image.Save(ms, Format);

                values = new NameValueCollection
                {
                    { "image", Convert.ToBase64String(ms.ToArray()) }
                };
            }

            var uploadResponse = await UploadValuesAsync <ImgurUploadResponse>(w, "https://api.imgur.com/3/upload.json", values);

            if (!uploadResponse.Success)
            {
                throw new Exception("Response indicates Failure");
            }

            return(new UploadResult
            {
                Url = uploadResponse.Data.Link,
                DeleteLink = $"https://api.imgur.com/3/image/{uploadResponse.Data.DeleteHash}"
            });
        }
Exemplo n.º 12
0
        public static string ToString(ImageFormats format)
        {
            switch (format)
            {
            case ImageFormats.MRC:
                return("MRC");

            case ImageFormats.MRCS:
                return("MRCS");

            case ImageFormats.EM:
                return("EM");

            case ImageFormats.K2Raw:
                return("K2Raw");

            case ImageFormats.FEIRaw:
                return("FEIRaw");

            case ImageFormats.TIFF:
                return("TIFF");

            case ImageFormats.DM4:
                return("DM4");

            default:
                return("");
            }
        }
Exemplo n.º 13
0
        public Task Save(IBitmapImage Image, ImageFormats Format, string FileName)
        {
            try
            {
                var extension = Format.ToString().ToLower();

                var fileName = _settings.GetFileName(extension, FileName);

                Image.Save(fileName, Format);

                _recentList.Add(new FileRecentItem(fileName, RecentFileType.Image));

                // Copy path to clipboard only when clipboard writer is off
                if (_settings.CopyOutPathToClipboard && !ServiceProvider.Get <ClipboardWriter>().Active)
                {
                    fileName.WriteToClipboard();
                }

                _systemTray.ShowScreenShotNotification(fileName);
            }
            catch (Exception e)
            {
                _messageProvider.ShowException(e, _loc.NotSaved);
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 14
0
        public static string GetExtension(ImageFormats format)
        {
            switch (format)
            {
            case ImageFormats.MRC:
                return(".mrc");

            case ImageFormats.MRCS:
                return(".mrcs");

            case ImageFormats.EM:
                return(".em");

            case ImageFormats.K2Raw:
                return(".dat");

            case ImageFormats.FEIRaw:
                return(".raw");

            case ImageFormats.TIFF:
                return(".tif");

            case ImageFormats.DM4:
                return(".dm4");

            default:
                return("");
            }
        }
Exemplo n.º 15
0
 public static string GetExtension(ImageFormats format)
 {
     switch (format)
     {
         case ImageFormats.MRC:
             return ".mrc";
         case ImageFormats.MRCS:
             return ".mrcs";
         case ImageFormats.EM:
             return ".em";
         case ImageFormats.K2Raw:
             return ".dat";
         case ImageFormats.FEIRaw:
             return ".raw";
         case ImageFormats.TIFF:
             return ".tif";
         case ImageFormats.TIFFF:
             return ".tiff";
         case ImageFormats.EER:
             return ".eer";
         case ImageFormats.DM4:
             return ".dm4";
         default:
             return "";
     }
 }
Exemplo n.º 16
0
 public static string ToString(ImageFormats format)
 { 
     switch (format)
     {
         case ImageFormats.MRC:
             return "MRC";
         case ImageFormats.MRCS:
             return "MRCS";
         case ImageFormats.EM:
             return "EM";
         case ImageFormats.K2Raw:
             return "K2Raw";
         case ImageFormats.FEIRaw:
             return "FEIRaw";
         case ImageFormats.TIFF:
             return "TIFF";
         case ImageFormats.TIFFF:
             return "TIFFF";
         case ImageFormats.EER:
             return "EER";
         case ImageFormats.DM4:
             return "DM4";
         default:
             return "";
     }
 }
Exemplo n.º 17
0
        public BnrState()
        {
            _bnr = new Bnr();

            EncodingDefinition = new EncodingDefinition();
            EncodingDefinition.AddPaletteEncoding(0, ImageFormats.Rgb555());
            EncodingDefinition.AddIndexEncoding(0, ImageFormats.I4(BitOrder.LeastSignificantBitFirst), new[] { 0 });
        }
Exemplo n.º 18
0
        public Task Save(IBitmapImage Image, ImageFormats Format, string FileName)
        {
            _clipboard.SetImage(Image);

            _systemTray.ShowNotification(new TextNotification("图片已复制到剪贴板"));

            return(Task.CompletedTask);
        }
Exemplo n.º 19
0
        public static byte[] WatermarkText(Stream imageStream, string watermark, ImageFormats srcImageFormat, ImageFormats?destImageFormat = null,
                                           string font = "Times New Roman", float fontSize = 30.0f, int colorARGB = TransparentWhite)
        {
            var ms = new MemoryStream();

            WatermarkText(imageStream, ms, watermark, srcImageFormat, destImageFormat, font, fontSize, colorARGB);
            return(ms.ToArray());
        }
Exemplo n.º 20
0
        public Task Save(IBitmapImage image, ImageFormats format, string fileName)
        {
            _clipboard.SetImage(image);

            _systemTray.ShowNotification(new TextNotification(_loc.ImgSavedClipboard));

            return(Task.CompletedTask);
        }
Exemplo n.º 21
0
    public static string ConvertToBase64ImageFormat(this byte[] b, ImageFormats f)
    {
        // you can find other formats image mimeType and add all you need
        string mt = system.Net.Mime.MediaTypeNames.Image.Tiff;
        string i  = Convert.ToBase64String(b);

        return(string.Format("data:{0};base64,{1}", mt, i));
    }
Exemplo n.º 22
0
        public NcgrState()
        {
            _ncgr = new Ncgr();

            EncodingDefinition = new EncodingDefinition();
            EncodingDefinition.AddPaletteEncoding(0, new Rgba(5, 5, 5, "BGR"));
            EncodingDefinition.AddIndexEncoding(3, ImageFormats.I4(BitOrder.LeastSignificantBitFirst), new[] { 0 });
            EncodingDefinition.AddIndexEncoding(4, ImageFormats.I8(), new[] { 0 });
        }
Exemplo n.º 23
0
        public GuiHalSurfaceWindowsFormsDXBackend(ImageFormats format)
            : base(format)
        {
            windowsFormsWindow = new WindowsFormBridgeDXBackend(this, format);

            if (((WindowsFormBridgeDXBackend)windowsFormsWindow).InitializeDirect3D() == false) // Check if D3D could be initialized
            {
                MessageBox.Show("Could not initialize Direct3D.", "Error");
                return;
            }
        }
Exemplo n.º 24
0
 public static Image GetCompressedBitmap(this Bitmap bmp, ImageFormats imageFormats = ImageFormats.PNG, long quality = 100L) //[0-100]
 {
     using (MemoryStream mss = new MemoryStream())
     {
         EncoderParameter  qualityParam = new EncoderParameter(Encoder.Quality, quality);
         ImageCodecInfo    imageCodec   = ImageCodecInfo.GetImageEncoders().FirstOrDefault(o => o.FormatID == GetFormatGuidFromEnum(imageFormats));
         EncoderParameters parameters   = new EncoderParameters(1);
         parameters.Param[0] = qualityParam;
         bmp.Save(mss, imageCodec, parameters);
         return(Image.FromStream(mss));
     }
 }
Exemplo n.º 25
0
        public void ExtractImage(int index, string saveAsName, ImageFormats imageFormat)
        {
            EnsureDocument();

            if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
                throw new Exception("This operation can only be executed in STA thread");

            if (index > doc.InlineShapes.Count)
                throw new Exception(String.Format("There is no image with index {0}. Image count is {1}", index, doc.InlineShapes.Count));

            MSWord.InlineShape inlineShape = doc.InlineShapes[index];

            if (inlineShape == null)
                throw new Exception("Unexpectly image object in the document is null");

            // the image in the Word document, can have size re-scaled to display
            // but we want to have it in original format, so we will scale it to original size
            var originalScale = inlineShape.ScaleWidth;
            inlineShape.ScaleWidth = 100;

            // copy to clipboard
            inlineShape.Select();
            word.Selection.Copy();

            // revert to Word scale
            inlineShape.ScaleWidth = originalScale;

            if (System.Windows.Forms.Clipboard.GetDataObject() != null)
            {
                System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();
                if (data.GetDataPresent(System.Windows.Forms.DataFormats.Bitmap))
                {
                    System.Drawing.Image image = (System.Drawing.Image)data.GetData(System.Windows.Forms.DataFormats.Bitmap, true);

                    System.Drawing.Imaging.ImageFormat drwImageFormat;
                    switch (imageFormat)
                    {
                        case ImageFormats.Png: { drwImageFormat = System.Drawing.Imaging.ImageFormat.Png; break; }
                        case ImageFormats.Gif: { drwImageFormat = System.Drawing.Imaging.ImageFormat.Gif; break; }
                        default: { drwImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg; break; }
                    }

                    image.Save(saveAsName, drwImageFormat);

                }
                else
                    throw new Exception("The data in the clipboard is not an image");

            }
            else
                throw new Exception("Nothing found in the clipboard to save");
        }
Exemplo n.º 26
0
        public Task Save(IBitmapImage Image, ImageFormats Format, string FileName)
        {
            if (!File.Exists(FileName))
            {
                Image.Save(FileName, Format);
            }

            var winserv = ServiceProvider.Get <IMainWindow>();

            winserv.EditImage(FileName);

            return(Task.CompletedTask);
        }
Exemplo n.º 27
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                var guid = System.Xml.XmlConvert.ToGuid(info.GetString("Guid"));

                var s = ImageFormats.FirstOrDefault(x => x.Guid == guid);

                if (null == s)
                {
                    s = new ImageFormat(guid);
                }

                return(s);
            }
Exemplo n.º 28
0
        public aa_test(ImageFormats format)
            : base(format)
        {
            m_idx = (-1);
            m_gamma = new AGG.UI.SliderWidget(3, 3, 480 - 3, 8);

            m_x[0] = 100;   m_y[0] = 100;
            m_x[1] = 500;   m_y[1] = 350;
            AddChild(m_gamma);
            m_gamma.label("gamma={0:F3}");
            m_gamma.range(0.0, 3.0);
            m_gamma.value(1.8);
        }
Exemplo n.º 29
0
        private void ImageSize(ImageFormats imgType, int number, int width, int height)
        {
            var path  = $"{_filesPath}{imgType}/image{number}.{imgType}";
            var image = new FileStream(path, FileMode.Open, FileAccess.Read);

            image.Position += 1;
            var getImageSize = typeof(ImageParser)
                               .GetMethod("GetImageSize", BindingFlags.NonPublic | BindingFlags.Static);
            var size = (ImageSize)getImageSize.Invoke(null, new object[] { image, imgType });

            Assert.AreEqual(width, size.Width);
            Assert.AreEqual(height, size.Height);
        }
Exemplo n.º 30
0
        /*public static bool CheckTextureFormat(string currentFormat, string desiredFormat)
         * {
         *  string curr = currentFormat.ToLowerInvariant().Replace("pf_", "").Replace("DDS_", "");
         *  string des = desiredFormat.ToLowerInvariant().Replace("pf_", "").Replace("DDS_", "");
         *  bool correct = curr == des;
         *  return correct || (!correct && curr.Contains("ati") && des.Contains("normalmap")) || (!correct && curr.Contains("normalmap") && des.Contains("ati"));
         * }*/

        public static ImageEngineFormat ParseFormat(string formatString)
        {
            if (String.IsNullOrEmpty(formatString))
            {
                return(ImageEngineFormat.Unknown);
            }

            if (formatString.Contains("normal", StringComparison.OrdinalIgnoreCase))
            {
                return(ImageEngineFormat.DDS_ATI2_3Dc);
            }
            else
            {
                return(ImageFormats.FindFormatInString(formatString).InternalFormat);
            }
        }
        /// <summary>
        /// Gets the byte array from clipboard image asynchronous.
        /// </summary>
        /// <returns>Task&lt;System.Byte[]&gt;.</returns>
        public async Task <byte[]> GetByteArrayFromClipboardImageAsync(ImageFormats format)
        {
            if (await GetBitmapSourceFromClipboardAsync() is ImageSource imageSource)
            {
                var encoder = new PngBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create((BitmapSource)imageSource));

                using (MemoryStream imageStream = new MemoryStream())
                {
                    encoder.Save(imageStream);
                    return(imageStream.ToArray());
                }
            }

            return(Array.Empty <byte>());
        }
Exemplo n.º 32
0
        public Task Save(IBitmapImage image, ImageFormats format, string fileName)
        {
            using (var stream = new MemoryStream())
            {
                image.Save(stream, ImageFormats.Png);

                var decoder = new PngBitmapDecoder(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);

                var win = new ImageEditorWindow();

                win.Open(decoder.Frames[0]);

                win.Show();
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 33
0
        private static ImageSize GetImageSize(Stream stream, ImageFormats format)
        {
            switch (format)
            {
            case ImageFormats.Png:
                return(ReadImagedSize(stream, PngSignatureAndChunkHeadOffset, 4, false));

            case ImageFormats.Gif:
                return(ReadImagedSize(stream, GifSignatureOffset, 2, true));

            case ImageFormats.Bmp:
                return(ReadImagedSize(stream, BmpSignatureAndMiscDataOffset, 4, true));

            default:
                throw new Exception("Unknown image format");
            }
        }
Exemplo n.º 34
0
 public static MapHeader CreateHeader(ImageFormats format)
 {
     switch (format)
     {
         case ImageFormats.MRC:
             return new HeaderMRC();
         case ImageFormats.MRCS:
             return new HeaderMRC();
         case ImageFormats.EM:
             return new HeaderEM();
         case ImageFormats.K2Raw:
             return new HeaderRaw(new int3(1, 1, 1), 0, typeof(byte));
         case ImageFormats.FEIRaw:
             return new HeaderRaw(new int3(1, 1, 1), 49, typeof(int));
         default:
             return null;
     }
 }
Exemplo n.º 35
0
 public static string GetExtension(ImageFormats format)
 {
     switch (format)
     {
         case ImageFormats.MRC:
             return ".mrc";
         case ImageFormats.MRCS:
             return ".mrcs";
         case ImageFormats.EM:
             return ".em";
         case ImageFormats.K2Raw:
             return ".dat";
         case ImageFormats.FEIRaw:
             return ".raw";
         case ImageFormats.TIFF:
             return ".tif";
         default:
             return "";
     }
 }
 /// <summary>
 ///     Export a slide to the specified image format
 /// </summary>
 /// <param name="slide">PPT.Slide object instance</param>
 /// <param name="filePathAndName">File and Path name for the export target</param>
 /// <param name="exportFormat">Format to export to</param>
 /// <param name="scaleWidth">Scale with of the image</param>
 /// <param name="scaleHeight">Scale height of the image</param>
 public void Export(
         PPT.Slide slide,
         string filePathAndName,
         ImageFormats.Formats exportFormat,
         int scaleWidth = 1280,
         int scaleHeight = 1024)
 {
     slide.Export(filePathAndName, exportFormat.ToString(), scaleWidth, scaleHeight);
 }
 /// <summary>
 ///     Export all slides to the specified file formats
 /// </summary>
 /// <param name="presentation">PPT.Presentation object instance</param>
 /// <param name="filePath">File Path to export all the slides to (excluding filename(s))</param>
 /// <param name="exportFormat">Format to export to</param>
 /// <param name="scaleWidth">Scale with of the image</param>
 /// <param name="scaleHeight">Scale height of the image</param>
 public void ExportAll(
         PPT.Presentation presentation,
         string filePath,
         ImageFormats.Formats exportFormat,
         int scaleWidth = 1280,
         int scaleHeight = 1024)
 {
     foreach (PPT.Slide slide in presentation.Slides)
     {
         slide.Export(
                 filePath + @"slide" + slide.SlideIndex + "." + exportFormat,
                 exportFormat.ToString(),
                 scaleWidth,
                 scaleHeight);
     }
 }
Exemplo n.º 38
0
 public CTFAGame(ImageFormats format)
     : base(1.0f/60.0f, 5, format)
 {
 }
Exemplo n.º 39
0
 public static string ToString(ImageFormats format)
 {
     switch (format)
     {
         case ImageFormats.MRC:
             return "MRC";
         case ImageFormats.MRCS:
             return "MRCS";
         case ImageFormats.EM:
             return "EM";
         case ImageFormats.K2Raw:
             return "K2Raw";
         case ImageFormats.FEIRaw:
             return "FEIRaw";
         case ImageFormats.TIFF:
             return "TIFF";
         default:
             return "";
     }
 }
Exemplo n.º 40
0
        public GuiHalSurfaceWindowsFormsDXBackend(ImageFormats format)
            : base(format)
        {
            windowsFormsWindow = new WindowsFormBridgeDXBackend(this, format);

            if (((WindowsFormBridgeDXBackend)windowsFormsWindow).InitializeDirect3D() == false) // Check if D3D could be initialized
            {
                MessageBox.Show("Could not initialize Direct3D.", "Error");
                return;
            }
        }
Exemplo n.º 41
0
 public static void Save(byte[] inData, int width, int height, Stream outStream, ImageFormats imageFormat, ImageSavedCallbackMethod imageSavedCallback)
 {
     switch (imageFormat)
     {
         #if !NaCl && !XNA && !VITA && !WP8
         case ImageFormats.BMPC: ImageBMPC.Save(inData, width, height, outStream, imageSavedCallback); break;
         #endif
         #if WINRT
         case ImageFormats.PNG: ImagePNG.Save(inData, width, height, outStream, imageSavedCallback); break;
         #endif
         default: Debug.ThrowError("Image", string.Format("Unsuported format: ", imageFormat)); break;
     }
 }