本文整理汇总了C#中System.Drawing.Imaging.ColorPalette.ConvertToMemory方法的典型用法代码示例。如果您正苦于以下问题:C# ColorPalette.ConvertToMemory方法的具体用法?C# ColorPalette.ConvertToMemory怎么用?C# ColorPalette.ConvertToMemory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Imaging.ColorPalette
的用法示例。
在下文中一共展示了ColorPalette.ConvertToMemory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAdjustedPalette
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type)
{
IntPtr handle = palette.ConvertToMemory();
try
{
int status = SafeNativeMethods.Gdip.GdipGetImageAttributesAdjustedPalette(new HandleRef(this, this.nativeImageAttributes), new HandleRef(null, handle), type);
if (status != 0)
{
throw SafeNativeMethods.Gdip.StatusException(status);
}
palette.ConvertFromMemory(handle);
}
finally
{
if (handle != IntPtr.Zero)
{
Marshal.FreeHGlobal(handle);
}
}
}
示例2: GetAdjustedPalette
/// <include file='doc\ImageAttributes.uex' path='docs/doc[@for="ImageAttributes.GetAdjustedPalette"]/*' />
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type)
{
// does inplace adjustment
IntPtr memory = palette.ConvertToMemory();
try {
int status = SafeNativeMethods.Gdip.GdipGetImageAttributesAdjustedPalette(
new HandleRef(this, nativeImageAttributes), new HandleRef(null, memory), type);
if (status != SafeNativeMethods.Gdip.Ok) {
throw SafeNativeMethods.Gdip.StatusException(status);
}
palette.ConvertFromMemory(memory);
} finally {
if(memory != IntPtr.Zero) {
Marshal.FreeHGlobal(memory);
}
}
}
示例3: _SetColorPalette
private void _SetColorPalette(ColorPalette palette) {
IntPtr memory = palette.ConvertToMemory();
int status = SafeNativeMethods.Gdip.GdipSetImagePalette(new HandleRef(this, nativeImage), memory);
if (memory != IntPtr.Zero) {
Marshal.FreeHGlobal(memory);
}
if (status != SafeNativeMethods.Gdip.Ok) {
throw SafeNativeMethods.Gdip.StatusException(status);
}
}