There's something else I remembered about PICT files. A PICT file on
a PICT stored in a container field is not going to have that buffer.
dunno, I haven't dealt with PICTs in a while ... I've converted to using
PNGs with CGImages. *shrug*
>
>
> Hi Jake,
>
> Sorry, I was copying and pasting code. My last attempt was to use
> Size(graphicBuffer) to get around the incorrect size error, but I
> had originally used graphicSize.
>
> And yes, unsigned char would be correct, however at this time, I'm
> not even sure that I should be using char to store the output at all.
>
> I can't find any sample code / documentation on how to do this, so
> I've been trying different combinations and getting a few of crashes
> as a result.
>
> thanks
>
> Kent.
>
> > I'm not sure what the Size() function does, but if it's like sizeof,
> > then it's going to return 4, which is the size of a pointer, which is
> > what your "graphicBuffer" variable is. You could maybe correct that
> > by
> > using Size(*graphicBuffer), but why bother? You already know the size
> > of the buffer because you used that to create the buffer. So, instead
> > of using Size(graphicBuffer), just use your "graphicSize" variable.
> >
> > Jake
> >
> > PS. Personally, I (would) use an "unsigned char" buffer, but I don't
> > think it really matters.
> >
> > kent wrote:
> >>
> >>
> >> Hi All,
> >>
> >>
> >> I'm trying to get a graphic, passed as a parameter, and display it
> >> in a
> >> window. (On Mac at the moment, but will need Windows as well, so
> >> may be
> >> back for more)
> >>
> >>
> >> So far, I have... (have error checking, but removed to make easier
> >> to read)
> >>
> >> I've included the results I'm getting for relevant lines at the
> >> bottom.
> >>
> >> I'd appreciate any hints on the gaps in between getting the
> >> graphic, and
> >> trying to display it within a window (ideally as a control)
> >>
> >> thanks
> >>
> >> Kent.
> >>
> >> ----------------------------------------------------------
> >> // relevant variables (others used, but declared elsewhere)
> >> ControlButtonContentInfo iconButton;
> >> char * graphicBuffer;
> >> long graphicSize;
> >>
> >>
> >> // Get the index for the graphic as PICT
> >> index = theGraphic.GetIndex(*fmx::QuadCharAutoPtr( 'P', 'I', 'C',
> >> 'T' ));
> >>
> >>
> >> // Get the graphic buffer size
> >> graphicSize = theGraphic.GetSize( index );
> >>
> >>
> >> // create an array to store the graphic
> >> // Note : Not sure what type this should be (char works ???)
> >> graphicBuffer = new char [graphicSize];
> >>
> >>
> >> // get the graphic and store in our buffer
> >>
> >> err = theGraphic.GetData( index, 0, size, graphicBuffer );
> >>
> >>
> >> // Define the default picture to show (PICT, none)
> >> iconButton.contentType = kControlPictureHandleTag;
> >> iconButton.u.picture = NULL;
> >>
> >> // Create our control to store the graphic. Allow user to click it.
> >> err = CreatePictureControl( parentWinRef(), &R, &iconButton, true,
> >> &objectRef );
> >>
> >>
> >> // Set the control to display our graphic
> >> // this is returning error -30591 : Size doesn't match
> >> err = SetControlData( objectRef, kControlPicturePart,
> >> kControlPictureHandleTag, Size(graphicBuffer), graphicBuffer );
> >>
> >>
> >> ------------------------------------------------------
> >> Results from relevant calls.
> >>
> >> Graphic Count : 3
> >> Graphic Index : PICT (1)
> >> Graphic Size : 3776
> >> Created Picture Control : 0
> >> Set Control Data : -30591
> >>
> >>
> >
> > --
> > Jake Traynham
> > Owner, CNS Plug-ins
> >
http://www.cnsplug-ins.com/ <
http://www.cnsplug-ins.com/>
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>
>