News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Gdi Shadow Rect

Started by ragdog, March 21, 2018, 08:20:46 PM

Previous topic - Next topic

ragdog

Hello

Is it Possible to create with gdi/gdi++ a Transparent shadow rect like this?



I search on many sites but i cannot found any solution.

Have any an idea or code snipp?

Greets,


daydreamer

https://docs.microsoft.com/en-us/dotnet/framework/winforms/advanced/brushes-and-filled-shapes-in-gdi
maybe you could define a path gradient brush for a rectangle and paint a little smaller white rectangle ontop of it
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

ragdog

Thanks for your reply

I have try it allready with gradient brush for a rectangle (GradientFill) but without goot results.

ok is stupid  :biggrin:


I must give a another solution but i cannot find any after many hours google.

LiaoMi

Algorithm for fast Drop shadow in GDI+
https://stackoverflow.com/questions/7364026/algorithm-for-fast-drop-shadow-in-gdi

IIR Gaussian Blur Filter Implementation using IntelĀ® Advanced Vector Extensions
PDF https://software.intel.com/sites/default/files/Gaussian_Filter.pdf
Download source: gaussian_blur.cpp [36KB] https://software.intel.com/sites/default/files/m/4/3/7/a/a/gaussian_blur_0311.cpp
https://software.intel.com/en-us/articles/iir-gaussian-blur-filter-implementation-using-intel-advanced-vector-extensions

ragdog

Hello

Thanks for the links i found from Qword an example
http://masm32.com/board/index.php?topic=2513.msg26347#msg26347

With a Ellipse if i change it to a rectangle have i not good result, i think the problem is the GradientCenterColor.
Now after many hours google can i not found any soultion in c/cpp or anything ,I do not understand  Delphi/#Net .

And think is not possible, unless i use a png image.

Regards,

mabdelouahab

Using some trick, I got a little similarity  :biggrin:



jj2007

Quote from: mabdelouahab on March 23, 2018, 09:53:37 AM
Using some trick

"some tricks" seems to be an underestatement - great code :t

Invoke GdipCreatePen1,COLOR_, STCK_, 0, Addr pen ;FP4(1.0)
invoke GdipCreatePath,FillModeAlternate,ADDR path
invoke GdipAddPathLineI,path,x1,Y,x2,Y
invoke GdipAddPathLineI,path,XW,y1,XW,y2 invoke GdipAddPathLineI,path,x2,YH,x1,YH
invoke GdipAddPathLineI,path,x2,YH,x1,YH
invoke GdipAddPathLineI,path,X,y2,X,y1 add rv(AddS,y1,ROUND_),1
invoke GdipAddPathArcI,path,X,Y,RR,RR,FP4(180.0),FP4(90.0)
invoke GdipAddPathArcI,path,x2,Y,RR,RR,FP4(270.0),FP4(90.0)
invoke GdipAddPathArcI,path,x2,y2,RR,RR,FP4(0.0),FP4(90.0)
invoke GdipAddPathArcI,path,X,y2,RR,RR,FP4(90.0),FP4(90.0)
invoke GdipCreateSolidFill,COLOR_,ADDR brush;ARGB_(130,255,0 , 255)
invoke GdipFillPath,graphics,brush,path/invoke GdipDeleteBrush,brush
invoke GdipDeleteBrush,brush
invoke GdipDrawPath,graphics,pen,path .endif/invoke GdipDeletePen,pen
DrawRectWithShadow invoke GdipDeletePen,pen/invoke GdipDeletePath,path
invoke GdipDeletePath,path
MainDraw invoke GdipCreateBitmapFromScan0,rect.right,rect.bottom,0,PixelFormat32bppPARGB,0,ADDR bitmap
invoke GdipGetImageGraphicsContext,bitmap,ADDR graphics
invoke GdipCreateHBITMAPFromBitmap,bitmap,ADDR Hbitmap,0
WinMain invoke GdipDisposeImage,bitmap
invoke GdiplusStartup,ADDR gtkn,ADDR gsi,0

ragdog

#7
Hello Mabdelouahab

Thank you for your time and example.
i studi your code  :t

I have change Qwords code from Ellipse to a rectangle and have simlilar looksame your example

but the lines in the corners do not looks good



Siekmanski

Looks like "vignettes".

I think it can be done with Polar Coordinates....
Maybe there are code examples on the net.
Creative coders use backward thinking techniques as a strategy.

ragdog