本文整理汇总了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.
}
}
示例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);
}
示例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");
}
示例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);
}
}
示例5: FreeImageAlgorithmsBitmap
public FreeImageAlgorithmsBitmap(Stream stream, FREE_IMAGE_FORMAT format)
: base(stream, format)
{
}
示例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();
}
}
示例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));
}
示例8: FIFSupportsICCProfiles
public static extern bool FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
示例9: FIFSupportsExportBPP
public static extern bool FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
示例10: LoadU
private static extern FIBITMAP LoadU(FREE_IMAGE_FORMAT fif, string filename, FREE_IMAGE_LOAD_FLAGS flags);
示例11: OpenMultiBitmapFromHandle
public static extern FIMULTIBITMAP OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io,
fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags);
示例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);
示例13: LoadMultiBitmapFromMemory
public static extern FIMULTIBITMAP LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, FREE_IMAGE_LOAD_FLAGS flags);
示例14: LoadFromHandle
public static extern FIBITMAP LoadFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io, fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags);
示例15: IsPluginEnabled
public static extern int IsPluginEnabled(FREE_IMAGE_FORMAT fif);