Page 2 of 2
Re: Reflection Effect
Posted: Mon Jan 30, 2017 12:59 pm
by netmaestro
Thanks for sharing that, RASHAD. It's another nice and compact implementation and it works well. My only concern with it is that the alpha drops off rather suddenly at the 2/3 mark. The dropoff is too sharp. If you look at the image in the first post, with the alpha reduced exponentially via the code from #NULL, you see that the alpha drops off quickly but yet still gradually. If you combine what you have with a variant of what #NULL supplied, we may have a viable alternative. Which we can always use. Please see what you can do.
Re: Reflection Effect
Posted: Mon Jan 30, 2017 1:06 pm
by RASHAD
@NM I just added a new snippet to my previous post
Maybe we should use the vector lib all around
Will try it if I have some more time
Re: Reflection Effect
Posted: Mon Jan 30, 2017 1:06 pm
by netmaestro
In threads like this one I really miss my friend srod. He really brings math to the masses, a rare and remarkable talent.
Re: Reflection Effect
Posted: Mon Jan 30, 2017 1:29 pm
by RASHAD
Agree not only for his talent with math but for more than that
But we still have Demivec ,Wilbert (Trond and I hope he is doing well)
Re: Reflection Effect
Posted: Mon Jan 30, 2017 2:47 pm
by coder14
THANK YOU EVERYONE!!!
Really great codes. Now to study and understand them.
TBH after testing them I feel that netmaestro's results are the best for my needs - I increased the exponent and get the perfect fade that looks like a drop reflection. Very nice!
I'm grateful to all of you for your help.
Re: Reflection Effect
Posted: Mon Jan 30, 2017 2:52 pm
by blueb
netmaestro wrote:... If only I'd spent less time dipping pigtails in the inkwell and paid more attention in school I might know some of this stuff.
We have the same disease.
Re: Reflection Effect
Posted: Mon Jan 30, 2017 5:36 pm
by Kwai chang caine
Very very nice .....
And very useful because, never i have a table enough clean in my house, for can have really this effect
Thanks a lot at all for sharing

Re: Reflection Effect
Posted: Mon Jan 30, 2017 7:27 pm
by Keya
blueb wrote:netmaestro wrote:... If only I'd spent less time dipping pigtails in the inkwell and paid more attention in school I might know some of this stuff.
We have the same disease.
or maybe just the same type of teachers like mine who never showed maths actually can be fun

Re: Reflection Effect
Posted: Tue Jan 31, 2017 7:05 am
by wilbert
Looking a bit closer to the example in the first post, it looks like the reflection in the image is also blurred.
Re: Reflection Effect
Posted: Thu Aug 31, 2017 7:06 pm
by SeregaZ
no any new simplest solution for mirror image? i need some horisontal or vertical or both case. without this fade out or mix colors.
Re: Reflection Effect
Posted: Thu Aug 31, 2017 8:48 pm
by normeus
This Procedure from @RASHAD's & @Netmaestro sample code:
Code: Select all
Procedure Image_Rotate(Image,Angle)
nimgw = h*Sin(Angle*#PI/180)+w*Cos(Angle*#PI/180)
nimgh = w*Sin(Angle*#PI/180) + h*Cos(Angle*#PI/180)
temp=CreateImage(#PB_Any,nimgw,nimgh)
Dim p.Point(2)
p(0)\x=0
p(0)\y=nimgh
p(1)\x=nimgw
p(1)\y=nimgh
p(2)\x=0
p(2)\y=0
ImageDc = CreateCompatibleDC_(0)
SelectObject_(ImageDc,ImageID(Image))
dc=StartDrawing(ImageOutput(temp))
PlgBlt_(dc,@p(),ImageDc,0,0,w,h,0,0,0)
StopDrawing()
CopyImage(temp,image)
FreeImage(temp)
EndProcedure
flips the image.
see the full code here
http://www.purebasic.fr/english/viewtop ... 37#p501437 and
around line 59 comment out ;FreeImage(10) then use image 10
around line 63 ImageGadget(1,0,h,w,h,ImageID(10))
send an image to it and it will flip it.
if you want vertical (horizontal?) change this section:
Code: Select all
; p(0)\x=0
; p(0)\y=nimgh
; p(1)\x=nimgw
; p(1)\y=nimgh
; p(2)\x=0
; p(2)\y=0
p(0)\x=nimgw
p(0)\y=0
p(1)\x=0
p(1)\y=0
p(2)\x=nimgw
p(2)\y=nimgh
[edit] added some code
Norm.