GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
gsget.c
Go to the documentation of this file.
1/*!
2 \file lib/ogsf/gsget.c
3
4 \brief OGSF library - get map attribute (lower level functions)
5
6 GRASS OpenGL gsurf OGSF Library
7
8 SPDX-FileCopyrightText: 1999-2008 GRASS Development Team
9 SPDX-License-Identifier: GPL-2.0-or-later
10
11 \author Bill Brown USACERL (January 1993)
12 \author Doxygenized by Martin Landa <landa.martin gmail.com> (May 2008)
13 */
14
15#include <grass/ogsf.h>
16
17/*!
18 \brief Get map attributes
19
20 \param buff
21 \param[in] offset
22 \param[out] att
23
24 \return 0 on failure
25 \return 1 on success
26 */
27int get_mapatt(typbuff *buff, int offset, float *att)
28{
29 if (buff->nm) {
30 if (BM_get(buff->nm, (offset % buff->nm->cols),
31 (offset / buff->nm->cols))) {
32 return (0);
33 }
34 }
35
36 *att = (buff->ib ? (float)buff->ib[offset]
37 : buff->sb ? (float)buff->sb[offset]
38 : buff->cb ? (float)buff->cb[offset]
39 : buff->fb ? (float)buff->fb[offset]
40 : buff->k);
41
42 if (buff->tfunc) {
43 *att = (buff->tfunc)(*att, offset);
44 }
45
46 return (1);
47}
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
Definition bitmap.c:213
int get_mapatt(typbuff *buff, int offset, float *att)
Get map attributes.
Definition gsget.c:27
OGSF header file (structures)
float * fb
Definition ogsf.h:210
struct BM * nm
Definition ogsf.h:215
unsigned char * cb
Definition ogsf.h:213
float(* tfunc)(float, int)
Definition ogsf.h:216
short * sb
Definition ogsf.h:212
float k
Definition ogsf.h:217
int * ib
Definition ogsf.h:211