1 | /* |
2 | * << Haru Free PDF Library >> -- hpdf_annotation.c |
3 | * |
4 | * URL: http://libharu.org |
5 | * |
6 | * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> |
7 | * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org> |
8 | * |
9 | * Permission to use, copy, modify, distribute and sell this software |
10 | * and its documentation for any purpose is hereby granted without fee, |
11 | * provided that the above copyright notice appear in all copies and |
12 | * that both that copyright notice and this permission notice appear |
13 | * in supporting documentation. |
14 | * It is provided "as is" without express or implied warranty. |
15 | * |
16 | */ |
17 | |
18 | #include "hpdf_conf.h" |
19 | #include "hpdf_utils.h" |
20 | #include "hpdf_info.h" |
21 | #include "hpdf_exdata.h" |
22 | #include "hpdf.h" |
23 | |
24 | /*----------------------------------------------------------------------------*/ |
25 | /*------ HPDF_ExData -----------------------------------------------------*/ |
26 | |
27 | |
28 | |
29 | HPDF_ExData |
30 | HPDF_3DAnnotExData_New(HPDF_MMgr mmgr, |
31 | HPDF_Xref xref) |
32 | { |
33 | HPDF_ExData exdata; |
34 | HPDF_STATUS ret = HPDF_OK; |
35 | |
36 | |
37 | HPDF_PTRACE((" HPDF_ExData_New\n" )); |
38 | |
39 | exdata = HPDF_Dict_New (mmgr); |
40 | if (!exdata) |
41 | return NULL; |
42 | |
43 | if (HPDF_Xref_Add (xref, exdata) != HPDF_OK) |
44 | return NULL; |
45 | |
46 | ret += HPDF_Dict_AddName (exdata, "Type" , "ExData" ); |
47 | ret += HPDF_Dict_AddName (exdata, "Subtype" , "3DM" ); |
48 | |
49 | if (ret != HPDF_OK) |
50 | return NULL; |
51 | |
52 | return exdata; |
53 | } |
54 | |
55 | |
56 | |
57 | HPDF_EXPORT(HPDF_STATUS) |
58 | HPDF_3DAnnotExData_Set3DMeasurement(HPDF_ExData exdata, |
59 | HPDF_3DMeasure measure) |
60 | { |
61 | HPDF_STATUS ret = HPDF_OK; |
62 | |
63 | ret = HPDF_Dict_Add (exdata, "M3DREF" , measure); |
64 | if (ret != HPDF_OK) |
65 | return ret; |
66 | |
67 | return ret; |
68 | } |
69 | |
70 | |