Files
harbour-core/contrib/hbcairo/tests/lightnin.prg
Viktor Szakats b9d69aa3f5 2013-04-02 17:49 UTC+0200 Viktor Szakats (harbour syenar.net)
+ bin/check.hb
    + new source verifier. Able to all documented (and more)
      required text file and filename properties.

  * bin/commit.hb
    + added feature to verify all files to be committed to
      conform with certain naming and text file content rules
    + added some more feedback

  * config/postinst.hb
    + include commit.hb and check.hb in 'install'

  * include/extend.h
  * contrib/hbcairo/paths.c
  * contrib/hbcairo/png.c
  * contrib/hbcairo/util.c
  * contrib/hbtpathy/readme.txt
  * tests/harbour.ini
  * tests/parseins.ini
    ! multiple EOL at EOF

  * contrib/hbhpdf/tests/files/cp932.txt
  * contrib/hbhpdf/tests/files/cp936.txt
  * contrib/hbhpdf/tests/files/elic_jp.txt
    ! line ending spaces
    ! missing EOL at EOF

  * contrib/hbhttpd/tests/tpl/app/account/edit.tpl
  * contrib/hbhttpd/tests/tpl/app/login.tpl
  * contrib/hbhttpd/tests/tpl/app/logout.tpl
  * contrib/hbhttpd/tests/tpl/app/main.tpl
  * contrib/hbhttpd/tests/tpl/app/register.tpl
  * lib/3rd/win/bcc/unicows_license.txt
  * lib/3rd/win/mingw/libunicows_license.txt
    ! missing EOL at EOF

  * COPYING.txt
  * src/rtl/gtcrs/hb-charmap.def
  * tests/big5_gen.prg
    ! tabs

  * extras/gfspell/spell.prg
  * src/rtl/gtwin/gtwin.c
    ! ASCII 127

  * src/codepage/cp_tpl.c
    ! converted to UTF-8 (just guessing what the original CP was)

  * src/pp/hbpp.c
    ! do not generate SVN header in hbverbld.h
    + avoid SVN header string in source as is to miss matched
      in source verifier

  * src/vm/extrap.c
    ! do not generate whitespace at EOL in output

  * tests/lang2po.hb
  * tests/po2lang.hb
    + minor improvements
    ! fixed to generate consistent EOL

  * bin/3rdpatch.hb
    * newline at top deleted

  * extras/hbdoc/hbdoc.hbp
  * extras/hbdoc/hbdoc.prg
  * extras/hbdoc/_tmplates.prg -> extras/hbdoc/_tmplate.prg
  * contrib/hbcairo/tests/lightning.prg -> contrib/hbcairo/tests/lightnin.prg
    ! long filename

  * .gitattributes
  * extras/guestbk/guestbk.prg
  * extras/guestbk/guestbk.txt
  * extras/guestbk/guestbk.htm -> extras/guestbk/guestbk.html
    * deleted .htm file, now all HTML has extension .html
    * .exe references in doc made OS neutral
    ; Can only be used on non-MS-DOS systems, so it's okay
2013-04-02 17:50:36 +02:00

63 lines
1.5 KiB
Plaintext

#require "hbcairo"
PROCEDURE Main()
LOCAL hSurface, hCairo, nI
hSurface := cairo_pdf_surface_create( "lightning.pdf", 566.9, 793.7 ) // 200x280 mm in pt
hCairo := cairo_create( hSurface )
// 20 pages
FOR nI := 1 TO 20
cairo_set_source_rgb( hCairo, 0, 0, 0 )
cairo_paint( hCairo )
cairo_set_source_rgb( hCairo, 1, 0.7, 1 )
DrawLightning( hCairo, 250, 50, 700, 3 )
cairo_show_page( hCairo )
NEXT
cairo_destroy( hCairo )
cairo_surface_destroy( hSurface )
RETURN
PROCEDURE DrawLightning( hCairo, nX, nY, nLen, nW, nInit )
LOCAL nI, nK, nW0, nX2
cairo_move_to( hCairo, nX, nY )
nW0 := nW
IF nInit == NIL
nInit := 0
ENDIF
nK := 0
FOR nI := 1 TO nLen
// AR(1) process
nInit := nInit * 0.9 + ( hb_Random() - 0.5 )
// ARIMA(1, 1, 0) process
nK += nInit
// ARIMA(1, 1, 0) + white noise
nX2 := nX + nK + hb_Random()
cairo_line_to( hCairo, nX2, nI + nY )
nW -= 0.003
IF nW < nW0 - 0.1
cairo_set_line_width( hCairo, nW0 )
cairo_stroke( hCairo )
cairo_move_to( hCairo, nX2, nI + nY )
nW0 := nW
ENDIF
// Branch
IF Abs( nInit ) > 1.6
cairo_set_line_width( hCairo, nW0 )
cairo_stroke( hCairo )
DrawLightning( hCairo, nX2, nI + nY, Int( ( nLen - nI ) / 2 ), nW / 2, nInit * 0.5 )
nInit *= -0.3
cairo_move_to( hCairo, nX2, nI + nY )
ENDIF
NEXT
cairo_set_line_width( hCairo, nW0 )
cairo_stroke( hCairo )
RETURN