Graphics.GetHalftonePalette メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Graphics.GetHalftonePalette メソッドの意味・解説 

Graphics.GetHalftonePalette メソッド

現在の Windows ハーフトーン パレット識別するハンドル取得します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Shared Function GetHalftonePalette
 As IntPtr
Dim returnValue As IntPtr

returnValue = Graphics.GetHalftonePalette
public static IntPtr GetHalftonePalette ()
public:
static IntPtr GetHalftonePalette ()
public static IntPtr GetHalftonePalette ()
public static function GetHalftonePalette
 () : IntPtr

戻り値
パレット識別するハンドル指定する内部ポインタ

解説解説
使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。このコード次のアクション実行します

16 ビット パレット8 ビット パレット使用してサンプル イメージ2 つレンダリング生成されます。

<System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")>
 _
Private Shared Function
 SelectPalette(ByVal hdc As IntPtr, _
ByVal htPalette As IntPtr, ByVal
 bForceBackground As Boolean) As
 IntPtr
End Function

<System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")>
 _
Private Shared Function
 RealizePalette(ByVal hdc As IntPtr) As
 Integer
End Function

<System.Security.Permissions.SecurityPermission( _
System.Security.Permissions.SecurityAction.LinkDemand, Flags := _
System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)> _
Public Sub GetHalftonePaletteVoid(ByVal
 e As PaintEventArgs)

    ' Create and draw image.
    Dim imageFile As Image = Image.FromFile("SampImag.jpg")
    e.Graphics.DrawImage(imageFile, New Point(0, 0))

    ' Get handle to device context.
    Dim hdc As IntPtr = e.Graphics.GetHdc()

    ' Get handle to halftone palette.
    Dim htPalette As IntPtr = Graphics.GetHalftonePalette()

    ' Select and realize new palette.
    SelectPalette(hdc, htPalette, True)
    RealizePalette(hdc)

    ' Create new graphics object.
    Dim newGraphics As Graphics = Graphics.FromHdc(hdc)

    ' Draw image with new palette.
    newGraphics.DrawImage(imageFile, 300, 0)

    ' Release handle to device context.
    e.Graphics.ReleaseHdc(hdc)
End Sub
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
private static extern IntPtr SelectPalette(
    IntPtr hdc,
    IntPtr htPalette,
    bool bForceBackground);
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]
private static extern int
 RealizePalette(IntPtr hdc);

[System.Security.Permissions.SecurityPermission(
System.Security.Permissions.SecurityAction.LinkDemand, Flags = 
System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode)]            
public void GetHalftonePaletteVoid(PaintEventArgs
 e)
{

    // Create and draw image.
    Image imageFile = Image.FromFile("SampImag.jpg");
    e.Graphics.DrawImage(imageFile, new Point(0, 0));

    // Get handle to device context.
    IntPtr hdc = e.Graphics.GetHdc();

    // Get handle to halftone palette.
    IntPtr htPalette = Graphics.GetHalftonePalette();

    // Select and realize new palette.
    SelectPalette(hdc, htPalette, true);
    RealizePalette(hdc);

    // Create new graphics object.
    Graphics newGraphics = Graphics.FromHdc(hdc);

    // Draw image with new palette.
    newGraphics.DrawImage(imageFile, 300, 0);

    // Release handle to device context.
    e.Graphics.ReleaseHdc(hdc);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からGraphics.GetHalftonePalette メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からGraphics.GetHalftonePalette メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からGraphics.GetHalftonePalette メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Graphics.GetHalftonePalette メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Graphics.GetHalftonePalette メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS