scbstrokes.h

Go to the documentation of this file.
00001 #ifndef SCBSTROKES_H_
00002 #define SCBSTROKES_H_
00003 
00004 /*
00005  * File Name  : scbstrokes.h
00006  * 
00007  * Description: Scribble library strokes list definition
00008  */
00009 
00010 /*
00011  * This file is part of liberscribble.
00012  *
00013  * liberscribble is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * liberscribble is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2008 iRex Technologies B.V.
00029  * All rights reserved.
00030  */
00031  
00032 
00033 //----------------------------------------------------------------------------
00034 // Include Files
00035 //----------------------------------------------------------------------------
00036 
00037 // system include files, between < >
00038 
00039 // ereader include files, between < >
00040 
00041 // local include files, between " "
00042 #include "scbstroke.h"
00043 
00044 #ifdef __cplusplus
00045 extern "C"
00046 {
00047 #endif
00048 
00049 
00050 //----------------------------------------------------------------------------
00051 // Definitions
00052 //---------------------------------------------------------------------------- 
00053 
00054 
00055 //----------------------------------------------------------------------------
00056 // Forward Declarations
00057 //----------------------------------------------------------------------------
00058 
00059 
00060 //----------------------------------------------------------------------------
00061 // Type Declarations
00062 //----------------------------------------------------------------------------
00063 
00064 typedef struct _ScbStrokes
00065 {
00066     GList * strokes;         /**< A list of strokes pointers */
00067 } ScbStrokes;
00068 
00069 typedef ScbStrokes * ScbStrokesPtr;
00070 
00071 
00072 //----------------------------------------------------------------------------
00073 // Global Constants
00074 //----------------------------------------------------------------------------
00075 
00076 
00077 //============================================================================
00078 // Public Functions
00079 //============================================================================
00080 
00081 // Construct a new stroke list, the member strokes in ScbStrokes structure
00082 // will be initialized
00083 // @param ptr the pointer of a ScbStrokes instance
00084 // @return return TRUE if construction succeeds
00085 gboolean erscribble_strokes_new(ScbStrokesPtr ptr);
00086 
00087 // Free the list as well as all of the items
00088 // @param strokes the pointer of a ScbStrokes instance
00089 void erscribble_strokes_free(ScbStrokesPtr strokes);
00090 
00091 // Destory the list without freeing each item. This function is used
00092 // when caller creates another container for existing items
00093 // @param strokes the pointer of the ScbStrokes instance which needs to be cleared
00094 void erscribble_strokes_clear(ScbStrokesPtr strokes);
00095 
00096 // Get the number of strokes
00097 // @param strokes the pointer of the ScbStrokes instance
00098 // @return return the number of strokes
00099 int erscribble_strokes_get_count(const ScbStrokesPtr strokes);
00100 
00101 // Add a stroke into the strokes list
00102 // @param strokes the pointer of the scribble strokes list
00103 // @param stroke the instance of scribble stroke to added
00104 void erscribble_strokes_add_stroke(ScbStrokesPtr strokes, 
00105                                    ScbStrokePtr stroke);
00106 
00107 // Add a list of strokes into another list
00108 // @param dst the pointer of destination strokes list
00109 // @param src the pointer of source strokes list
00110 void erscribble_strokes_add_strokes(ScbStrokesPtr dst, 
00111                                     const ScbStrokesPtr src);
00112 
00113 // Detach a stroke from list without freeing stroke memory
00114 // NOTE, caller should release memory of stroke returned
00115 // caller can also add the return value to other stroke container
00116 // @param strokes the strokes list which contains the target stroke
00117 // @param stroke the target stroke which needs to be detached
00118 // @return return the pointer of the detached stroke
00119 ScbStrokePtr erscribble_strokes_detach_stroke(ScbStrokesPtr strokes, 
00120                                               ScbStrokePtr stroke);
00121 
00122 // Hit test whether a point area(expanded by the setting of hit-test-context) intersects
00123 // with any strokes in the list. The result is a stroke list, empty result means no intersection
00124 // happens. Caller should call erscribble_stroke_detach to remove the stroke instance from the container
00125 // @param strokes the pointer of strokes list used for hit test
00126 // @param point the hit point
00127 // @param ctx the context recording necessary setting for the hit test
00128 // @return return a results list of strokes
00129 ScbStrokesPtr erscribble_strokes_point_hit_test(ScbStrokesPtr strokes, 
00130                                                 ScbDevPointPtr point,
00131                                                 const ScbHitTestCtxPtr ctx);
00132 
00133 // Hit test whether a line area(expanded by the setting of hit-test-context) intersects
00134 // with any strokes in the list. The result is a stroke list, empty result means no intersection
00135 // happens. Caller should call erscribble_stroke_detach to remove the stroke instance from the container
00136 // @param strokes the pointer of strokes list used for hit test
00137 // @param point1 the start hit point
00138 // @param point2 the end hit point
00139 // @param ctx the context recording necessary setting for the hit test
00140 // @return return a results list of strokes
00141 ScbStrokesPtr erscribble_strokes_line_hit_test(ScbStrokesPtr strokes, 
00142                                                ScbDevPointPtr point1,
00143                                                ScbDevPointPtr point2,
00144                                                const ScbHitTestCtxPtr ctx);
00145 
00146 // Draw the erased strokes by driver(fast way)
00147 // @param strokes the erased strokes list
00148 void erscribble_strokes_erase_driver_draw(ScbStrokesPtr strokes);
00149 
00150 // Dump the data of strokes list
00151 // This function can be used for debug
00152 void erscribble_strokes_dump(ScbStrokesPtr strokes);
00153 
00154 // load the strokes from the stream
00155 gboolean erscribble_strokes_load(ScbStrokesPtr strokes, ScbStreamPtr stream, const int strokes_num);
00156 
00157 // write strokes data into memory stream
00158 gboolean erscribble_strokes_write_stream(ScbStrokesPtr strokes, ScbStreamPtr stream);
00159 
00160 // clear a strokes list without release memory
00161 void erscribble_strokes_clear(ScbStrokesPtr strokes);
00162 
00163 
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167 
00168 #endif
Generated by  doxygen 1.6.2-20100208