PhotoCD(3)
NAME
PhotoCD − Reader for Kodak(tm) Photo CD(tm) format
DESCRIPTION
Kodak Photo CD allows digital data generated by scanning 35-mm film to be encoded and stored on a compact disc. The XIL library supports the following Photo CD image resolutions:
BASE/16192 x 128 pixels
BASE/4384 x 256
BASE768 x 512
4BASE1536 x 1024
16BASE3072 x 2048
64BASE6144 x 4096
Images on Kodak Photo CD are stored in the XIL library’s "photoycc" color space. The Photo CD reader returns images in this color space. To display or further process the images, you normally convert the images to an RGB color space, such as "rgb709," by calling xil_color_convert(3). Grayscale or "Black and White" versions of the images may be obtained by converting to "y709" or "ylinear."
Using the Photo CD Reader
To access images from Photo CD files, supply "ioSUNWPhotoCD" for the devicename argument in xil_create_from_device(3), and specify NULL for the deviceObj argument. After creating the device image, it may be used as a source to any XIL image operation. Because Photo CD is a read-only device, the device image created by this device handler is read-only. Trying to use the device image as a destination will generate an error.
Use xil_get_device_attribute(3) and xil_set_device_attribute(3) to get and set the Photo CD reader attributes, as described below. The Photo CD reader doesn’t use or recognize associated device objects, so you cannot initialize attributes for it. You must create the device image first, then set its attributes.
PhotoCD Reader Attributes
The following paragraphs describe the attributes of the Photo CD reader. The enumerated types are defined in xilPhotoCD.h. Note that some attributes are "set/get" and others are "get-only." This is noted under the Access heading for each attribute.
FILEPATH
Description Pathname for the desired image pack. Setting this attribute directs the library to use the image pack with the given pathname for the next use as an image source. This attribute does not need to be reset for each use of the image as a source, only when a different image is desired. There is no default pathname; trying to use the created device image before setting this attribute will cause an error to be generated.
Access set/get
Type char ∗
RESOLUTION
Description Describes the size of the image to be obtained from the Photo CD. The default value is XIL_PHOTOCD_BASE, or 768 x 512 pixels. After the value has been set, the FILEPATH attribute may be changed without changing the desired resolution. Conversely, the resolution may be changed without resetting the path attribute.
Access set/get
Type typedef enum{
XIL_PHOTOCD_16TH_BASE,
XIL_PHOTOCD_4TH_BASE,
XIL_PHOTOCD_BASE,
XIL_PHOTOCD_4X_BASE,
XIL_PHOTOCD_16X_BASE
XIL_PHOTOCD_64X_BASE
} XilPhotoCDResolution;
MAX_RESOLUTION
Description Describes the maximum size obtainable from this image pack. In some cases, not all image sizes are available within an image pack (This is sometimes done for pre-recorded Photo CDs). This attribute returns the maximum size which may be asked for using the RESOLUTION attribute. The value returned is one of the sizes described below.
Access get-only
Type typedef enum{
XIL_PHOTOCD_16TH_BASE,
XIL_PHOTOCD_4TH_BASE,
XIL_PHOTOCD_BASE,
XIL_PHOTOCD_4X_BASE,
XIL_PHOTOCD_16X_BASE
XIL_PHOTOCD_64X_BASE
} XilPhotoCDResolution;
ROTATION
Description Describes the amount of rotation required to display the image in its proper orientation. The value returned is one of the enumeration constants shown below.
Access get-only
Type typedef enum{
XIL_PHOTOCD_CCW0,
XIL_PHOTOCD_CCW90,
XIL_PHOTOCD_CCW180,
XIL_PHOTOCD_CCW270
} XilPhotoCDRotate;
ERRORS
For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide.
EXAMPLES
The following example opens a Photo CD image, checking the image’s ROTATION attribute so it can rotate the image, if necessary, before displaying it, and so the display window has the appropriate dimensions. The example also converts the image to the RGB 709 color space for display.
XilSystemState state;
XilImage ycc_photocd_image, rgb_photocd_image, photocd_image, display;
XilPhotoCDRotate rotation;
char ∗pathname = "my_photocd_image";
state = xil_open();
/∗ create the device image ∗/
ycc_photocd_image = xil_create_from_device(state, "ioSUNWPhotoCD", NULL);
/∗ set the file name and desired image size ∗/
xil_set_device_attribute(ycc_photocd_image, "FILEPATH", pathname);
xil_set_device_attribute(ycc_photocd_image, "RESOLUTION",
(void∗) XIL_PHOTOCD_BASE);
/∗ read the image’s rotation attribute and image parameters ∗/
xil_get_device_attribute(ycc_photocd_image, "ROTATION", (void∗∗)&rotation);
xil_get_info(ycc_photocd_image, &width, &height, &nbands, &datatype);
/∗ create an image to prepare for color-space conversion ∗/
rgb_photocd_image = xil_create(state, width, height, nbands,
datatype);
/∗ Set color spaces to prepare for color-space conversion ∗/
xil_set_colorspace(ycc_photocd_image,
xil_colorspace_get_by_name(state, "photoycc"));
xil_set_colorspace(rgb_photocd_image,
xil_colorspace_get_by_name(state, "rgb709"));
/∗ Convert the image’s color space so it can be displayed ∗/
xil_color_convert(ycc_photocd_image, rgb_photocd_image);
/∗ Set the image origin in preparation for a rotation ∗/
xil_set_origin(rgb_photocd_image, width/2.0, height/2.0);
/∗ Based upon the Photo CD image’s ROTATION attribute, open a
∗ window with appropriate dimentions; for 90 and 270 degree
∗ rotation, the image is rotated. Also, set the Photo CD
∗ image’s origin to its center. ∗/
if(rotation == XIL_PHOTOCD_CCW90 ||
rotation == XIL_PHOTOCD_CCW270) {
/∗ ...code to open a window with dimensions height-by-width ...∗/
display = xil_create_from_window(state, xdisplay, xwindow);
photocd_image = xil_create(state, height, width, nbands,
datatype);
xil_set_origin(photocd_image, height/2.0, width/2.0);
}
else {
/∗ ...code to open a window with dimensions width-by-height ...∗/
display = xil_create_from_window(state, xdisplay, xwindow);
photocd_image = xil_create(state, width, height, nbands,
datatype);
xil_set_origin(photocd_image, width/2.0, height/2.0);
}
/∗ Set the radians for a rotation. Constant PI has be previously
∗ defined and set equal to 3.14159 ∗/
switch (rotation) {
case XIL_PHOTOCD_CCW0:
angle = 0; break;
case XIL_PHOTOCD_CCW90:
angle = PI ∗ 0.5; break;
case XIL_PHOTOCD_CCW180:
angle = PI; break;
case XIL_PHOTOCD_CCW270:
angle = PI ∗ 1.5; break;
}
/∗ Rotate the image, then return its origin to 0,0 ∗/
xil_rotate(rgb_photocd_image, photocd_image, "nearest", angle);
xil_set_origin(photocd_image, 0.0, 0.0);
/∗ copy the image to the display ∗/
xil_copy(photocd_image, display);
NOTES
The xil_set_device_attribute(3) and xil_get_device_attribute(3) calls are used to modify the default behavior of specific device images. Generic attributes of images are set by individual function calls.
SEE ALSO
xil_color_convert(3), xil_create_from_device(3), xil_open(3).
SunOS — Last change: 07 April 1994