Browse Source

Removing dllimport extensions

Former-commit-id: 0c0b015aa6967a6663861f9a3b1621bc7085297c
pull/17/head
James South 12 years ago
parent
commit
b9ce7b0600
  1. 2
      src/ImageProcessor/Configuration/NativeBinaryFactory.cs
  2. 4
      src/ImageProcessor/Configuration/NativeMethods.cs
  3. 6
      src/ImageProcessor/ImageFactory.cs
  4. 2
      src/ImageProcessor/Imaging/Formats/GifFormat.cs
  5. 8
      src/ImageProcessor/Imaging/Formats/NativeMethods.cs
  6. BIN
      src/ImageProcessorConsole/images/output/120430.gif
  7. BIN
      src/ImageProcessorConsole/images/output/4.sm.webp
  8. BIN
      src/ImageProcessorConsole/images/output/Tl4Yb.gif
  9. BIN
      src/ImageProcessorConsole/images/output/nLpfllv.gif
  10. BIN
      src/ImageProcessorConsole/images/output/test.webp

2
src/ImageProcessor/Configuration/NativeBinaryFactory.cs

@ -94,7 +94,7 @@ namespace ImageProcessor.Configuration
Assembly assembly = Assembly.GetExecutingAssembly(); Assembly assembly = Assembly.GetExecutingAssembly();
string targetBasePath = new Uri(assembly.Location).LocalPath; string targetBasePath = new Uri(assembly.Location).LocalPath;
string targetPath = Path.GetFullPath(Path.Combine(targetBasePath, "..\\" + folder + "\\" + name)); string targetPath = Path.GetFullPath(Path.Combine(targetBasePath, "..\\" + folder + "\\" + name));
// Copy the file across if necessary. // Copy the file across if necessary.
FileInfo fileInfo = new FileInfo(targetPath); FileInfo fileInfo = new FileInfo(targetPath);
bool rewrite = true; bool rewrite = true;

4
src/ImageProcessor/Configuration/NativeMethods.cs

@ -27,7 +27,7 @@ namespace ImageProcessor.Configuration
/// an executable module. /// an executable module.
/// </param> /// </param>
/// <returns>If the function succeeds, the return value is a handle to the module; otherwise null.</returns> /// <returns>If the function succeeds, the return value is a handle to the module; otherwise null.</returns>
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] [DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr LoadLibrary(string libname); public static extern IntPtr LoadLibrary(string libname);
/// <summary> /// <summary>
@ -38,7 +38,7 @@ namespace ImageProcessor.Configuration
/// <param name="hModule">A handle to the loaded library module. /// <param name="hModule">A handle to the loaded library module.
/// The LoadLibrary, LoadLibraryEx, GetModuleHandle, or GetModuleHandleEx function returns this handle.</param> /// The LoadLibrary, LoadLibraryEx, GetModuleHandle, or GetModuleHandleEx function returns this handle.</param>
/// <returns>If the function succeeds, the return value is nonzero; otherwise zero.</returns> /// <returns>If the function succeeds, the return value is nonzero; otherwise zero.</returns>
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] [DllImport("kernel32", CharSet = CharSet.Auto)]
public static extern bool FreeLibrary(IntPtr hModule); public static extern bool FreeLibrary(IntPtr hModule);
} }
} }

6
src/ImageProcessor/ImageFactory.cs

@ -241,11 +241,11 @@ namespace ImageProcessor
if (this.ShouldProcess) if (this.ShouldProcess)
{ {
// Set our new image as the memory stream value. // Set our new image as the memory stream value.
#if !__MonoCS__ #if !__MonoCS__
Image newImage = Image.FromStream(this.InputStream, true); Image newImage = Image.FromStream(this.InputStream, true);
#else #else
Image newImage = Image.FromStream(this.InputStream); Image newImage = Image.FromStream(this.InputStream);
#endif #endif
// Dispose and reassign the image. // Dispose and reassign the image.
this.Image.Dispose(); this.Image.Dispose();

2
src/ImageProcessor/Imaging/Formats/GifFormat.cs

@ -86,7 +86,7 @@ namespace ImageProcessor.Imaging.Formats
foreach (GifFrame frame in info.GifFrames) foreach (GifFrame frame in info.GifFrames)
{ {
factory.Image = frame.Image; factory.Image = frame.Image;
frame.Image = quantizer.Quantize(processor.Invoke(factory)); frame.Image = quantizer.Quantize(processor.Invoke(factory));
encoder.AddFrame(frame); encoder.AddFrame(frame);
} }
} }

8
src/ImageProcessor/Imaging/Formats/NativeMethods.cs

@ -66,7 +66,7 @@ namespace ImageProcessor.Imaging.Formats
/// <returns> /// <returns>
/// 1 if success, otherwise error code returned in the case of (a) formatting error(s). /// 1 if success, otherwise error code returned in the case of (a) formatting error(s).
/// </returns> /// </returns>
[DllImport("libwebp.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPGetInfo")] [DllImport("libwebp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPGetInfo")]
public static extern int WebPGetInfo(IntPtr data, uint dataSize, out int width, out int height); public static extern int WebPGetInfo(IntPtr data, uint dataSize, out int width, out int height);
/// <summary> /// <summary>
@ -90,7 +90,7 @@ namespace ImageProcessor.Imaging.Formats
/// <returns> /// <returns>
/// output_buffer if function succeeds; NULL otherwise /// output_buffer if function succeeds; NULL otherwise
/// </returns> /// </returns>
[DllImport("libwebp.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPDecodeBGRAInto")] [DllImport("libwebp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPDecodeBGRAInto")]
public static extern IntPtr WebPDecodeBGRAInto(IntPtr data, uint dataSize, IntPtr outputBuffer, int outputBufferSize, int outputStride); public static extern IntPtr WebPDecodeBGRAInto(IntPtr data, uint dataSize, IntPtr outputBuffer, int outputBufferSize, int outputStride);
/// <summary> /// <summary>
@ -117,7 +117,7 @@ namespace ImageProcessor.Imaging.Formats
/// <returns> /// <returns>
/// Size of WebP Image /// Size of WebP Image
/// </returns> /// </returns>
[DllImport("libwebp.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPEncodeBGRA")] [DllImport("libwebp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPEncodeBGRA")]
public static extern int WebPEncodeBGRA(IntPtr rgb, int width, int height, int stride, float qualityFactor, out IntPtr output); public static extern int WebPEncodeBGRA(IntPtr rgb, int width, int height, int stride, float qualityFactor, out IntPtr output);
/// <summary> /// <summary>
@ -129,7 +129,7 @@ namespace ImageProcessor.Imaging.Formats
/// <returns> /// <returns>
/// 1 if success, otherwise error code returned in the case of (a) error(s). /// 1 if success, otherwise error code returned in the case of (a) error(s).
/// </returns> /// </returns>
[DllImport("libwebp.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPFree")] [DllImport("libwebp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPFree")]
public static extern int WebPFree(IntPtr pointer); public static extern int WebPFree(IntPtr pointer);
#endregion #endregion
} }

BIN
src/ImageProcessorConsole/images/output/120430.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
src/ImageProcessorConsole/images/output/4.sm.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
src/ImageProcessorConsole/images/output/Tl4Yb.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
src/ImageProcessorConsole/images/output/nLpfllv.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
src/ImageProcessorConsole/images/output/test.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Loading…
Cancel
Save