diff --git a/build/service/CalendarExtractor.php b/build/service/CalendarExtractor.php index ec1e291..62d327a 100644 --- a/build/service/CalendarExtractor.php +++ b/build/service/CalendarExtractor.php @@ -151,9 +151,6 @@ } - /* (3) Remove last */ - unset( $col_ind[count($col_ind)-1] ); - } @@ -163,7 +160,9 @@ =========================================================*/ { /* (1) For each day */ - foreach($col_ind as $day_n=>$col_x){ + for( $day_n = 0 ; $day_n <= count($col_ind) ; $day_n++ ){ + $col_x = $col_ind[$day_n]; + /* (2) For each y pixel -> exctract event */ for( $y = self::$start_y ; $y < self::$stop_y ; $y++ ){ @@ -177,7 +176,8 @@ if( $p == 0 && $p1 != 0xffffff ){ // {1} calculate time // - $time = $this->yToTime($day_n, $y); + $start_y = $y; + $time = $this->yToTime($day_n, $start_y); // {2} Store default event name if not already set // if( !isset($d_db[$p1e]) ) @@ -194,6 +194,10 @@ // {5} If end reached // $this->event[$p1e][$time] = $this->yToTime($day_n, $y); + // {6} Exctract event's image // + $this->extractEvent([$col_x, $start_y+1], [$col_ind[$day_n+1]-1, $y]); + + } @@ -222,6 +226,17 @@ + /* (3) Exctracts an event + * + * @start Start rect (x, y) + * @stop Stop rect (x, y) + * + ---------------------------------------------------------*/ + public function extractEvent($start=null, $stop=null){ + var_dump("from (${start[0]}, ${start[1]}) to (${stop[0]}, ${stop[1]})"); + } + + /* (3) Get a pixel's color * * @x X coordinate