Sign in to follow this  
Followers 0
nend

[SOLVED]GDI how can I do this?

5 posts in this topic

#1 ·  Posted (edited)

Hoi,

I've got one logo ( jpg 150x150 pixels) and a shade (png 110X110 pixels)

How can I resize the logo to 110x110 and lay over (inserted) the shade jpg so that the picture is 110x110

Everytime I'd tryd to do that the logo gets smaller but also the shade gets smaller in ratio.

How can I make this right?

#include "GDIPlus.au3"
#include "GuiConstantsEx.au3"

Local $hGUI, $hImagelogo, $hImageshade, $hGraphicpop

$hGUI = GUICreate("", 400, 400)
GUISetState()

_GDIPlus_StartUp()
$hGraphicpop = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$hImagelogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\test.jpg")
$hImageshade = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\shade.png")


$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImagelogo)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hImageshade, 0, 0)
_GDIPLus_GraphicsDrawImageRect($hGraphicpop, $hImagelogo, 20, 20, 110, 110)

Do
Sleep(20)
until GUIGetMsg() = $GUI_EVENT_CLOSE

_GDIPlus_GraphicsDispose($hGraphicpop)
_GDIPlus_ImageDispose($hImagelogo)
_GDIPlus_ImageDispose($hImageshade)
_GDIPlus_ShutDown()

post-16070-0-91421200-1354191196_thumb.p

post-16070-0-37545600-1354191197_thumb.j

post-16070-0-84640700-1354191371_thumb.j

Edited by nend

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Please provide the images.

Btw, it is not GDI but GDI+. ;)

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Please provide the images.

Btw, it is not GDI but GDI+. ;)

Br,

UEZ

Hoi UEZ,

Thanks for looking at it.

I've inserted the image in the first post.

I can place the shade image on the logo image on a gui but I want to saves it as 1 image finally.

Edited by nend

Share this post


Link to post
Share on other sites

Try this:

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

Local $hGUI, $hImagelogo, $hImageshade, $hGraphicpop

$hGUI = GUICreate("", 400, 400)
GUISetState()

_GDIPlus_StartUp()
$hGraphicpop = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$hImagelogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "test.jpg")
$hImageshade = _GDIPlus_ImageLoadFromFile(@ScriptDir & "shade.png")

$iW_bg = _GDIPlus_ImageGetWidth($hImagelogo)
$iH_bg = _GDIPlus_ImageGetHeight($hImagelogo)
$hBitmap =  _GDIPlus_BitmapCreateFromGraphics($iW_bg, $iH_bg, $hGraphicpop)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$iW_fg = _GDIPlus_ImageGetWidth($hImageshade)
$iH_fg = _GDIPlus_ImageGetHeight($hImageshade)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImagelogo, 0, 0, $iW_bg, $iH_bg)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImageshade, $iW_bg - $iW_fg, 0, $iW_fg, $iH_bg)
_GDIPlus_GraphicsDrawImageRect($hGraphicpop, $hBitmap, 0, 0, $iW_bg, $iH_bg)
_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "Result.jpg")

Do
Sleep(20)
until GUIGetMsg() = $GUI_EVENT_CLOSE

_GDIPlus_ImageDispose($hImagelogo)
_GDIPlus_ImageDispose($hImageshade)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hGraphicpop)
_GDIPlus_ShutDown()

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Try this:

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

Local $hGUI, $hImagelogo, $hImageshade, $hGraphicpop

$hGUI = GUICreate("", 400, 400)
GUISetState()

_GDIPlus_StartUp()
$hGraphicpop = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$hImagelogo = _GDIPlus_ImageLoadFromFile(@ScriptDir & "test.jpg")
$hImageshade = _GDIPlus_ImageLoadFromFile(@ScriptDir & "shade.png")

$iW_bg = _GDIPlus_ImageGetWidth($hImagelogo)
$iH_bg = _GDIPlus_ImageGetHeight($hImagelogo)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW_bg, $iH_bg, $hGraphicpop)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)

$iW_fg = _GDIPlus_ImageGetWidth($hImageshade)
$iH_fg = _GDIPlus_ImageGetHeight($hImageshade)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImagelogo, 0, 0, $iW_bg, $iH_bg)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImageshade, $iW_bg - $iW_fg, 0, $iW_fg, $iH_bg)
_GDIPlus_GraphicsDrawImageRect($hGraphicpop, $hBitmap, 0, 0, $iW_bg, $iH_bg)
_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "Result.jpg")

Do
Sleep(20)
until GUIGetMsg() = $GUI_EVENT_CLOSE

_GDIPlus_ImageDispose($hImagelogo)
_GDIPlus_ImageDispose($hImageshade)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_GraphicsDispose($hGraphicpop)
_GDIPlus_ShutDown()

Br,

UEZ

Thanks UEZ,

I't works great, I'm gonna studdy that script so the next time I can do it my self. :thumbsup:

Regards,

Nend

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0