Function Reference


_GDIPlus_GraphicsDrawImagePointsRect

Draws an image

#include <GDIPlus.au3>
_GDIPlus_GraphicsDrawImagePointsRect ( $hGraphics, $hImage, $nULX, $nULY, $nURX, $nURY, $nLLX, $nLLY, $nSrcX, $nSrcY, $nSrcWidth, $nSrcHeight [, $hImageAttributes = 0 [, $iUnit = 2]] )

Parameters

$hGraphics Pointer to a Graphics object
$hImage Pointer to an Image object
$nULX The X coordinate of the upper left corner of the source image
$nULY The Y coordinate of the upper left corner of the source image
$nURX The X coordinate of the upper right corner of the source image
$nURY The Y coordinate of the upper right corner of the source image
$nLLX The X coordinate of the lower left corner of the source image
$nLLY The Y coordinate of the lower left corner of the source image
$nSrcX The X coordinate of the upper-left corner of the portion of the source image to be drawn
$nSrcY The Y coordinate of the upper-left corner of the portion of the source image to be drawn
$nSrcWidth The width of the portion of the source image to be drawn
$nSrcHeight The height of the portion of the source image to be drawn
$hImageAttributes [optional] Pointer to an ImageAttributes object that specifies the color and size attributes of the image to be drawn
$iUnit [optional] Unit of measurement:
    0 - World coordinates, a nonphysical unit
    1 - Display units
    2 - A unit is 1 pixel
    3 - A unit is 1 point or 1/72 inch
    4 - A unit is 1 inch
    5 - A unit is 1/300 inch
    6 - A unit is 1 millimeter

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).

Related

_GDIPlus_GraphicsDrawImage

See Also

Search GdipDrawImagePointsRect in MSDN Library.

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; X64 running support
        Local $sWow64 = ""
        If @AutoItX64 Then $sWow64 = "\Wow6432Node"

        ;get AutoIt install dir
        Local $sRegPath = "HKLM\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt"

        Local $sFile = RegRead($sRegPath, "InstallDir") & "\Examples\GUI\logo4.gif"
        If Not FileExists($sFile) Then
                MsgBox(($MB_SYSTEMMODAL + $MB_ICONHAND), "", $sFile & " not found!", 30)
                Return False
        EndIf

        _GDIPlus_Startup()
        Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) ;create an image object based on a file
        If @error Then
                _GDIPlus_Shutdown()
                MsgBox(($MB_SYSTEMMODAL + $MB_ICONHAND), "", "An error has occured - unable to load image!", 30)
                Return False
        EndIf

        Local $hGUI, $hGraphic, $iImgW, $iImgH

        ; Create GUI
        $hGUI = GUICreate("GDI+", 800, 400)
        GUISetState(@SW_SHOW)
        $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle

        $iImgW = _GDIPlus_ImageGetWidth($hImage)
        $iImgH = _GDIPlus_ImageGetHeight($hImage)

        _GDIPlus_GraphicsDrawImagePointsRect($hGraphic, $hImage, 100, 10, 300, 60, 90, 160, 0, 0, $iImgW * 0.45, $iImgH)
        _GDIPlus_GraphicsDrawImagePointsRect($hGraphic, $hImage, 300, 60, 360, 30, 290, 210, $iImgW * 0.45, 0, $iImgW * 0.2, $iImgH)
        _GDIPlus_GraphicsDrawImagePointsRect($hGraphic, $hImage, 360, 30, 560, 80, 350, 180, $iImgW * 0.65, 0, $iImgW * 0.35, $iImgH)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

        ;cleanup resources
        _GDIPlus_ImageDispose($hImage)
        _GDIPlus_GraphicsDispose($hGraphic)
        _GDIPlus_Shutdown()
        GUIDelete($hGUI)
EndFunc   ;==>Example