CIMES: a Collaborative Image Editing System for Pattern Design Xianghua Xu, Jiajun Bu, Chun Chen and Yong Li College of Computer Science, Zhejiang University, Hangzhou 310027, China {xuxh_cs, bjj, chenc, lyzju}@cs.zju.edu.cn Abstract. In this paper, we present a Collaborative IMage Editing System (CIMES), which is developed for textile pattern design based on our previous image processing system. CIMES adopts a replicated architecture. An image operation representation approach is proposed to reduce the space cost of image operation preservation. Then a concurrent control algorithm is proposed to resolve the image editing conflicting caused by multi-user collaborative editing and maintain the consistency of shared image. An image undo/redo algorithm is also presented to support multiple undo modes in the same editing sessions, including global undo and local undo. 1 Introduction With the evolution of Internet environment, more and more applications open collaborative working ways, such as document review and real-time online collaboration of engineering designs. In this paper, we present a Collaborative IMage Editing System (CIMES), which is developed for textile pattern design based on our previous image processing system TOP[4]. CIMES allows a group of users to edit a large dimension image at the same time from different sites connected via high speed Internet. Image processing tools, such as painting brush, standard pen and color processing, are supported in this system. To achieve high responsiveness and unconstrained collaboration in the Internet environment [11], a replicated architecture is adopted in CIMES. Shared images are replicated at the local storage of each collaborative site, and image editing operations are performed at local sites immediately and then propagated to remote sites. Because each user cannot instantly see changes made by other users to shared documents, so users may happen to edit the same part of the document at the same time under unconstrained collaborative editing. Therefore, the major challenge of supporting responsive and unconstrained cooperative editing is the management of multiple streams of concurrent activities so that document consistency can be maintained in the event of conflicts. There are three consistency problems in collaborative editing systems: (1) convergence, (2) causality preservation, and (3) intention preservation [12]. Some algorithms[7, 10, 11] are proposed to resolve consistency problem in collaborative text/graphic editing systems, but these algorithms cannot be used directly in collabo-
rative image editing systems. In this paper, we briefly present algorithms used to achieve consistency maintenance and group undo in CIMES. The rest of this paper is organized as follows. In section 2, image operation representation issues is discussed and a distributed image operation algorithm is presented. Then the image operation undo/redo algorithm is given. Our work is compared with others in Section 3. A short conclusion and further works are given in Section 4. 2. Distributed Image Editing and Undo Algorithm 2.1. Image Operation Representation and Boolean Calculations Image operations can be described as a drawing primitive: Draw[S], where S is a set of pixels within the editing region. An image operation O is associated with a Image Context, denoted as BC[O]. The initial image Context is denoted as BC 0. The set of S s corresponding pixel on BC is denoted as BS, called background pixel set. Definition 1. Image Operation Representation (BOR): Operation O is represented as a quadruple, denoted as <OI, SI, SV, S>, which represents Operation ID, Site ID, State vector and the set of colored pixels influenced by the operation. Many approaches can be used to represent the S, such as run-length encoding, block encoding and quad-tree encoding. We only record the operation-image (S) for each operation but not record the previous image (BS) before executing the operation. Since the S usually contains one color, and the previous image may contain hundreds of colors, obviously space cost can be greatly reduced. The state vector (SV) [5] is used to represent the relation among operations. The operations can be regarded as an operation sequence under state vector structure. CIMES maintains a history buffer (HB) for preserving executed operations at each site. The list of operations in HB is represented as HB = [O 1,O 2,,O n ]. All operations in HB satisfy the total ordering relationship: O 1 >O 2 > >O n. Given two operation O 1 and O 2 with an overlapping relation as shown in Fig. 1-a and 1-b, we define three types of Boolean calculations. (a) O 1 (b) O 2 (c) O3 (d) Initial region (e) O1 O2 (f) O1 O2 (g) O1+O2 (i) O1 (O2+O3) (j) O1 (O2+O3) (l) O1 (O2 O3) Fig. 1. Examples of join, addition and subtract calculations Definition 2. Join Calculation (Fig. 1-e): Given two operations O 1 and O 2, O 1 O 2 is the subset of S[O 1 ] which is overlapping with S[O 2 ]. Definition 3. Subtract Calculation (Fig. 1-f): Given two operations O 1 and O 2, O 1 O 2 is the subset of S[O 1 ] which is not overlapping with S[O 2 ].
Definition 4. Add Calculation + (Fig. 1-g): Given two operations O 1 and O 2, O 1 +O 2 is the union of S[O 2 ] and a subset of S[O 1 ] which is not overlapping with S[O 2 ]. Suppose BC 0 is the result of operation O 0 and HB = [O 1,O 2,,O n ]. The image context of O n, BC[O n ], is the result of the orderly addition of O 0. For any operation O i in HB, following properties depict the operation relation among operations. Property 1. O V i =O i O i+1 O n. O V i is the visible part of O i in the current BC. O V i is equivalent to an image operation drawing the visible part of O i in current BC. If O V i = φ, then O i is invisible. Property 2. O B i =BC 0 O i +O 1 O i + +O i 1 O i. O B i is equivalent to an image operation drawing the background pixels of O i in current BC. Property 3. O BV i = O B i O V i. O BV i is the part of background pixels of O i, which is visible in current BC, as if O i was undone. O BV i is an inversed operation of O i and equivalent to O i s undo operation of in current BC. 2.2. Distributed Image Editing Algorithm As mentioned above, an HB is maintained at each site to preserve image operations executed at this site. Operations are first inserted into HB total orderly and then executed by distributed image editing algorithm. For a local image operation (O i ), it is generated by an editing action. The editing action usually persists a duration of time. Before the editing action complete, the intermediate result is preserved as temporary operation and not written in the current BC. After the editing action is done, the image operation is generated and inserted into HB according to total order. Then the operation s visible part (O i V ) is calculated (according to property 1): O i V =O i O i+1 O n, Where O i is an operation executed currently, O i+1 O n is operations total-orderly after O i. Finally, current BC is updated with O i V and then O i is propagated to remote sites. When a remote editing operation is received, the operation is first inserted into HB according to total order, then the operation s visible part is calculated out and then current BC is updated. 2. 3 Image Undo/Redo Algorithms According to property 1-3, we can calculate an image operation s visible part of the background pixels in current BC. Suppose current HB=[O 1, O 2,, O i,, O n ] and an undo target operation (O i ) is selected by User1. The visible background pixels are calculated by Undo algorithm: O i BV = O i B O i V = (BC 0 O i +O 1 O i + +O i 1 O i ) (O i O i+1 O n ). Then current BC is updated by O i BV and undo effect is achieved. The redo process is similar to operation execution described in section 2.2. Above algorithm can undo/redo any operation preserved in HB. Global and local undo scopes [1] are also supported. In local undo scope, a user can undo any operation performed by himself. While in global undo scope, he can undo any operation performed by any user.
3. Compared to related works Most of existing collaborative graphics editing systems are object-based, such as GRACE[11], NetDraw[8], and etc. In object-based systems, graphic objects are represented by attributes. Operations act on the objects by modifying the attributes of the objects. While in image-based systems, operations act directly on the drawing area by modifying the pixels color in the drawing area. Therefore, algorithms in object-based collaborative editing systems, such as operation transformation [3, 5, 10] and multiversion algorithm [6, 11], cannot be used in image-based collaborative editing systems. Wscrawl[13] and WE-MET[14] are systems similar to collaborative image editing systems. WScrawl is a multi-user sketchpad based on a centralized architecture that leverages on X-windows. There is no concurrent conflicting problem in Wscrawl. WE-MET is an image-based whiteboard tool used in local network environment. It does not consider the concurrent conflicting problem. To the best of our knowledge, there are no other systems supporting collaborative image editing on the Internet. Some undo solutions have been proposed to resolve the undo problem in textbased and object-based collaborative editing systems [2, 9]. These solutions based on a simple operation-inversion approach, which is suitable for the text and object-based collaborative editing systems. With a simple operation-inversion approach in the image-based editing systems, such as MS Painter, the previous image of an operation should be preserved in order to achieving the inversion of the operation, while the previous image is no need to be preserved in our approach. Obviously the space costs is reduced compared to simple operation-inverse approach. 4. Conclusions In this paper, we briefly present a collaborative image editing systems on the Internet. A transformation algorithm is proposed to achieve consistency preservation in imagebased collaborative editing systems. This approach minimizes the cost for preserving, displaying and executing the image operations. A group undo approach is also proposed to realize undo/redo facility in collaborative editing environment. The system and algorithms proposed in this paper are the beginning of our research in the collaborative image editing area, but not a complete solution. There are still some issues need to be studied further, such as optional locking and conflicting locking mechanism, how to realizing group intentions. Supporting more complicated editing operations (similar to image operations in PhotoShop) is another future work. References 1. D. Chen and C. Sun. Undo Any Operation in Collaborative Graphics Editing Systems. In Proceedings of ACM 2001 Conference on Supporting Group Work. Boulder, Sep. 2001. Boulder, Colorado, USA. p.197-206.
2. R. Choudhary and P. Dewan. A general multi-user undo/redo model. In Proc. of European Conference on Computer Supported Work, Oct 1995. p.231-246. 3. A.H. Davis, et al. Generalizing operational transformation to the standard general markup language. Proceedings of ACM CSCW, Nov, 2002. New Orleans, USA. p.58-67. 4. X. Duan-Qing and C. Chun, Design and Implementation of A Digital Prepress System Based on the Unification Technology of Four-Color and Special-Color Separation. Chinese Journal of Computer Aided Design and Computer Graphics, 2000. 12(2): p. 96-100. In Chinese. 5. C.A. Ellis and S.J. Gibbs. Concurrency control in groupware systems. In Proceedings of the ACM SIGMOD Conference on Management of Data, May 1989. Seattle, WA, USA. p.399-407. 6. T.P. Moran, et al., Some design principles of sharing in Tivoli, a whiteboard meeting support tool, In Groupware for Real-time Drawing: A Designer's guide, S. Greenberg, S. Hayne, and R. Rada, Editors. 1995, McGraw-Hill. p. 24-36. 7. E.R. Pedersen, et al. Tivoli: An electronic whiteboard for informal workgroup meetings. In Proc. of ACM INTERCHI'93 Conference on Human Factors in Computing Systems, April 1993. p.391-398. 8. D. Qian and M.D. Gross. Collaborative Design with NetDraw. In Proceedings of Computer Aided Architectural Design Futures '99, 1999. 9. M. Ressel and R. Gunzenhauser. Reducing the problems of group undo. In Proceedings of ACM Conference on Supporting Group Work, Nov. 1999. Phoenix, USA. p.131-139. 10. M. Ressel, et al. An integrating, transformation-directed approach to concurrency control and undo in group editors. In Proceedings of ACM Conference on Computer Supported Cooperative Work, Nov. 1996. New York, USA. p.288-297. 11. C. Sun and D. Chen, Consistency Maintenance in Real-Time Collaborative Graphics Editing Systems. ACM Transactions on Computer-Human Interaction, 2002. 9(1): p. 1-41. 12. C. Sun, et al., Achieving convergence, causality-preservation, and intentionpreservation in real-time cooperative editing systems. ACM Transaction on Computer-Human Interaction, 1998. 5(1): p. 63-108. 13. B. Wilson, WSCRAWL 2.0: A Shared whiteboard based on X-Windows, In Designing Groupware for Real Time Drawing, S. Greenberg, S. Hayne, and R. Rada, Editors. 1994, McGraw Hill. 14. C. Wolf, et al. WE-MET (Window Environment-Meeting Enhancement Tools). In Proceedings of CHI'91, 1991. New Orleans, LA, USA. p.441-442.