openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] Error handling in RgbaInput file


From: Drew Hess
Subject: Re: [Openexr-devel] Error handling in RgbaInput file
Date: Sat, 10 Jan 2004 23:15:32 -0800 (PST)

If the file doesn't exist/is corrupted/isn't an EXR, the constructor will 
throw an exception.  That's how all IlmImf routines indicate errors, via 
exceptions.

In the case of the examples, the exceptions are caught by main (), see 
main.cpp.


-dwh-


On Sun, 11 Jan 2004, Brad Hards wrote:

> -----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-----
> 
> 
> _______________________________________________
> Openexr-devel mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/openexr-devel
> 
> 
> 






reply via email to

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