Jump to content
Sign in to follow this  

Radial Gradient Problem

Recommended Posts

Using SMS


When I try to create a radial gradient I simply Get a DOM Exception "Not supported" when I try and run the program. There are no problems with linear gradients and I now my Chrome supports radial gradients.


Is it just me who can't create radial gradients or is there maybe a bug in SMS?

Share this post

Link to post
Share on other sites

There was a bug in the RTL library in this version, if I recall correctly.


An excerpt from my book:


E> There's a bug in the `CreateRadialGradientF` implementation which prevents

E> radial gradients from being created. To fix it, open the *w3graphics* unit

E> (click on the `w3graphics` in the `uses` list of the unit and press Ctrl+Enter).

E> Find the `CreateRadialGradientF` function. In the line where

E> `FDC.createRadialGradient` is called, add parameter `r0` after `y0`.

E> Save, close and recompile and radial gradients should work.


E> {lang="delphi"}

E> ~~~~~~~~~~~~~~~

E> function TW3Canvas.CreateRadialGradientF(x0,y0,r0,

E>   x1,y1,r1:Float):TW3CanvasGradient;

E> var

E>   mTemp: THandle;

E> begin

E>   try

E>    // mTemp:=FDC.createRadialGradient(x0,y0,x1,y1,r1); //original code

E>     mTemp:=FDC.createRadialGradient(x0,y0,r0,x1,y1,r1); //correction

E> except

E>   on e: exception do

E>     Raise Exception.Create('Failed to create gradient object:' +

E>       e.message);

E>   end;

E>   result:=TW3CanvasGradient.Create(mTemp);

E> end;


You can also try the http://www.gabrijelcic.org/Smart/Graphics/ demo, it works fine in Chrome (at least for me).


A chapter on Smart graphics (which includes the radial gradient demo) is available for free at https://leanpub.com/asmartbook (click "Download a sample PDF").


In any case I would suggest upgrading to RC.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this