Visual Studio 2012 Support
[xy_vsfilter.git] / src / thirdparty / VirtualDub / h / vd2 / Kasumi / region.h
blobb063221cb0e631e2817aebd5093046835221800e
1 // VirtualDub - Video processing and capture application
2 // Graphics support library
3 // Copyright (C) 1998-2009 Avery Lee
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.
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.
19 #ifndef f_VD2_KASUMI_REGION_H
20 #define f_VD2_KASUMI_REGION_H
22 struct VDPixmap;
24 #include <vd2/system/vectors.h>
25 #include <vd2/system/vdstl.h>
27 class VDPixmapRegion {
28 public:
29 void swap(VDPixmapRegion& x);
30 void clear();
32 public:
33 vdfastvector<uint32> mSpans;
34 vdrect32 mBounds;
37 class VDPixmapPathRasterizer {
38 public:
39 VDPixmapPathRasterizer();
40 VDPixmapPathRasterizer(const VDPixmapPathRasterizer&); // no-op
41 ~VDPixmapPathRasterizer();
43 VDPixmapPathRasterizer& operator=(const VDPixmapPathRasterizer&); // no-op
45 void Clear();
46 void QuadraticBezier(const vdint2 pts[4]);
47 void CubicBezier(const vdint2 pts[4]);
48 void Line(const vdint2& pt1, const vdint2& pt2);
49 void FastLine(int x0, int y0, int x1, int y1);
51 void ScanConvert(VDPixmapRegion& region);
53 protected:
54 void ClearEdgeList();
55 void FreeEdgeLists();
56 void ClearScanBuffer();
57 void ReallocateScanBuffer(int ymin, int ymax);
59 struct Edge {
60 Edge *next;
61 int posandflag;
64 enum { kEdgeBlockMax = 1024 };
66 struct EdgeBlock {
67 EdgeBlock *next;
68 Edge edges[1024];
70 EdgeBlock(EdgeBlock *p) : next(p) {}
73 struct Scan {
74 Edge *chain;
75 uint32 count;
78 EdgeBlock *mpEdgeBlocks;
79 EdgeBlock *mpFreeEdgeBlocks;
80 int mEdgeBlockIdx;
81 Scan *mpScanBuffer;
82 Scan *mpScanBufferBiased;
83 int mScanYMin;
84 int mScanYMax;
87 bool VDPixmapFillRegion(const VDPixmap& dst, const VDPixmapRegion& region, int x, int y, uint32 color);
88 bool VDPixmapFillRegionAntialiased8x(const VDPixmap& dst, const VDPixmapRegion& region, int x, int y, uint32 color);
90 void VDPixmapCreateRoundRegion(VDPixmapRegion& dst, float r);
91 void VDPixmapConvolveRegion(VDPixmapRegion& dst, const VDPixmapRegion& r1, const VDPixmapRegion& r2, VDPixmapRegion *tempCache = NULL);
93 #endif