openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Openexr-devel] Error handling in RgbaInput file


From: Brad Hards
Subject: [Openexr-devel] Error handling in RgbaInput file
Date: Sun, 11 Jan 2004 17:36:49 +1100
User-agent: KMail/1.5.94

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm looking at the examples, and don't fully understand the API. 
For example, in the read examples, what happens in an error
case?

For example, in this code:
<example>
void
readRgba1 (const char fileName[],
           Array2D<Rgba> &pixels,
           int &width,
           int &height)
{
    //
    // Read an RGBA image using class RgbaInputFile:
    //
    //  - open the file
    //  - allocate memory for the pixels
    //  - describe the memory layout of the pixels
    //  - read the pixels from the file
    //

    RgbaInputFile file (fileName);
    Box2i dw = file.dataWindow();

    width  = dw.max.x - dw.min.x + 1;
    height = dw.max.y - dw.min.y + 1;
    pixels.resizeErase (height, width);

    file.setFrameBuffer (&pixels[0][0] - dw.min.x - dw.min.y * width, 1, width);
    file.readPixels (dw.min.y, dw.max.y);
}
</example>

What happens if the file doesn't exist? Which function will error out? 
What will the return value be?

Similarly, what happens if the file isn't really a EXR file? Or is corrupted?

Brad
- -- 
http://linux.conf.au - I'm registered. Are you?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAAO8DGwwszQ/PZzgRAug+AJwPGbQwzg6iN7yBjrBpe032rrjveQCggvqN
VuU4EoTF9oE14TtatyI2xBY=
=0Hhz
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]