Posted to tcl by GPS at Sat Oct 25 21:13:36 GMT 2008view raw

  1.  
  2. imagecore::jpeg decode bytearray
  3. Decode the bytearray data that is expected to be a valid JPEG. If the data is invalid then an error is returned. On success a serialized imagecore representation is produced.
  4.  
  5. imagecore::jpeg encode ?-quality? serialized-data
  6. Encode the serialized data to a JPEG. The result when successful is a bytearray of JPEG data. If an error occurs during encoding, an error is returned.
  7.  
  8. imagecore::png decode bytearray
  9.  
  10. imagecore::png encode ?-compression? serialized-data
  11.  
  12.  
  13. imagecore ?serialized-data?
  14. By default if serialized-data isn't passed, we get a 0 by 0 image. The command created by imagecore is used for interacting and modifying the image.
  15.  
  16.  
  17. Instance Commands:
  18. getsize
  19. Return a 2 element list of the width and height. It may be assigned to variables with lassign.
  20.  
  21. setsize width height
  22. Set the size of the image. The old image data will be lost. Negative width or height will return an error.
  23.  
  24. serialize
  25. Returns a serialized representation of the image data, suitable for transferring over the network. The serialized data may be reconstructed with the imagecore command.
  26.  
  27. scale xvalue yvalue
  28. Scale x and y by a floating point (double) value where 1.0 is 0 change.
  29.  
  30. scaleto width height
  31. Scale to an absolute width and height.
  32.  
  33. rotate degress
  34. Degrees should be in the range [-360,360].
  35.  
  36. getpixel x y
  37. Return a [list R G B A] of the pixel at x y.
  38.  
  39. putpixel x y [list R G B A]
  40. Set the pixel at x y.
  41.  
  42. getrow y
  43. Return a row of pixels as a list.
  44.  
  45. putrow y row
  46. Set a row of pixels. The coordinate y must be valid. The row must be a list that exactly matches the width of the image.
  47.  
  48. blend imagecore-src-instance srcx srcy width height destx desty
  49. Perform alpha blending using the alpha values in imagecore-src-instance.
  50.  
  51. blendalpha imagecore-src-instance alpha srcx srcy width height destx desty
  52. Perform alpha blending using the alpha argument value.
  53.  
  54. blendcomplex imagecore-src-instance srcx srcy width height destx desty cummulative-alpha-buffer.
  55. Perform alpha blending using
  56.  
  57. line x1 y1 x2 y2 [list R G B A] ?width?
  58. Draw a line using the color and optional width along the coordinates specified.
  59.  
  60. rectangle x y width height [list R G B A]
  61. Draw a rectangle using the specified color and coordinates.
  62.  
  63. arc x1 y1 x2 y2 [list R G B A] ?width?
  64. Draw an arch using the color and optional width along the coordinates specified.
  65.  
  66. ?nurbs curve?
  67.  
  68.  
  69. C API
  70. int Tcl_ImagecoreGetBuffer(Tcl_Interp *interp, Tcl_Obj *instanceName, void **imageData, int *width, int *height);
  71.  
  72. If the result is TCL_OK then return the start of the image data, its width, and height. The idea is that this may be used with a new Tk image backend or for extension users.
  73.  
  74.  
  75. int Tcl_ImagecoreSetBuffer(Tcl_Interp *interp, Tcl_Obj *instanceName, void *imageData, int width, int height);
  76.  
  77. If the result is TCL_OK then the imagecore instance exists, and the data has been replaced (with a new buffer if the width and height are different).
  78.