Jump to content
Sign in to follow this  
Noviceatthis

GDI help needed

Recommended Posts

Noviceatthis

Hello all,

So basically i'm playing around with GDI plus in an effort to understand it better, and i've hit a bit of a problem:

#include <GDIPlus.au3>

_GDIPlus_Startup()

$hBitmap = _GDIPlus_BitmapCreateFromScan0(500, 80)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)

$hBrush1 = _GDIPlus_BrushCreateSolid(0xFF8090F0)
$hBrush2 = _GDIPlus_BrushCreateSolid(0xFFCC00FF)


_GDIPlus_GraphicsFillRect($hContext, 0, 0, 250, 80, $hBrush1)
_GDIPlus_GraphicsFillRect($hContext, 250, 0, 250, 80, $hBrush2)


_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Test.jpg")

_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_Shutdown()

ShellExecute(@ScriptDir & "\Test.jpg")

So it does what I want, to an extent. The transition zone between the two colours has (if you zoom in) several other intermediary colours. I was just wondering whether it was possible to have the the one colour transitioning to the other without these intermediaries, meaning there are only two colours in this picture.

Thanks in advance.

Share this post


Link to post
Share on other sites
Noviceatthis

Thanks eukalyptus, works perfectly

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.