当前位置: 首页>>代码示例>>C#>>正文


C# FREE_IMAGE_FORMAT类代码示例

本文整理汇总了C#中FREE_IMAGE_FORMAT的典型用法代码示例。如果您正苦于以下问题:C# FREE_IMAGE_FORMAT类的具体用法?C# FREE_IMAGE_FORMAT怎么用?C# FREE_IMAGE_FORMAT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FREE_IMAGE_FORMAT类属于命名空间,在下文中一共展示了FREE_IMAGE_FORMAT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FreeImageEncoderPlugin

        public FreeImageEncoderPlugin(ResizeSettings settings, object original)
        {
            ImageFormat originalFormat = DefaultEncoder.GetOriginalFormat(original);
            if (!IsValidOutputFormat(originalFormat)) originalFormat = ImageFormat.Jpeg;//No valid info available about the original format. Use Jpeg.

            //What format was specified?
            ImageFormat requestedFormat = DefaultEncoder.GetRequestedFormat(settings.Format, originalFormat); //fallback to originalFormat if not specified.
            if (!IsValidOutputFormat(requestedFormat))
                throw new ArgumentException("An unrecognized or unsupported output format (" + (settings.Format != null ? settings.Format : "(null)") + ") was specified in 'settings'.");
            this.format =  FreeImage.GetFormat(requestedFormat);

            //Parse JPEG settings.
            int quality = 90;
            if (string.IsNullOrEmpty(settings["quality"]) || !int.TryParse(settings["quality"], NumberStyles.Number, NumberFormatInfo.InvariantInfo, out quality)) quality = 90;
            if (format == FREE_IMAGE_FORMAT.FIF_JPEG) {
                if (quality >= 100) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYSUPERB;
                else if (quality >= 75)
                    encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD;
                else if (quality >= 50) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYNORMAL;
                else if (quality >= 25) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYAVERAGE;
                else encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYBAD;

                if ("true".Equals(settings["progressive"])) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_PROGRESSIVE;

                if ("411".Equals(settings["subsampling"])) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_SUBSAMPLING_411;
                if ("420".Equals(settings["subsampling"])) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_SUBSAMPLING_420;
                if ("422".Equals(settings["subsampling"])) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_SUBSAMPLING_422;
                if ("444".Equals(settings["subsampling"])) encodingOptions |= FREE_IMAGE_SAVE_FLAGS.JPEG_SUBSAMPLING_444;
            }
            if (string.IsNullOrEmpty(settings["colors"]) || !int.TryParse(settings["colors"], NumberStyles.Number, NumberFormatInfo.InvariantInfo, out colors)) colors = -1;

            if (format == FREE_IMAGE_FORMAT.FIF_GIF) {
                //encodingOptions = FREE_IMAGE_SAVE_FLAGS.
            }
        }
开发者ID:eakova,项目名称:resizer,代码行数:35,代码来源:FreeImageEncoder.cs

示例2: FreeImageEngine_Message

 static void FreeImageEngine_Message(FREE_IMAGE_FORMAT fif, string message)
 {
     // Display the message
     // FreeImage continues code executing when all
     // addes subscribers of 'Message' finished returned.
     MessageBox.Show(message, "FreeImage-Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
开发者ID:barsnadcat,项目名称:steelandconcrete,代码行数:7,代码来源:MainForm.cs

示例3: FreeImage_Message

 static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message)
 {
     // Display the data
     MessageBox.Show(
         String.Format("FreeImage-Message:\n{1}\nFormat:{0}", fif.ToString(), message),
         "FreeImage-Message");
 }
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:7,代码来源:MainForm.cs

示例4: OnMessage

		/// <summary>
		/// Internal callback
		/// </summary>
		private static void OnMessage(FREE_IMAGE_FORMAT fif, string message)
		{
			// Get a local copy of the multicast-delegate
			OutputMessageFunction m = Message;

			// Check the local copy instead of the static instance
			// to prevent a second thread from setting the delegate
			// to null, which would cause a nullreference exception
			if (m != null)
			{
				// Invoke the multicast-delegate
				m.Invoke(fif, message);
			}
		}
开发者ID:cg123,项目名称:xenko,代码行数:17,代码来源:FreeImageEngine.cs

示例5: FreeImageAlgorithmsBitmap

 public FreeImageAlgorithmsBitmap(Stream stream, FREE_IMAGE_FORMAT format)
     : base(stream, format)
 {
 }
开发者ID:glennpierce,项目名称:Fia,代码行数:4,代码来源:FreeImageAlgorithms.cs

示例6: OpenFile

        private void OpenFile(UniFile file)
        {
            m_file = file;
            try
            {
                if (file.FileExtension.ToLowerInvariant() == "dds")
                {
                    m_image = new FreeImageBitmap(file.Stream, FREE_IMAGE_FORMAT.FIF_DDS);
                    m_format = FREE_IMAGE_FORMAT.FIF_DDS;
                }
                else if (file.FileExtension.ToLowerInvariant() == "tga")
                {
                    m_image = new FreeImageBitmap(file.Stream, FREE_IMAGE_FORMAT.FIF_TARGA);
                    m_format = FREE_IMAGE_FORMAT.FIF_TARGA;
                }
                m_picbxImage.Image = (Bitmap)m_image;

                m_binary = new MemoryStream();
                file.Stream.Position = 0;
                file.Stream.CopyTo(m_binary);
            }
            catch (Exception e)
            {
                 UIHelper.ShowError("Failed to open image! Error: " + e.Message);
                ModTool.Core.LoggingManager.SendMessage("Failed to open image " + file.FilePath);
                ModTool.Core.LoggingManager.HandleException(e);
            }
            finally
            {
                file.Close();
            }
        }
开发者ID:micheleissa,项目名称:dow2-toolbox,代码行数:32,代码来源:ImageViewer.cs

示例7: GetFIFDescription

 /// <summary>
 /// Returns a descriptive string that describes the bitmap formats the given plugin can read and/or write.
 /// </summary>
 /// <param name="fif">The desired <see cref="FREE_IMAGE_FORMAT"/>.</param>
 /// <returns>A descriptive string that describes the bitmap formats.</returns>
 public static unsafe string GetFIFDescription(FREE_IMAGE_FORMAT fif)
 {
     return PtrToStr(GetFIFDescription_(fif));
 }
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:9,代码来源:FreeImageStaticImports.cs

示例8: FIFSupportsICCProfiles

 public static extern bool FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:1,代码来源:FreeImageStaticImports.cs

示例9: FIFSupportsExportBPP

 public static extern bool FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:1,代码来源:FreeImageStaticImports.cs

示例10: LoadU

 private static extern FIBITMAP LoadU(FREE_IMAGE_FORMAT fif, string filename, FREE_IMAGE_LOAD_FLAGS flags);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:1,代码来源:FreeImageStaticImports.cs

示例11: OpenMultiBitmapFromHandle

        public static extern FIMULTIBITMAP OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io,
			fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:2,代码来源:FreeImageStaticImports.cs

示例12: OpenMultiBitmap

        public static extern FIMULTIBITMAP OpenMultiBitmap(FREE_IMAGE_FORMAT fif, string filename, bool create_new,
			bool read_only, bool keep_cache_in_memory, FREE_IMAGE_LOAD_FLAGS flags);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:2,代码来源:FreeImageStaticImports.cs

示例13: LoadMultiBitmapFromMemory

 public static extern FIMULTIBITMAP LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, FREE_IMAGE_LOAD_FLAGS flags);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:1,代码来源:FreeImageStaticImports.cs

示例14: LoadFromHandle

 public static extern FIBITMAP LoadFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io, fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:1,代码来源:FreeImageStaticImports.cs

示例15: IsPluginEnabled

 public static extern int IsPluginEnabled(FREE_IMAGE_FORMAT fif);
开发者ID:abhishekbhalani,项目名称:freeimage,代码行数:1,代码来源:FreeImageStaticImports.cs


注:本文中的FREE_IMAGE_FORMAT类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。