AminetAminet
Search:
84716 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/lib/chunky.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:Link library for fast chunky-gfx-routines
Author:pernathw at cip.ub.uni-muenchen.de (Wanja Pernath)
Uploader:Author
Type:dev/lib
Version:1.0
Requires:AGA, OS3.x, MC68020 + some FASTRAM
Architecture:m68k-amigaos
Date:1998-02-28
Download:http://aminet.net/dev/lib/chunky.lha - View contents
Readme:http://aminet.net/dev/lib/chunky.readme
Downloads:8129

INTRODUCTION
============

A while ago I've tried to code a game for  the  Amiga  which  should  have  SVGA
quality.  But  I don't have expected the sillyness of Commodore as they designed
the new AGA-Custom chips. My tears have washed my t-shirt when I saw the 'great'
chip-ram-bandwidth and my neighbours thought of a bloody-mess as I expected that
the Blitter is simply useless when it comes to a display of 640x480x256

After a while I saw that the cpu is several times faster  in  blitting  with  or
without a mask and later I expected that it is more-than-10-times as fast as the
system graphics routines when I  use  a  temporary  chunky  buffer  to  draw  my
graphics in and then blast it over the bitmap.

That  was  the  time  I  decided  to  code  a  chunky-graphics-link-library  for
everybody's use.

And that's it.


CONTENTS
========

When you receive a copy of chunky.lha, it should contain this files:

lib-src/
  chunky.c            the main chunky-gfx-routines
  chunky.h            the header file
  text.c              functions for rendering text
  c2p.asm             a simple chunky to planar routine by Morten Eriksen
  p2c.asm             a simple planar to chunky routine by Morten Eriksen
  makefile            a makefile for GNU/C
  libchunky.a         the link lib for GNU/C

tst-src/
  chunky.h            a copy of the above
  test1.c             the lines test source
  test2.c             the Insertion test source
  test3.c             the text test source
  test4.c             the fixed-width font test for WB

chunky.readme         this file
test1                 the lines test executable
test2                 the Insertion test executable
test3                 the text test executable
test4                 the fixed-width font test for WB
results040.txt        all test results for a MC68040
results030.txt        all test results for a MC68030


TIME TABLE
==========

This is the result of the program 'test' which opens a  display  of  640x480x256
and  calls  several  timed graphic routines with the original gfx.OS and with my
new gfx.chunky.

Test-Machine: A1200 with MC68040 and 8MB Fast

I suppose, you should have a MC68030 + 4MB as minimum


1. Several Graphic functions ( test1.c )
----------------------------------------
  I've timed DrawChunkyPort() seperatly to make the results clearer.

  Draw 640 vertical lines with color raising:
  Elapsed time for function v_lines_chk():    0.195829 sec.
  Elapsed time for function v_lines_rpt():    12.308480 sec.

  Draw 480 horizontal lines with color raising:
  Elapsed time for function h_lines_chk():    0.058839 sec.
  Elapsed time for function h_lines_rpt():    12.255457 sec.

  Draw 480 diagonal lines from 0/0 -> 640/y with color raising:
  Elapsed time for function s_lines_chk():    0.418446 sec.
  Elapsed time for function s_lines_rpt():    12.247091 sec.

  Draw 256 filled boxes with color raising from 0->255:
  Elapsed time for function rect1_chk():      0.052174 sec.
  Elapsed time for function rect1_rpt():      0.873216 sec.

  Time to convert the 640x480x256 ChunkyPort to the display:
  Elapsed time for function DrawChunkyPort(): 0.299809 sec.


2. Draw on background ( test2.c )
---------------------------------
  The first function creates its own ChunkyPort, draws there and
  then copy the chunkyContents into the RastPort w/o destroying
  background gfx

  The second one creates its ChunkyPort from RastPort at the position
  of the later rewritten ChunkyBuffer. This ensures that all the rendering
  does not destroy the background.

  As you can see, the second one is four times as fast as the first one

  Elapsed time for function InsertChunkyPort():         0.417537 sec.
  Elapsed time for function CreateChunkyFromRastPort(): 0.108726 sec.


3. Draw some text ( test3.c )
-----------------------------
  This program writes 512 times the text 'This is a test...' with
  different colors onto the screen

  The font is set to 'courier.font/13'
  Elapsed time for function chk_test: 0.721666 sec.
  Elapsed time for function rpt_test: 3.921369 sec.


4. Fixed-Font-Width test ( test4.c )
------------------------------------
  This is only present, because I've expected last-minute that the fixed-width
  fonts do not use the TextFont->tf_CharSpace and TextFont->tf_CharKern entries.
  Indeed this pointers are set to NULL --> GURU on some times.

  Now I use a better TextLength-Algorithm and Text()- one, so you can use those
  fixed-width-bitmapped fonts, too.


FUNCTIONS
=========

The functions in libchunky.a are namely the same as in the Amiga OS. The
exeption is the suffix 'Chk'

See lib-src/*.c for more details.


USAGE
=====

Very simple. Open your screen with preferrable 256 colors and setup the
so-called 'struct ChunkyPort' using the function like this:

  ...
  struct ChunkyPort *cp;
  struct RastPort   *rport = INITIALIZE_IT;

  // Initialize ChunkyPort
  if( cp = InitChunkyPort( CHUNKY_SIZEX, CHUNKY_SIZEY ) ){

    // Do your rendering here
    ...
    SetAPenChk( cp, x );
    RectFillChk( cp, x1, y1, x2, y2 );
    ...

    // Blast the ChunkyPort onto the screen
    DrawChunkyPort( cp, rport, POS_ON_SCREEN_X, POS_ON_SCREEN_Y );
    FreeChunkyPort( cp );
  }
  ...

Now you're able to use most of the chunky-rendering functions, except the
text ones. To use text-rendering, you _MUST_ first call SetFontChk():

  ...
  struct ChunkyPort *cp;
  struct RastPort   *rport = INITIALIZE_IT;

  if( cp = InitChunkyPort( CHUNKY_SIZEX, CHUNKY_SIZEY ) ){

    // Setup the struct TextFont you want to use
    SetFontChk( cp, rport->Font );

    // Do your rendering here

    SetAPenChk(cp, x);
    MoveChk( cp, 100, 100 );
    TextChk( cp, "Hi, my name is Wanja" );

    // Blast the ChunkyPort onto the screen
    DrawChunkyPort( cp, rport, POS_ON_SCREEN_X, POS_ON_SCREEN_Y );

    // Free ChunkyPort
    FreeChunkyPort( cp );
  }
  ...

See tst-src/test#? for further details


DISCLAIMER & THANKS
===================

libchunky.a and all the corresponding files are FREEWARE. Spread it  around  the
world as much as you can, but please remember to spread the full archive. If you
have used the whole or a part of  libchunky.a's  code  and  files,  remember  to
mention me.

I've used libchunky.a for a while and I've not expected any bugs, but I can't be
sure of this. If you found a bug (or two), I would be glad to hear from you.

In other words: I take no responsibility for any crashes that might occur during
developement or during execution of the executable program.

 ----

I would like to thank the following people for help, suggestions and
bug-reports:

  - Andreas Zunke (Na, wie geht's Deinem MEMCONTROL?)
  - Stefan Dirnstorfer ( For math-hints )
  - Morten Eriksen for the great but slow c2p/p2c routines
  - various AMIGA-Magazines for programming tips and tricks

 ----


THE FUTURE
==========

There are many things to do but the highest priority on my own  to-do-list  have
those pretty routines for cpu-blitting from ChunkyPort to ChunkyPort and with or
without a mask using.

Another one is to implement this functions as a standard amiga library.

Further I want to fix this ugly DrawEllipseChk() bug.  If  there's  anybody  out
there  who knows of a good and fast standard Circle() routine, then please email
me.

And if there's anybody out there who knows of  a  highly  optimized  speedy  c2p
routine for standard amiga OS-Bitmaps as a replacement for the ones I used in my
code, then please, please email me, too.

And your questions and suggestions are highly wellcome.

Write to:
                                 Wanja Pernath
                                  Joergstr. 74
                                D-80689 München

                               Tel.: 089/54662171

                     email: pernathw at cip.ub.uni-muenchen.de


  ----


And always remember:

            TAKE THIS PICE OF CODE AND PROGRAM GREAT AMIGA SOFTWARE

                           HELP THE AMIGA TO BE ALIVE

                HELP THE DEVELOPERS BY BUYING GFX-CARDS AND SOFT

                                      BYE


Contents of dev/lib/chunky.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                 3438    8292  41.5% -lh5- 5f88 Feb 27  1998 lib_chunky/chunky.readme
[generic]                 4143   18328  22.6% -lh5- 53f6 Feb 25  1998 lib_chunky/lib-src/c2p.asm
[generic]                 1220    2961  41.2% -lh5- 7967 Feb 25  1998 lib_chunky/lib-src/c2p.o
[generic]                 3276   11472  28.6% -lh5- 9f0c Feb 26  1998 lib_chunky/lib-src/chunky.c
[generic]                 1555    5533  28.1% -lh5- 112a Feb 26  1998 lib_chunky/lib-src/chunky.h
[generic]                 2699    5336  50.6% -lh5- d7d7 Feb 26  1998 lib_chunky/lib-src/chunky.o
[generic]                  383     793  48.3% -lh5- c8cd Feb 26  1998 lib_chunky/lib-src/frames.c
[generic]                  242     364  66.5% -lh5- d9ba Feb 26  1998 lib_chunky/lib-src/frames.o
[generic]                 7137   14792  48.2% -lh5- fa37 Feb 27  1998 lib_chunky/lib-src/libchunky.a
[generic]                  643    1271  50.6% -lh5- e07c Feb 26  1998 lib_chunky/lib-src/Makefile
[generic]                 2672    8083  33.1% -lh5- a98d Feb 25  1998 lib_chunky/lib-src/p2c.asm
[generic]                  692    1253  55.2% -lh5- 9f0e Feb 25  1998 lib_chunky/lib-src/p2c.o
[generic]                 3111   11521  27.0% -lh5- 4af7 Feb 27  1998 lib_chunky/lib-src/text.c
[generic]                 2172    3813  57.0% -lh5- fe47 Feb 27  1998 lib_chunky/lib-src/text.o
[generic]                  266    1020  26.1% -lh5- e7d8 Feb 27  1998 lib_chunky/results030.txt
[generic]                  265    1018  26.0% -lh5- 4e33 Feb 27  1998 lib_chunky/results040.txt
[generic]                11286   21604  52.2% -lh5- b490 Feb 26  1998 lib_chunky/test1
[generic]                10138   18840  53.8% -lh5- bf56 Feb 26  1998 lib_chunky/test2
[generic]                12667   23672  53.5% -lh5- e28a Feb 27  1998 lib_chunky/test3
[generic]                11486   21388  53.7% -lh5- 6e17 Feb 27  1998 lib_chunky/test4
[generic]                  717    1225  58.5% -lh5- 4037 Feb 26  1998 lib_chunky/tst-src/circle.o
[generic]                 1921    6844  28.1% -lh5- b636 Feb 26  1998 lib_chunky/tst-src/test1.c
[generic]                 2409    5553  43.4% -lh5- e416 Feb 26  1998 lib_chunky/tst-src/test1.o
[generic]                 1627    3858  42.2% -lh5- 5cce Feb 26  1998 lib_chunky/tst-src/test2.c
[generic]                 1358    2410  56.3% -lh5- c116 Feb 26  1998 lib_chunky/tst-src/test2.o
[generic]                 1999    6040  33.1% -lh5- 8f29 Feb 27  1998 lib_chunky/tst-src/test3.c
[generic]                 2006    4130  48.6% -lh5- d7a0 Feb 27  1998 lib_chunky/tst-src/test3.o
[generic]                  626    1423  44.0% -lh5- e8e1 Feb 27  1998 lib_chunky/tst-src/test4.c
[generic]                  748    1313  57.0% -lh5- b810 Feb 27  1998 lib_chunky/tst-src/test4.o
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        29 files   92902  214150  43.4%            Feb 28  1998

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>