Section Header
  
  
    + name        := AREA;
  
  
    - comment     := "Window Clipping. (Algorithm by Benoit Sonntag)";
    
  
    - version     := 5;
  
Section Inherit
  
  
    - parent_video:ABSTRACT_BITMAP := 
  
  
    - parent_inbox:INBOX := 
  
Section INTERFACE  
  
  
    - set_video_support bmp:ABSTRACT_BITMAP <-
    
Section Public  
  
  
  
 Redefine BITMAP.
  
  
  
 Size zone.
  
    + height:INTEGER;
  
    + width :INTEGER;	
  
  
    - x_min:INTEGER := 
  
    - y_min:INTEGER := 
  
    - x_max:INTEGER <- 
  
    - y_max:INTEGER <- 
  
  
 Simple clipping.
  
    + clip_x0:INTEGER; 
  
    + clip_y0:INTEGER;
  
    + clip_x1:INTEGER;
  
    + clip_y1:INTEGER;
  
  
 Current position.
  
    + spot_x:INTEGER;  
  
    + spot_y:INTEGER;
    
  
 Current color.
  
  
 Slave display.
  
    - slave_pixel_hard  (x,y:INTEGER) color col:UINTEGER_32; 
  
    - slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER color col:UINTEGER_32; 
  
    - slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER 
  image line:ABSTRACT_BMP_LINE offset ofs:INTEGER; 
  
  
 Master / Normal display.
  
    - pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
    
  
    - line_h_hard (x0,y0:INTEGER) until x1:INTEGER color col:UINTEGER_32 <-
    
  
    - line_h_hard (x0,y0:INTEGER) until x1:INTEGER image line:ABSTRACT_BMP_LINE offset ofs:INTEGER <-
    
Section Public
  
  
 Window links.
  
    + parent:AREA;  
         Englobe window.
  
    + child :AREA;  
         First children.
  
    + prev  :AREA;  
         Previous window.
  
    + next  :AREA;  
         Next window.
  
  
 +-parent---------------------+
  
 |           +-self-----------|
  
 |  +-next---|                |
  
 |  |        |    +-child--+  |
  
 |  |        |    |        |  |
  
 |  |        |    +--------+  |
  
 |  |        |  +-prev--------|
  
 |  |        +--|             |
  
 |  +-----------|             |
  
 |              |             |
  
 +----------------------------+
  
  
    + plan:PLAN;
  
    + clip:CLIP; 
         Cash clip zone.
  
 Current window absolute position.
  
    + x_window:INTEGER;
  
    + y_window:INTEGER; 
  
    - set_next new:AREA <-
    
  
    - set_prev new:AREA <-
    
  
    - set_child new:AREA <-
    
Section Public  
  
  
    - debug_display <-
    
Section Public  
  
  
    - get_x_window:INTEGER <-
    
  
    - get_y_window:INTEGER <-
    
  
  
 New window
  
  
  
    - make father:AREA from (x0,y0:INTEGER) size (w,h:INTEGER) <-
    
  
    - create (x,y:INTEGER) size (w,h:INTEGER) :AREA <-
    
  
  
 Delete window
  
  
  
    - delete <-
    
  
  
 Moving window
  
 
  
  
    - update father:AREA from (x0,y0:INTEGER) size (w,h:INTEGER) <-
        
  
    - move (x,y:INTEGER) <-
    
  
    - set_position (x,y:INTEGER) <-
    
  
  
 Resize window.
  
  
  
    - resize (lx,ly:INTEGER) <-
  
         Resize window.
    
  
  
 First window
  
  
  
    - first <-
  
         put first plan window.
    
  
    - get_window (x,y:INTEGER) :AREA <-
  
         Get object pointer by (X,Y).
    
  
////////////////////////////////////////////////////////////
  
                         AREA                           //
  
////////////////////////////////////////////////////////////
  
Section AREA
  
  
    - list_plan:PLAN;
  
    - list_x:LIMIT_X;
  
    - list_y:LIMIT_Y;
  
  
    - display_list_x <-
    
  
  list_plan={plan1,plan2}
  
                       
  
                       .
  
  plan1+---------------Y---------+
  
       |               .         |
  
       |     plan2+----Y-----------------+
  
       |          |    .         :       |
  
       |          |    .         :       |
  
       |          |    .         :       |
  
  .....X..........X..............X.......X.....list_x
  
       |          |    .         :       |
  
       |          |    .         :       |
  
       |          +----Y-----------------+
  
       |               .         | 
  
       +---------------Y---------+
  
                       .
  
                     list_y
  
  
    - stack_plan:FAST_ARRAY[PLAN]:=
  
    - last_clip :CLIP;
  
    - first_clip:CLIP;
  
    - top_clip  :CLIP;
  
  
                                   |           |
  
                                   | top_clip  |
  
                                   |           |
  
                                   +-----------+
  
+------------+       +-----------+ +-----------+
  
|            |       |           | |           |
  
| first_clip |  ...  | last_clip | |    NEW    |
  
|            |       |           | |           |
  
+------------+       +-----------+ +-----------+
  
  
    - add_clip win:AREA from (xmin,ymin:INTEGER) to (xmax,ymax:INTEGER) <-
    
  
    - remove_plan <-
    
  
    - append_plan <-
    
  
    - update_plan <-
    
  
    - creat_clip <-
    
  
    - clip_next_child <-
    
  
    - clip_type1 <-
    
  
    - sub_delete <-
    
  
    - sub_move (x,y:INTEGER) <-
    
  
    - sub_resize <-
    
  
 get_clip x,y :
  
 
  
 [clip]
  
   X#####+-------++-------+
  
   |    #|       ||       |
  
   |    #|       ||       |
  
   +----#######--++-------+
  
   +---------+#-----------+
  
   |         |#           |
  
   |         |####>X(x,y) |
  
   |         ||           |
  
   +---------++-----------+
  
  
    - debug:BOOLEAN;
  
  
    - get_clip (x,y:INTEGER) :CLIP <-
  
         Find clip `(x,y)', begin search is `clip'.
    
Section Public  
  
  
    - margin_clip_x0:INTEGER;
  
    - margin_clip_y0:INTEGER;
  
    - margin_clip_x1:INTEGER;
  
    - margin_clip_y1:INTEGER;
  
  
    - redraw (x0,y0:INTEGER) to (x1,y1:INTEGER) <-
    
  
    - draw (x0,y0:INTEGER) to (x1,y1:INTEGER) <-
    
  
    - refresh <-
    
  
    - get_object (x,y:INTEGER) :AREA <-
      
  
    - receive msg:EVENT <-
  
         Default.