Board index FlightGear Development Canvas

Canvas clipping  Topic is solved

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Canvas clipping

Postby Gijs » Wed Sep 25, 2013 6:54 pm

Hi,

now that I've most of the 744's EICAS pages done, I started converting the PFD to Canvas. I think I can implement all of its functionality, but there's one thing that doesn't work yet.

For the attitude indicator, I've created a group containing two squares (sky and ground) and placed a rounded-square on top of it. I then selected the group and the rounded-square, chose Object > Clip > Set and voila, the horizon is nicely clipped (see image below). When I load this in FlightGear, the clip isn't respected and I see the full squares of both sky and ground.

Is my procedure wrong? Should I register something in the Nasal? Or is clipping not yet (fully) supported? You can find my SVG file at http://liveries.flightgear.org/744/PFD.svg It's just a rough sketch to see if I can get clipping to work.

Cheers,
Gijs

Image
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas clipping  

Postby TheTom » Wed Sep 25, 2013 9:24 pm

I just had a look at my own PFD and saw that the SVG parsers doesn't support it yet. For now you have to use .set("clip", "rect(<top>, <right>, <bottom>, <left>"); I will add this to the parser if I find some time...
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: Canvas clipping

Postby Gijs » Thu Sep 26, 2013 1:16 pm

Cool, that works. But it doesn't give me the nice rounded corners that I'll eventually need. At least I can continue with the rest of the display now. Thanks!

Cheers,
Gijs
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Canvas clipping

Postby Philosopher » Thu Sep 26, 2013 1:28 pm

Could you make the corners as separate SVG elements? (and place them over the ground/sky paths) That would be relatively easy.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Canvas clipping

Postby TheTom » Thu Sep 26, 2013 1:53 pm

Currently only rectangular clipping regions are possible (and will be for the next time). You can still get rounded corners if you just draw them in black (or any other background color) on top of the clipped region. (My HSI also has rounded corners: viewtopic.php?f=19&t=19294&start=180#p189161)
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: Canvas clipping

Postby Gijs » Thu Sep 26, 2013 2:32 pm

Thanks to both of you it works just like our 3D instruments now. Feels a little old-scool this way, but looks great ;-)
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest