Changeset 20626 in project


Ignore:
Timestamp:
10/03/10 19:14:33 (11 years ago)
Author:
petercrlane
Message:

Initial documentation for leptonica

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/leptonica

    r20620 r20626  
    55An interface to the [[http://www.leptonica.com/|leptonica]] library of routines for image analysis and processing.
    66
    7 == Examples
     7=== Memory Management
    88
     9Most of the library's operations are based around manipulating images, which are stored in a structure known as a
     10{{pix}}.  You should manually manage the references to the images.  If you want a copy of an existing {{pix}}, use
     11{{pix-clone}}; this updates the reference count for an image.  Use {{pix-destroy}} when you are finished with a reference to a {{pix}}; this decrements the reference count, and finally deletes the image when the count is 0.
    912
    10 == Authors
     13=== Implemented Procedures
    1114
    12 [[http://wiki.call-cc.org/users/peter-lane|Peter Lane]].
     15==== Creating and managing images
    1316
    14 == License
     17<procedure>(pix-clone pix)</procedure>
     18Return a reference to given {{pix}}.
     19
     20<procedure>(pix-copy pix-d pix-s)</procedure>
     21Makes a copy of {{pix-s}}: if {{pix-d}} is {{#f}} then returns a pointer to a copy of {{pix-s}}, else makes {{pix-d}} a copy of {{pix-s}}.
     22
     23<procedure>(pix-create width height depth)</procedure>
     24Returns a pointer to a new {{pix}}, an image of given {{width}} and {{height}} in pixels, and colour {{depth}}.
     25
     26<procedure>(pix-destroy pix)</procedure>
     27Reduces reference count to {{pix}}, and destroys picture if count is 0.
     28
     29<procedure>(pix-read filename)</procedure>
     30Returns a pointer to a new {{pix}} created by reading image from {{filename}}.  Returns {{#f}} if there is an error.
     31
     32<procedure>(pix-save filename pix image-type)</procedure>
     33Writes {{pix}} to an image file called {{filename}}.  The {{image-type}} is taken from the list of constants, below.
     34
     35==== Image attributes
     36
     37<procedure>(pix-get-width pix)</procedure>
     38Returns the width in pixels of given {{pix}}.
     39
     40<procedure>(pix-set-width pix integer)</procedure>
     41Sets the width in pixels of given {{pix}}.  Returns 0 if ok, or 1 if error.
     42
     43<procedure>(pix-get-height pix)</procedure>
     44Returns the height in pixels of given {{pix}}.
     45
     46<procedure>(pix-set-height pix integer)</procedure>
     47Sets the height in pixels of given {{pix}}.  Returns 0 if ok, or 1 if error.
     48
     49<procedure>(pix-get-depth pix)</procedure>
     50Returns the colour depth of given {{pix}}.
     51
     52<procedure>(pix-set-depth pix integer)</procedure>
     53Sets colour depth of given {{pix}}.  Returns 0 if ok, or 1 if error.
     54
     55<procedure>(pix-set-dimensions pix width height depth)</procedure>
     56Sets all three properties of given {{pix}}.  Returns 0 if ok, or 1 if error.
     57
     58<procedure>(pix-get-x-res pix)</procedure>
     59Returns the x resolution of given {{pix}}.
     60
     61<procedure>(pix-set-x-res pix integer)</procedure>
     62Sets the x resolution of given {{pix}}.  Returns 0 if ok, or 1 if error.
     63
     64<procedure>(pix-get-y-res pix)</procedure>
     65Returns the y resolution of given {{pix}}.
     66
     67<procedure>(pix-set-y-res pix integer)</procedure>
     68Sets the y resolution of given {{pix}}.  Returns 0 if ok, or 1 if error.
     69
     70<procedure>(pix-set-resolution pix x-res y-res)</procedure>
     71Sets the x and y resolution of given {{pix}}.  Returns 0 if ok, or 1 if error.
     72
     73<procedure>(pix-scale-resolution pix x-scale y-scale)</procedure>
     74Rescales the image in the x and y directions.  Returns 0 if ok, or 1 if error.
     75
     76<procedure>(pix-get-input-format pix)</procedure>
     77Returns the input format of {{pix}}.
     78
     79<procedure>(pix-set-input-format pix integer)</procedure>
     80Sets the input format of {{pix}}.
     81
     82==== Manipulating images
     83
     84<procedure>(rotate pix angle rotation-type in-colour width height)</procedure>
     85Returns a pointer to a new {{pix}} created by rotating given {{pix}}. 
     86* angle: in radians, with positive value indicating clockwise.
     87* rotation-type: from list of constants below.
     88* in-colour: from list of constants below, determines if white or black pixels complete missing spaces.
     89* width: of final image
     90* height: of final image
     91
     92<procedure>(scale pix scale-x scale-y)</procedure>
     93Returns a pointer to a new {{pix}} created by rescaling given {{pix}} along x and y dimensions.
     94
     95==== Constants
     96
     97; image-type : IFF-UNKNOWN, IFF-BMP, IFF-JFIF-JPEG, IFF-PNG, IFF-TIFF, IFF-TIFF-PACKBITS, IFF-TIFF-RLE, IFF-TIFF-G3, IFF-TIFF-G4, IFF-TIFF-LZW, IFF-TIFF-ZIP, IFF-PNM, IFF-PS, IFF-GIF, IFF-JP2, IFF-DEFAULT, IFF-SPIX.
     98; in-colour : L-BRING-IN-WHITE, L-BRING-IN-BLACK.
     99; rotation-type : L-ROTATE-AREA-MAP, L-ROTATE-SHEAR, L-ROTATE-SAMPLING.
     100
     101=== Examples
     102
     103See the examples folder in the [[http://anonymous@code.call-cc.org/svn/chicken-eggs/release/4/leptonica/examples/|repository]].
     104
     105=== Author
     106
     107[[http://wiki.call-cc.org/users/peter-lane|Peter Lane]]
     108
     109=== License
    15110
    16111GPL version 3.0.
    17112
    18 == Requirements
     113=== Requirements
     114
     115You will need libraries for handling images: libjpeg, libpng, libtiff etc.
     116
     117=== Version History
     118
     119* 0.1: initial release
    19120
    20121
    21 
    22 == Version History
    23 
Note: See TracChangeset for help on using the changeset viewer.