Debian Codegraph @

pencil/include/geometry/geometry_v_align.inl

raw
1 /* File: geometry_v_align.inl; Copyright and License: see below */
2
3 #include "u8/u8_trace.h"
4 #include "u8/u8_log.h"
5
6 static inline double geometry_v_align_get_top ( const geometry_v_align_t *this_, double height, double reference_top, double reference_height )
7 {
8 assert( ( *this_ == GEOMETRY_V_ALIGN_TOP )||( *this_ == GEOMETRY_V_ALIGN_CENTER )||( *this_ == GEOMETRY_V_ALIGN_BOTTOM ) );
9 double top;
10
11 switch ( *this_ )
12 {
13 case GEOMETRY_V_ALIGN_TOP:
14 {
15 top = reference_top;
16 }
17 break;
18
19 case GEOMETRY_V_ALIGN_CENTER:
20 {
21 top = reference_top + 0.5 * ( reference_height - height );
22 }
23 break;
24
25 default:
26 case GEOMETRY_V_ALIGN_BOTTOM:
27 {
28 top = reference_top + reference_height - height;
29 }
30 break;
31 }
32
33 return top;
34 }
35
36
37 /*
38 Copyright 2017-2026 Andreas Warnke
39
40 Licensed under the Apache License, Version 2.0 (the "License");
41 you may not use this file except in compliance with the License.
42 You may obtain a copy of the License at
43
44 http://www.apache.org/licenses/LICENSE-2.0
45
46 Unless required by applicable law or agreed to in writing, software
47 distributed under the License is distributed on an "AS IS" BASIS,
48 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49 See the License for the specific language governing permissions and
50 limitations under the License.
51 */