Fri, 17 Feb 2017 01:02:45 +0300
* MaskedObject now can work with different animation types, not perfect,
but working.
* Bitmap wrapper is no more, const_cast should work in all cases
1004
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

1  #include "Bitmap.h" 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

2  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

3  #include <fstream> 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

4  #include <algorithm> 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

5  #include <numeric> 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

6  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

7  #include "../Encoding/PNG.h" 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

8  #include "../Encoding/JPEG.h" 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

9  #include "../IO/Stream.h" 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

10  #include "../Utils/Assert.h" 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

11  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

12  namespace Gorgon { namespace Graphics { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

13  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

14  void Bitmap::Prepare() { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

15  if(data) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

16  Graphics::Texture::Set(*data); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

17  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

18  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

19  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

20  void Bitmap::Discard() { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

21  if(data) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

22  delete data; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

23  data=nullptr; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

24  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

25  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

26  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

27  bool Bitmap::Import(const std::string &filename) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

28  auto dotpos = filename.find_last_of('.'); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

29  if(dotpos!=1) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

30  auto ext = filename.substr(dotpos+1); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

31  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

32  if(String::ToLower(ext) == "png") { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

33  return ImportPNG(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

34  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

35  else if(String::ToLower(ext) == "jpg"  String::ToLower(ext) =="jpeg") { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

36  return ImportJPEG(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

37  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

38  else if(String::ToLower(ext) == "bmp") { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

39  return ImportBMP(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

40  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

41  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

42  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

43  std::ifstream file(filename, std::ios::binary); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

44  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

45  static const uint32_t pngsig = 0x474E5089; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

46  static const uint32_t jpgsig1 = 0xE0FFD8FF; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

47  static const uint32_t jpgsig2 = 0xE1FFD8FF; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

48  static const uint32_t bmpsig = 0x4D42; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

49  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

50  uint32_t sig = IO::ReadUInt32(file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

51  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

52  file.close(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

53  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

54  if(sig == pngsig) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

55  return ImportPNG(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

56  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

57  else if(sig == jpgsig1  sig == jpgsig2) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

58  return ImportJPEG(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

59  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

60  else if((sig&0xffff) == bmpsig) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

61  return ImportBMP(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

62  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

63  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

64  throw std::runtime_error("Unsuppoted file format"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

65  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

66  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

67  bool Bitmap::Import(std::istream &file) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

68  static const uint32_t pngsig = 0x474E5089; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

69  static const uint32_t jpgsig1 = 0xE0FFD8FF; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

70  static const uint32_t jpgsig2 = 0xE1FFD8FF; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

71  static const uint32_t bmpsig = 0x4D42; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

72  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

73  uint32_t sig = IO::ReadUInt32(file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

74  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

75  file.seekg(4, std::ios::cur); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

76  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

77  if(sig == pngsig) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

78  return ImportPNG(file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

79  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

80  else if(sig == jpgsig1  sig == jpgsig2) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

81  return ImportJPEG(file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

82  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

83  else if((sig&0xffff) == bmpsig) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

84  return ImportBMP(file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

85  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

86  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

87  throw std::runtime_error("Unsuppoted file format"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

88  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

89  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

90  bool Bitmap::ImportPNG(const std::string &filename) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

91  std::ifstream file(filename, std::ios::binary); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

92  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

93  if(!file.is_open()  !file.good()) return false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

94  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

95  Destroy(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

96  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

97  data=new Containers::Image(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

98  Encoding::Png.Decode(file, *data); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

99  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

100  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

101  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

102  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

103  bool Bitmap::ImportJPEG(const std::string &filename) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

104  std::ifstream file(filename, std::ios::binary); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

105  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

106  if(!file.is_open()  !file.good()) return false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

107  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

108  Destroy(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

109  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

110  data=new Containers::Image(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

111  Encoding::Jpg.Decode(file, *data); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

112  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

113  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

114  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

115  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

116  bool Bitmap::ImportBMP(const std::string &filename) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

117  std::ifstream file(filename, std::ios::binary); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

118  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

119  if(!file.is_open()  !file.good()) return false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

120  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

121  Destroy(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

122  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

123  data=new Containers::Image(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

124  return data>ImportBMP(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

125  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

126  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

127  bool Bitmap::ImportPNG(std::istream &file) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

128  Destroy(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

129  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

130  data=new Containers::Image(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

131  Encoding::Png.Decode(file, *data); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

132  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

133  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

134  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

135  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

136  bool Bitmap::ImportJPEG(std::istream &file) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

137  Destroy(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

138  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

139  data=new Containers::Image(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

140  Encoding::Jpg.Decode(file, *data); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

141  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

142  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

143  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

144  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

145  bool Bitmap::ImportBMP(std::istream &file) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

146  Destroy(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

147  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

148  data=new Containers::Image(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

149  return data>ImportBMP(file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

150  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

151  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

152  bool Bitmap::ExportPNG(const std::string &filename) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

153  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

154  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

155  if(GetMode()!=Graphics::ColorMode::RGB && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

156  GetMode()!=Graphics::ColorMode::RGBA && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

157  GetMode()!=Graphics::ColorMode::Grayscale && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

158  GetMode()!=Graphics::ColorMode::Grayscale_Alpha && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

159  GetMode()!=Graphics::ColorMode::Alpha) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

160  throw std::runtime_error("Unsupported color mode"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

161  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

162  std::ofstream file(filename, std::ios::binary); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

163  if(!file.is_open()) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

164  return false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

165  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

166  Encoding::Png.Encode(*data, file); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

167  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

168  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

169  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

170  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

171  bool Bitmap::ExportPNG(std::ostream &out) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

172  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

173  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

174  if(GetMode()!=Graphics::ColorMode::RGB && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

175  GetMode()!=Graphics::ColorMode::RGBA && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

176  GetMode()!=Graphics::ColorMode::Grayscale && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

177  GetMode()!=Graphics::ColorMode::Grayscale_Alpha && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

178  GetMode()!=Graphics::ColorMode::Alpha) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

179  throw std::runtime_error("Unsupported color mode"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

180  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

181  Encoding::Png.Encode(*data, out); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

182  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

183  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

184  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

185  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

186  bool Bitmap::ExportBMP(const std::string &filename) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

187  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

188  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

189  return data>ExportBMP(filename); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

190  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

191  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

192  bool Bitmap::ExportBMP(std::ostream &out) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

193  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

194  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

195  return data>ExportBMP(out); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

196  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

197  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

198  bool Bitmap::ExportJPG(const std::string &filename, int quality) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

199  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

200  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

201  if(GetMode()!=Graphics::ColorMode::RGB && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

202  GetMode()!=Graphics::ColorMode::Grayscale) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

203  throw std::runtime_error("Unsupported color mode"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

204  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

205  if(quality < 0  quality > 100) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

206  throw std::runtime_error("Unsupported quality"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

207  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

208  std::ofstream file(filename, std::ios::binary); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

209  if(!file.is_open()) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

210  return false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

211  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

212  Encoding::Jpg.Encode(*data, file, quality); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

213  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

214  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

215  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

216  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

217  bool Bitmap::ExportJPG(std::ostream &out, int quality) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

218  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

219  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

220  if(GetMode()!=Graphics::ColorMode::RGB && 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

221  GetMode()!=Graphics::ColorMode::Grayscale) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

222  throw std::runtime_error("Unsupported color mode"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

223  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

224  if(quality < 0  quality > 100) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

225  throw std::runtime_error("Unsupported quality"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

226  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

227  Encoding::Jpg.Encode(*data, out, quality); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

228  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

229  return true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

230  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

231  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

232  void Bitmap::StripRGB() { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

233  ASSERT(HasAlpha(GetMode()), "Unsupported color mode"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

234  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

235  int alpha = AlphaIndex(GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

236  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

237  auto &data = *this>data; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

238  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

239  Containers::Image img(data.GetSize(), ColorMode::Alpha); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

240  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

241  for(int y=0; y<data.GetHeight(); y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

242  for(int x=0; x<data.GetWidth(); x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

243  img(x, y, 0) = data(x, y, alpha); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

244  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

245  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

246  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

247  Assume(img); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

248  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

249  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

250  void Bitmap::StripAlpha() { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

251  if(!HasAlpha(GetMode())) return; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

252  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

253  int alpha = AlphaIndex(GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

254  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

255  auto &data = *this>data; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

256  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

257  Containers::Image img(data.GetSize(), (ColorMode)((int)GetMode()&~(int)ColorMode::Alpha)); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

258  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

259  for(int y=0; y<data.GetHeight(); y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

260  for(int x=0; x<data.GetWidth(); x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

261  int cc = 0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

262  for(int c=0; c<(int)data.GetBytesPerPixel(); c++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

263  if(c!=alpha) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

264  img(x, y, cc++) = data(x, y, c); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

265  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

266  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

267  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

268  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

269  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

270  Assume(img); 
972
40b12ffaea3e
* Animation storage system to unify image, animation, and pointer
cemkalyoncu
parents:
932
diff
changeset

271  } 
40b12ffaea3e
* Animation storage system to unify image, animation, and pointer
cemkalyoncu
parents:
932
diff
changeset

272  
1004
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

273  std::vector<Geometry::Bounds> Bitmap::CreateLinearAtlas(Containers::Collection<const Bitmap> list, AtlasMargins margins) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

274  std::vector<Geometry::Bounds> ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

275  std::map<const Bitmap *, Geometry::Bounds> mapping; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

276  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

277  int N = list.GetSize(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

278  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

279  if(N == 0) return ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

280  if(N == 1) return {Geometry::Bounds(0, 0, list[0].GetSize())}; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

281  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

282  int marginwidth = 0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

283  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

284  if(margins == Zero) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

285  marginwidth = 1; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

286  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

287  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

288  auto mode = list[0].GetMode(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

289  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

290  int minw = list[0].GetWidth() + marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

291  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

292  std::vector<const Bitmap *> ordering; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

293  for(auto &bmp : list) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

294  ordering.push_back(&bmp); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

295  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

296  if(minw > bmp.GetWidth() + marginwidth) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

297  minw = bmp.GetWidth() + marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

298  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

299  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

300  //first height based, so the items with similar heights would be next to each other 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

301  //second sort criteria is width as wider items should be packed at start. Items 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

302  //are reverse sorted for performance 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

303  list.Sort([](const Bitmap &l, const Bitmap &r) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

304  if(l.GetHeight() == r.GetHeight()) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

305  return l.GetWidth() < r.GetWidth(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

306  else 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

307  return l.GetHeight() > r.GetHeight(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

308  }); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

309  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

310  int totalw = std::accumulate(list.begin(), list.end(), 0, [margins](int l, const Bitmap &r) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

311  return l + r.GetWidth() + (margins == Zero ? 1 : 0); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

312  }); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

313  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

314  int avgw = (int)std::ceil(float(totalw) / N); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

315  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

316  // average line height would be skewed towards high 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

317  int avgh = list[int(N*2/3)].GetHeight(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

318  if(margins == Zero) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

319  avgh += 1; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

320  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

321  int lines = (int)std::round(std::sqrt(float(N)/avgh*avgw)); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

322  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

323  int x = 0, y = 0, maxy = 0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

324  int w = (int)std::ceil((float)totalw/lines); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

325  w += minw; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

326  int maxx = 0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

327  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

328  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

329  if(margins == Zero) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

330  x = marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

331  y = marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

332  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

333  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

334  //build positions 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

335  for(int i=0; i<N; i++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

336  auto &bmp = *list.Last(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

337  if(x + bmp.GetWidth() + marginwidth < w) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

338  auto size = bmp.GetSize(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

339  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

340  mapping[&bmp] = {x, y, size}; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

341  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

342  x += size.Width + marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

343  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

344  if(size.Height > maxy) maxy = size.Height; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

345  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

346  list.Remove(list.GetSize()1); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

347  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

348  else { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

349  bool found = false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

350  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

351  if(w  x > minw) { //search to find a smaller image 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

352  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

353  int maxw = w  x  1  marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

354  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

355  for(auto it = list.Last(); it.IsValid(); it.Previous()) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

356  auto size = it>GetSize(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

357  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

358  if(size.Width <= maxw) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

359  mapping[it.CurrentPtr()] = {x, y, size}; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

360  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

361  x += size.Width + marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

362  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

363  if(size.Height > maxy) maxy = size.Height; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

364  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

365  it.Remove(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

366  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

367  found = true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

368  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

369  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

370  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

371  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

372  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

373  if(!found) { //too small 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

374  y += maxy + marginwidth; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

375  maxy = 0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

376  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

377  if(maxx < x) maxx = x; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

378  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

379  if(margins == Zero) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

380  x = 1; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

381  else 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

382  x = 0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

383  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

384  i; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

385  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

386  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

387  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

388  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

389  if(x) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

390  y += maxy; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

391  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

392  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

393  Resize({maxx, y + marginwidth}, mode); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

394  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

395  if(margins == Zero) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

396  data>Clean(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

397  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

398  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

399  //channel count 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

400  int C = GetBytesPerPixel(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

401  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

402  for(auto p : mapping) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

403  auto b = p.second; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

404  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

405  if(p.first>GetMode() != mode) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

406  throw std::runtime_error("Color modes are not uniform in atlas generation"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

407  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

408  for(int y=0; y<b.Height(); y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

409  for(int x=0; x<b.Width(); x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

410  for(int c=0; c<C; c++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

411  (*data)(x+b.Left, y+b.Top, c) = (*p.first)(x, y, c); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

412  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

413  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

414  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

415  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

416  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

417  ret.reserve(N); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

418  for(int i=0; i<N; i++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

419  ret.push_back(mapping[ordering[i]]); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

420  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

421  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

422  //ExportPNG("atlas.png"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

423  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

424  return ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

425  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

426  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

427  std::vector<TextureImage> Bitmap::CreateAtlasImages(std::vector<Geometry::Bounds> boundaries) const { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

428  if(GetID() == 0) throw std::runtime_error("Cannot map atlas from an unprepared image"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

429  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

430  std::vector<TextureImage> ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

431  ret.reserve(boundaries.size()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

432  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

433  for(auto b : boundaries) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

434  ret.emplace_back(GetID(), GetMode(), GetSize(), b); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

435  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

436  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

437  return ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

438  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

439  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

440  Geometry::Margins Bitmap::Trim(bool left, bool top, bool right, bool bottom) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

441  ASSERT(data, "Image data does not exists"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

442  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

443  ASSERT(HasAlpha(GetMode()), "Unsupported color mode"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

444  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

445  Geometry::Margins ret(0, 0, 0, 0); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

446  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

447  int alpha = AlphaIndex(GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

448  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

449  auto &data = *this>data; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

450  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

451  if(left) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

452  for(int x=0; x<data.GetWidth(); x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

453  bool empty = true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

454  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

455  for(int y=0; y<data.GetHeight(); y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

456  if(data(x, y, alpha) != 0) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

457  empty = false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

458  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

459  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

460  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

461  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

462  if(empty) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

463  ret.Left++; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

464  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

465  else { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

466  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

467  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

468  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

469  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

470  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

471  if(top) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

472  for(int y=0; y<data.GetHeight(); y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

473  bool empty = true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

474  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

475  for(int x=0; x<data.GetWidth(); x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

476  if(data(x, y, alpha) != 0) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

477  empty = false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

478  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

479  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

480  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

481  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

482  if(empty) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

483  ret.Top++; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

484  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

485  else { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

486  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

487  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

488  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

489  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

490  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

491  if(right) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

492  for(int x=data.GetWidth()1; x>=0; x) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

493  bool empty = true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

494  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

495  for(int y=0; y<data.GetHeight(); y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

496  if(data(x, y, alpha) != 0) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

497  empty = false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

498  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

499  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

500  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

501  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

502  if(empty) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

503  ret.Right++; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

504  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

505  else { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

506  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

507  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

508  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

509  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

510  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

511  if(bottom) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

512  for(int y=data.GetHeight()1; y>=0; y) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

513  bool empty = true; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

514  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

515  for(int x=0; x<data.GetWidth(); x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

516  if(data(x, y, alpha) != 0) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

517  empty = false; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

518  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

519  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

520  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

521  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

522  if(empty) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

523  ret.Bottom++; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

524  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

525  else { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

526  break; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

527  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

528  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

529  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

530  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

531  if(ret.TotalX() == 0 && ret.TotalY() == 0) return ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

532  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

533  if(ret.TotalX() >= data.GetWidth()  ret.TotalY() >= data.GetHeight()) 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

534  return ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

535  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

536  Containers::Image img(data.GetSize()  ret.Total(), GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

537  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

538  int yy=0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

539  for(int y=ret.Top; y<data.GetHeight()  ret.Bottom; y++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

540  int xx=0; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

541  for(int x=ret.Left; x<data.GetWidth()  ret.Right; x++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

542  for(int c=0; c<(int)data.GetBytesPerPixel(); c++) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

543  img(xx, yy, c) = data(x, y, c); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

544  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

545  xx++; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

546  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

547  yy++; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

548  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

549  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

550  Assume(img); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

551  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

552  return ret; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

553  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

554  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

555  Containers::Image Bitmap::ReleaseData() { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

556  if(data==nullptr) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

557  #ifndef NDEBUG 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

558  ASSERT_DUMP(false, "No data to release"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

559  #endif 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

560  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

561  return { }; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

562  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

563  else { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

564  Containers::Image temp=std::move(*data); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

565  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

566  delete data; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

567  data=nullptr; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

568  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

569  return temp; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

570  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

571  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

572  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

573  Graphics::Bitmap Bitmap::Rotate90() const { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

574  ASSERT(data, "Bitmap data is not set"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

575  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

576  Graphics::Bitmap target(GetHeight(), GetWidth(), GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

577  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

578  int h = target.GetHeight(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

579  ForAllPixels([&](int x, int y, int c) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

580  target(y, h  x  1, c) = (*this)(x, y, c); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

581  }); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

582  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

583  return target; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

584  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

585  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

586  Graphics::Bitmap Bitmap::Rotate180() const { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

587  ASSERT(data, "Bitmap data is not set"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

588  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

589  Graphics::Bitmap target(GetSize(), GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

590  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

591  int h = target.GetHeight(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

592  int w = target.GetWidth(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

593  ForAllPixels([&](int x, int y, int c) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

594  target(w  x  1, h  y  1, c) = (*this)(x, y, c); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

595  }); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

596  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

597  return target; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

598  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

599  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

600  Graphics::Bitmap Bitmap::Rotate270() { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

601  ASSERT(data, "Bitmap data is not set"); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

602  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

603  Graphics::Bitmap target(GetHeight(), GetWidth(), GetMode()); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

604  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

605  int w = target.GetWidth(); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

606  ForAllPixels([&](int x, int y, int c) { 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

607  target(w  y  1, x, c) = (*this)(x, y, c); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

608  }); 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

609  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

610  return target; 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

611  } 
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

612  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

613  
b6b47ba90e06
* MaskedObject now can work with different animation types, not perfect,
cemkalyoncu
parents:
986
diff
changeset

614  } } 