GLBasic forum

Codesnippets => 2D-snippets => Topic started by: Qedo on 2020-May-09

Title: Text Shadow CSS importer
Post by: Qedo on 2020-May-09
I wanted to bring the Text Shadow CSS Generator into GLBasic and attached find the result.
At the page https://html-css-js.com/css/generator/text-shadow/ I found 30 ready-made examples and I imported their CSS.
Find everything in the source and if you want to add your own style edited on the site you can add it in the FONT_CSS1.txt file.
It is sufficient to copy and past the CSS perhaps with a few small changes
Not everything is implemented, for example the CMYK and CSV color commands are not recognized because at the moment I am satisfied so even if it should not be complicated to implement them.
For the Blur effect I used the excellent example of fast blur found at //http://blog.ivank.net/fastest-gaussian-blur.htmle, customized for GLB.
If you want and if you like it you can use it in your programs, I would be pleased.
Ciao
Qedo
Title: Re: Text Shadow CSS importer
Post by: dreamerman on 2020-May-19
Interesting project, effects looks nice and this can be handy, specially blur and shadow functions.
Those c++ inline in OpenGL part are much faster than standard GLB? Some possible optimization is to avoid DimPush and just declare arrays with final size.
Title: Re: Text Shadow CSS importer
Post by: Qedo on 2020-May-19
dreamerman, you are always attentive and collaborative. it is a pleasure to confront with you.
in the OpenGL part the program uses only the FASTMEM2SPRITE function which would be the equivalent of the GLB MEM2SPRITE but faster. This avoids the bottleneck of MEM2SPRITE which is not very fast.
for DimPush I don't care much because they are not used heavily.
What slows down the CPU is the calculation of the GaussianBlur function which, despite the name, is not a real Gaussian.
I used an alternative optimization method which I found at this address http://blog.ivank.net/fastest-gaussian-blur.html
With this function you get some good results that allow you to use them in real time calculation as you saw by editing the text.
However I would like to know the opinion of other forum users
Thank
Ciao
Title: Re: Text Shadow CSS importer
Post by: SnooPI on 2020-May-19
Yes it's interesting and I confirm MEM2SPRITE is slow, I also had to write my own function for my 3D software engine.

Good job Qedo.
Title: Re: Text Shadow CSS importer
Post by: Qedo on 2020-May-20
thanks SnooPI, did you also customize SPRITE2MEM?  (although less critical)
I tried it in OpenGL (the source is attached to the program) but it doesn't work well
Ciao
Title: Re: Text Shadow CSS importer
Post by: SnooPI on 2020-May-20
No, because I didn't have the use of it.
But I will take a closer look.

---EDIT---
Qedo, just a tip, use Gernot's OpenGL wrapper instead.
With this (very good) wrapper you can use all the OpenGL functions without using the INLINE function.

...\GLBasic\Samples\Common\gl.gbas

There are many interesting sources in this Common folder.
Title: Re: Text Shadow CSS importer
Post by: Qedo on 2020-May-20
 :good: