@ElmImage.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class ElmImage : ElmData
  4. {
  5. enum FLAG // !! these enums are saved !!
  6. {
  7. MIP_MAPS =1<<0,
  8. POW2 =1<<1,
  9. ALPHA_LUM=1<<2,
  10. HAS_COLOR=1<<3, // if image is not monochromatic (r!=g || r!=b) (this member is not synced, it is inherited from image data)
  11. HAS_ALPHA=1<<4, // if any alpha pixel is not 255 (this member is not synced, it is inherited from image data)
  12. };
  13. enum TYPE : byte // !! these enums are saved !!
  14. {
  15. COMPRESSED ,
  16. COMPRESSED2,
  17. FULL ,
  18. ALPHA ,
  19. //CUSTOM ,
  20. NUM ,
  21. };
  22. static NameDesc ImageTypes[]
  23. ;
  24. static int ImageTypesElms;
  25. class ImageMode
  26. {
  27. IMAGE_MODE mode;
  28. cchar8 *name;
  29. };
  30. static ImageMode ImageModes[]
  31. ;
  32. byte flag; // FLAG
  33. TYPE type;
  34. IMAGE_MODE mode;
  35. VecI2 size; // -1=use existing, 0=default (use existing but adjust scale to keep aspect ratio if other value is modified)
  36. TimeStamp mip_maps_time, pow2_time, alpha_lum_time, type_time, mode_time, size_time, file_time;
  37. bool ignoreAlpha()C;
  38. bool mipMaps ()C; void mipMaps (bool on);
  39. bool pow2 ()C; void pow2 (bool on);
  40. bool alphaLum ()C; void alphaLum(bool on);
  41. bool hasColor ()C; void hasColor(bool on);
  42. bool hasAlpha ()C; void hasAlpha(bool on);
  43. bool hasAlpha2 ()C;
  44. bool hasAlpha3 ()C;
  45. IMAGE_TYPE androidType()C; // if want to be compressed then use ETC2_A8 or ETC2 or ETC1
  46. IMAGE_TYPE iOSType()C; // if want to be compressed then use PVRTC1_4
  47. IMAGE_TYPE webType()C; // if want to be compressed with alpha then use BC3
  48. // get
  49. bool equal(C ElmImage &src)C;
  50. bool newer(C ElmImage &src)C;
  51. virtual bool mayContain(C UID &id)C override;
  52. // operations
  53. virtual void newData()override;
  54. uint undo(C ElmImage &src);
  55. uint sync(C ElmImage &src);
  56. bool syncFile(C ElmImage &src);
  57. // io
  58. virtual bool save(File &f)C override;
  59. virtual bool load(File &f)override;
  60. virtual void save(MemPtr<TextNode> nodes)C override;
  61. virtual void load(C MemPtr<TextNode> &nodes)override;
  62. public:
  63. ElmImage();
  64. };
  65. /******************************************************************************/
  66. /******************************************************************************/
  67. /******************************************************************************/