Ignore:
Timestamp:
Oct 28, 2008, 8:30:10 PM (12 years ago)
Author:
nico
Message:
  • Change type of the last argument of drawing function (from string to long)
  • Adapt sample programs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/examples/polyline.php

    r3131 r3132  
    11#!/usr/bin/php5
    22<?php
     3
     4function transform($tbl, $tx, $ty, $sx, $sy) {
     5        $result = array();
     6        foreach($tbl as $pt)
     7                $result[] = array($pt[0] * $sx + $tx, $pt[1] * $sy + $ty);
     8        return $result;
     9}
    310
    411$canvas = caca_create_canvas(0, 0);
     
    2229);
    2330
    24 function transform($tbl, $tx, $ty, $sx, $sy) {
    25         $result = array();
    26         foreach($tbl as $pt)
    27                 $result[] = array($pt[0] * $sx + $tx, $pt[1] * $sy + $ty);
    28         return $result;
    29 }
    30 
    3131for ($i = 0; $i < 10; $i++) {
    3232        caca_set_color_ansi($canvas, 1 + (($color += 4) % 15), CACA_TRANSPARENT);
    3333        $scale = caca_rand(4, 10) / 10;
    34         $translate = array(caca_rand(-10, 60), caca_rand(-5, 20));
     34        $translate = array(caca_rand(-5, 55), caca_rand(-2, 25));
    3535        $pts = transform($tbl, $translate[0], $translate[1], $scale, $scale);
    3636        caca_draw_thin_polyline($canvas, $pts);
     
    4040caca_refresh_display($display);
    4141sleep(5);
     42
Note: See TracChangeset for help on using the changeset viewer.