Using svg datatype

This forum is for general developer support questions.
Post Reply
yoodoo2
Posts: 9
Joined: Wed Aug 31, 2011 10:07 am

Using svg datatype

Post 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);
	}
chris
Posts: 564
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

Re: Using svg datatype

Post 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.
yoodoo2
Posts: 9
Joined: Wed Aug 31, 2011 10:07 am

Re: Using svg datatype

Post 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.
User avatar
thomasrapp
Posts: 318
Joined: Sun Jun 19, 2011 12:22 am

Re: Using svg datatype

Post 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.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Using svg datatype

Post 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?).
chris
Posts: 564
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

Re: Using svg datatype

Post 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?
yoodoo2
Posts: 9
Joined: Wed Aug 31, 2011 10:07 am

Re: Using svg datatype

Post 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.
Post Reply