1MACROS(3) Library Functions Manual MACROS(3)
2
3
4
6 IM_IMAGE_ADDR, IM_IMAGE_SIZEOF_ELEMENT, IM_IMAGE_SIZEOF_PEL,
7 IM_IMAGE_SIZEOF_LINE, IM_IMAGE_N_ELEMENTS - macros for images
8
10 #include <vips/vips.h>
11
12 int IM_IMAGE_SIZEOF_ELEMENT( im )
13 IMAGE *im;
14
15 int IM_IMAGE_SIZEOF_PEL( im )
16 IMAGE *im;
17
18 int IM_IMAGE_SIZEOF_LINE( im )
19 IMAGE *im;
20
21 int IM_IMAGE_N_ELEMENTS( im )
22 IMAGE *im;
23
24 char *IM_IMAGE_ADDR( im, x, y )
25 IMAGE *im;
26 int x;
27 int y;
28
29
31 These macros help to simplify address arithmetic for images.
32
33 IM_IMAGE_SIZEOF_ELEMENT(3) returns sizeof( one band element ).
34
35 IM_IMAGE_SIZEOF_PEL(3) returns sizeof( one pel ).
36
37 IM_IMAGE_SIZEOF_LINE(3) returns sizeof( one horizontal line of pels ).
38
39 IM_IMAGE_N_ELEMENTS(3) returns the number of band elements across a
40 horizontal line.
41
42 IM_IMAGE_ADDR(3) returns a pointer to the pixel at position (x,y) in
43 the image. The point (x,y) should lie within the image.
44
45 If the macro DEBUG has been defined, then IM_IMAGE_ADDR(3) will also
46 perform bounds checking. If you ask for the address of a pel outside
47 the image, then IM_IMAGE_ADDR(3) will print an error message of the
48 form:
49
50 IM_IMAGE_ADDR: point out of bounds, file "test.c", line 18
51 (point x=50, y=0
52 should have been within Rect left=0, top=0, width=50, height=50)
53
54 and call abort(3).
55
56 DEBUG needs to be defined *before* vips.h is included. Either define
57 DEBUG with -D in your Makefile, or have a #define DEBUG right at the
58 top of your file.
59
61 National Gallery, 1993
62
64 im_malloc(3), im_open_local(3), `VIPS Library Programmers' Guide' in
65 accompanying documentation.
66
68 J. Cupitt - 23/7/93
69
70
71
72 11 April 1990 MACROS(3)