Page 1 of 1

Using svg datatype

Posted: Wed Oct 23, 2013 4:03 pm
by yoodoo2
Does anyone have a simple example of how to use datatypes to load and display a svg file into a rastport? I'm getting ERROR 2000 returned from the following code, which worked up to about update 3, iirc

Thanks

Code: Select all

if (o=IDataTypes->NewDTObject((APTR)filename, NULL)) 
         DTA_SourceType,         DTST_FILE,
           DTA_GroupID,            GID_PICTURE, 
          PDTA_Remap,             TRUE,
           PDTA_Screen,            screen,
          PDTA_FreeSourceBitMap,  TRUE,
           PDTA_DestMode,          PMODE_V43,
           PDTA_UseFriendBitMap,   TRUE,
           OBP_Precision,          PRECISION_IMAGE,
         TAG_DONE))
	{

	drawinfo = IDataTypes->ObtainDTDrawInfoA(o, TAG_DONE);
	IDataTypes->DrawDTObjectA(drawspacewindow->RPort, o,  startx, starty, width, height, 0, 0, TAG_DONE); 
	IDataTypes->ReleaseDTDrawInfo(o, drawinfo);
	IDataTypes->DisposeDTObject(o);
	}

Re: Using svg datatype

Posted: Wed Oct 23, 2013 7:31 pm
by chris
Which SVG datatype are you using? There are at least two - one is a subclass of picture.datatype, and the other is a subclass of drawing.datatype.

If you've changed from using one to the other, then the problem is likely just this tag:

Code: Select all

DTA_GroupID,            GID_PICTURE, 
That's restricting you to picture.datatype subclasses, so remove it.

If you need the drawing.datatype includes let me know and I'll add you to the project, but it shouldn't be necessary unless you're creating a subclass.

Re: Using svg datatype

Posted: Wed Oct 23, 2013 7:49 pm
by yoodoo2
It certainly doesn't work with your version, 53.1, but I believe it stopped working with earlier versions from salass (52?) too.
Any idea what the error code 2000 means? Can't find it in the includes.

Re: Using svg datatype

Posted: Thu Oct 24, 2013 1:55 pm
by thomasrapp
yoodoo2 wrote:Any idea what the error code 2000 means? Can't find it in the includes.
Use GetDTString(2000) to get the message text.

Re: Using svg datatype

Posted: Thu Oct 24, 2013 5:24 pm
by salass00
yoodoo2 wrote: Any idea what the error code 2000 means? Can't find it in the includes
At end of <datatypes/datatypes.h>:
#define DTERROR_UNKNOWN_DATATYPE 2000

It means that it wasn't recognised as a supported format by any of the datatype descriptors installed on the system. Either you forgot to install the SVG descriptor file in DEVS:DataTypes or the file is just not being recognised as an SVG file (maybe because it's compressed?).

Re: Using svg datatype

Posted: Fri Oct 25, 2013 5:42 pm
by chris
salass00 wrote:It means that it wasn't recognised as a supported format by any of the datatype descriptors installed on the system. Either you forgot to install the SVG descriptor file in DEVS:DataTypes or the file is just not being recognised as an SVG file (maybe because it's compressed?).
Or because it's not a GID_PICTURE datatype...

@yoodoo2

If it doesn't work with either, it might be a problem with the descriptor, as IIRC I used salass00's descriptor for my SVG datatype.

Can you open the file with MultiView?

Re: Using svg datatype

Posted: Fri Oct 25, 2013 8:09 pm
by yoodoo2
Hmm, something odd going on here. Some of the svg files I use for testing did load in Multiview a few days ago, but now they don't. They all load fine in both OWB and NetSurf.

I must have messed something up here somehow.