1 #define DWG_TYPE DWG_TYPE_IMAGE
2 #include "common.c"
3
4 void
api_process(dwg_object * obj)5 api_process (dwg_object *obj)
6 {
7 int error;
8 BITCODE_BL class_version;
9 dwg_point_3d pt0, uvec, vvec;
10 dwg_point_2d size; /*!< DXF 13/23; width, height in pixel */
11 BITCODE_BS display_props;
12 BITCODE_B clipping;
13 BITCODE_RC brightness;
14 BITCODE_RC contrast;
15 BITCODE_RC fade;
16 BITCODE_B clip_mode;
17 BITCODE_BS clip_boundary_type;
18 BITCODE_BL num_clip_verts;
19 dwg_point_2d* clip_verts;
20 BITCODE_2RD *cpts;
21 BITCODE_H imagedef;
22 BITCODE_H imagedefreactor;
23
24 dwg_ent_image *image = dwg_object_to_IMAGE (obj);
25
26 CHK_ENTITY_3RD_W_OLD (image, IMAGE, pt0);
27 CHK_ENTITY_3RD (image, IMAGE, uvec); // still old api name u_vector
28 CHK_ENTITY_3RD (image, IMAGE, vvec);
29 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, display_props, BS);
30 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, clipping, B);
31 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, brightness, RC);
32 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, contrast, RC);
33 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, fade, RC);
34 CHK_ENTITY_TYPE (image, IMAGE, clip_mode, B); // no old api
35 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, clip_boundary_type, BS);
36 CHK_ENTITY_TYPE_W_OLD (image, IMAGE, num_clip_verts, BL);
37
38 if (!dwg_dynapi_entity_value (image, "IMAGE", "clip_verts", &clip_verts, NULL))
39 fail ("IMAGE.clip_verts");
40 #ifdef USE_DEPRECATED_API
41 cpts = dwg_ent_image_get_clip_verts (image, &error);
42 if (error)
43 fail ("IMAGE.clip_verts");
44 else
45 #else
46 cpts = image->clip_verts;
47 #endif
48 {
49 for (BITCODE_BL i = 0; i < num_clip_verts; i++)
50 {
51 ok ("IMAGE.clip_verts[%d]: (%f, %f)", i, cpts[i].x,
52 cpts[i].y);
53 if (memcmp (&clip_verts[i], &cpts[i], sizeof (clip_verts[i])))
54 fail ("IMAGE.clip_verts[%d]", i);
55 }
56 }
57 #ifdef USE_DEPRECATED_API
58 free (cpts);
59 #endif
60
61 CHK_ENTITY_H (image, IMAGE, imagedef);
62 CHK_ENTITY_H (image, IMAGE, imagedefreactor);
63 }
64