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
|
//
// Description:
// SWFNative Implementation
//
// Authors:
// Jonathan Shore <jshore@e-shuppan.com>
//
// Copyright:
// Copyright 2001 E-Publishing Group Inc. Permission is granted to use or
// modify this code provided that the original copyright notice is included.
//
// This software is distributed with no warrantee of liability, merchantability,
// or fitness for a specific purpose.
//
#include <SWFNative.h>
#include <SWFUtilities.h>
#include <SWFFill.h>
#include <SWFShape.h>
#include <SWFDisplayItem.h>
#include <SWFMovie.h>
#include <SWFMovieClip.h>
#include <SWFMorph.h>
#include <SWFFont.h>
#include <SWFBitmap.h>
#include <SWFText.h>
#include <SWFTextField.h>
#include <SWFSound.h>
#include <SWFGradient.h>
#include <SWFButton.h>
#include <SWFAction.h>
//
// SWFFill Methods
//
JNIEXPORT void JNICALL Java_SWFFill_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFFill ((SWFFill)handle);
}
JNIEXPORT void JNICALL Java_SWFFill_nSkewX (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_skewX ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nSkewXTo (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_skewXTo ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nSkewY (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_skewY ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nSkewYTo (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_skewYTo ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nScaleX (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_scaleX ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nScaleXTo (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_scaleXTo ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nScaleY (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_scaleY ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nScaleYTo (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_scaleYTo ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nScale (JNIEnv *, jobject, jint handle, jfloat xv, jfloat yv)
{
SWFFill_scaleXY ((SWFFill)handle, xv, yv);
}
JNIEXPORT void JNICALL Java_SWFFill_nRotate (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_rotate ((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nRotateTo (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFFill_rotateTo((SWFFill)handle, v);
}
JNIEXPORT void JNICALL Java_SWFFill_nMove (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFFill_move ((SWFFill)handle, x,y);
}
JNIEXPORT void JNICALL Java_SWFFill_nMoveTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFFill_moveTo ((SWFFill)handle, x,y);
}
//
// SWFShape Methods
//
JNIEXPORT jint JNICALL Java_SWFShape_nNew (JNIEnv *, jobject)
{
return (jint)newSWFShape();
}
JNIEXPORT void JNICALL Java_SWFShape_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFShape ((SWFShape)handle);
}
JNIEXPORT void JNICALL Java_SWFShape_nMovePen (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFShape_movePen ((SWFShape)handle, x, y);
}
JNIEXPORT void JNICALL Java_SWFShape_nMovePenTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFShape_movePenTo ((SWFShape)handle, x, y);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawLine (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFShape_drawLine ((SWFShape)handle, x, y);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawLineTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFShape_drawLineTo ((SWFShape)handle, x, y);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawLineToRelative (JNIEnv *, jobject, jint handle, jfloat dx, jfloat dy)
{
// might be wrong (no equiv call)
SWFShape_drawLineTo ((SWFShape)handle, dx, dy);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawCurve (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy)
{
SWFShape_drawCurve ((SWFShape)handle, bx, by, cx, cy);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawCurveTo (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy)
{
SWFShape_drawCurveTo ((SWFShape)handle, bx, by, cx, cy);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawCubic (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy, jfloat dx, jfloat dy)
{
SWFShape_drawCubic ((SWFShape)handle, bx, by, cx, cy, dx, dy);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawCubicTo (JNIEnv *, jobject, jint handle, jfloat bx, jfloat by, jfloat cx, jfloat cy, jfloat dx, jfloat dy)
{
SWFShape_drawCubicTo ((SWFShape)handle, bx, by, cx, cy, dx, dy);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawArc (JNIEnv *, jobject, jint handle, jfloat r, jfloat from, jfloat to)
{
SWFShape_drawArc ((SWFShape)handle, (int)r, from, to);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawCircle (JNIEnv *, jobject, jint handle, jfloat r)
{
SWFShape_drawCircle ((SWFShape)handle, (int)r);
}
JNIEXPORT void JNICALL Java_SWFShape_nDrawGlyph (JNIEnv *, jobject, jint handle, jint Hfont, jint c)
{
SWFShape_drawGlyph ((SWFShape)handle, (SWFFont)Hfont, c);
}
JNIEXPORT void JNICALL Java_SWFShape_nEnd (JNIEnv *, jobject, jint handle)
{
SWFShape_end ((SWFShape)handle);
}
JNIEXPORT void JNICALL Java_SWFShape_nSetLine (JNIEnv *, jobject, jint handle, jshort width, jint r, jint g, jint b, jint alpha)
{
SWFShape_setLine ((SWFShape)handle, width, r, g, b, alpha);
}
JNIEXPORT jint JNICALL Java_SWFShape_nAddBitmapFill (JNIEnv *, jobject, jint handle, jint Hbitmap, jshort flags)
{
return (jint)SWFShape_addBitmapFill ((SWFShape)handle, (SWFBitmap)Hbitmap, flags);
}
JNIEXPORT jint JNICALL Java_SWFShape_nAddGradientFill (JNIEnv *, jobject, jint handle, jint Hgradient, jshort flags)
{
return (jint)SWFShape_addGradientFill ((SWFShape)handle, (SWFGradient)Hgradient, flags);
}
JNIEXPORT jint JNICALL Java_SWFShape_nAddSolidFill (JNIEnv *, jobject, jint handle, jint r, jint g, jint b, jint alpha)
{
return (jint)SWFShape_addSolidFill ((SWFShape)handle, r,g,b, alpha);
}
JNIEXPORT void JNICALL Java_SWFShape_nSetLeftFill (JNIEnv *, jobject, jint handle, jint Hfill)
{
SWFShape_setLeftFill ((SWFShape)handle, (SWFFill)Hfill);
}
JNIEXPORT void JNICALL Java_SWFShape_nSetRightFill (JNIEnv *, jobject, jint handle, jint Hfill)
{
SWFShape_setRightFill ((SWFShape)handle, (SWFFill)Hfill);
}
//
// SWFDisplayItem Methods
//
JNIEXPORT void JNICALL Java_SWFDisplayItem_nDestroy (JNIEnv *, jobject, jint handle)
{
// do nothing
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nRotate (JNIEnv *, jobject, jint handle, jfloat r)
{
SWFDisplayItem_rotate ((SWFDisplayItem)handle, r);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nRotateTo (JNIEnv *, jobject, jint handle, jfloat r)
{
SWFDisplayItem_rotate ((SWFDisplayItem)handle, r);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nMove (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFDisplayItem_move ((SWFDisplayItem)handle, x, y);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nMoveTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFDisplayItem_moveTo ((SWFDisplayItem)handle, x, y);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nScale (JNIEnv *, jobject, jint handle, jfloat xs, jfloat ys)
{
SWFDisplayItem_scale ((SWFDisplayItem)handle, xs, ys);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nScaleTo (JNIEnv *, jobject, jint handle, jfloat xs, jfloat ys)
{
SWFDisplayItem_scaleTo ((SWFDisplayItem)handle, xs, ys);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewX (JNIEnv *, jobject, jint handle, jfloat s)
{
SWFDisplayItem_skewX ((SWFDisplayItem)handle, s);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewXTo (JNIEnv *, jobject, jint handle, jfloat s)
{
SWFDisplayItem_skewXTo ((SWFDisplayItem)handle, s);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewY (JNIEnv *, jobject, jint handle, jfloat s)
{
SWFDisplayItem_skewY ((SWFDisplayItem)handle, s);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSkewYTo (JNIEnv *, jobject, jint handle, jfloat s)
{
SWFDisplayItem_skewYTo ((SWFDisplayItem)handle, s);
}
JNIEXPORT jint JNICALL Java_SWFDisplayItem_nGetDepth (JNIEnv *, jobject, jint handle)
{
return (jint)SWFDisplayItem_getDepth ((SWFDisplayItem)handle);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSetDepth (JNIEnv *, jobject, jint handle, jint depth)
{
SWFDisplayItem_setDepth ((SWFDisplayItem)handle, depth);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nRemove (JNIEnv *, jobject, jint handle)
{
SWFDisplayItem_remove ((SWFDisplayItem)handle);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSetName (JNIEnv* env, jobject, jint handle, jstring name)
{
const char* sname = env->GetStringUTFChars(name, NULL);
SWFDisplayItem_setName ((SWFDisplayItem)handle, sname);
env->ReleaseStringUTFChars (name, sname);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nSetRatio (JNIEnv *, jobject, jint handle, jfloat r)
{
SWFDisplayItem_setRatio ((SWFDisplayItem)handle, r);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nAddColor (JNIEnv *, jobject, jint handle, jint r, jint g, jint b, jint alpha)
{
SWFDisplayItem_addColor ((SWFDisplayItem)handle, r,g,b, alpha);
}
JNIEXPORT void JNICALL Java_SWFDisplayItem_nMultColor (JNIEnv *, jobject, jint handle, jfloat r, jfloat g, jfloat b, jfloat alpha)
{
SWFDisplayItem_multColor ((SWFDisplayItem)handle, r,g,b, alpha);
}
//
// SWFMovie Methods
//
JNIEXPORT jint JNICALL Java_SWFMovie_nNew (JNIEnv *, jobject)
{
return (jint)newSWFMovie();
}
JNIEXPORT void JNICALL Java_SWFMovie_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFMovie ((SWFMovie)handle);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetScale (JNIEnv *, jobject, jfloat scale)
{
Ming_setScale (scale);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetCubicThreshold (JNIEnv *, jobject, jint v)
{
Ming_setCubicThreshold (v);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetRate (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFMovie_setRate ((SWFMovie)handle, v);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetDimension (JNIEnv *, jobject, jint handle, jint width, jint height)
{
SWFMovie_setDimension ((SWFMovie)handle, width, height);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetFrames (JNIEnv *, jobject, jint handle, jint n)
{
SWFMovie_setFrames ((SWFMovie)handle, n);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetBackground (JNIEnv *, jobject, jint handle, jint r, jint g, jint b)
{
SWFMovie_setBackground ((SWFMovie)handle, r,g,b);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSetSoundStream (JNIEnv *, jobject, jint handle, jint Hsound)
{
SWFMovie_setSoundStream ((SWFMovie)handle, (SWFSound)Hsound);
}
JNIEXPORT jint JNICALL Java_SWFMovie_nAdd (JNIEnv *, jobject, jint handle, jint Hobject)
{
return (jint)SWFMovie_add ((SWFMovie)handle, (SWFBlock)Hobject);
}
JNIEXPORT void JNICALL Java_SWFMovie_nRemove (JNIEnv *, jobject, jint handle, jint Hobject)
{
SWFMovie_remove ((SWFMovie)handle, (SWFDisplayItem)Hobject);
}
JNIEXPORT void JNICALL Java_SWFMovie_nNextFrame (JNIEnv *, jobject, jint handle)
{
SWFMovie_nextFrame ((SWFMovie)handle);
}
JNIEXPORT void JNICALL Java_SWFMovie_nLabelFrame (JNIEnv* env, jobject, jint handle, jstring label)
{
const char* slabel = env->GetStringUTFChars (label, NULL);
SWFMovie_labelFrame ((SWFMovie)handle, (char*)slabel);
env->ReleaseStringUTFChars (label, slabel);
}
JNIEXPORT void JNICALL Java_SWFMovie_nSave (JNIEnv* env, jobject, jint handle, jstring filename)
{
// should add error checking
const char* sfilename = env->GetStringUTFChars (filename, NULL);
SWFMovie_save ((SWFMovie)handle, (char*)sfilename);
env->ReleaseStringUTFChars (filename, sfilename);
}
JNIEXPORT jbyteArray JNICALL Java_SWFMovie_nOutput (JNIEnv* env, jobject, jint handle)
{
// get output into stream
StringStream mystream;
SWFMovie_output ((SWFMovie)handle, StringStream::hook, (void*)&mystream);
jbyteArray narray = env->NewByteArray (mystream.length());
env->SetByteArrayRegion (narray, 0, mystream.length(), (jbyte*)mystream.getBytes());
return narray;
}
//
// SWFMovieClip Methods
//
JNIEXPORT jint JNICALL Java_SWFMovieClip_nNew (JNIEnv *, jobject)
{
return (jint)newSWFMovieClip();
}
JNIEXPORT void JNICALL Java_SWFMovieClip_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFMovieClip ((SWFMovieClip)handle);
}
JNIEXPORT void JNICALL Java_SWFMovieClip_nSetFrames (JNIEnv *, jobject, jint handle, jint v)
{
SWFMovieClip_setNumberOfFrames ((SWFMovieClip)handle, v);
}
JNIEXPORT jint JNICALL Java_SWFMovieClip_nAdd (JNIEnv *, jobject, jint handle, jint Hobject)
{
return (jint)SWFMovieClip_add ((SWFMovieClip)handle, (SWFBlock)Hobject);
}
JNIEXPORT void JNICALL Java_SWFMovieClip_nRemove (JNIEnv *, jobject, jint handle, jint Hobject)
{
SWFMovieClip_remove ((SWFMovieClip)handle, (SWFBlock)Hobject);
}
JNIEXPORT void JNICALL Java_SWFMovieClip_nNextFrame (JNIEnv *, jobject, jint handle)
{
SWFMovieClip_nextFrame ((SWFMovieClip)handle);
}
JNIEXPORT void JNICALL Java_SWFMovieClip_nLabelFrame (JNIEnv* env, jobject, jint handle, jstring name)
{
const char* sname = env->GetStringUTFChars (name, NULL);
SWFMovieClip_labelFrame ((SWFMovieClip)handle, (char*)sname);
env->ReleaseStringUTFChars (name, sname);
}
//
// SWFMorph Methods
//
JNIEXPORT jint JNICALL Java_SWFMorph_nNew (JNIEnv *, jobject)
{
return (jint)newSWFMorphShape();
}
JNIEXPORT void JNICALL Java_SWFMorph_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFMorph ((SWFMorph)handle);
}
JNIEXPORT jint JNICALL Java_SWFMorph_nGetShape1 (JNIEnv *, jobject, jint handle)
{
return (jint)SWFMorph_getShape1 ((SWFMorph)handle);
}
JNIEXPORT jint JNICALL Java_SWFMorph_nGetShape2 (JNIEnv *, jobject, jint handle)
{
return (jint)SWFMorph_getShape2 ((SWFMorph)handle);
}
//
// SWFFont Methods
//
JNIEXPORT jint JNICALL Java_SWFFont_nNewFileFont (JNIEnv* env, jobject, jstring font)
{
const char* sfont = env->GetStringUTFChars (font, NULL);
FILE* file = fopen (sfont, "rb");
jint obj = (jint)loadSWFFontFromFile (file);
env->ReleaseStringUTFChars (font, sfont);
return obj;
}
JNIEXPORT jint JNICALL Java_SWFFont_nNewBrowserFont (JNIEnv* env, jobject, jstring font)
{
const char* sfont = env->GetStringUTFChars (font, NULL);
jint obj = (jint)newSWFBrowserFont ((char*)sfont);
env->ReleaseStringUTFChars (font, sfont);
return obj;
}
JNIEXPORT void JNICALL Java_SWFFont_nDestroyFileFont (JNIEnv *, jobject, jint handle)
{
destroySWFFont ((SWFFont)handle);
}
JNIEXPORT void JNICALL Java_SWFFont_nDestroyBrowserFont (JNIEnv *, jobject, jint handle)
{
destroySWFBrowserFont ((SWFFont)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFFont_nGetStringWidth (JNIEnv* env, jobject, jint handle, jstring str)
{
const char* sstr = env->GetStringUTFChars (str, NULL);
jfloat w = SWFFont_getStringWidth ((SWFFont)handle, sstr);
env->ReleaseStringUTFChars (str, sstr);
return w;
}
JNIEXPORT jfloat JNICALL Java_SWFFont_nGetAscent (JNIEnv *, jobject, jint handle)
{
return SWFFont_getAscent ((SWFFont)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFFont_nGetDescent (JNIEnv *, jobject, jint handle)
{
return SWFFont_getDescent ((SWFFont)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFFont_nGetLeading (JNIEnv *, jobject, jint handle)
{
return SWFFont_getLeading ((SWFFont)handle);
}
//
// SWFBitmap Methods
//
JNIEXPORT jint JNICALL Java_SWFBitmap_nNewDblBitmap (JNIEnv* env, jobject, jstring filename)
{
const char* sfilename = env->GetStringUTFChars (filename, NULL);
FILE* file = fopen (sfilename, "rb");
jint obj = (jint)newSWFDBLBitmap (file);
env->ReleaseStringUTFChars (filename, sfilename);
return obj;
}
JNIEXPORT jint JNICALL Java_SWFBitmap_nNewJpegBitmap (JNIEnv* env, jobject, jstring filename)
{
const char* sfilename = env->GetStringUTFChars (filename, NULL);
FILE* file = fopen (sfilename, "rb");
jint obj = (jint)newSWFJpegBitmap (file);
env->ReleaseStringUTFChars (filename, sfilename);
return obj;
}
JNIEXPORT jint JNICALL Java_SWFBitmap_nNewDataBitmap (JNIEnv* env, jobject, jbyteArray array)
{
jboolean copy = true;
int len =
env->GetArrayLength(array);
jbyte* data =
env->GetByteArrayElements(array, ©);
// create input for image
SWFInput input =
newSWFInput_allocedBuffer ((unsigned char*)data, len);
// create image
jint obj = (jint)newSWFJpegBitmap_fromInput (input);
return obj;
}
JNIEXPORT jint JNICALL Java_SWFBitmap_nNewJpegWithAlpha (JNIEnv* env, jobject, jstring bitmap, jstring alpha)
{
const char* sbitmap = env->GetStringUTFChars (bitmap, NULL);
const char* salpha = env->GetStringUTFChars (alpha, NULL);
FILE* Bfile = fopen (sbitmap, "rb");
FILE* Afile = fopen (salpha, "rb");
jint obj = (jint)newSWFJpegWithAlpha (Bfile, Afile);
env->ReleaseStringUTFChars (bitmap, sbitmap);
env->ReleaseStringUTFChars (alpha, salpha);
return obj;
}
JNIEXPORT void JNICALL Java_SWFBitmap_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFBitmap ((SWFBitmap)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFBitmap_nGetWidth (JNIEnv *, jobject, jint handle)
{
return SWFBitmap_getWidth ((SWFBitmap)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFBitmap_nGetHeight (JNIEnv *, jobject, jint handle)
{
return SWFBitmap_getHeight ((SWFBitmap)handle);
}
//
// SWFText Methods
//
JNIEXPORT jint JNICALL Java_SWFText_nNew (JNIEnv *, jobject)
{
return (jint)newSWFText2();
}
JNIEXPORT void JNICALL Java_SWFText_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFText ((SWFText)handle);
}
JNIEXPORT void JNICALL Java_SWFText_nSetFont (JNIEnv *, jobject, jint handle, jint Hfont)
{
SWFText_setFont ((SWFText)handle, (SWFFont)Hfont);
}
JNIEXPORT void JNICALL Java_SWFText_nSetColor (JNIEnv *, jobject, jint handle, jint r, jint g, jint b, jint alpha)
{
SWFText_setColor ((SWFText)handle, r,g,b, alpha);
}
JNIEXPORT void JNICALL Java_SWFText_nAddString (JNIEnv* env, jobject, jint handle, jstring text)
{
const char* stext = env->GetStringUTFChars (text, NULL);
SWFText_addString ((SWFText)handle, stext, NULL);
env->ReleaseStringUTFChars (text, stext);
}
JNIEXPORT void JNICALL Java_SWFText_nSetHeight (JNIEnv *, jobject, jint handle, jfloat height)
{
SWFText_setHeight ((SWFText)handle, height);
}
JNIEXPORT void JNICALL Java_SWFText_nSetSpacing (JNIEnv *, jobject, jint handle, jfloat spacing)
{
SWFText_setSpacing ((SWFText)handle, spacing);
}
JNIEXPORT jfloat JNICALL Java_SWFText_nGetAscent (JNIEnv *, jobject, jint handle)
{
return SWFText_getAscent ((SWFText)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFText_nGetDescent (JNIEnv *, jobject, jint handle)
{
return SWFText_getDescent ((SWFText)handle);
}
JNIEXPORT jfloat JNICALL Java_SWFText_nGetLeading (JNIEnv *, jobject, jint handle)
{
return SWFText_getLeading ((SWFText)handle);
}
JNIEXPORT void JNICALL Java_SWFText_nMoveTo (JNIEnv *, jobject, jint handle, jfloat x, jfloat y)
{
SWFText_moveTo ((SWFText)handle, x, y);
}
//
// SWFTextField Methods
//
JNIEXPORT jint JNICALL Java_SWFTextField_nNew (JNIEnv *, jobject)
{
return (jint)newSWFTextField();
}
JNIEXPORT void JNICALL Java_SWFTextField_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFTextField ((SWFTextField)handle);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetFont (JNIEnv *, jobject, jint handle, jint Hfont)
{
SWFTextField_setFont ((SWFTextField)handle, (SWFFont)Hfont);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetColor (JNIEnv *, jobject, jint handle, jint r, jint g, jint b, jint alpha)
{
SWFTextField_setColor ((SWFTextField)handle, r,g,b, alpha);
}
JNIEXPORT void JNICALL Java_SWFTextField_nAddString (JNIEnv* env, jobject, jint handle, jstring text)
{
const char* stext = env->GetStringUTFChars (text, NULL);
SWFTextField_addString ((SWFTextField)handle, (char*)stext);
env->ReleaseStringUTFChars (text, stext);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetBounds (JNIEnv *, jobject, jint handle, jfloat width, jfloat height)
{
SWFTextField_setBounds ((SWFTextField)handle, width, height);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetFlags (JNIEnv *, jobject, jint handle, jlong flags)
{
SWFTextField_setFlags ((SWFTextField)handle, flags);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetAlignment (JNIEnv *, jobject, jint handle, jint align)
{
SWFTextField_setAlignment ((SWFTextField)handle, (SWFTextFieldAlignment)align);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetVariableName (JNIEnv* env, jobject, jint handle, jstring name)
{
const char* sname = env->GetStringUTFChars (name, NULL);
SWFTextField_setVariableName ((SWFTextField)handle, (char*)sname);
env->ReleaseStringUTFChars (name, sname);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetLeftMargin (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFTextField_setLeftMargin ((SWFTextField)handle, v);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetRightMargin (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFTextField_setRightMargin ((SWFTextField)handle, v);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetIndentation (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFTextField_setIndentation ((SWFTextField)handle, v);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetLineSpacing (JNIEnv *, jobject, jint handle, jfloat v)
{
SWFTextField_setLineSpacing ((SWFTextField)handle, v);
}
JNIEXPORT void JNICALL Java_SWFTextField_nSetLength (JNIEnv *, jobject, jint handle, jint len)
{
SWFTextField_setLength ((SWFTextField)handle, len);
}
//
// SWFSound Methods
//
JNIEXPORT jint JNICALL Java_SWFSound_nNew (JNIEnv* env, jobject, jstring filename)
{
const char* sfilename = env->GetStringUTFChars (filename, NULL);
FILE* file = fopen (sfilename, "rb");
jint obj = (jint)newSWFSound (file);
env->ReleaseStringUTFChars (filename, sfilename);
return obj;
}
//
// SWFGradient Methods
//
JNIEXPORT jint JNICALL Java_SWFGradient_nNew (JNIEnv *, jobject)
{
return (jint)newSWFGradient();
}
JNIEXPORT void JNICALL Java_SWFGradient_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFGradient ((SWFGradient)handle);
}
JNIEXPORT void JNICALL Java_SWFGradient_nAddEntry (JNIEnv *, jobject, jint handle, jfloat ratio, jint r, jint g, jint b, jint alpha)
{
SWFGradient_addEntry ((SWFGradient)handle, ratio, r,g,b, alpha);
}
//
// SWFButton Methods
//
JNIEXPORT jint JNICALL Java_SWFButton_nNew (JNIEnv *, jobject)
{
return (jint)newSWFButton();
}
JNIEXPORT void JNICALL Java_SWFButton_nDestroy (JNIEnv *, jobject, jint handle)
{
destroySWFButton ((SWFButton)handle);
}
JNIEXPORT void JNICALL Java_SWFButton_nAddShape (JNIEnv *, jobject, jint handle, jint Hshape, jint flags)
{
SWFButton_addShape ((SWFButton)handle, (SWFBlock)Hshape, flags);
}
JNIEXPORT void JNICALL Java_SWFButton_nAddAction (JNIEnv *, jobject, jint handle, jint Haction, jint flags)
{
SWFButton_addAction ((SWFButton)handle, (SWFAction)Haction, flags);
}
//
// SWFAction Methods
//
JNIEXPORT jint JNICALL Java_SWFAction_nNew (JNIEnv* env, jobject, jstring script)
{
const char* sscript = env->GetStringUTFChars (script, NULL);
jint obj = (jint)compileSWFActionCode ((char*)sscript);
env->ReleaseStringUTFChars (script, sscript);
return obj;
}
|