Format.hx 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C)2005-2017 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package hl;
  23. @:enum abstract PixelFormat(Int) {
  24. var RGB = 0;
  25. var BGR = 1;
  26. var RGBX = 2;
  27. var BGRX = 3;
  28. var XBGR = 4;
  29. var XRGB = 5;
  30. var GRAY = 6;
  31. var RGBA = 7;
  32. var BGRA = 8;
  33. var ABGR = 9;
  34. var ARGB = 10;
  35. var CMYK = 11;
  36. }
  37. /**
  38. These are the bindings for the HL `fmt.hdll` library, which contains various low level formats handling.
  39. **/
  40. class Format {
  41. /**
  42. Decode JPG data into the target buffer.
  43. **/
  44. @:hlNative("fmt","jpg_decode")
  45. public static function decodeJPG( src : hl.Bytes, srcLen : Int, dst : hl.Bytes, width : Int, height : Int, stride : Int, format : PixelFormat, flags : Int ) : Bool {
  46. return false;
  47. }
  48. /**
  49. Decode PNG data into the target buffer.
  50. **/
  51. @:hlNative("fmt","png_decode")
  52. public static function decodePNG( src : hl.Bytes, srcLen : Int, dst : hl.Bytes, width : Int, height : Int, stride : Int, format : PixelFormat, flags : Int ) : Bool {
  53. return false;
  54. }
  55. /**
  56. Upscale/downscale an image.
  57. Currently supported flag bits: 1 = bilinear filtering
  58. **/
  59. @:hlNative("fmt","img_scale")
  60. public static function scaleImage( out : hl.Bytes, outPos : Int, outStride : Int, outWidth : Int, outHeight : Int, _in : hl.Bytes, inPos : Int, inStride : Int, inWidth : Int, inHeight : Int, flags : Int ) {
  61. }
  62. }