1#!F-adobe-helvetica-medium-r-normal--18*
2#!N
3#!CDarkGreen #!N  #!Rex10
4Example 12. Image Files #!N #!EC #!N #!N This Data Explorer
5header file reads an image (  #!F-adobe-times-bold-r-normal--18*   cylinder.rgb #!EF ). The
6image is 350 x 300 and consists of RGB colors (3-vectors).
7You can read this image in, and display it, using the
8visual program  #!F-adobe-times-bold-r-normal--18*   /usr/local/dx/samples/programs/ReadImage.net #!EF . This file can be found
9in  #!F-adobe-times-bold-r-normal--18*   /usr/local/dx/samples/data/image.dx #!EF . #!N Note: It is easier to
10import a file in the RGB format by using the ReadImage
11module. This example illustrates the different aspects of header files. #!N
12#!CForestGreen #!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N # First describe the positions. The
13image is written such that #!N # x varies fastest, and
14the first pixel in the file is the one that is
15#!N # to be displayed at the top left. #!N #
16Because x varies fastest, the last delta specifies a vector in
17#!N # the x direction. Because the first pixel is at
18the top left, #!N # the delta in the y direction
19is -1. #!N object 1 class gridpositions 300 350 #!T,43,69 #!N
20origin TAB 0 TAB 0 #!N delta TAB 0 TAB -1
21#!N delta TAB 1 TAB 0 #!EF #!N #!N #!EC #!CForestGreen
22#!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N # Next describe the connections #!N #
23The image is 350 pixels in x and 300 pixels in
24y. Since #!N # x is the last delta specified, the
25connections are specified as #!N # 300 x 350 #!N object
262 class gridconnections 300 350 #!N attribute "ref" string "positions" #!N
27attribute "element type" string "quads" #!EF #!N #!N #!EC #!CForestGreen #!N
28#!N  #!F-adobe-courier-bold-r-normal--18*   #!N # Next indicate that the data can be
29found in the file "cylinder.rgb", #!N # starting at byte 0.
30There are three bytes (red, green, and blue) #!N # for
31each pixel. #!N object 3 class array type byte rank 1
32shape 3 ieee msb items 105000 #!N data file cylinder.rgb,0 #!N
33attribute "dep" string "positions" #!EF #!N #!N #!EC #!CForestGreen #!N #!N
34 #!F-adobe-courier-bold-r-normal--18*   #!N # We read the colors in as the "data"
35component. This allows us #!N # to immediately begin operating on
36them (for example, to convert the #!N # bytes to floating
37point colors) #!N object "image" class field #!N component "positions" 1
38#!N component "connections" 2 #!N component "data" 3 #!EF #!N #!N
39#!EC #!N #!N #!N  #!F-adobe-times-medium-i-normal--18*   Next Topic #!EF #!N #!N  #!Lsynff,dxall638 h Syntax of the Native File Format  #!EL
40#!N  #!F-adobe-times-medium-i-normal--18*   #!N
41