Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[How To] Simulate a Linear Gradient


  • Please log in to reply
22 replies to this topic
AngieX
  • Members
  • 77 posts
  • Last active: Aug 16 2008 03:17 AM
  • Joined: 26 Nov 2006
I hope you had a very very good rest! We as humans do need them most frequently! :-) I try to go to Spa once a month to relax my nerves and calm my spirit!

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:

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear AngieX, :)

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 :(. Maybe you can request PhiLho in that topic.

Regards, :)

mb777
  • Members
  • 42 posts
  • Last active: Feb 25 2009 07:06 PM
  • Joined: 08 Jan 2009
This is brilliant!

I wish i had seen it earlier. I was looking for ways to improve the appearance of the application i am writing.

mb777
  • Members
  • 42 posts
  • Last active: Feb 25 2009 07:06 PM
  • Joined: 08 Jan 2009
Is it possible to use this as a background with a tab. I am trying, but cannot make the tab transparent for the image to show through

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

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.

TLM
  • Administrators
  • 3864 posts
  • Last active:
  • Joined: 21 Aug 2006
HOLY CRAP MIND FRIGGIN BLOWING!!!!!

Thanks for this

egocarib
  • Members
  • 42 posts
  • Last active: Nov 11 2016 07:10 PM
  • Joined: 17 Apr 2015

Anyone have the code for SKAN's BitmapGradient.ahk? It's only linked in this thread, but all the links are broken.



thanhlam1793
  • Members
  • 1 posts
  • Last active: Dec 14 2015 01:26 PM
  • Joined: 07 Dec 2015

 

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>