Coverage Report

Created: 2026-08-11 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvips/libvips/draw/drawink.h
Line
Count
Source
1
/* a drawink operation with an ink param
2
 */
3
4
/*
5
6
  This file is part of VIPS.
7
8
  VIPS is free software; you can redistribute it and/or modify
9
  it under the terms of the GNU Lesser General Public License as published by
10
  the Free Software Foundation; either version 2 of the License, or
11
  (at your option) any later version.
12
13
  This program is distributed in the hope that it will be useful,
14
  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
  GNU Lesser General Public License for more details.
17
18
  You should have received a copy of the GNU Lesser General Public License
19
  along with this program; if not, write to the Free Software
20
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21
  02110-1301  USA
22
23
 */
24
25
/*
26
27
  These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
28
29
 */
30
31
#ifndef VIPS_DRAWINK_H
32
#define VIPS_DRAWINK_H
33
34
#ifdef __cplusplus
35
extern "C" {
36
#endif /*__cplusplus*/
37
38
#include "pdraw.h"
39
40
#define VIPS_TYPE_DRAWINK (vips_drawink_get_type())
41
#define VIPS_DRAWINK(obj) \
42
500
  (G_TYPE_CHECK_INSTANCE_CAST((obj), \
43
500
    VIPS_TYPE_DRAWINK, VipsDrawink))
44
#define VIPS_DRAWINK_CLASS(klass) \
45
  (G_TYPE_CHECK_CLASS_CAST((klass), \
46
    VIPS_TYPE_DRAWINK, VipsDrawinkClass))
47
#define VIPS_IS_DRAWINK(obj) \
48
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), VIPS_TYPE_DRAWINK))
49
#define VIPS_IS_DRAWINK_CLASS(klass) \
50
  (G_TYPE_CHECK_CLASS_TYPE((klass), VIPS_TYPE_DRAWINK))
51
#define VIPS_DRAWINK_GET_CLASS(obj) \
52
  (G_TYPE_INSTANCE_GET_CLASS((obj), \
53
    VIPS_TYPE_DRAWINK, VipsDrawinkClass))
54
55
typedef struct _VipsDrawink {
56
  VipsDraw parent_instance;
57
58
  VipsArrayDouble *ink;
59
60
  /* Ink cast to pixel type.
61
   */
62
  VipsPel *pixel_ink;
63
} VipsDrawink;
64
65
typedef struct _VipsDrawinkClass {
66
  VipsDrawClass parent_class;
67
68
} VipsDrawinkClass;
69
70
GType vips_drawink_get_type(void);
71
72
static inline int
73
vips__drawink_pel(VipsDrawink *drawink, VipsPel *q)
74
130
{
75
130
  VipsDraw *draw = (VipsDraw *) drawink;
76
77
130
  int j;
78
79
  /* Faster than memcopy() for n < about 20.
80
   */
81
460
  for (j = 0; j < draw->psize; j++)
82
330
    q[j] = drawink->pixel_ink[j];
83
84
130
  return 0;
85
130
}
Unexecuted instantiation: draw_circle.c:vips__drawink_pel
Unexecuted instantiation: draw_flood.c:vips__drawink_pel
Unexecuted instantiation: draw_mask.c:vips__drawink_pel
draw_rect.c:vips__drawink_pel
Line
Count
Source
74
130
{
75
130
  VipsDraw *draw = (VipsDraw *) drawink;
76
77
130
  int j;
78
79
  /* Faster than memcopy() for n < about 20.
80
   */
81
460
  for (j = 0; j < draw->psize; j++)
82
330
    q[j] = drawink->pixel_ink[j];
83
84
130
  return 0;
85
130
}
Unexecuted instantiation: draw_line.c:vips__drawink_pel
Unexecuted instantiation: drawink.c:vips__drawink_pel
86
87
/* Paint, with clip.
88
 */
89
static inline int
90
vips__drawink_pel_clip(VipsDrawink *drawink, int x, int y)
91
0
{
92
0
  VipsDraw *draw = (VipsDraw *) drawink;
93
0
94
0
  if (x < 0 ||
95
0
    x >= draw->image->Xsize)
96
0
    return 0;
97
0
  if (y < 0 ||
98
0
    y >= draw->image->Ysize)
99
0
    return 0;
100
0
101
0
  vips__drawink_pel(drawink, VIPS_IMAGE_ADDR(draw->image, x, y));
102
0
103
0
  return 0;
104
0
}
Unexecuted instantiation: draw_circle.c:vips__drawink_pel_clip
Unexecuted instantiation: draw_flood.c:vips__drawink_pel_clip
Unexecuted instantiation: draw_mask.c:vips__drawink_pel_clip
Unexecuted instantiation: draw_rect.c:vips__drawink_pel_clip
Unexecuted instantiation: draw_line.c:vips__drawink_pel_clip
Unexecuted instantiation: drawink.c:vips__drawink_pel_clip
105
106
/* Is p painted?
107
 */
108
static inline gboolean
109
vips__drawink_painted(VipsDrawink *drawink, VipsPel *p)
110
0
{
111
0
  VipsDraw *draw = (VipsDraw *) drawink;
112
0
113
0
  int j;
114
0
115
0
  for (j = 0; j < draw->psize; j++)
116
0
    if (p[j] != drawink->pixel_ink[j])
117
0
      break;
118
0
119
0
  return j == draw->psize;
120
0
}
Unexecuted instantiation: draw_circle.c:vips__drawink_painted
Unexecuted instantiation: draw_flood.c:vips__drawink_painted
Unexecuted instantiation: draw_mask.c:vips__drawink_painted
Unexecuted instantiation: draw_rect.c:vips__drawink_painted
Unexecuted instantiation: draw_line.c:vips__drawink_painted
Unexecuted instantiation: drawink.c:vips__drawink_painted
121
122
int vips__drawink_scanline(VipsDrawink *drawink, int y, int x1, int x2);
123
124
#ifdef __cplusplus
125
}
126
#endif /*__cplusplus*/
127
128
#endif /*VIPS_DRAWINK_H*/