~ubuntu-branches/ubuntu/maverick/zapping/maverick

« back to all changes in this revision

Viewing changes to libtv/clip_vector.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-03-08 23:19:08 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050308231908-oip7rfv6lcmo8c0e
Tags: 0.9.2-2ubuntu1
Rebuilt for Python transition (2.3 -> 2.4)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2001-2004 Michael H. Schimek
 
3
 *  Copyright (C) 2000-2003 I�aki Garc�a Etxebarria
 
4
 *
 
5
 *  This program is free software; you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation; either version 2 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 */
 
19
 
 
20
/* $Id: clip_vector.h,v 1.2 2005/01/31 07:13:06 mschimek Exp $ */
 
21
 
 
22
#ifndef __ZTV_CLIP_VECTOR_H__
 
23
#define __ZTV_CLIP_VECTOR_H__
 
24
 
 
25
#include <inttypes.h>           /* uintX_t */
 
26
#include "macros.h"
 
27
 
 
28
TV_BEGIN_DECLS
 
29
 
 
30
/* Overlay clipping rectangle. These are regions you don't want
 
31
   overlaid, with clipping coordinates relative to the top, left
 
32
   corner of the overlay window (not the overlay buffer). */
 
33
 
 
34
typedef struct {
 
35
        uint16_t                x1;
 
36
        uint16_t                y1;
 
37
        uint16_t                x2;
 
38
        uint16_t                y2;
 
39
} tv_clip;
 
40
 
 
41
tv_inline tv_bool
 
42
tv_clip_equal                   (const tv_clip *        clip1,
 
43
                                 const tv_clip *        clip2)
 
44
{
 
45
        if (8 == sizeof (tv_clip))
 
46
                return ((* (const uint64_t *) clip1)
 
47
                        == (* (const uint64_t *) clip2));
 
48
        else
 
49
                return (0 == ((clip1->x1 ^ clip2->x1) |
 
50
                              (clip1->y1 ^ clip2->y1) |
 
51
                              (clip1->x2 ^ clip2->x2) |
 
52
                              (clip1->y2 ^ clip2->y2)));
 
53
}
 
54
 
 
55
typedef struct {
 
56
        tv_clip *               vector;
 
57
        unsigned int            size;
 
58
        unsigned int            capacity;
 
59
} tv_clip_vector;
 
60
 
 
61
extern uint8_t *
 
62
tv_clip_vector_to_clip_mask     (tv_clip_vector *       vector,
 
63
                                 unsigned int           width,
 
64
                                 unsigned int           height)
 
65
  __attribute__ ((_tv_nonnull (1)));
 
66
extern tv_bool
 
67
_tv_clip_vector_add_clip_xy     (tv_clip_vector *       vector,
 
68
                                 unsigned int           x1,
 
69
                                 unsigned int           y1,
 
70
                                 unsigned int           x2,
 
71
                                 unsigned int           y2)
 
72
  __attribute__ ((_tv_nonnull (1)));
 
73
 
 
74
#define tv_clip_vector_add_clip_xy(v,x1,y1,x2,y2) \
 
75
  _tv_clip_vector_add_clip_xy(v,x1,y1,x2,y2)
 
76
 
 
77
tv_inline tv_bool
 
78
tv_clip_vector_add_clip_wh      (tv_clip_vector *       vector,
 
79
                                 unsigned int           x,
 
80
                                 unsigned int           y,
 
81
                                 unsigned int           width,
 
82
                                 unsigned int           height)
 
83
{
 
84
        return _tv_clip_vector_add_clip_xy (vector,
 
85
                                           x, y, x + width, y + height);
 
86
}
 
87
 
 
88
extern tv_bool
 
89
tv_clip_vector_equal            (const tv_clip_vector * vector1,
 
90
                                 const tv_clip_vector * vector2)
 
91
  __attribute__ ((_tv_nonnull (1, 2)));
 
92
 
 
93
tv_inline void
 
94
tv_clip_vector_clear            (tv_clip_vector *       vector)
 
95
{
 
96
        vector->size = 0;
 
97
}
 
98
 
 
99
extern tv_bool
 
100
tv_clip_vector_set              (tv_clip_vector *       dst,
 
101
                                 const tv_clip_vector * src)
 
102
  __attribute__ ((_tv_nonnull (1)));
 
103
extern tv_bool
 
104
tv_clip_vector_copy             (tv_clip_vector *       dst,
 
105
                                 const tv_clip_vector * src)
 
106
  __attribute__ ((_tv_nonnull (1)));
 
107
extern void
 
108
tv_clip_vector_destroy          (tv_clip_vector *       vector)
 
109
  __attribute__ ((_tv_nonnull (1)));
 
110
extern void
 
111
tv_clip_vector_init             (tv_clip_vector *       vector)
 
112
  __attribute__ ((_tv_nonnull (1)));
 
113
 
 
114
TV_END_DECLS
 
115
 
 
116
#endif /* __ZTV_CLIP_VECTOR_H__ */