2
0

Image.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. function Image() {
  2. }
  3. Image.prototype.loadImage = function(fileName) {
  4. return Polycode.Image_loadImage(this.__ptr, fileName)
  5. }
  6. Image.prototype.saveImage = function(fileName) {
  7. return Polycode.Image_saveImage(this.__ptr, fileName)
  8. }
  9. Image.prototype.pasteImage = function(image,x,y,blendingMode,blendAmount,blendColor) {
  10. Polycode.Image_pasteImage(this.__ptr, image,x,y,blendingMode,blendAmount,blendColor)
  11. }
  12. Image.prototype.createEmpty = function(width,height,fillColor) {
  13. Polycode.Image_createEmpty(this.__ptr, width,height,fillColor)
  14. }
  15. Image.prototype.fill = function(color) {
  16. Polycode.Image_fill(this.__ptr, color)
  17. }
  18. Image.prototype.setPixel = function(x,y,r,g,b,a) {
  19. Polycode.Image_setPixel(this.__ptr, x,y,r,g,b,a)
  20. }
  21. Image.prototype.getPixel = function(x,y) {
  22. var retVal = new Color()
  23. retVal.__ptr = Polycode.Image_getPixel(this.__ptr, x,y)
  24. return retVal
  25. }
  26. Image.prototype.swap = function(v1,v2) {
  27. Polycode.Image_swap(this.__ptr, v1,v2)
  28. }
  29. Image.prototype.drawLine = function(x0,y0,x1,y1,col) {
  30. Polycode.Image_drawLine(this.__ptr, x0,y0,x1,y1,col)
  31. }
  32. Image.prototype.moveBrushTo = function(x,y) {
  33. Polycode.Image_moveBrushTo(this.__ptr, x,y)
  34. }
  35. Image.prototype.moveBrush = function(x,y) {
  36. Polycode.Image_moveBrush(this.__ptr, x,y)
  37. }
  38. Image.prototype.drawLineTo = function(x,y,col) {
  39. Polycode.Image_drawLineTo(this.__ptr, x,y,col)
  40. }
  41. Image.prototype.fillRect = function(x,y,w,h,col) {
  42. Polycode.Image_fillRect(this.__ptr, x,y,w,h,col)
  43. }
  44. Image.prototype.perlinNoise = function(seed,alpha) {
  45. Polycode.Image_perlinNoise(this.__ptr, seed,alpha)
  46. }
  47. Image.prototype.fastBlur = function(blurSize) {
  48. Polycode.Image_fastBlur(this.__ptr, blurSize)
  49. }
  50. Image.prototype.fastBlurVert = function(blurSize) {
  51. Polycode.Image_fastBlurVert(this.__ptr, blurSize)
  52. }
  53. Image.prototype.fastBlurHor = function(blurSize) {
  54. Polycode.Image_fastBlurHor(this.__ptr, blurSize)
  55. }
  56. Image.prototype.getPixelsInRect = function(x,y,width,height) {
  57. var retVal = new char()
  58. retVal.__ptr = Polycode.Image_getPixelsInRect(this.__ptr, x,y,width,height)
  59. return retVal
  60. }
  61. Image.prototype.getImagePart = function(subRect) {
  62. var retVal = new Image()
  63. retVal.__ptr = Polycode.Image_getImagePart(this.__ptr, subRect)
  64. return retVal
  65. }
  66. Image.prototype.getBrushX = function() {
  67. return Polycode.Image_getBrushX(this.__ptr)
  68. }
  69. Image.prototype.getBrushY = function() {
  70. return Polycode.Image_getBrushY(this.__ptr)
  71. }
  72. Image.prototype.isLoaded = function() {
  73. return Polycode.Image_isLoaded(this.__ptr)
  74. }
  75. Image.prototype.getType = function() {
  76. return Polycode.Image_getType(this.__ptr)
  77. }
  78. Image.prototype.getWidth = function() {
  79. return Polycode.Image_getWidth(this.__ptr)
  80. }
  81. Image.prototype.getHeight = function() {
  82. return Polycode.Image_getHeight(this.__ptr)
  83. }
  84. Image.prototype.getPixels = function() {
  85. var retVal = new char()
  86. retVal.__ptr = Polycode.Image_getPixels(this.__ptr)
  87. return retVal
  88. }
  89. Image.prototype.premultiplyAlpha = function() {
  90. Polycode.Image_premultiplyAlpha(this.__ptr)
  91. }
  92. Image.prototype.savePNG = function(fileName) {
  93. return Polycode.Image_savePNG(this.__ptr, fileName)
  94. }