gnustep / libs-gui

The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification). *** Larger patches require copyright assignment to FSF. please file bugs here. ***
http://www.gnustep.org
GNU General Public License v3.0
279 stars 103 forks source link

Update NSView with setShadow:/shadow methods #229

Closed gcasa closed 11 months ago

gcasa commented 11 months ago

Please see the bug here: https://github.com/gnustep/libs-gui/issues/217

gcasa commented 11 months ago

I think that this might give some clue as to how to do this in the backend. I am not sure that shadows necessarily need layers to work. https://stackoverflow.com/questions/30630280/how-do-i-create-a-circular-shadow-effect-with-cairo

gcasa commented 11 months ago

Also of interest MIGHT be... https://github.com/rcairo/rcairo/blob/master/lib/cairo/context/blur.rb

I know these examples are in different languages, but they are both using cairo, so I wanted to note them here.

gcasa commented 11 months ago

It seems as though the keys being used are these...

[heron@nomad Base.lproj] % strings MainMenu.nib | grep -i shadow                                     [0]
NSShadowHoriz
IBNSShadowedSymbolConfiguration
NSShadowVert
NSViewShadow
NSShadowBlurRadius
NSShadowColor
NSShadow_Test
NSShadow_Test
Quit NSShadow_Test
Quit NSShadow_Test
About NSShadow_Test
About NSShadow_Test
NSShadow_Test Help
NSShadow_Test Help
Hide NSShadow_Test
Hide NSShadow_Test
NSShadow_Test
NSShadow_Test
NSShadow

The new NIBArchive format is proving to be a menace at analyzing nib files for keys... but since we can read xib files it is not a problem, but it is a format we might want to consider looking at in the future. GC

gcasa commented 11 months ago

Yet more info about blur... https://discourse.gnome.org/t/cairo-gaussian-blur-for-shadows/2174

gcasa commented 11 months ago

Okay, so now I have got everything decoding for the NSShadow from the XIB properly. I am going to work on the backend now. Some changes might be needed in libs-gui, but I doubt it.

fredkiefer commented 11 months ago

Let me try to explain this once more:

I would suggest to merge this PR here separately and not wait until you have the complete implementation in place.

gcasa commented 11 months ago

Okay. Thank you for the great input. I will change this PR to ready and if you find it suitable, then please approve.

gcasa commented 11 months ago

I will open another PR for the shadow work in GSGraphicsContext.

gcasa commented 11 months ago

@fredkiefer please approve if it's okay to merge. I am in the process of looking at what is involved on the backend.

gcasa commented 11 months ago

https://github.com/gnustep/libs-gui/pull/232 PR for set method on libs-gui

gcasa commented 11 months ago

Looks mostly OK, but the RETAIN issue needs to be resolved. You could also use the setter instead.

I added both retains, I think using the setter is cleaner. I am going to go ahead and make that change. Give me a moment.

gcasa commented 11 months ago

I changed the code to use the setter, thanks. :). Merging.

gcasa commented 11 months ago

Forgot to add the NSView.m file to the commit... I will correct it on master. Sorry.

gcasa commented 11 months ago

Oh... it got them. :). Nevermind.