|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
Problems with picFrameI have a plugin that was written for 4D 2004 on a Mac using the 4D 2004 Plugin SDK (written in Carbon). I need to get it working in 4D v11 Mac. I don't have time to rewrite it in Cocoa, so I thought I would recompile it for 32-bit Universal and try it in 4D v11. The 4D Conversion documentation says the following: "Plug-ins of version 2004 (4D or third party) are compatible with 4D v11 SQL", so I thought it would work.
I am, however, having problems with pictures in the plugin. I pass picture parameters to the plugin to do some special processing. A section of the code retrieves the picture's frame rectangle to work with. When running in 4D v11, the picture frame rectangle retrieved appears to be garbage. Here is an example of the line of code that retrieves the picture frame: vPic1 = (PicHandle)PA_GetPictureHandleParameter( params, 1, &vPic1_info ); pic1Rect = (*vPic1)->picFrame; How do I retrieve the proper picFrame for the picture? I need the dimensions. Jon Thelin |
|
|
Re: Problems with picFrame> Here is an example of the line of code that retrieves the picture
> frame: > > vPic1 = (PicHandle)PA_GetPictureHandleParameter( params, 1, > &vPic1_info ); > pic1Rect = (*vPic1)->picFrame; > > How do I retrieve the proper picFrame for the picture? I need the > dimensions. v11 does not use QuickDraw (it is deprecated), so PA_Picture is no longer a PicHandle. To get the dimensions you have to use PA_ExecuteCommandByID and call the PICTURE PROPERTIES command. PA_Variable params[3]; PA_SetPictureVariable(¶ms[0], vPic1); PA_SetLongintVariable(¶ms[1], 0); PA_SetLongintVariable(¶ms[2], 0); PA_ExecuteCommandByID(457, params, 3); long width = PA_GetLongintVariable(¶ms[1]); long height = PA_GetLongintVariable(¶ms[2]); Similarly, to get the size in bytes you call the 'Picture size' command. Regards, Aparajita www.aparajitaworld.com "If you dare to fail, you are bound to succeed." - Sri Chinmoy | www.srichinmoy.org ********************************************************************** 4D Plugins hosted by 4D, Inc. http://www.4D.com/ Register for 4D Summit 2009 Today http://www.4D.com/summit To Unsubscribe: mailto:4D-Plugins-off@... *********************************************************************** |
|
|
Re: Problems with picFrameThe PA_ExecuteCommandByID call does not exist in the 4D 2004 Plugin SDK. Is this a new call in the v11 SDK? If so, how do I modify the project to use the new 4D commands and still keep the project carbon? Jon Thelin
|
|
|
Re: Problems with picFrame> The PA_ExecuteCommandByID call does not exist in the 4D 2004 Plugin
> SDK. Is > this a new call in the v11 SDK? If so, how do I modify the project > to use > the new 4D commands and still keep the project carbon? The v11 SDK is still C/Carbon-based. Regards, Aparajita www.aparajitaworld.com "If you dare to fail, you are bound to succeed." - Sri Chinmoy | www.srichinmoy.org ********************************************************************** 4D Plugins hosted by 4D, Inc. http://www.4D.com/ Register for 4D Summit 2009 Today http://www.4D.com/summit To Unsubscribe: mailto:4D-Plugins-off@... *********************************************************************** |
|
|
Re: Problems with picFrameHi,
if you examine the two sets of pluginAPI.c, you will see that the entry point for the 2004/v11 entry points are not mutually exclusive. it is possible to hybrid the two. (David Dancy has posted a detailed message on how) though,I think you should replace the call with, PA_GetPictureParameter( params, index, *pict, &info ); for simplicity. miyako On 2009/09/28, at 8:10, Jon Thelin wrote:
|
|
|
|
|
|
Re: Problems with picFrameJens Blomster wrote...
>> - use the 4D2004 Plugin SDK, just like before >> - replace the header files Flags.h, PrivateTypes.h, PublicTypes.h with >> counterparts from a Plugin SDK v11 - generated project (so to get the >> 64-bit types right and possible to compile) >> - set XCode to compile Universal. >> >> The resulting .bundle plugin worked with both 2004 and >> v11/Intel/no-Rosetta. Apparently now there was a PicHandle, since >> retrieval of the picFrame now worked as before. Maybe I activated a >> compatibility layer in 4Dv11 by using the old plugin entry points. I tired this and was unable to compile without errors in 4DPluginAPI.h and 4DPluginAPI.c (over 700 errors in total). Here is a sample of some of the errors: 4DPluginAPI.h:218: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PA_CreateTableRef' 4DPluginAPI.h:219: error: expected ')' before 'tableRef' 4DPluginAPI.h:220: error: expected ')' before 'tableRef' 4DPluginAPI.h:341: error: expected declaration specifiers or '...' before 'PA_PictureInfo' Jon Thelin |
|
|
|
|
|
|
|
|
Re: Problems with picFrameThe pictures that I will be working with are all in PICT format originally from the 4D database. The PICT picture is passed to the plugin, some text is drawn over on top of the picture (and/or other pictures are added to the picture), and then it is returned to 4D for displaying/printing. I'm using Carbon QuickDraw routines to perform the alterations to the picture. After looking through the 4D Plugin API files from the Plugin SDK v11, I'm wondering if I can extract the PICT data from the 4D picture parameter that is passed to the Plugin (it comes through as PA_Picture). Then make the needed alterations to the picture using Carbon Quickdraw routines and then somehow bundle the PICT file back into a PA_Picture for returning. The following snippet is not real code, but a summary of what I might do:
PA_Picture vPA_Pic1; PA_Picture newPA_Pic; PicHandle vPic1; long index = 0; boolean foundIt; PA_Unistring *type; vPA_Pic1 = PA_GetPictureParameter( params, 1 ); ... find index of 'Pict' type in vPA_Pic1 using PA_GetPictureData calls with null handle. ... (it should be the first one since they are PICT pictures.) PicHandle vPic1 = PA_NewHandle( 0 ); type = PA_GetPictureData( vPA_Pic1, index, (PA_Handle)vPic1 ) PA_DisposeUnistring( type ); .... do any manipulating of the PicHandle here using carbon quickdraw routines. >>>>> how do I put the PicHandle (vPic1) back into a PA_Picture (newPA_Pic) for returning? <<<<< PA_SetPictureParameter( params, 1, newPA_Pic ); The problem is that I don't know how to bundle my new PicHandle (PICT format) back into 4D's PA_Picture for returning. I could be on the wrong track entirely. Jon Thelin |
|
|
Re: Problems with picFrameI have a plugin written with the 4D 2004 Plugin SDK and compiled as universal. When I run it using 4D v11, it runs in 'compatibility mode' as noted in 4D_v11_Plugin_SDK.pdf:
Plugins that use 4D Plugin API v11 exports now the "FourDPackex" method instead of "FourDPack". When 4D loads a plugin, if the new method is exported, 4D will load the plugin as a new plugin, and will communicate with this plugin using only Unicode, and the new Picture format. Plugins that continue to export the old method will be considered as legacy plugins, and they will continue to work using a compatibility mode exactly like with 4D 2004. If for some reasons you prefere not to handle Unicode now, you can still use 4D Plugin SDK 2004 for this purpose, plugins created will continue to work exactly the same way. I am passing a Pict picture from 4D to the plugin. it appears to behave as if it is a Qucikdraw picture (I can perform a DrawPicture with it, etc). However, I am unable to get the picture's picframe (rectangle) to determine it's dimensions. It doesn't appear to be formatted as a standard Quickdraw picture. Does anyone know how I can retrieve the picture's dimensions from within the Plugin? Jon Thelin > > if you examine the two sets of pluginAPI.c, > you will see that the entry point for the 2004/v11 entry points are > not mutually exclusive. > it is possible to hybrid the two. (David Dancy has posted a detailed > message on how) > > though,I think you should replace the call with, > > PA_GetPictureParameter( params, index, *pict, &info ); > > for simplicity. > > miyako > > On 2009/09/28, at 8:10, Jon Thelin wrote: > > > > The PA_ExecuteCommandByID call does not exist in the 4D 2004 Plugin > SDK. Is > this a new call in the v11 SDK? If so, how do I modify the project > to use > the new 4D commands and still keep the project carbon? > > > Jon Thelin > > > > aparajita wrote: >> >>>> Here is an example of the line of code that retrieves the picture >>>> frame: >>>> >>>> vPic1 = (PicHandle)PA_GetPictureHandleParameter( params, 1, >>>> &vPic1_info ); >>>> pic1Rect = (*vPic1)->picFrame; >>>> >>>> How do I retrieve the proper picFrame for the picture? I need the >>>> dimensions. >> >>> v11 does not use QuickDraw (it is deprecated), so PA_Picture is no >>> longer a PicHandle. To get the dimensions you have to use >>> PA_ExecuteCommandByID and call the PICTURE PROPERTIES command. >>> >>> PA_Variable params[3]; >>> PA_SetPictureVariable(¶ms[0], vPic1); >>> PA_SetLongintVariable(¶ms[1], 0); >>> PA_SetLongintVariable(¶ms[2], 0); >>> PA_ExecuteCommandByID(457, params, 3); >>> >>> long width = PA_GetLongintVariable(¶ms[1]); >>> long height = PA_GetLongintVariable(¶ms[2]); >> >> Similarly, to get the size in bytes you call the 'Picture size' >> command. >> |
| Free embeddable forum powered by Nabble | Forum Help |