Image.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. function Image() {
  2. if(arguments[0] != "__skip_ptr__") {
  3. this.__ptr = Polycode.Image()
  4. }
  5. }
  6. Image.IMAGE_RGB = 0
  7. Image.IMAGE_RGBA = 1
  8. Image.IMAGE_FP16 = 2
  9. Image.prototype.createEmpty = function(width,height,fillColor) {
  10. Polycode.Image_createEmpty(this.__ptr, width, height, fillColor)
  11. }
  12. Image.prototype.fill = function(color) {
  13. Polycode.Image_fill(this.__ptr, color)
  14. }
  15. Image.prototype.setPixel = function(x,y,r,g,b,a) {
  16. Polycode.Image_setPixel(this.__ptr, x, y, r, g, b, a)
  17. }
  18. Image.prototype.getPixel = function(x,y) {
  19. var retVal = new Color("__skip_ptr__")
  20. retVal.__ptr = Polycode.Image_getPixel(this.__ptr, x, y)
  21. return retVal
  22. }
  23. Image.prototype.drawLine = function(x0,y0,x1,y1,col) {
  24. Polycode.Image_drawLine(this.__ptr, x0, y0, x1, y1, col)
  25. }
  26. Image.prototype.moveBrushTo = function(x,y) {
  27. Polycode.Image_moveBrushTo(this.__ptr, x, y)
  28. }
  29. Image.prototype.moveBrush = function(x,y) {
  30. Polycode.Image_moveBrush(this.__ptr, x, y)
  31. }
  32. Image.prototype.drawLineTo = function(x,y,col) {
  33. Polycode.Image_drawLineTo(this.__ptr, x, y, col)
  34. }
  35. Image.prototype.fillRect = function(x,y,w,h,col) {
  36. Polycode.Image_fillRect(this.__ptr, x, y, w, h, col)
  37. }
  38. Image.prototype.perlinNoise = function(seed,alpha) {
  39. Polycode.Image_perlinNoise(this.__ptr, seed, alpha)
  40. }
  41. Image.prototype.fastBlur = function(blurSize) {
  42. Polycode.Image_fastBlur(this.__ptr, blurSize)
  43. }
  44. Image.prototype.fastBlurVert = function(blurSize) {
  45. Polycode.Image_fastBlurVert(this.__ptr, blurSize)
  46. }
  47. Image.prototype.fastBlurHor = function(blurSize) {
  48. Polycode.Image_fastBlurHor(this.__ptr, blurSize)
  49. }
  50. Image.prototype.getBrushX = function() {
  51. return Polycode.Image_getBrushX(this.__ptr)
  52. }
  53. Image.prototype.getBrushY = function() {
  54. return Polycode.Image_getBrushY(this.__ptr)
  55. }
  56. Image.prototype.isLoaded = function() {
  57. return Polycode.Image_isLoaded(this.__ptr)
  58. }
  59. Image.prototype.getType = function() {
  60. return Polycode.Image_getType(this.__ptr)
  61. }
  62. Image.prototype.getWidth = function() {
  63. return Polycode.Image_getWidth(this.__ptr)
  64. }
  65. Image.prototype.getHeight = function() {
  66. return Polycode.Image_getHeight(this.__ptr)
  67. }
  68. Image.prototype.premultiplyAlpha = function() {
  69. Polycode.Image_premultiplyAlpha(this.__ptr)
  70. }