Author Topic: Text Shadow CSS importer  (Read 186 times)

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 233
  • UNUS SED LEO
    • View Profile
Text Shadow CSS importer
« 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

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 336
    • View Profile
    • my personal website
Re: Text Shadow CSS importer
« Reply #1 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.
Check my source code editor for GLBasic - link Update: 20.04.2020

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 233
  • UNUS SED LEO
    • View Profile
Re: Text Shadow CSS importer
« Reply #2 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
« Last Edit: 2020-May-19 by Qedo »

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 335
    • View Profile
Re: Text Shadow CSS importer
« Reply #3 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.

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 233
  • UNUS SED LEO
    • View Profile
Re: Text Shadow CSS importer
« Reply #4 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

Offline SnooPI

  • Dr. Type
  • ****
  • Posts: 335
    • View Profile
Re: Text Shadow CSS importer
« Reply #5 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.
« Last Edit: 2020-May-20 by SnooPI »

Offline Qedo

  • Mr. Polyvector
  • ***
  • Posts: 233
  • UNUS SED LEO
    • View Profile
Re: Text Shadow CSS importer
« Reply #6 on: 2020-May-20 »
 :good: