
[How To] Simulate a Linear Gradient
so..... Maybe, what I was asking was way to in-depth at this forum --- but it would be interesting to see if this beautiful jewel of gradients in some more advanced 'liquid' or fluid movements & motions. Do you have any ideas to start me off tinkering?? Remember, I am a bit of a novice hand at this, but can soak this in like a sponge, and work with parts -- if I see enough examples and explanations. Maybe I can turn something into a flower and re-post it here. A lot of people I have met on other software dev. sites would just kick you to the street for asking questions about graphics! It almost seems like a little friendly island out here called AHK-Land. :lol:
![[How To] Simulate a Linear Gradient: post #16](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)

it would be interesting to see if this beautiful jewel of gradients in some more advanced 'liquid' or fluid movements & motions. Do you have any ideas to start me off tinkering??
I am not sure and do not have much idea on image manipulation. But, I guess that - one can manipulate Bitmap directly in memory with GDI+
Take a look at PhiLho's topic: Image conversions and capturing with GDI
I do not have any expertise in that area

Regards,

![[How To] Simulate a Linear Gradient: post #17](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
I wish i had seen it earlier. I was looking for ways to improve the appearance of the application i am writing.
![[How To] Simulate a Linear Gradient: post #18](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
![[How To] Simulate a Linear Gradient: post #19](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
Is it possible to use this as a background with a tab.
I do not think so. Most of the standard controls use window color to paint it background and to workaround it would be a great mess.
![[How To] Simulate a Linear Gradient: post #20](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
Thanks for this
![[How To] Simulate a Linear Gradient: post #21](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
Anyone have the code for SKAN's BitmapGradient.ahk? It's only linked in this thread, but all the links are broken.
![[How To] Simulate a Linear Gradient: post #22](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
1) Have a var_input = %, so the 50% is flexible
No. That is not possible CreateBMPGradient()! That function has been hardcoded to create a 2 pixel bitmap. Each pixel will occupy half the control 50:50. If you want 33:66, then the function has to re-written to accomodate 3 pixels. Say for blue n black it would be blue+black+black, and effectively blue would occupy 33.33% and black 66.66%
Hope you get that right.
2) To turn this into a callable function, so the display is updated when the function is called. I envision something like UpdateGraph(var_width, var_height, var_start_color, var_end_color, var_input).
Writing such a wrapper function id redundant, IMHO. Just assign a variable (like MyPic ) to the picture control and call the GuiControl command to change the picture ( or its dimension )
Try this:
var_width = 250
var_height = 250
var_start_color = 0208FF
var_end_color = FFFFFF
GradientFile=Bg.bmp
IfNotExist, %GradientFile%
GradientFile:=CreateBMPGradient(GradientFile,var_start_color,var_end_color,1)
Gui, Margin, 0,0
Gui, Add, Picture, x0 y0 w%var_width% h%var_height% v[color=red]MyPic[/color], %GradientFile%
Gui, Show, , AngieX
Return
; Changing the background
[color=red]+F2::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","000000","FF0000",1)
+F3::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","640067","DC6C00",1)
+F4::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","004080","808040",1)
+F5::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","804040","EDC47E",1)
+F6::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","000000","FF8000",1)
+F7::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","000000","00FF00",1)
+F8::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","000000","0000FF",1)
+F9::GuiControl,,MyPic, % CreateBMPGradient("bg.bmp","000000","DECADE",1)[/color]
GuiClose:
GuiEscape:
ExitApp
Return
#Include BitmapGradient.ahk
Try Shift+functions to test the changing of background gradient.
thanks
<a href="12cali.info">12cali</a>
![[How To] Simulate a Linear Gradient: post #23](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)