Update:
This small update brings a proper shadow implementation with blurring, two new functions (textPath and textAlongPath) and a few bug fixes. textAlongPath is still somewhat buggy with multi-segment paths but otherwise works great (see the TextWave demo). I fixed a few problems with arcTo that wasn’t working as specified and made a few changes here and there. More importantly, I fixed a nasty crash bug that was sometimes happening on exit.
There is also two new utility functions available from script allowing you to suspend the canvas drawing updates. This allows you to do all the drawing necessary for a frame of animation and refresh the canvas at the end, instead of having it refresh at 30fps while your script is doing all the drawing operations.
With this new API, it was possible to fix all the flickering in the included examples! I’ve also added a few new example scripts. Check out the Polygon example, as well as all the text-related ones.
Download
Every major browser has support for it, Yahoo! Widgets has support for it, how come there isn't something for DesktopX?
Enter DXCanvas, a DesktopX drawing plugin that implements the Canvas spec (plus some DesktopX-specific additions).
How does it work
DXCanvas is a DesktopX drawing plugin, which means it takes over drawing for the object it is associated to.
In the configuration, you can set the initial size for the canvas. By default, the drawing surface size will be 300x150. You can also specify whether you want the surface to be transparent and show the other objects or windows under it, or opaque.
A canvas object is made available to scripting. To be able to draw on the canvas, you need to request a context. This is done by calling getContext(type) on the canvas object. The only supported type right now is "2d".
See the list of functions in the implementation section. Note that some are slightly different from the Canvas specification, or are completely new. This is to adjust to differences in what is possible in a browser and in DesktopX.
Canvas Controller Widget
I've made a little widget to make testing easier. It loads a list of scripts from a user-defined folder and allows you to switch between them. It support scripts written in both JScript and VBScript.
It basically associate the script to an object having the DXCanvas plugin as a capability.
Two functions are required for the scripts to work: Object_OnScriptEnter() and Object_OnScriptExit().
The canvas size is reset its default size of 300x150 when switching between scripts, so make sure to set it to the required size if needed by your script.
To add a new script to the list, create a new .js or .vbs file in a folder and select this folder in the widget preferences. A few test scripts are included in the Script folder.
It also support subfolders (only 1 folder deep), so you can organize your scripts in subfolders.
How to help
Download the Canvas Controller widget and start creating scripts!
What to look for
What is broken/not working properly
Links
Changelog
1.1 Build 287:
1.1 Build 269:
1.0 Build 225:
1.0 Build 217
1.0 Build 214
1.0 Build 211
1.0 Build 201
1.0 Build 191
1.0 Build 180
1.0 Build 168
1.0 Build 159
1.0 Build 149
You can download a test version here. It only includes the Canvas Controller widget for now. Please do not use the DXCanvas plugin in your own objects and widgets yet. This version of the plugin will expire on the 10/01/2008.
Implementation
Under the hood, it's using Cairo, a 2D vector graphics library that also powers the Mozilla and Yahoo Widgets implementations. Right now, the Cairo library is dynamically loaded at runtime, but I hope to have it statically linked into the plugin for the final version.
Here is a list classes with their attributes and functions and the state of their implementation
Canvas
CanvasRenderingContext2D
Gradient
ImageData
PixelArray
TextMetrics
Littleboy,
With the latest build the controller starts minimized to the system tray and crashes when I try to open it. This occurs on all of my systems - Vista and XP. Tried running a script from a new object and still get the (Null) error on the Set ctx = canvas.getContext("2d") line.
Can you send me the DXCanvas.log file?
20:07:17:337 =====================================================================================================================20:07:17:337 == DXCanvas v1.0 build 21120:07:17:337 =====================================================================================================================20:07:17:337 Creating new surface (300x150)20:07:17:337 Creating new context20:08:22:662 Destroying surface and context
===============Finish Loging================
OK, so it's creating the surface and context allright. How come you get null when asking for the context?
I forgot to ask you for the crash details (the contents of the crash dialog). Did you extract the new version to a new folder or to the same folder as the old version? Is the dxpack doing the same thing and crashing DesktopX too?
If you have a debugger installed on the machine, getting a stack trace would be nice too (if you don't, don't worry about it).
When it crashes on Vista I only get a nice pretty dialog that says - Canvas Controller.exe has stopped working. On XP this is what I get for an error code:
AppName: canvas controller.exe AppVer: 0.0.0.0 ModName: canvas controller.exe ModVer: 0.0.0.0 Offset: 00014aa3 This is what is in the crash log: *************************************************************** <?xml version="1.0" encoding="UTF-16"?><DATABASE><EXE NAME="Canvas Controller.exe" FILTER="GRABMI_FILTER_PRIVACY"> <MATCHING_FILE NAME="Canvas Controller.exe" SIZE="1112064" CHECKSUM="0x1E519228" MODULE_TYPE="WIN32" PE_CHECKSUM="0x8ECB3" LINKER_VERSION="0x0" LINK_DATE="03/28/2008 19:14:43" UPTO_LINK_DATE="03/28/2008 19:14:43" /> <MATCHING_FILE NAME="SDCtrls.dll" SIZE="217088" CHECKSUM="0xE6CA394" BIN_FILE_VERSION="1.0.0.3" BIN_PRODUCT_VERSION="1.0.0.3" PRODUCT_VERSION="1, 0, 0, 3" FILE_DESCRIPTION="DesktopX ActiveX USER Control Wrapper" COMPANY_NAME="Stardock" PRODUCT_NAME="DesktopX ActiveX Controls" FILE_VERSION="1, 0, 0, 3" ORIGINAL_FILENAME="SDCtrls.DLL" INTERNAL_NAME="SDCtrls" LEGAL_COPYRIGHT="Copyright 2004" VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="1.0.0.3" UPTO_BIN_PRODUCT_VERSION="1.0.0.3" LINK_DATE="05/22/2006 19:19:36" UPTO_LINK_DATE="05/22/2006 19:19:36" VER_LANGUAGE="English (United States) [0x409]" /> <MATCHING_FILE NAME="SDPlugins\DXAxHost.dll" SIZE="442560" CHECKSUM="0x4CEA5916" BIN_FILE_VERSION="3.5.0.0" BIN_PRODUCT_VERSION="3.5.0.0" PRODUCT_VERSION="3, 5, 0, 0" FILE_DESCRIPTION="DXScript" COMPANY_NAME="Stardock" PRODUCT_NAME="DXScript" FILE_VERSION="3, 5, 0, 0" ORIGINAL_FILENAME="DXAxHost.DLL" INTERNAL_NAME="DXAxHost" LEGAL_COPYRIGHT="Copyright 2001-2007 Stardock Corporation" VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0x796DA" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="3.5.0.0" UPTO_BIN_PRODUCT_VERSION="3.5.0.0" LINK_DATE="03/26/2008 23:44:02" UPTO_LINK_DATE="03/26/2008 23:44:02" VER_LANGUAGE="English (United States) [0x409]" /> <MATCHING_FILE NAME="SDPlugins\DXCanvas.dll" SIZE="2642944" CHECKSUM="0xA36A1A4B" BIN_FILE_VERSION="1.0.0.1" BIN_PRODUCT_VERSION="1.0.0.1" PRODUCT_VERSION="1.0.0.0" FILE_DESCRIPTION="DesktopX plugin : Provides a scriptable free-form vector drawing surface" COMPANY_NAME="Three Oaks Crossing" PRODUCT_NAME="DXCanvas" FILE_VERSION="1.0.0.0" ORIGINAL_FILENAME="DXCanvas.dll" INTERNAL_NAME="DXCanvas.dll" LEGAL_COPYRIGHT="Copyright (c) 2008 Three Oaks Crossing. All rights reserved." VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="1.0.0.1" UPTO_BIN_PRODUCT_VERSION="1.0.0.1" LINK_DATE="09/14/2008 17:18:57" UPTO_LINK_DATE="09/14/2008 17:18:57" VER_LANGUAGE="English (United States) [0x409]" /></EXE><EXE NAME="kernel32.dll" FILTER="GRABMI_FILTER_THISFILEONLY"> <MATCHING_FILE NAME="kernel32.dll" SIZE="984576" CHECKSUM="0xF0B331F6" BIN_FILE_VERSION="5.1.2600.3119" BIN_PRODUCT_VERSION="5.1.2600.3119" PRODUCT_VERSION="5.1.2600.3119" FILE_DESCRIPTION="Windows NT BASE API Client DLL" COMPANY_NAME="Microsoft Corporation" PRODUCT_NAME="Microsoft® Windows® Operating System" FILE_VERSION="5.1.2600.3119 (xpsp_sp2_gdr.070416-1301)" ORIGINAL_FILENAME="kernel32" INTERNAL_NAME="kernel32" LEGAL_COPYRIGHT="© Microsoft Corporation. All rights reserved." VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x40004" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0xF9293" LINKER_VERSION="0x50001" UPTO_BIN_FILE_VERSION="5.1.2600.3119" UPTO_BIN_PRODUCT_VERSION="5.1.2600.3119" LINK_DATE="04/16/2007 15:52:53" UPTO_LINK_DATE="04/16/2007 15:52:53" VER_LANGUAGE="English (United States) [0x409]" /></EXE></DATABASE> ***************************************************************
AppName: canvas controller.exe AppVer: 0.0.0.0 ModName: canvas controller.exe
ModVer: 0.0.0.0 Offset: 00014aa3
This is what is in the crash log:
***************************************************************
<?xml version="1.0" encoding="UTF-16"?><DATABASE><EXE NAME="Canvas Controller.exe" FILTER="GRABMI_FILTER_PRIVACY"> <MATCHING_FILE NAME="Canvas Controller.exe" SIZE="1112064" CHECKSUM="0x1E519228" MODULE_TYPE="WIN32" PE_CHECKSUM="0x8ECB3" LINKER_VERSION="0x0" LINK_DATE="03/28/2008 19:14:43" UPTO_LINK_DATE="03/28/2008 19:14:43" /> <MATCHING_FILE NAME="SDCtrls.dll" SIZE="217088" CHECKSUM="0xE6CA394" BIN_FILE_VERSION="1.0.0.3" BIN_PRODUCT_VERSION="1.0.0.3" PRODUCT_VERSION="1, 0, 0, 3" FILE_DESCRIPTION="DesktopX ActiveX USER Control Wrapper" COMPANY_NAME="Stardock" PRODUCT_NAME="DesktopX ActiveX Controls" FILE_VERSION="1, 0, 0, 3" ORIGINAL_FILENAME="SDCtrls.DLL" INTERNAL_NAME="SDCtrls" LEGAL_COPYRIGHT="Copyright 2004" VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="1.0.0.3" UPTO_BIN_PRODUCT_VERSION="1.0.0.3" LINK_DATE="05/22/2006 19:19:36" UPTO_LINK_DATE="05/22/2006 19:19:36" VER_LANGUAGE="English (United States) [0x409]" /> <MATCHING_FILE NAME="SDPlugins\DXAxHost.dll" SIZE="442560" CHECKSUM="0x4CEA5916" BIN_FILE_VERSION="3.5.0.0" BIN_PRODUCT_VERSION="3.5.0.0" PRODUCT_VERSION="3, 5, 0, 0" FILE_DESCRIPTION="DXScript" COMPANY_NAME="Stardock" PRODUCT_NAME="DXScript" FILE_VERSION="3, 5, 0, 0" ORIGINAL_FILENAME="DXAxHost.DLL" INTERNAL_NAME="DXAxHost" LEGAL_COPYRIGHT="Copyright 2001-2007 Stardock Corporation" VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0x796DA" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="3.5.0.0" UPTO_BIN_PRODUCT_VERSION="3.5.0.0" LINK_DATE="03/26/2008 23:44:02" UPTO_LINK_DATE="03/26/2008 23:44:02" VER_LANGUAGE="English (United States) [0x409]" /> <MATCHING_FILE NAME="SDPlugins\DXCanvas.dll" SIZE="2642944" CHECKSUM="0xA36A1A4B" BIN_FILE_VERSION="1.0.0.1" BIN_PRODUCT_VERSION="1.0.0.1" PRODUCT_VERSION="1.0.0.0" FILE_DESCRIPTION="DesktopX plugin : Provides a scriptable free-form vector drawing surface" COMPANY_NAME="Three Oaks Crossing" PRODUCT_NAME="DXCanvas" FILE_VERSION="1.0.0.0" ORIGINAL_FILENAME="DXCanvas.dll" INTERNAL_NAME="DXCanvas.dll" LEGAL_COPYRIGHT="Copyright (c) 2008 Three Oaks Crossing. All rights reserved." VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x4" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" UPTO_BIN_FILE_VERSION="1.0.0.1" UPTO_BIN_PRODUCT_VERSION="1.0.0.1" LINK_DATE="09/14/2008 17:18:57" UPTO_LINK_DATE="09/14/2008 17:18:57" VER_LANGUAGE="English (United States) [0x409]" /></EXE><EXE NAME="kernel32.dll" FILTER="GRABMI_FILTER_THISFILEONLY"> <MATCHING_FILE NAME="kernel32.dll" SIZE="984576" CHECKSUM="0xF0B331F6" BIN_FILE_VERSION="5.1.2600.3119" BIN_PRODUCT_VERSION="5.1.2600.3119" PRODUCT_VERSION="5.1.2600.3119" FILE_DESCRIPTION="Windows NT BASE API Client DLL" COMPANY_NAME="Microsoft Corporation" PRODUCT_NAME="Microsoft® Windows® Operating System" FILE_VERSION="5.1.2600.3119 (xpsp_sp2_gdr.070416-1301)" ORIGINAL_FILENAME="kernel32" INTERNAL_NAME="kernel32" LEGAL_COPYRIGHT="© Microsoft Corporation. All rights reserved." VERFILEDATEHI="0x0" VERFILEDATELO="0x0" VERFILEOS="0x40004" VERFILETYPE="0x2" MODULE_TYPE="WIN32" PE_CHECKSUM="0xF9293" LINKER_VERSION="0x50001" UPTO_BIN_FILE_VERSION="5.1.2600.3119" UPTO_BIN_PRODUCT_VERSION="5.1.2600.3119" LINK_DATE="04/16/2007 15:52:53" UPTO_LINK_DATE="04/16/2007 15:52:53" VER_LANGUAGE="English (United States) [0x409]" /></EXE></DATABASE>
I extracted the zip to a new folder and tried it and it crashed. I also extracted the zip over the old and got the same. This build did not have a .dxpack included in the .zip
I also tried to run one of the sample scripts in a new object, included the plug-in in Additional abilities and still get the null error.
Hope this helps.
Same happened to me. Starts minimized, then crashed.
I compiled a gadget using the controller object and had the same result.
Then when I went into your main script and edited the paths you had, basically just change forward slashes to back slashes then it works. Strange behavior because it should bring up an error about the script paths and not crash.
Are you running anything from McFee ? This looks like your antispyware is catching it for some reason. Can you try disabling it and test again?
What was the latest working build for you? IIRC using the plugin alone never worked for you, right?
I'm not running anything from McCafee. The plugin never worked on Vista for me.
Your previous build worked for me on my work computer(XP).
Build 214 is working on my XP machine (XP Pro - SP2) here at work. I'll try it on Vista tonight and let you know ASAP.
Hopefully last build before releasing it on Wincustomize. It should feel a little bit faster
Had a crash with both Build 214 & 217 but, not when I built a gadget from your widget.
Was copying over top of previous build's. So when I deleted the old version folder & the gadget cache folder (each time) then build's 211,214 and 217 all ran perfectly.
Good to hear! I'm waiting for CaptainBeaker to test it on his Vista computer before uploading it on WC.
Build 217 is a release build and won't expire, so if you're confident it will work, you can start building and distributing things based on it.
Unfortunately I still get the Null error on this line:
Set ctx = canvas.getContext("2d")
The DXCanvas log is empty. I did hovever notice this. I went into the plugin configuration and unchecked 'use per-pixel alpha blending and I get a black box (in the dimensions I set in the plugin) instead of the context. After I get the Null error and select 'Disable and Edit' or 'Continue' the black box remains. If I select per-pixel alpha blending and try to run the script again, the black context box does not show up.
?????......
My bad, the log was disabled in release mode. I've uploaded a new build. Can you try it and see what appears in the log?
If that doesn't work, can you try another scripting plugin and see if it works? There is DXVolumeControl or the scriptable email plugin included with DesktopX. If none of those two work, then it's probably a problem on your side or DesktopX acting strange...
Do you run any antispyware or anything that could cause scripts to be blocked?
The behavior with the black box seems to be normal. Since you cannot use the context and paint anything on it, it appears as fully transparent black in per-pixel mode and opaque black otherwise.
You might want to lock down a layer. Specifically the list box. At the moment I'm looking at the list box control and the rest of the gadget has gone AWOL.
Yeah, it seems to be a bug with DesktopX. The listbox will move no matter what. The only way to prevent it from moving is to lock movement on the main object, which AFAIK is not possible from script. I tried locking the object, adding a new layer and locking that layer in addition to the object, but with no luck. If I add OnMove, OnDrag, OnLButtonUp callbacks, I get called alright when dragging the object, but then if I call Object.Move it doesn't do anything. DesktopX seems to think the listbox is still at the previous coordinates (shows them in objects list and object properties), even though the listbox clearly moved.
I'm probably going to have to remove the lock option
I tried your Vistavolume control and get the same (null) error that I do with the Canvas plugin. I think there must be something going on with my Vista systems. I'm using Avast! AV on each of them. I'll unistall Avast and see if the plugins start working. I have no problems running any of the scripts I add to objects and the DXmeter plugin works for me. It looks like something is stopping the scriptable plugins as you suggested. I don't think there is a problem with your plugin.
Thanks for your help...
Scripting plugins are registering as COM components (in HKCU, so it works as a standard user). Avast might be blocking registry access in some way.
I've been working with UAC turned off. I turned it back on tonight and I do not get the (Null) error. I'm able to run Canvas scripts in an object and see output. However, if I crash my script with a syntax error or an undefined variable, when I select 'Cancel and edit' or 'continue' the context flashes on and of very rapidly like it's flickering and my CPU(s) max out. I have a hell of a time killing the object.
I'm getting closer, but something's still up.
This one might be a problem with my code. Can you send me an object that exhibits this behavior (max CPU and flicker)?
I just made a new object and pasted a simple script which draws concentric circles. The script has no errors and the object starts flickering and then maxing out the CPU. I have to kill DesktopX to get rid of it. I packaged the object but need your e-mail again to send it.
I just found your e-mail and sent the test object.
I just tried the latest build on my work computer (XP Pro). The flickering and pegged CPU is occuring on this computer also when I run the test scripts. The Canvas Controller has been working consistently on this machine until this build.
The flickering is most pronounced when I run this script. I pasted it as is in case there is something about the script that is causing the flicker, but it might just be the size of the context causing the problem. I tried running the script with different context sizes. I start to see the flicker when the context gets around 800 X 800 and it gets worse as it gets bigger. Looks like the context is having a hard time refreshing as it gets bigger. When I noticed the problem on my Vista machine, I was using a context of 800 X 800.
There are many great features available to you once you register, including:
Sign in or Create Account