GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/limn/methodsLimn.c Lines: 49 54 90.7 %
Date: 2017-05-26 Branches: 6 14 42.9 %

Line Branch Exec Source
1
/*
2
  Teem: Tools to process and visualize scientific data and images             .
3
  Copyright (C) 2013, 2012, 2011, 2010, 2009  University of Chicago
4
  Copyright (C) 2008, 2007, 2006, 2005  Gordon Kindlmann
5
  Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998  University of Utah
6
7
  This library is free software; you can redistribute it and/or
8
  modify it under the terms of the GNU Lesser General Public License
9
  (LGPL) as published by the Free Software Foundation; either
10
  version 2.1 of the License, or (at your option) any later version.
11
  The terms of redistributing and/or modifying this software also
12
  include exceptions to the LGPL that facilitate static linking.
13
14
  This library is distributed in the hope that it will be useful,
15
  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
  Lesser General Public License for more details.
18
19
  You should have received a copy of the GNU Lesser General Public License
20
  along with this library; if not, write to Free Software Foundation, Inc.,
21
  51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
*/
23
24
25
#include "limn.h"
26
27
limnLight *
28
limnLightNew(void) {
29
  limnLight *lit;
30
31
  lit = (limnLight *)calloc(1, sizeof(limnLight));
32
  return lit;
33
}
34
35
limnLight *
36
limnLightNix(limnLight *lit) {
37
38
  if (lit) {
39
    free(lit);
40
  }
41
  return NULL;
42
}
43
44
void
45
limnCameraInit(limnCamera *cam) {
46
47
2
  if (cam) {
48
1
    cam->atRelative = limnDefCameraAtRelative;
49
1
    cam->orthographic = limnDefCameraOrthographic;
50
1
    cam->rightHanded = limnDefCameraRightHanded;
51
1
    cam->uRange[0] = cam->uRange[1] = AIR_NAN;
52
1
    cam->vRange[0] = cam->vRange[1] = AIR_NAN;
53
1
    cam->fov = AIR_NAN;
54
1
    cam->aspect = AIR_NAN;
55
1
  }
56
1
  return;
57
}
58
59
limnCamera *
60
limnCameraNew(void) {
61
  limnCamera *cam;
62
63
2
  cam = (limnCamera *)calloc(1, sizeof(limnCamera));
64
1
  if (cam) {
65
1
    limnCameraInit(cam);
66
1
  }
67
1
  return cam;
68
}
69
70
limnCamera *
71
limnCameraNix(limnCamera *cam) {
72
73
2
  if (cam) {
74
1
    free(cam);
75
1
  }
76
1
  return NULL;
77
}
78
79
void
80
_limnOptsPSDefaults(limnOptsPS *ps) {
81
82
2
  ps->lineWidth[limnEdgeTypeUnknown] = AIR_NAN;
83
1
  ps->lineWidth[limnEdgeTypeBackFacet] = 0.0;
84
1
  ps->lineWidth[limnEdgeTypeBackCrease] = 0.0;
85
1
  ps->lineWidth[limnEdgeTypeContour] = 2.0;
86
1
  ps->lineWidth[limnEdgeTypeFrontCrease] = 1.0;
87
1
  ps->lineWidth[limnEdgeTypeFrontFacet] = 0.0;
88
1
  ps->lineWidth[limnEdgeTypeBorder] = 1.0;
89
1
  ps->lineWidth[limnEdgeTypeLone] = 1.0;
90
1
  ps->creaseAngle = 46;
91
1
  ps->showpage = AIR_FALSE;
92
1
  ps->wireFrame = AIR_FALSE;
93
1
  ps->noBackground = AIR_FALSE;
94
1
  ELL_3V_SET(ps->bg, 1, 1, 1);
95
1
  ELL_3V_SET(ps->edgeColor, 0, 0, 0);
96
1
}
97
98
limnWindow *
99
limnWindowNew(int device) {
100
  limnWindow *win;
101
102
2
  win = (limnWindow *)calloc(1, sizeof(limnWindow));
103
1
  if (win) {
104
1
    win->device = device;
105
1
    switch(device) {
106
    case limnDevicePS:
107
1
      win->yFlip = 1;
108
1
      _limnOptsPSDefaults(&(win->ps));
109
1
      break;
110
    }
111
1
    win->scale = 72;
112
1
    win->file = NULL;
113
1
  }
114
1
  return win;
115
}
116
117
limnWindow *
118
limnWindowNix(limnWindow *win) {
119
120
2
  if (win) {
121
1
    free(win);
122
1
  }
123
1
  return NULL;
124
}