App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

Blender.java
Go to the documentation of this file.
1 package mhr.appcore.blending;
2
3 import mhr.appcore.bitmap.BitmapInfo;
4 import mhr.appcore.bitmap.ChannelCount;
5 import mhr.appcore.bitmap.Depth;
6 import mhr.appcore.bitmap.NBitmap;
7 import mhr.appcore.bitmap.NativeType;
8 import mhr.appcore.exceptions.AlreadyDisposedException;
9 import mhr.appcore.utils.Rect;
10
14 public class Blender {
15 //----- Nativní metody ----------------------------------------------------------------------------------------------------------------------//
16 protected native static int blendTo(int nativeType, int mode, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY);
17
18 protected native static int blendTo(int nativeType, int mode, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY,
19 double alpha);
20
21 protected native static int blendTo(int nativeType, int mode, long dstAdress, int color, int dstTlx, int dstTly, int dstBrx, int dstBry);
22
23 protected native static int blendTo(int nativeType, int mode, long dstAdress, int color, int dstTlx, int dstTly, int dstBrx, int dstBry, double alpha);
24
25 protected native static int addTo(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY);
26
27 protected native static int addTo(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY, double alpha);
28
29 protected native static int addTo(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX, int srcOrigY,
30 int mskOrigX, int mskOrigY);
31
32 protected native static int addTo(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX, int srcOrigY,
33 int mskOrigX, int mskOrigY, double alpha);
34
35 protected native static int removeFrom(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY);
36
37 protected native static int removeFrom(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY, double alpha);
38
39 protected native static int removeFrom(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
40 int srcOrigY, int mskOrigX, int mskOrigY);
41
42 protected native static int removeFrom(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
43 int srcOrigY, int mskOrigX, int mskOrigY, double alpha);
44
45 protected native static int addTo4ch(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY);
46
47 protected native static int addTo4ch(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY, double alpha);
48
49 protected native static int addTo4ch(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
50 int srcOrigY, int mskOrigX, int mskOrigY);
51
52 protected native static int addTo4ch(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
53 int srcOrigY, int mskOrigX, int mskOrigY, double alpha);
54
55 protected native static int removeFrom4ch(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY);
56
57 protected native static int removeFrom4ch(int nativeType, long dstAdress, long srcAdress, int srcTlx, int srcTly, int srcBrx, int srcBry, int srcOrigX, int srcOrigY,
58 double alpha);
59
60 protected native static int removeFrom4ch(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
61 int srcOrigY, int mskOrigX, int mskOrigY);
62
63 protected native static int removeFrom4ch(int nativeType, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
64 int srcOrigY, int mskOrigX, int mskOrigY, double alpha);
65
66 protected native static int drawTo(int nativeType, int mode, long dstAdress, long mskAdress, int color, int mskTlx, int mskTly, int mskBrx, int mskBry, int mskOrigX,
67 int mskOrigY);
68
69 protected native static int drawTo(int nativeType, int mode, long dstAdress, long mskAdress, int color, int mskTlx, int mskTly, int mskBrx, int mskBry, int mskOrigX,
70 int mskOrigY, double alpha);
71
72 protected native static int drawTo(int nativeType, int mode, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
73 int srcOrigY, int mskOrigX, int mskOrigY);
74
75 protected native static int drawTo(int nativeType, int mode, long dstAdress, long mskAdress, long srcAdress, int mskTlx, int mskTly, int mskBrx, int mskBry, int srcOrigX,
76 int srcOrigY, int mskOrigX, int mskOrigY, double alpha);
77
78 //----- Java pole ---------------------------------------------------------------------------------------------------------------------------//
79 //----- Konstruktory ------------------------------------------------------------------------------------------------------------------------//
81 protected Blender() {
82 }
83
84 //----- Destruktory -------------------------------------------------------------------------------------------------------------------------//
85 //----- Metody ------------------------------------------------------------------------------------------------------------------------------//
86
87 public static int blendTo(BlendMode mode, NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY) throws IllegalArgumentException, AlreadyDisposedException {
88 BitmapInfo srcInfo = src.getInfo();
89 if (srcInfo.channelCount == ChannelCount.FOUR_CHANNEL && src.getNativeType() == dst.getNativeType()) {
90 return blendTo(src.getNativeType().getValue(), mode.getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX,
91 srcOrigY);
92 } else {
93 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
94 }
95 }
96
97 public static int blendTo(BlendMode mode, NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY, double alpha) throws IllegalArgumentException,
98 AlreadyDisposedException {
99 BitmapInfo srcInfo = src.getInfo();
100 if (srcInfo.channelCount == ChannelCount.FOUR_CHANNEL && src.getNativeType() == dst.getNativeType()) {
101 return blendTo(src.getNativeType().getValue(), mode.getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX,
102 srcOrigY, alpha);
103 } else {
104 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
105 }
106 }
107
108 public static int blendTo(BlendMode mode, NBitmap dst, int color, Rect dstRect) throws IllegalArgumentException, AlreadyDisposedException {
109 BitmapInfo dstInfo = dst.getInfo();
110 if (dstInfo.channelCount == ChannelCount.FOUR_CHANNEL) {
111 return blendTo(dst.getNativeType().getValue(), mode.getValue(), dst.getAdress(), color, dstRect.tlx, dstRect.tly, dstRect.brx, dstRect.bry);
112 } else {
113 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
114 }
115 }
116
117 public static int blendTo(BlendMode mode, NBitmap dst, int color, Rect dstRect, double alpha) throws IllegalArgumentException, AlreadyDisposedException {
118 BitmapInfo dstInfo = dst.getInfo();
119 if (dstInfo.channelCount == ChannelCount.FOUR_CHANNEL) {
120 return blendTo(dst.getNativeType().getValue(), mode.getValue(), dst.getAdress(), color, dstRect.tlx, dstRect.tly, dstRect.brx, dstRect.bry, alpha);
121 } else {
122 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
123 }
124 }
125
126 public static int addTo(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY) throws IllegalArgumentException, AlreadyDisposedException {
127 BitmapInfo srcInfo = src.getInfo();
128 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && src.getNativeType() == dst.getNativeType()) {
129 return addTo(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY);
130 } else {
131 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
132 }
133 }
134
135 public static int addTo(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY, double alpha) throws IllegalArgumentException, AlreadyDisposedException {
136 BitmapInfo srcInfo = src.getInfo();
137 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && src.getNativeType() == dst.getNativeType()) {
138 return addTo(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY, alpha);
139 } else {
140 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
141 }
142 }
143
144 public static int addTo(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY) throws IllegalArgumentException,
145 AlreadyDisposedException {
146 BitmapInfo mskInfo = msk.getInfo();
147 BitmapInfo dstInfo = dst.getInfo();
148 BitmapInfo srcInfo = src.getInfo();
149 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.SINGLE_CHANNEL && srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL
150 && dstInfo.depth == mskInfo.depth && dstInfo.depth == srcInfo.depth) {
151 return addTo(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX, srcOrigY,
152 mskOrigX, mskOrigY);
153 } else {
154 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
155 }
156 }
157
158 public static int addTo(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY, double alpha)
159 throws IllegalArgumentException, AlreadyDisposedException {
160 BitmapInfo mskInfo = msk.getInfo();
161 BitmapInfo dstInfo = dst.getInfo();
162 BitmapInfo srcInfo = src.getInfo();
163 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.SINGLE_CHANNEL && srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL
164 && dstInfo.depth == mskInfo.depth && dstInfo.depth == srcInfo.depth) {
165 return addTo(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX, srcOrigY,
166 mskOrigX, mskOrigY, alpha);
167 } else {
168 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
169 }
170 }
171
172 public static int removeFrom(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY) throws IllegalArgumentException, AlreadyDisposedException {
173 BitmapInfo srcInfo = src.getInfo();
174 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && src.getNativeType() == dst.getNativeType()) {
175 return removeFrom(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY);
176 } else {
177 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
178 }
179 }
180
181 public static int removeFrom(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY, double alpha) throws IllegalArgumentException, AlreadyDisposedException {
182 BitmapInfo srcInfo = src.getInfo();
183 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && src.getNativeType() == dst.getNativeType()) {
184 return removeFrom(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY, alpha);
185 } else {
186 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
187 }
188 }
189
190 public static int removeFrom(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY) throws IllegalArgumentException,
191 AlreadyDisposedException {
192 BitmapInfo mskInfo = msk.getInfo();
193 BitmapInfo dstInfo = dst.getInfo();
194 BitmapInfo srcInfo = src.getInfo();
195 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.SINGLE_CHANNEL && srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL
196 && dstInfo.depth == mskInfo.depth && dstInfo.depth == srcInfo.depth) {
197 return removeFrom(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX,
198 srcOrigY, mskOrigX, mskOrigY);
199 } else {
200 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
201 }
202 }
203
204 public static int removeFrom(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY, double alpha)
205 throws IllegalArgumentException, AlreadyDisposedException {
206 BitmapInfo mskInfo = msk.getInfo();
207 BitmapInfo dstInfo = dst.getInfo();
208 BitmapInfo srcInfo = src.getInfo();
209 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.SINGLE_CHANNEL && srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL
210 && dstInfo.depth == mskInfo.depth && dstInfo.depth == srcInfo.depth) {
211 return removeFrom(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX,
212 srcOrigY, mskOrigX, mskOrigY, alpha);
213 } else {
214 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
215 }
216 }
217
218 public static int addTo4ch(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY) throws IllegalArgumentException, AlreadyDisposedException {
219 BitmapInfo srcInfo = src.getInfo();
220 BitmapInfo dstInfo = dst.getInfo();
221 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && dstInfo.depth == srcInfo.depth) {
222 return addTo4ch(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY);
223 } else {
224 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
225 }
226 }
227
228 public static int addTo4ch(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY, double alpha) throws IllegalArgumentException, AlreadyDisposedException {
229 BitmapInfo srcInfo = src.getInfo();
230 BitmapInfo dstInfo = dst.getInfo();
231 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && dstInfo.depth == srcInfo.depth) {
232 return addTo4ch(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY, alpha);
233 } else {
234 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
235 }
236 }
237
238 public static int addTo4ch(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY) throws IllegalArgumentException,
239 AlreadyDisposedException {
240 BitmapInfo mskInfo = msk.getInfo();
241 BitmapInfo srcInfo = src.getInfo();
242 BitmapInfo dstInfo = dst.getInfo();
243 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL
244 && dstInfo.depth == srcInfo.depth && dstInfo.depth == mskInfo.depth) {
245 return addTo4ch(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX,
246 srcOrigY, mskOrigX, mskOrigY);
247 } else {
248 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
249 }
250 }
251
252 public static int addTo4ch(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY, double alpha)
253 throws IllegalArgumentException, AlreadyDisposedException {
254 BitmapInfo mskInfo = msk.getInfo();
255 BitmapInfo srcInfo = src.getInfo();
256 BitmapInfo dstInfo = dst.getInfo();
257 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL
258 && dstInfo.depth == srcInfo.depth && dstInfo.depth == mskInfo.depth) {
259 return addTo4ch(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX,
260 srcOrigY, mskOrigX, mskOrigY, alpha);
261 } else {
262 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
263 }
264 }
265
266 public static int removeFrom4ch(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY) throws IllegalArgumentException, AlreadyDisposedException {
267 BitmapInfo srcInfo = src.getInfo();
268 BitmapInfo dstInfo = dst.getInfo();
269 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && dstInfo.depth == srcInfo.depth) {
270 return removeFrom4ch(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY);
271 } else {
272 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
273 }
274 }
275
276 public static int removeFrom4ch(NBitmap dst, NBitmap src, Rect srcRect, int srcOrigX, int srcOrigY, double alpha) throws IllegalArgumentException, AlreadyDisposedException {
277 BitmapInfo srcInfo = src.getInfo();
278 BitmapInfo dstInfo = dst.getInfo();
279 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && dstInfo.depth == srcInfo.depth) {
280 return removeFrom4ch(src.getNativeType().getValue(), dst.getAdress(), src.getAdress(), srcRect.tlx, srcRect.tly, srcRect.brx, srcRect.bry, srcOrigX, srcOrigY, alpha);
281 } else {
282 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
283 }
284 }
285
286 public static int removeFrom4ch(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY) throws IllegalArgumentException,
287 AlreadyDisposedException {
288 BitmapInfo mskInfo = msk.getInfo();
289 BitmapInfo srcInfo = src.getInfo();
290 BitmapInfo dstInfo = dst.getInfo();
291 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL
292 && dstInfo.depth == srcInfo.depth && dstInfo.depth == mskInfo.depth) {
293 return removeFrom4ch(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX,
294 srcOrigY, mskOrigX, mskOrigY);
295 } else {
296 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
297 }
298 }
299
300 public static int removeFrom4ch(NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY, double alpha)
301 throws IllegalArgumentException, AlreadyDisposedException {
302 BitmapInfo mskInfo = msk.getInfo();
303 BitmapInfo srcInfo = src.getInfo();
304 BitmapInfo dstInfo = dst.getInfo();
305 if (srcInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL
306 && dstInfo.depth == srcInfo.depth && dstInfo.depth == mskInfo.depth) {
307 return removeFrom4ch(dst.getNativeType().getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, srcOrigX,
308 srcOrigY, mskOrigX, mskOrigY, alpha);
309 } else {
310 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
311 }
312 }
313
314 public static int drawTo(BlendMode mode, NBitmap dst, NBitmap msk, int color, Rect mskRect, int mskOrigX, int mskOrigY) throws IllegalArgumentException,
315 AlreadyDisposedException {
316 BitmapInfo mskInfo = msk.getInfo();
317 BitmapInfo dstInfo = dst.getInfo();
318 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && dstInfo.depth == mskInfo.depth) {
319 return drawTo(dst.getNativeType().getValue(), mode.getValue(), dst.getAdress(), msk.getAdress(), color, mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, mskOrigX,
320 mskOrigY);
321 } else {
322 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
323 }
324 }
325
326 public static int drawTo(BlendMode mode, NBitmap dst, NBitmap msk, int color, Rect mskRect, int mskOrigX, int mskOrigY, double alpha) throws IllegalArgumentException,
327 AlreadyDisposedException {
328 BitmapInfo mskInfo = msk.getInfo();
329 BitmapInfo dstInfo = dst.getInfo();
330 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && dstInfo.depth == mskInfo.depth) {
331 return drawTo(dst.getNativeType().getValue(), mode.getValue(), dst.getAdress(), msk.getAdress(), color, mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry, mskOrigX,
332 mskOrigY, alpha);
333 } else {
334 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
335 }
336 }
337
338 public static int drawTo(BlendMode mode, NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY)
339 throws IllegalArgumentException, AlreadyDisposedException {
340 BitmapInfo mskInfo = msk.getInfo();
341 BitmapInfo dstInfo = dst.getInfo();
342 BitmapInfo srcInfo = src.getInfo();
343 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && srcInfo.channelCount == ChannelCount.FOUR_CHANNEL
344 && dstInfo.depth == mskInfo.depth && dstInfo.depth == srcInfo.depth) {
345 return drawTo(dst.getNativeType().getValue(), mode.getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry,
346 srcOrigX, srcOrigY, mskOrigX, mskOrigY);
347 } else {
348 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
349 }
350 }
351
352 public static int drawTo(BlendMode mode, NBitmap dst, NBitmap msk, NBitmap src, Rect mskRect, int srcOrigX, int srcOrigY, int mskOrigX, int mskOrigY, double alpha)
353 throws IllegalArgumentException, AlreadyDisposedException {
354 BitmapInfo mskInfo = msk.getInfo();
355 BitmapInfo dstInfo = dst.getInfo();
356 BitmapInfo srcInfo = src.getInfo();
357 if (mskInfo.channelCount == ChannelCount.SINGLE_CHANNEL && dstInfo.channelCount == ChannelCount.FOUR_CHANNEL && srcInfo.channelCount == ChannelCount.FOUR_CHANNEL
358 && dstInfo.depth == mskInfo.depth && dstInfo.depth == srcInfo.depth) {
359 return drawTo(dst.getNativeType().getValue(), mode.getValue(), dst.getAdress(), msk.getAdress(), src.getAdress(), mskRect.tlx, mskRect.tly, mskRect.brx, mskRect.bry,
360 srcOrigX, srcOrigY, mskOrigX, mskOrigY, alpha);
361 } else {
362 throw new IllegalArgumentException("Operation is not applicable to suplied NBitmaps.");
363 }
364 }
365
366 }