Author Topic: Drop shadow layout, may be turned into something useful?  (Read 968 times)

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
    • My deviantart page
Drop shadow layout, may be turned into something useful?
« on: January 20, 2019, 08:37:54 AM »
I've put together a simple layout to demonstrate my drop shadow code, here it works for wheel art but you can use it on any image. I'm not a good programmer but I'm sure someone might like the code and maybe build something useful with that (a class?) so that it can be used and re-used.

The parameters to play with to define the shadow are in the code, they are self explanatory except from shadow_downsample, this is a float parameter < 1.0 so that the shadow surface is built smaller than the original image and then enlarged. Since the shadow is smooth you won't loose detail and gain speed because the shader will be faster on a smaller image.

Have fun!

jedione

  • Hero Member
  • *****
  • Posts: 600
  • punktoe
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #1 on: January 20, 2019, 08:41:09 AM »
thankyou....now paying with... ;D
help a friend....

jedione

  • Hero Member
  • *****
  • Posts: 600
  • punktoe
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #2 on: January 20, 2019, 09:13:30 AM »
just tryed to cram this code in to the shuffle module,  would be cool..

to no avail...
help a friend....

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #3 on: January 20, 2019, 09:16:31 AM »
just tryed to cram this code in to the shuffle module,  would be cool..

to no avail...

LOL don't ask me, it was hard enough to untangle this code from my own Arcadeflow layout :D I promise I'll take a look at how to code classes and all this cool stuff as soon as possible

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 815
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #4 on: January 20, 2019, 09:35:35 AM »
Thank you @zapaolo! Will update shader module tonight with this. Working on compiling mame within a virtual console and it’s eating up my resources and even crashed my computer.

@jedione As far as integrating it with shuffle - I assume it would be the no different than styling existing objects. Assume. I could be wrong. Let me add this to the module tonight and then send me what your working on.

jedione

  • Hero Member
  • *****
  • Posts: 600
  • punktoe
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #5 on: January 20, 2019, 09:36:37 AM »
thanks...alot...
btw does this work text...did not for me.
help a friend....

jedione

  • Hero Member
  • *****
  • Posts: 600
  • punktoe
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #6 on: January 20, 2019, 09:39:07 AM »
ok in a bit ill send you the shuffle that i have made with animation... ;D ;D ;D ;D
help a friend....

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 815
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #7 on: January 20, 2019, 09:44:04 AM »
thanks...alot...
btw does this work text...did not for me.

According to the docs, shader isn’t available for text. It is available for image and surface. I don’t see why you couldn’t place text on a surface and then duplicate the surface for the shadow.

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #8 on: January 20, 2019, 09:51:16 AM »
thanks...alot...
btw does this work text...did not for me.

According to the docs, shader isn’t available for text. It is available for image and surface. I don’t see why you couldn’t place text on a surface and then duplicate the surface for the shadow.

It can work for text, I use it for drop shadows exactly as you say, putting text on the first surface and applying shader to that surface. I'll check tomorrow and post an update :)

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 815
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #9 on: January 20, 2019, 09:55:14 AM »
Exactly. Not available directly on text object, but available to surface that can contain objects including text. :)

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #10 on: January 20, 2019, 10:01:58 AM »
Exactly. Not available directly on text object, but available to surface that can contain objects including text. :)

The problem is that the code does a clone of the artwork to place it in the surface to be shaded, but you can't clone a text object. In my layout I don't need safeguard areas so I just place text on a surface, and clone that surface inside a second surface, and then apply the shaders. This works but shadow is cut when the surface ends. I'll see if I can come up with some clever trick

zpaolo11x

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
    • My deviantart page
Re: Drop shadow layout, may be turned into something useful?
« Reply #11 on: January 20, 2019, 10:05:24 AM »
For text you can do like this: instead of creating a picture called pic0, create a surface and place text on the surface:

local pic0 = fe.add_surface(400,200)
local t0 = pic0.add_text("[Title]",0,0,400,100)

Actually whatever you add to that surface will be "dropshadowed" :D

Bgoulette

  • Sr. Member
  • ****
  • Posts: 112
  • I wrote a book.
    • View Profile
    • BlakeGoulette.com
Re: Drop shadow layout, may be turned into something useful?
« Reply #12 on: January 20, 2019, 12:20:50 PM »
Looking forward to poking around in this! (Sorry for the banal comment: seems AM forums' don't have a means of bookmarking threads?)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 168
    • View Profile
    • Idaho Garagecade
Re: Drop shadow layout, may be turned into something useful?
« Reply #13 on: January 20, 2019, 01:08:46 PM »
Looking forward to poking around in this! (Sorry for the banal comment: seems AM forums' don't have a means of bookmarking threads?)

NOTIFY button at top right does this.
Visit my arcade blog ... www.idahogaragecade.com (updated 12-13-18)

calle81

  • Sr. Member
  • ****
  • Posts: 178
    • View Profile
Re: Drop shadow layout, may be turned into something useful?
« Reply #14 on: January 20, 2019, 02:48:24 PM »
Would be cool if you could also show how to do a white glow behind wheel art :)

This together with the conveyor module would be gold!  :)