Function Reference

_GDIPlus_MatrixRotate

行列を自身と回転行列の積で更新します。

#Include <GDIPlus.au3>
_GDIPlus_MatrixRotate($hMatrix, $fAngle[, $bAppend = False])

 

パラメータ

$hMatrix Matrixオブジェクトのハンドル
$fAngle 回転角度。正数で時計回りに回転します。
$bAppend [オプション]乗算順序を指定します:
 True - 回転行列を左から乗じます
False - 回転行列を右から乗じます

 

返し値

成功: True
失敗: False

 

注意

なし。

 

関連

 

こちらも参照

MSDNライブラリでGdipRotateMatrixを検索して下さい。

 


#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height

    ; GDI+ライブラリを初期化
    _GDIPlus_Startup()

    ; フルスクリーンをキャプチャ
    $hBitmap1 = _ScreenCapture_Capture("")
    $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)

    ; スクリーン領域をキャプチャ
    $hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300)
    $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2)

    $width = _GDIPlus_ImageGetWidth($hImage2)
    $height = _GDIPlus_ImageGetHeight($hImage2)

    ; 画像を他の画像内に描画
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)

    ;DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle,    $iWidth,    $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
    DrawInsert($hGraphic, $hImage2, 350, 100, 0, $width + 2, $height + 2, 0xFFFF8000, 2)
    DrawInsert($hGraphic, $hImage2, 340, 50, 15, 200, 150, 0xFFFF8000, 4)
    DrawInsert($hGraphic, $hImage2, 310, 30, 35, $width + 4, $height + 4, 0xFFFF00FF, 4)
    DrawInsert($hGraphic, $hImage2, 320, 790, -35, $width, $height)

    ; 結果画像を保存
    _GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

    ; リソースを破棄
    _GDIPlus_ImageDispose($hImage1)
    _GDIPlus_ImageDispose($hImage2)
    _WinAPI_DeleteObject($hBitmap1)
    _WinAPI_DeleteObject($hBitmap2)
    ; GDI+ライブラリを閉じる
    _GDIPlus_Shutdown()

EndFunc   ;==>_Main

; #FUNCTION# ==================================================================================================
; 名称...........: DrawInsert
; 説明 ...: 画像を他の画像内に描画
; 書式.........: DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
; Graphics $hImage2を$hGraphicに挿入
; パラメータ ....: $hGraphics   - Graphicsオブジェクトのハンドル
;                  $hImage      - 挿入されるImageオブジェクトのハンドル
;                  $iX          - 挿入される画像の左上隅のX座標
;                  $iY          - 挿入される画像の左上隅のY座標
;                  $iWidth      - 挿入先周りの長方形の枠の幅
;                  $iHeight     - 挿入先周りの長方形の枠の高さ
;                  $iARGB       - ペンの色(枠の色)のアルファ成分とRGB成分
;                  $nWidth      - $iUnitパラメータで指定された単位でのペンの幅 - 枠の幅

; 返し値 .: 成功      - True
;         失敗      - False
;==================================================================================================
Func DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
    Local $hMatrix, $hPen2

    ; 回転行列
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $nAngle, "False")
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

    _GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, $iX, $iY)

    ; ペン+カラーを取得
    $hPen2 = _GDIPlus_PenCreate($iARGB, $nWidth)

    ; 挿入された画像の周りにフレームを描画
    _GDIPlus_GraphicsDrawRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hPen2)

    ; リソースを破棄
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_PenDispose($hPen2)
    Return 1
EndFunc   ;==>DrawInsert