Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Related to GraphicsImportSetDataHandle API



Hi,
 
    I want to draw the JPEG image (which is in Memory) onto Gworld
using correspoding image importer component. Handle to the memory is 
available and image importer handle has been set using
GraphicsImportSetDataHandle. The code snippet is shown below.
Everything is fine till GraphicsImportDraw. But GraphicsImportDraw
is returning codecBadDataErr (-8969). When GetGraphicsImporterForFile
is used to open the same file then GraphicsImportDraw is successful and 
showing the image on window.
 
    Pls suggest why this error is occurred and how can it be fixed?
 
        Handle imageDataHandle = 0;
 
        //err = GetGraphicsImporterForFile( &theFSSpec,        &importer );
        theFile = fopen("Part 1:data6.jpg", "r");
        fseek(theFile, 0, SEEK_END);
        dataSize = ftell(theFile);
        fseek(theFile, 0, SEEK_SET);   
        imageDataHandle = NewHandleClear(dataSize);
        i = fread(*imageDataHandle, 1, dataSize, theFile);
        
        err = OpenADefaultComponent(GraphicsImporterComponentType, kQTFileTypeJPEG, &importer);
        if(err == noErr)
        {
               result = GraphicsImportSetDataHandle(importer, imageDataHandle);            
        }
        
        err = GraphicsImportGetNaturalBounds( importer,  &bounds );  
        OffsetRect( &bounds, 10, 45 );
       window = NewCWindow( NULL, &bounds, "\pDraw Image", true, documentProc, (WindowPtr)-1, true, 0);      
        err = GraphicsImportSetGWorld( importer, GetWindowPort( window ), NULL );             
        err = GraphicsImportDraw( importer );                 
        CloseComponent( importer );
        DisposeHandle(imageDataHandle);
 
Thanks and Regards,
Sivaram Prasad Nakkala
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.