Haven Rock XML and
open source software
for down-to-earth
business solutions
Google

havenrock.com whole Web

               
               
               
               
Developer Resources



GD4O API Cross-reference

The following tables list all functions in the GD API. Corresponding OCaml function names are shown for all functions currently implemented in GD4O. The When column shows when each function was implemented: [0] indicates that the function was implemented in OCamlGD 0.7; [1], [2], [3], [4], and [5] stand for GD4O releases 1.0a1, 1.0a2, 1.0a3, 1.0a4, and 1.0a5, respectively.

  1. Image creation, destruction, loading, and saving
  2. Drawing functions
  3. Query functions
  4. Font and text-handling functions
  5. Color-handling functions
  6. Copying and resizing functions
  7. Miscellaneous functions

Image creation, destruction, loading, and saving

C Function When OCaml Function Comments
gdImageCreate
[0] create
gdImageCreateTrueColor
[2] create_truecolor
gdImageCreateFromJpeg
[0] open_jpeg
gdImageCreateFromPng
[0] open_png
gdImageCreateFromPngSource
gdImageCreateFromGd
gdImageCreateFromGd2
gdImageCreateFromGd2Part
gdImageCreateFromXbm
gdImageCreateFromXpm
gdImageDestroy
gdImageJpeg
[0] #image#save_as_jpeg
gdImageJpegPtr
gdImagePng
[0] #image#save_as_png
gdImagePngEx
gdImagePngPtr
gdImagePngPtrEx
gdImagePngToSink
[0] #image#out_as_png
gdImageWBMP
gdImageWBMPPtr
gdImageGd
gdImageGdPtr
gdImageGd2
gdImageGd2Ptr
gdImageTrueColorToPalette

Drawing functions

C Function When OCaml Function Comments
gdImageSetPixel
[0] #image#set_pixel
gdImageLine
[0] #image#line
gdImageDashedLine
[0] #image#dashed_line
gdImagePolygon
[1] #image#polygon
gdImageRectangle
[0] #image#rectangle
gdImageFilledPolygon
[1] #image#filled_polygon
gdImageFilledRectangle
[0] #image#filled_rectangle
gdImageArc
[0] #image#arc
gdImageFilledArc
[2] #image#closed_arc
& #image#closed_chord
In the C library, 'FilledArc' takes a bitwise OR of several flags. But those flags include one that specifies an arc, and another that specifies a chord - which are in fact mutually exclusive drawing operations. Seems like rather poor design to me, so I separated FilledArc into two methods. Furthermore, the word 'closed' seems to me a more accurate description of what the method does.
gdImageFilledEllipse
[1] #image#filled_ellipse
gdImageFillToBorder
[0] #image#border_fill
This function works when called from a native code executable, but when called from byte code, it seems to go into infinite recursion.
gdImageFill
[0] #image#fill
gdImageSetAntiAliased
[1] #image#set_antialiased
Antialiased drawing is surprisingly slow. Must be something sub-optimal in the C wrapper.
gdImageSetAntiAliasedDontBlend
[2] #image#set_antialiased_dontblend
gdImageSetBrush
[2] #image#set_brush
gdImageSetTile
[2] #image#set_tile
gdImageSetStyle
gdImageSetThickness
[2] #image#set_thickness
gdImageAlphaBlending
gdImageSaveAlpha
gdImageSetClip
[2] #image#set_clip
gdImageGetClip
gdImageBlue

Query functions

C Function When OCaml Function Comments
gdImageAlpha
gdImageGetPixel
[0] #image#get_pixel
gdImageBoundsSafe
[0] #image#in_range
gdImageGreen
gdImageRed
gdImageSX
[0] #image#width
gdImageSY
[0] #image#height

Font and text-handling functions

C Function When OCaml Function Comments
gdImageChar
[0] #image#letter
gdImageCharUp
[0] #image#letter_up
gdImageString
[0] #image#string
gdImageString16
gdImageStringUp
[0] #image#string_up
gdImageStringUp16
gdImageStringFT
[3] #image#string_ft
& ft_bbox
In the C API, gdImageStringFt returns the bounding box of the string. If you need the bounding box without drawing the string, you pass a null gdImagePointer. Since OCaml doesn't really have null pointers, the ft_bbox function simply calls a C function that passes a null gdImagePtr to gdImageStringFT.
gdImageStringFTEx
[4] #image#string_ftex
& ftex_bbox
Partially implemented. Supports multiline text, but not yet double-byte characters. See also notes for gdImageStringFT.
gdImageStringTTF

Color-handling functions

C Function When OCaml Function Comments
gdImageColorAllocate
[0] #color_allocator#create
gdImageColorAllocateAlpha
gdImageColorClosest
[0] #color_allocator#closest
gdImageColorClosestAlpha
gdImageColorClosestHWB
[0] #collor_allocator#closest_hwb
gdImageColorExact
[0] #collor_allocator#exact
gdImageColorResolve
[0] #collor_allocator#resolve
gdImageColorResolveAlpha
gdImageColorsTotal
gdImageRed
[0] #collor_allocator#red
gdImageGreen
[0] #collor_allocator#green
gdImageBlue
[0] #collor_allocator#blue
gdImageGetInterlaced
gdImageGetTransparent
[0] #collor_allocator#get_transparent
Name changed to conform more closely to the C API. The previous name, '#transparent', is now used for the method corresponding to gdImageTransparent.
gdImageColorDeallocate
gdImageColorTransparent
[2] #color_allocator#set_transparent
gdImageTrueColor
gdImageTrueColorAlpha

Copying and resizing functions

C Function When OCaml Function Comments
gdImageCopy
[5] #image#copy
gdImageCopyResized
[5] #image#copy_resized
gdImageCopyResampled
[5] #image#copy_resampled
gdImageCopyRotated
[5] #image#copy_rotated
gdImageCopyMerge
[5] #image#copy_merge
gdImageCopyMergeGray
[5] #image#copy_merge_gray
gdImagePaletteCopy
[5] #image#palette_copy

Miscellaneous functions

C Function When OCaml Function Comments
gdImageCompare
gdImageInterlace
gdFree

Copyright © 2003 by Matt Gushee   ::  Last modified:  Nov. 24, 2003