POV-Ray : Newsgroups : povray.macintosh : Associating a resolution with a .pov file : Re: Associating a resolution with a .pov file Server Time
18 May 2024 07:29:49 EDT (-0400)
  Re: Associating a resolution with a .pov file  
From: Eric Pepke
Date: 5 Jan 2003 14:16:54
Message: <3E1883FC.2020905@acm.org>
Thorsten wrote:

> Eric Pepke wrote:
> 
>>However, I would like to be able to associate an image size with
>>a particular .pov file that I generate.  Is there any way to do
>>this?  I don't know where the sizes are stored when they are set
>>in the user interface, the resource fork perhaps?
>>
> 
> Well, where else could they be stored together with the file?  Apparently
> you are a programmer, so you can just get the POV-Ray source code and find
> out the exact details of the preference format there. It is
> well-documented.


That's a good question.  I would think that they might be stored in a
file with the same name and a different extension.  However, when I
create a .pov file with the user interface, it doesn't appear to do
that.  By playing around with cp, though, I noticed that the .pov
file did have a resource fork.  Looking at the resource fork with
ResEdit, I noticed two resources with type POVR.  The one with ID
3000 appeared to be the one with the information.

Following your advice, however, I got the POV-Ray source code and
searched for "Preference" and "Setting" (both are used in the POV-Ray
user interface).  I found a piece of code that executed a
WritePreferencesResource that used the TextDocument.renderSettings to
keep the render settings.  This, of course, is a Collection, which is
a Mac Carbon Core thingie.  I went through a bunch of stuff trying to
figure out the use of kFilePrefs_CollectionKind versus (which is 'FPrf')
which says it's used in kFPData_CollectionKind, but it isn't, and
kPrefsCollectionKind which is actually 'Kind', so at this point I gave
up and went back to WritePreferencesResource, which I found in the
framework subdirectory, and it turns out the kind doesn't matter much,
because it uses a FlattenCollectionToHdl to get the data to save to the
resource.  This, of course, is Mac-specific and basically has an
internal format.  However, it's likely that Apple will maintain backward
compatibility.  So, at this point I gave up trying to find where the
format is well documented and just looked through the resource to find
the values for width and height.  A 16-bit height turns out to start at
address 31A, and a 16-bit width turns out to start at address 322.  This
is probably the low word of a 32-bit number, but it doesn't matter for
the resolutions I'm using.


I went back and looked at the Read Me First! file, the How To Compile!
file, the various text files in the subdirectories, and I could still
find no documentation.

So, in the absence of being able to find this documentation, I guess I'm
stuck with taking a snapshot of the resource set up correctly, patching
in the width and height programmatically, and saving that as a resource.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.