-
Notifications
You must be signed in to change notification settings - Fork 418
/
Copy pathIOSNative.m
10008 lines (8691 loc) · 461 KB
/
IOSNative.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Codename One designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Codename One through http://www.codenameone.com/ if you
* need additional information or have any questions.
*/
// Pisces imports
#import "Renderer.h"
#import "PathConsumer.h"
#import "Stroker.h"
// end Pisces imports
#include "xmlvm.h"
#include "java_lang_String.h"
#import "CN1ES2compat.h"
#ifndef NEW_CODENAME_ONE_VM
#include "xmlvm-util.h"
#else
#include "cn1_globals.h"
#endif
#import "CN1AudioUnit.h"
#import <UIKit/UIKit.h>
#import "CodenameOne_GLViewController.h"
#import "NetworkConnectionImpl.h"
#include "com_codename1_impl_ios_IOSImplementation.h"
#include "com_codename1_ui_Display.h"
#include "com_codename1_ui_Component.h"
#include "java_lang_Throwable.h"
#include "java_lang_RuntimeException.h"
#import "FillPolygon.h"
#import "AudioPlayer.h"
#import "DrawGradient.h"
#import <MediaPlayer/MediaPlayer.h>
#import <CoreLocation/CoreLocation.h>
#import <MobileCoreServices/UTCoreTypes.h>
#import <Foundation/Foundation.h>
#import <MessageUI/MFMailComposeViewController.h>
#import <AddressBookUI/AddressBookUI.h>
#import <MessageUI/MFMessageComposeViewController.h>
#import "UIWebViewEventDelegate.h"
#include <sqlite3.h>
#ifdef CN1_USE_STOREKIT
#import "StoreKit/StoreKit.h"
#endif
#include "com_codename1_contacts_Contact.h"
#include "com_codename1_contacts_Address.h"
#include "java_util_Hashtable.h"
#include "com_codename1_ui_Image.h"
#include "com_codename1_impl_ios_IOSImplementation_NativeImage.h"
#include "com_codename1_util_SuccessCallback.h"
#import "SocketImpl.h"
#import "com_codename1_ui_geom_Rectangle.h"
#import <MobileCoreServices/MobileCoreServices.h>
#include "com_codename1_ui_plaf_Style.h"
#import "RadialGradientPaint.h"
#include "java_io_IOException.h"
#include "com_codename1_io_Cookie.h"
#include "com_codename1_ui_plaf_UIManager.h"
#include "java_io_Writer.h"
#include "java_util_ArrayList.h"
#include "com_codename1_ui_Font.h"
#include "java_util_Vector.h"
#include "permission_apis.h"
//#import "QRCodeReaderOC.h"
#define AUTO_PLAY_VIDEO
#ifdef ENABLE_WKWEBVIEW
#if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9 || __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1)
#import <WebKit/WebKit.h>
#define supportsWKWebKit
#endif
#endif
#ifdef INCLUDE_ZOOZ
#import "ZooZ.h"
#endif
#import "Rotate.h"
//#define CN1_USE_AVKIT
#ifdef CN1_USE_AVKIT
#if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9 || __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1)
#import <AVKit/AVKit.h>
#define CN1_AVPLAYERVIEWCONTROLLER AVPlayerViewController*
#else
#define CN1_AVPLAYERVIEWCONTROLLER id
#endif
#else
#define CN1_AVPLAYERVIEWCONTROLLER id
#endif
extern int popoverSupported();
//#define CN1_INCLUDE_NOTIFICATIONS2
#define INCLUDE_CN1_PUSH2
#ifdef CN1_INCLUDE_NOTIFICATIONS2
#import <UserNotifications/UserNotifications.h>
#endif
#ifdef INCLUDE_PHOTOLIBRARY_USAGE
#ifdef ENABLE_GALLERY_MULTISELECT
#ifdef USE_PHOTOKIT_FOR_MULTIGALLERY
#import <PhotosUI/PhotosUI.h>
#endif
#endif
#endif
/*static JAVA_OBJECT utf8_constant = JAVA_NULL;
JAVA_OBJECT fromNSString(NSString* str)
{
if (str == nil) {
return JAVA_NULL;
}
if (utf8_constant == JAVA_NULL) {
utf8_constant = xmlvm_create_java_string("UTF-8");
}
NSAutoreleasePool* p = [[NSAutoreleasePool alloc] init];
java_lang_String* s = __NEW_java_lang_String();
const char* chars = [str UTF8String];
int length = strlen(chars);
org_xmlvm_runtime_XMLVMArray* data = XMLVMArray_createSingleDimensionWithData(__CLASS_byte, length, chars);
java_lang_String___INIT____byte_1ARRAY_java_lang_String(s, data, utf8_constant);
[p release];
return s;
}*/
extern UIView *editingComponent;
extern void initVMImpl();
extern void deinitVMImpl();
extern int Java_com_codename1_impl_ios_IOSImplementation_getDisplayWidthImpl();
extern int Java_com_codename1_impl_ios_IOSImplementation_getDisplayHeightImpl();
extern JAVA_INT getSafeTop();
extern JAVA_INT getSafeLeft();
extern JAVA_INT getSafeBottom();
extern JAVA_INT getSafeRight();
extern void Java_com_codename1_impl_ios_IOSImplementation_flushBufferImpl
(void* peer, int x, int y, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingMutableImpl
(int x, int y, int width, int height, int clipApplied);
extern void Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingShapeMutableImpl
(int numCommands, JAVA_OBJECT commands, int numPoints, JAVA_OBJECT points);
extern void Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingGlobalImpl
(int x, int y, int width, int height, int clipApplied);
extern void Java_com_codename1_impl_ios_IOSImplementation_setAntiAliasedMutableImpl(JAVA_BOOLEAN antialiased);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawLineGlobalImpl
(int color, int alpha, int x1, int y1, int x2, int y2);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawLineMutableImpl
(int color, int alpha, int x1, int y1, int x2, int y2);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeFillRectMutableImpl
(int color, int alpha, int x, int y, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeFillRectGlobalImpl
(int color, int alpha, int x, int y, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRectMutableImpl
(int color, int alpha, int x, int y, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRectGlobalImpl
(int color, int alpha, int x, int y, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawStringGlobalImpl
(int color, int alpha, void* fontPeer, NSString* str, int x, int y);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawStringMutableImpl
(int color, int alpha, void* fontPeer, NSString* str, int x, int y);
extern void* Java_com_codename1_impl_ios_IOSImplementation_createNativeMutableImageImpl
(int width, int height, int argb);
extern void Java_com_codename1_impl_ios_IOSImplementation_startDrawingOnImageImpl
(int width, int height, void *peer);
extern void* Java_com_codename1_impl_ios_IOSImplementation_finishDrawingOnImageImpl
();
extern void Java_com_codename1_impl_ios_IOSImplementation_deleteNativePeerImpl
(void* peer);
extern void Java_com_codename1_impl_ios_IOSImplementation_deleteNativeFontPeerImpl
(void* peer);
extern void* Java_com_codename1_impl_ios_IOSImplementation_createImageImpl
(void* data, int dataLength, int* widthAndHeightReturnValue);
extern void* Java_com_codename1_impl_ios_IOSImplementation_scaleImpl
(void* peer, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRoundRectGlobalImpl
(int color, int alpha, int x, int y, int width, int height, int arcWidth, int arcHeight);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeFillRoundRectGlobalImpl
(int color, int alpha, int x, int y, int width, int height, int arcWidth, int arcHeight);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRoundRectMutableImpl
(int color, int alpha, int x, int y, int width, int height, int arcWidth, int arcHeight);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeFillRoundRectMutableImpl
(int color, int alpha, int x, int y, int width, int height, int arcWidth, int arcHeight);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeFillArcMutableImpl
(int color, int alpha, int x, int y, int width, int height, int startAngle, int angle);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawArcMutableImpl
(int color, int alpha, int x, int y, int width, int height, int startAngle, int angle);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawImageMutableImpl
(void* peer, int alpha, int x, int y, int width, int height, int renderingHints);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeDrawImageGlobalImpl
(void* peer, int alpha, int x, int y, int width, int height, int renderingHints);
extern void Java_com_codename1_impl_ios_IOSImplementation_nativeTileImageGlobalImpl
(void* peer, int alpha, int x, int y, int width, int height);
extern signed int Java_com_codename1_impl_ios_IOSImplementation_stringWidthNativeImpl
(void* peer, const char* str, int len);
extern int Java_com_codename1_impl_ios_IOSImplementation_charWidthNativeImpl
(void* peer, int chr);
extern int Java_com_codename1_impl_ios_IOSImplementation_getFontHeightNativeImpl
(void* peer);
extern int Java_com_codename1_impl_ios_IOSImplementation_getFontAscentNativeImpl
(void* peer);
extern int Java_com_codename1_impl_ios_IOSImplementation_getFontDescentNativeImpl
(void* peer);
extern void* Java_com_codename1_impl_ios_IOSImplementation_createSystemFontImpl
(int face, int style, int size);
extern void loadResourceFile(const char* name, int nameLen, const char* type, int typeLen, void* data);
extern int getResourceSize(const char* name, int nameLen, const char* type, int typeLen);
extern int isPainted();
extern void Java_com_codename1_impl_ios_IOSImplementation_imageRgbToIntArrayImpl
(void* peer, int* arr, int x, int y, int width, int height, int imgWidth, int imgHeight);
extern void* Java_com_codename1_impl_ios_IOSImplementation_createImageFromARGBImpl
(int* arr, int width, int height);
extern void Java_com_codename1_impl_ios_IOSImplementation_editStringAtImpl
(CN1_THREAD_STATE_MULTI_ARG int x, int y, int w, int h, void* peer, int isSingleLine, int rows, int maxSize,
int constraint, const char* str, int len, BOOL dialogHeight, int color, JAVA_LONG imagePeer,
int padTop, int padBottom, int padLeft, int padRight, NSString* hintString, int hintColor, BOOL showToolbar, BOOL blockCopyPaste, int alignment, int verticalAlignment);
extern void Java_com_codename1_impl_ios_IOSImplementation_resetAffineGlobal();
extern void Java_com_codename1_impl_ios_IOSImplementation_scale(float x, float y);
extern int isIPad();
extern int isIOS7();
extern int isIOS8();
extern int isIOS8_2();
NSString* cn1_getDocumentsDir() {
NSArray *writablePaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return [writablePaths lastObject];
}
NSString* cn1_getContainerRoot() {
NSString* appRoot = cn1_getDocumentsDir();
if ([appRoot hasSuffix:@"/"]) {
appRoot = [appRoot substringWithRange:NSMakeRange(0, [appRoot length]-1)];
}
return [appRoot substringWithRange:NSMakeRange(0, [appRoot rangeOfString:@"/" options:NSBackwardsSearch].location +1)];
}
NSString* cn1_fixAppRoot(NSString* path) {
NSString* base = @"/var/mobile/Containers/Data/Application/";
NSString* containerRoot = cn1_getContainerRoot();
if ([path hasPrefix:base] && ![path hasPrefix:containerRoot]) {
NSUInteger start = [base length];
NSUInteger end = [path length];
NSString* theRest = [path substringWithRange:NSMakeRange(start, end - start)];
NSUInteger slashPos = [theRest rangeOfString:@"/"].location;
if (slashPos <= 0) {
return path;
}
start = slashPos+1;
end = [theRest length];
return [containerRoot stringByAppendingString: [theRest substringWithRange:NSMakeRange(start, end - start)]];
}
return path;
}
NSString* fixFilePath(NSString* ns) {
//NSLog(@"Fixing %@", ns);
if([ns hasPrefix:@"file:"]) {
ns = [ns substringFromIndex:5];
while([ns hasPrefix:@"//"]) {
ns = [ns substringFromIndex:1];
}
}
NSString* out = cn1_fixAppRoot(ns);
//NSLog(@"Fixed to %@", out);
return out;
}
bool galleryPopover = NO;
#ifndef NEW_CODENAME_ONE_VM
JAVA_OBJECT utf8String = NULL;
const char* stringToUTF8(JAVA_OBJECT str) {
if(str == NULL) {
return NULL;
}
if(utf8String == NULL) {
utf8String = xmlvm_create_java_string("UTF-8");
}
org_xmlvm_runtime_XMLVMArray* byteArray = java_lang_String_getBytes___java_lang_String(str, utf8String);
JAVA_ARRAY_BYTE* data = (JAVA_ARRAY_BYTE*)byteArray->fields.org_xmlvm_runtime_XMLVMArray.array_;
JAVA_ARRAY_INT len = byteArray->fields.org_xmlvm_runtime_XMLVMArray.length_;
char* cs = XMLVM_ATOMIC_MALLOC(len + 1);
memcpy(cs, data, len);
cs[len] = '\0';
return cs;
}
#endif // NEW_CODENAME_ONE_VM
void com_codename1_impl_ios_IOSNative_initVM__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject)
{
POOL_BEGIN();
int retVal = UIApplicationMain(0, nil, nil, @"CodenameOne_GLAppDelegate");
POOL_END();
}
void xmlvm_init_native_com_codename1_impl_ios_IOSNative()
{
}
void com_codename1_impl_ios_IOSNative_deinitializeVM__(CN1_THREAD_STATE_SINGLE_ARG)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_deinitializeVM__]
deinitVMImpl();
//XMLVM_END_WRAPPER
}
JAVA_BOOLEAN com_codename1_impl_ios_IOSNative_isPainted__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_isPainted__]
return isPainted();
//XMLVM_END_WRAPPER
}
JAVA_INT com_codename1_impl_ios_IOSNative_getDisplayWidth__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_getDisplayWidth__]
POOL_BEGIN();
JAVA_INT i = Java_com_codename1_impl_ios_IOSImplementation_getDisplayWidthImpl();
POOL_END();
return i;
//XMLVM_END_WRAPPER
}
JAVA_INT com_codename1_impl_ios_IOSNative_getDisplayHeight__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_getDisplayHeight__]
POOL_BEGIN();
JAVA_INT i = Java_com_codename1_impl_ios_IOSImplementation_getDisplayHeightImpl();
POOL_END();
return i;
//XMLVM_END_WRAPPER
}
JAVA_OBJECT com_codename1_impl_ios_IOSNative_getClipboardString___R_java_lang_String(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject) {
POOL_BEGIN();
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
JAVA_OBJECT str = fromNSString(CN1_THREAD_STATE_PASS_ARG pasteboard.string);
POOL_END();
return str;
}
void com_codename1_impl_ios_IOSNative_setClipboardString___java_lang_String(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_OBJECT str) {
POOL_BEGIN();
NSString* ns = toNSString(CN1_THREAD_STATE_PASS_ARG str);
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = ns;
POOL_END();
}
void retainCN1(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o){
com_codename1_impl_ios_IOSImplementation_retain___java_lang_Object(CN1_THREAD_STATE_PASS_ARG o);
}
void releaseCN1(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o){
com_codename1_impl_ios_IOSImplementation_release___java_lang_Object(CN1_THREAD_STATE_PASS_ARG o);
}
JAVA_OBJECT getClientProperty(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o, NSString* key){
return com_codename1_ui_Component_getClientProperty___java_lang_String_R_java_lang_Object(
CN1_THREAD_STATE_PASS_ARG o,
fromNSString(CN1_THREAD_STATE_PASS_ARG key)
);
}
BOOL getBooleanClientProperty(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT o, NSString* key){
JAVA_OBJECT val = getClientProperty(CN1_THREAD_STATE_PASS_ARG o, key);
if(val == JAVA_NULL){
return NO;
}
return val == get_static_java_lang_Boolean_TRUE(threadStateData);
}
#ifndef NEW_CODENAME_ONE_VM
NSString* toNSString(JAVA_OBJECT str) {
if(str == JAVA_NULL) {
return 0;
}
// accessing internal state since toCharArray performs an allocation which can be REALLY expensive
int offset = ((java_lang_String*) str)->fields.java_lang_String.offset_;
org_xmlvm_runtime_XMLVMArray* cArr = ((java_lang_String*) str)->fields.java_lang_String.value_;
//CN1Log(@"cArr pointer is: %i", cArr);
if(cArr == JAVA_NULL) {
const char* chrs = stringToUTF8(str);
NSString* st = [NSString stringWithUTF8String:chrs];
//CN1Log(@"Unicode chars: %@ over %i at offset %i", st, chrArr[iter], iter);
return st;
}
JAVA_ARRAY_CHAR* chrArr = (JAVA_ARRAY_CHAR*)cArr->fields.org_xmlvm_runtime_XMLVMArray.array_;
//CN1Log(@"chrArr pointer is: %i", chrArr);
int length = ((java_lang_String*) str)->fields.java_lang_String.count_;
for(int iter = offset ; iter < length ; iter++) {
if(chrArr[iter] > 127) {
const char* chrs = stringToUTF8(str);
NSString* st = [NSString stringWithUTF8String:chrs];
//CN1Log(@"Unicode chars: %@ over %i at offset %i", st, chrArr[iter], iter);
return st;
}
}
if(offset > 0) {
return [[NSString stringWithCharacters:chrArr length:length+offset] substringFromIndex:offset];
}
return [NSString stringWithCharacters:chrArr length:length];
}
#endif
void com_codename1_impl_ios_IOSNative_editStringAt___int_int_int_int_long_boolean_int_int_int_java_lang_String_boolean_int_long_int_int_int_int_java_lang_String_int_boolean_boolean_int_int(CN1_THREAD_STATE_MULTI_ARG
JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_LONG n5, JAVA_BOOLEAN n6, JAVA_INT n7,
JAVA_INT n8, JAVA_INT n9, JAVA_OBJECT n10, JAVA_BOOLEAN forceSlide,
JAVA_INT color, JAVA_LONG imagePeer, JAVA_INT padTop, JAVA_INT padBottom, JAVA_INT padLeft, JAVA_INT padRight, JAVA_OBJECT hint, JAVA_INT hintColor, JAVA_BOOLEAN showToolbar, JAVA_BOOLEAN blockCopyPaste,
JAVA_INT alignment, JAVA_INT verticalAlignment)
{
POOL_BEGIN();
const char* chr = stringToUTF8(CN1_THREAD_STATE_PASS_ARG n10);
int l = strlen(chr) + 1;
char cc[l];
memcpy(cc, chr, l);
Java_com_codename1_impl_ios_IOSImplementation_editStringAtImpl(CN1_THREAD_STATE_PASS_ARG n1, n2, n3, n4, n5, n6, n7, n8, n9, cc, 0, forceSlide, color, imagePeer,
padTop, padBottom, padLeft, padRight, toNSString(CN1_THREAD_STATE_PASS_ARG hint), hintColor, showToolbar, blockCopyPaste, alignment, verticalAlignment);
POOL_END();
}
extern float scaleValue;
extern int editComponentPadTop, editComponentPadLeft;
extern float editCompoentX, editCompoentY, editCompoentW, editCompoentH;
void com_codename1_impl_ios_IOSNative_resizeNativeTextView___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT x, JAVA_INT y, JAVA_INT w, JAVA_INT h, JAVA_INT padTop, JAVA_INT padRight, JAVA_INT padBottom, JAVA_INT padLeft) {
POOL_BEGIN();
dispatch_async(dispatch_get_main_queue(), ^{
POOL_BEGIN();
if(editingComponent != nil) {
float scale = scaleValue;
CGRect existingBounds = editingComponent.frame;
NSString *currText = ((UITextField*)editingComponent).text;
float neditCompoentX = (x + padLeft) / scale;
float neditCompoentY = (y + padTop) / scale;
float neditComponentPadTop = padTop;
float neditComponentPadLeft = padLeft;
if (scale > 1) {
neditCompoentY -= 1.5;
} else {
neditCompoentY -= 1;
}
float neditCompoentW = (w - padLeft - padRight) / scale;
float neditCompoentH = (h - padTop - padBottom) / scale;
CGRect rect = CGRectMake(neditCompoentX, neditCompoentY, neditCompoentW, neditCompoentH);
//CN1Log(@"Changing bounds %f,%f,%f,%f to %f,%f,%f,%f", existingBounds.origin.x, existingBounds.origin.y, existingBounds.size.width, existingBounds.size.height, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
if (fabs(existingBounds.size.width - rect.size.width) > 1 || fabs(existingBounds.size.height - rect.size.height) > 1 ||
fabs(existingBounds.origin.x - rect.origin.x) > 1 || fabs(existingBounds.origin.y - rect.origin.y) > 1
) {
//CN1Log(@"Changing bounds %f,%f,%f,%f to %f,%f,%f,%f", existingBounds.origin.x, existingBounds.origin.y, existingBounds.size.width, existingBounds.size.height, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
editCompoentH = neditCompoentH;
editCompoentW = neditCompoentW;
editCompoentX = neditCompoentX;
editCompoentY = neditCompoentY;
editingComponent.frame = rect;
}
}
POOL_END();
});
POOL_END();
}
#ifdef INCLUDE_CN1_PUSH_2
typedef void (^CN1PushCompletionHandlerType)();
extern CN1PushCompletionHandlerType cn1PushCompletionHandler;
int pushReceivedCount=0;
#endif
void com_codename1_impl_ios_IOSNative_firePushCompletionHandler__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject) {
#ifdef INCLUDE_CN1_PUSH_2
dispatch_async(dispatch_get_main_queue(), ^{
if (cn1PushCompletionHandler != nil) {
pushReceivedCount--;
if (pushReceivedCount <= 0) {
cn1PushCompletionHandler();
Block_release(cn1PushCompletionHandler);
cn1PushCompletionHandler = nil;
}
}
});
#endif
}
#ifdef INCLUDE_CN1_BACKGROUND_FETCH
typedef void (^CN1BackgroundFetchBlockType)(UIBackgroundFetchResult);
extern CN1BackgroundFetchBlockType cn1UIBackgroundFetchResultCompletionHandler;
#endif
void com_codename1_impl_ios_IOSNative_fireUIBackgroundFetchResultFailed__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject) {
#ifdef INCLUDE_CN1_BACKGROUND_FETCH
cn1UIBackgroundFetchResultCompletionHandler(UIBackgroundFetchResultFailed);
#endif
}
void com_codename1_impl_ios_IOSNative_fireUIBackgroundFetchResultNoData__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject) {
#ifdef INCLUDE_CN1_BACKGROUND_FETCH
cn1UIBackgroundFetchResultCompletionHandler(UIBackgroundFetchResultNoData);
#endif
}
void com_codename1_impl_ios_IOSNative_fireUIBackgroundFetchResultNewData__(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject) {
#ifdef INCLUDE_CN1_BACKGROUND_FETCH
cn1UIBackgroundFetchResultCompletionHandler(UIBackgroundFetchResultNewData);
#endif
}
JAVA_BOOLEAN com_codename1_impl_ios_IOSNative_isBackgroundFetchSupported___R_boolean(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject) {
#ifdef INCLUDE_CN1_BACKGROUND_FETCH
return YES;
#else
return NO;
#endif
}
void com_codename1_impl_ios_IOSNative_setPreferredBackgroundFetchInterval___int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT seconds) {
#ifdef INCLUDE_CN1_BACKGROUND_FETCH
NSTimeInterval interval = seconds;
if (interval < 0) {
interval = UIApplicationBackgroundFetchIntervalNever;
}
if (interval < 3600) {
// Minimum fetch interval appears to be between 10 minutes and 35 minutes
// Setting custom intervals seem to give unpredictable results, so for low values (< 1 hour)
// it is best to just use minimum interval and let the system work it out.
interval = UIApplicationBackgroundFetchIntervalMinimum;
}
[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:interval];
#endif
}
extern long CN1_EDT_THREAD_ID;
void com_codename1_impl_ios_IOSNative_flushBuffer___long_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_LONG n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_flushBuffer___long_int_int_int_int]
POOL_BEGIN();
if (CN1_EDT_THREAD_ID < 0) {
CN1_EDT_THREAD_ID = (long)threadStateData->threadId;
}
Java_com_codename1_impl_ios_IOSImplementation_flushBufferImpl((void *)n1, n2, n3, n4, n5);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_imageRgbToIntArray___long_int_1ARRAY_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_LONG n1, JAVA_OBJECT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
POOL_BEGIN();
#ifndef NEW_CODENAME_ONE_VM
org_xmlvm_runtime_XMLVMArray* intArray = n2;
JAVA_ARRAY_INT* data = (JAVA_ARRAY_INT*)intArray->fields.org_xmlvm_runtime_XMLVMArray.array_;
#else
JAVA_ARRAY_INT* data = (JAVA_ARRAY_INT*)((JAVA_ARRAY)n2)->data;
#endif
Java_com_codename1_impl_ios_IOSImplementation_imageRgbToIntArrayImpl((void *)n1, data, n3, n4, n5, n6, n7, n8);
POOL_END();
}
JAVA_LONG com_codename1_impl_ios_IOSNative_createImageFromARGB___int_1ARRAY_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_OBJECT n1, JAVA_INT n2, JAVA_INT n3)
{
POOL_BEGIN();
#ifndef NEW_CODENAME_ONE_VM
org_xmlvm_runtime_XMLVMArray* intArray = n1;
JAVA_ARRAY_INT* data = (JAVA_ARRAY_INT*)intArray->fields.org_xmlvm_runtime_XMLVMArray.array_;
#else
JAVA_ARRAY_INT* data = (JAVA_ARRAY_INT*)((JAVA_ARRAY)n1)->data;
#endif
JAVA_ARRAY_LONG i = Java_com_codename1_impl_ios_IOSImplementation_createImageFromARGBImpl((void *)data, n2, n3);
POOL_END();
return i;
}
JAVA_LONG com_codename1_impl_ios_IOSNative_createImage___byte_1ARRAY_int_1ARRAY(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_OBJECT n1, JAVA_OBJECT n2)
{
#ifndef NEW_CODENAME_ONE_VM
POOL_BEGIN();
org_xmlvm_runtime_XMLVMArray* byteArray = n1;
JAVA_ARRAY_BYTE* data = (JAVA_ARRAY_BYTE*)byteArray->fields.org_xmlvm_runtime_XMLVMArray.array_;
org_xmlvm_runtime_XMLVMArray* intArray = n2;
JAVA_ARRAY_INT* data2 = (JAVA_ARRAY_INT*)intArray->fields.org_xmlvm_runtime_XMLVMArray.array_;
JAVA_LONG i = Java_com_codename1_impl_ios_IOSImplementation_createImageImpl(data, byteArray->fields.org_xmlvm_runtime_XMLVMArray.length_, data2);
POOL_END();
#else
JAVA_ARRAY byteArray = (JAVA_ARRAY)n1;
JAVA_ARRAY intArray = (JAVA_ARRAY)n2;
void* data = byteArray->data;
void* data2 = intArray->data;
JAVA_LONG i = (JAVA_LONG)Java_com_codename1_impl_ios_IOSImplementation_createImageImpl(data, byteArray->length, data2);
#endif
return i;
}
JAVA_LONG com_codename1_impl_ios_IOSNative_createImageNSData___long_int_1ARRAY(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_LONG nsData, JAVA_OBJECT n2)
{
POOL_BEGIN();
NSData* nd = (BRIDGE_CAST NSData*) ((void*)nsData);
UIImage* img = [UIImage imageWithData:nd];
#ifndef NEW_CODENAME_ONE_VM
org_xmlvm_runtime_XMLVMArray* intArray = n2;
JAVA_ARRAY_INT* data2 = (JAVA_ARRAY_INT*)intArray->fields.org_xmlvm_runtime_XMLVMArray.array_;
#else
JAVA_ARRAY_INT* data2 = (JAVA_ARRAY_INT*)((JAVA_ARRAY)n2)->data;
#endif
data2[0] = (int)img.size.width;
data2[1] = (int)img.size.height;
GLUIImage* glu = [[GLUIImage alloc] initWithImage:img];
POOL_END();
return (JAVA_LONG) ((BRIDGE_CAST void*)glu);
}
JAVA_LONG com_codename1_impl_ios_IOSNative_scale___long_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_LONG n1, JAVA_INT n2, JAVA_INT n3)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_scale___long_int_int]
POOL_BEGIN();
JAVA_LONG i = (JAVA_LONG)Java_com_codename1_impl_ios_IOSImplementation_scaleImpl(n1, n2, n3);
POOL_END();
return i;
//XMLVM_END_WRAPPER
}
JAVA_LONG com_codename1_impl_ios_IOSNative_gausianBlurImage___long_float(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_LONG n1, JAVA_FLOAT radius) {
POOL_BEGIN();
GLUIImage* glu = (BRIDGE_CAST GLUIImage*)n1;
if(((BRIDGE_CAST void*)[CodenameOne_GLViewController instance].currentMutableImage) == glu) {
Java_com_codename1_impl_ios_IOSImplementation_finishDrawingOnImageImpl();
}
UIImage* original = [glu getImage];
// taken from: http://stackoverflow.com/a/19433086/756809
CIFilter *gaussianBlurFilter = [CIFilter filterWithName:@"CIGaussianBlur"];
[gaussianBlurFilter setDefaults];
CIImage *inputImage = [CIImage imageWithCGImage:[original CGImage]];
[gaussianBlurFilter setValue:inputImage forKey:kCIInputImageKey];
NSNumber *radiusNumber = [NSNumber numberWithFloat:radius];
[gaussianBlurFilter setValue:radiusNumber forKey:kCIInputRadiusKey];
CIImage *outputImage = [gaussianBlurFilter outputImage];
CIContext *context = [CIContext contextWithOptions:nil];
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[inputImage extent]];
UIImage *image = [UIImage imageWithCGImage:cgimg];
CGImageRelease(cgimg);
GLUIImage* gl = [[GLUIImage alloc] initWithImage:image];
POOL_END();
return (BRIDGE_CAST void*)gl;
}
void com_codename1_impl_ios_IOSNative_setNativeClippingMutable___int_int_int_int_boolean(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_BOOLEAN n5)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_setNativeClippingMutable___int_int_int_int_boolean]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingMutableImpl(n1, n2, n3, n4, n5);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_setNativeClippingMutable___int_byte_1ARRAY_int_float_1ARRAY(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT numCommands, JAVA_OBJECT commands, JAVA_INT numPoints, JAVA_OBJECT points)
{
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingShapeMutableImpl(numCommands, commands, numPoints, points);
POOL_END();
}
void com_codename1_impl_ios_IOSNative_setNativeClippingGlobal___int_int_int_int_boolean(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_BOOLEAN n5)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_setNativeClippingGlobal___int_int_int_int_boolean]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingGlobalImpl(n1, n2, n3, n4, n5);
POOL_END();
//XMLVM_END_WRAPPER
}
extern void Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingMaskGlobalImpl(JAVA_LONG textureName, JAVA_INT x, JAVA_INT y, JAVA_INT w, JAVA_INT h);
void com_codename1_impl_ios_IOSNative_setNativeClippingMaskGlobal___long_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_LONG textureName, JAVA_INT x, JAVA_INT y, JAVA_INT w, JAVA_INT h)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_setNativeClippingGlobal___int_int_int_int_boolean]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingMaskGlobalImpl(textureName, x, y, w, h);
POOL_END();
//XMLVM_END_WRAPPER
}
extern void Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingPolygonGlobalImpl(JAVA_OBJECT points);
void com_codename1_impl_ios_IOSNative_setNativeClippingPolygonGlobal___float_1ARRAY(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_OBJECT points)
{
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_setNativeClippingPolygonGlobalImpl(points);
POOL_END();
}
void com_codename1_impl_ios_IOSNative_setAntiAliasedMutable___boolean(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_BOOLEAN antialiased)
{
Java_com_codename1_impl_ios_IOSImplementation_setAntiAliasedMutableImpl(antialiased);
}
void com_codename1_impl_ios_IOSNative_nativeDrawLineMutable___int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawLineMutable___int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawLineMutableImpl(n1, n2, n3, n4, n5, n6);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeDrawLineGlobal___int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawLineGlobal___int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawLineGlobalImpl(n1, n2, n3, n4, n5, n6);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeFillRectMutable___int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeFillRectMutable___int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeFillRectMutableImpl(n1, n2, n3, n4, n5, n6);
POOL_END();
//XMLVM_END_WRAPPER
}
extern void Java_com_codename1_impl_ios_IOSImplementation_clearRectMutable(int x, int y, int w, int h);
//native void clearRectMutable(int x, int y, int width, int height);
void com_codename1_impl_ios_IOSNative_clearRectMutable___int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT x, JAVA_INT y, JAVA_INT w, JAVA_INT h) {
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_clearRectMutable(x, y, w, h);
POOL_END();
}
extern void Java_com_codename1_impl_ios_IOSImplementation_clearRectGlobal(int x, int y, int w, int h);
//native void nativeClearRectGlobal(int x, int y, int width, int height);
void com_codename1_impl_ios_IOSNative_nativeClearRectGlobal___int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT x, JAVA_INT y, JAVA_INT w, JAVA_INT h) {
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_clearRectGlobal(x, y, w, h);
POOL_END();
}
void com_codename1_impl_ios_IOSNative_nativeFillRectGlobal___int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeFillRectGlobal___int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeFillRectGlobalImpl(n1, n2, n3, n4, n5, n6);
POOL_END();
//XMLVM_END_WRAPPER
}
/*
native void fillPolygonGlobal(int color, int alpha, int[] xPoints, int[] yPoints, int nPoints);
*/
void com_codename1_impl_ios_IOSNative_fillPolygonGlobal___int_int_int_1ARRAY_int_1ARRAY_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT color, JAVA_INT alpha, JAVA_OBJECT xPoints, JAVA_OBJECT yPoints, JAVA_INT nPoints) {
POOL_BEGIN();
JAVA_INT* x = (JAVA_INT*)((JAVA_ARRAY)xPoints)->data;
JAVA_INT* y = (JAVA_INT*)((JAVA_ARRAY)yPoints)->data;
JAVA_FLOAT xFloats[nPoints];
JAVA_FLOAT yFloats[nPoints];
for (int i=0; i<nPoints; i++) {
xFloats[i] = (JAVA_FLOAT)*(x+i);
yFloats[i] = (JAVA_FLOAT)*(y+i);
}
FillPolygon* f = [[FillPolygon alloc] initWithArgs:xFloats y:yFloats num:nPoints color:color alpha:alpha];
[CodenameOne_GLViewController upcoming:f];
#ifndef CN1_USE_ARC
[f release];
#endif
POOL_END();
}
void com_codename1_impl_ios_IOSNative_nativeDrawRectMutable___int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawRectMutable___int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRectMutableImpl(n1, n2, n3, n4, n5, n6);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeDrawRectGlobal___int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawRectGlobal___int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRectGlobalImpl(n1, n2, n3, n4, n5, n6);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeDrawRoundRectMutable___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawRoundRectMutable___int_int_int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRoundRectMutableImpl(n1, n2, n3, n4, n5, n6, n7, n8);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeDrawRoundRectGlobal___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawRoundRectGlobal___int_int_int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawRoundRectGlobalImpl(n1, n2, n3, n4, n5, n6, n7, n8);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeFillRoundRectMutable___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeFillRoundRectMutable___int_int_int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeFillRoundRectMutableImpl(n1, n2, n3, n4, n5, n6, n7, n8);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeFillRoundRectGlobal___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeFillRoundRectGlobal___int_int_int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeFillRoundRectGlobalImpl(n1, n2, n3, n4, n5, n6, n7, n8);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeFillArcMutable___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeFillArcMutable___int_int_int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeFillArcMutableImpl(n1, n2, n3, n4, n5, n6, n7, n8);
POOL_END();
//XMLVM_END_WRAPPER
}
void com_codename1_impl_ios_IOSNative_nativeDrawArcMutable___int_int_int_int_int_int_int_int(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT n1, JAVA_INT n2, JAVA_INT n3, JAVA_INT n4, JAVA_INT n5, JAVA_INT n6, JAVA_INT n7, JAVA_INT n8)
{
//XMLVM_BEGIN_WRAPPER[com_codename1_impl_ios_IOSNative_nativeDrawArcMutable___int_int_int_int_int_int_int_int]
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSImplementation_nativeDrawArcMutableImpl(n1, n2, n3, n4, n5, n6, n7, n8);
POOL_END();
//XMLVM_END_WRAPPER
}
//native void nativeDrawShadowMutable(long image, int x, int y, int offsetX, int offsetY, int blurRadius, int spreadRadius, int color, float opacity);
extern void Java_com_codename1_impl_ios_IOSNative_nativeDrawShadowMutable(CN1_THREAD_STATE_MULTI_ARG JAVA_LONG image,
JAVA_INT x, JAVA_INT y, JAVA_INT offsetX, JAVA_INT offsetY, JAVA_INT blurRadius, JAVA_INT spreadRadius, JAVA_INT color, JAVA_FLOAT opacity);
void com_codename1_impl_ios_IOSNative_nativeDrawShadowMutable___long_int_int_int_int_int_int_int_float(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject,
JAVA_LONG image, JAVA_INT x, JAVA_INT y, JAVA_INT offsetX, JAVA_INT offsetY, JAVA_INT blurRadius, JAVA_INT spreadRadius, JAVA_INT color, JAVA_FLOAT opacity) {
POOL_BEGIN();
Java_com_codename1_impl_ios_IOSNative_nativeDrawShadowMutable(CN1_THREAD_STATE_PASS_ARG image, x, y, offsetX, offsetY, blurRadius, spreadRadius, color, opacity);
POOL_END();
}
extern CGContextRef Java_com_codename1_impl_ios_IOSImplementation_drawPath(CN1_THREAD_STATE_MULTI_ARG JAVA_INT commandsLen, JAVA_OBJECT commandsArr, JAVA_INT pointsLen, JAVA_OBJECT pointsArr);
static CGContextRef drawPath(CN1_THREAD_STATE_MULTI_ARG JAVA_INT commandsLen, JAVA_OBJECT commandsArr, JAVA_INT pointsLen, JAVA_OBJECT pointsArr) {
return Java_com_codename1_impl_ios_IOSImplementation_drawPath(CN1_THREAD_STATE_PASS_ARG commandsLen, commandsArr, pointsLen, pointsArr);
}
//native void nativeFillShapeMutable(int color, int alpha, int commandsLen, byte[] commandsArr, int pointsLen, float[] pointsArr);
void com_codename1_impl_ios_IOSNative_nativeFillShapeMutable___int_int_int_byte_1ARRAY_int_float_1ARRAY(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT color, JAVA_INT alpha, JAVA_INT commandsLen, JAVA_OBJECT commandsArr, JAVA_INT pointsLen, JAVA_OBJECT pointsArr) {
POOL_BEGIN();
[UIColorFromRGB(color, alpha) set];
CGContextRef context = drawPath(CN1_THREAD_STATE_PASS_ARG commandsLen, commandsArr, pointsLen, pointsArr);
CGContextFillPath(context);
POOL_END();
}
void com_codename1_impl_ios_IOSNative_nativeDrawShapeMutable___int_int_int_byte_1ARRAY_int_float_1ARRAY_float_int_int_float(CN1_THREAD_STATE_MULTI_ARG JAVA_OBJECT instanceObject, JAVA_INT color, JAVA_INT alpha, JAVA_INT commandsLen, JAVA_OBJECT commandsArr, JAVA_INT pointsLen, JAVA_OBJECT pointsArr, JAVA_FLOAT lineWidth, JAVA_INT capStyle, JAVA_INT joinStyle, JAVA_FLOAT mitreLimit) {
POOL_BEGIN();
if ([CodenameOne_GLViewController isCurrentMutableTransformSet]) {
CGContextSaveGState(UIGraphicsGetCurrentContext());
CGContextConcatCTM(UIGraphicsGetCurrentContext(), [CodenameOne_GLViewController currentMutableTransform]);
}
CGContextRef context = drawPath(CN1_THREAD_STATE_PASS_ARG commandsLen, commandsArr, pointsLen, pointsArr);
CGContextSaveGState(context);
[UIColorFromRGB(color, alpha) set];
CGContextSetLineWidth(context, lineWidth);
CGLineCap cap = kCGLineCapButt;
switch (capStyle) {
case CN1_CAP_BUTT: {
cap = kCGLineCapButt;
break;
}
case CN1_CAP_ROUND: {
cap = kCGLineCapRound;
break;
}
case CN1_CAP_SQUARE: {
cap = kCGLineCapSquare;
break;
}
}
CGContextSetLineCap(context, cap);
CGLineJoin join = kCGLineJoinMiter;
switch (joinStyle) {
case CN1_JOIN_MITER: {