1 | /****************************************************************************** |
---|
2 | * SAGE - Scalable Adaptive Graphics Environment |
---|
3 | * |
---|
4 | * Module: sageFrame.h - classes for storing and manipulating image frames |
---|
5 | * Author : Byungil Jeong |
---|
6 | * |
---|
7 | * Copyright (C) 2004 Electronic Visualization Laboratory, |
---|
8 | * University of Illinois at Chicago |
---|
9 | * |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * Redistribution and use in source and binary forms, with or without |
---|
13 | * modification, are permitted provided that the following conditions are met: |
---|
14 | * |
---|
15 | * * Redistributions of source code must retain the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer. |
---|
17 | * * Redistributions in binary form must reproduce the above |
---|
18 | * copyright notice, this list of conditions and the following disclaimer |
---|
19 | * in the documentation and/or other materials provided with the distribution. |
---|
20 | * * Neither the name of the University of Illinois at Chicago nor |
---|
21 | * the names of its contributors may be used to endorse or promote |
---|
22 | * products derived from this software without specific prior written permission. |
---|
23 | * |
---|
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
27 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
31 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
32 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
35 | * |
---|
36 | * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or |
---|
37 | * http://www.evl.uic.edu/cavern/forum/ |
---|
38 | * |
---|
39 | *****************************************************************************/ |
---|
40 | |
---|
41 | #ifndef _SAGE_FRAME_H |
---|
42 | #define _SAGE_FRAME_H |
---|
43 | |
---|
44 | #include "sageBlock.h" |
---|
45 | |
---|
46 | class sageFrame; |
---|
47 | class sageBlockFrame; |
---|
48 | class sageBlockPartition; |
---|
49 | |
---|
50 | class sageSubFrame : public sagePixelData { |
---|
51 | public: |
---|
52 | std::vector<int> blockList; |
---|
53 | sageBlockFrame *mainFrame; |
---|
54 | |
---|
55 | int computeFrameRect(); |
---|
56 | }; |
---|
57 | |
---|
58 | class sageBlockFrame : public sagePixelData { |
---|
59 | protected: |
---|
60 | sagePixelBlock *blocks; |
---|
61 | int idx; |
---|
62 | int numCol, numRow, subBlockNum; |
---|
63 | int pixelSize; // Byte per pixel |
---|
64 | int memWidth; |
---|
65 | sageBlockPartition *partition; |
---|
66 | |
---|
67 | public: |
---|
68 | sageBlockFrame(int w, int h, int bytes, float compX = 1.0, float compY = 1.0); |
---|
69 | |
---|
70 | //inline void setBlockSize(int w, int h) { blockWidth = w, blockHeight = h; } |
---|
71 | int initFrame(sageBlockPartition *part); |
---|
72 | inline void resetBlockIndex() { idx = 0; } |
---|
73 | bool extractPixelBlock(sagePixelBlock *block, int rowOrder); |
---|
74 | |
---|
75 | int generateBlocks(int rowOrd); |
---|
76 | int generateSubFrame(sageRect &subRect, sageSubFrame &sFrame); |
---|
77 | bool updateBlockConfig() { return false; } |
---|
78 | |
---|
79 | /** |
---|
80 | * override virtual function |
---|
81 | */ |
---|
82 | int updateBufferHeader() { return 0; } |
---|
83 | |
---|
84 | /** |
---|
85 | * for sagenext, embed frame number |
---|
86 | */ |
---|
87 | int updateBufferHeader(int fnum); |
---|
88 | |
---|
89 | virtual ~sageBlockFrame(); |
---|
90 | |
---|
91 | friend class sageSubFrame; |
---|
92 | }; |
---|
93 | |
---|
94 | #endif |
---|