From be8797be5239085d5d09eec90a926ae8da7a8583 Mon Sep 17 00:00:00 2001 From: magicismight Date: Sun, 24 Sep 2017 23:44:17 +0800 Subject: [PATCH] Add PerformanceBezier as a submodule --- .gitmodules | 4 + ios/PerformanceBezier | 1 + ios/PerformanceBezier/.gitignore | 26 - ios/PerformanceBezier/LICENSE | 319 -------- .../project.pbxproj | 724 ------------------ .../PerformanceBezier/Info.plist | 22 - .../PerformanceBezier/JRSwizzle.h | 13 - .../PerformanceBezier/JRSwizzle.m | 134 ---- .../PerformanceBezier-Info.plist | 5 - .../PerformanceBezier/PerformanceBezier.h | 20 - .../PerformanceBezier/UIBezierPath+Center.h | 17 - .../PerformanceBezier/UIBezierPath+Center.m | 18 - .../UIBezierPath+Clockwise.h | 18 - .../UIBezierPath+Clockwise.m | 50 -- .../UIBezierPath+Description.h | 13 - .../UIBezierPath+Description.m | 57 -- .../PerformanceBezier/UIBezierPath+Equals.h | 18 - .../PerformanceBezier/UIBezierPath+Equals.m | 18 - .../UIBezierPath+FirstLast.h | 21 - .../UIBezierPath+FirstLast.m | 61 -- .../PerformanceBezier/UIBezierPath+NSOSX.h | 54 -- .../PerformanceBezier/UIBezierPath+NSOSX.m | 522 ------------- .../UIBezierPath+NSOSX_Private.h | 29 - .../UIBezierPath+Performance.h | 49 -- .../UIBezierPath+Performance.m | 525 ------------- .../UIBezierPath+Performance_Private.h | 26 - .../PerformanceBezier/UIBezierPath+Trim.h | 35 - .../PerformanceBezier/UIBezierPath+Trim.m | 209 ----- .../PerformanceBezier/UIBezierPath+Trimming.h | 33 - .../PerformanceBezier/UIBezierPath+Trimming.m | 365 --------- .../PerformanceBezier/UIBezierPath+Uncached.h | 17 - .../PerformanceBezier/UIBezierPath+Uncached.m | 23 - .../PerformanceBezier/UIBezierPath+Util.h | 48 -- .../PerformanceBezier/UIBezierPath+Util.m | 316 -------- .../UIBezierPathProperties.h | 25 - .../UIBezierPathProperties.m | 81 -- .../PerformanceBezierTests/Info.plist | 24 - .../PerformanceBezierAbstractTest.h | 23 - .../PerformanceBezierAbstractTest.m | 161 ---- .../PerformanceBezierClockwiseTests.m | 189 ----- ios/PerformanceBezier/README.md | 67 -- ios/PerformanceBezier/SubdivideLicense | 32 - ios/Text/RNSVGTSpan.m | 2 +- package.json | 2 +- 44 files changed, 7 insertions(+), 4409 deletions(-) create mode 160000 ios/PerformanceBezier delete mode 100644 ios/PerformanceBezier/.gitignore delete mode 100644 ios/PerformanceBezier/LICENSE delete mode 100644 ios/PerformanceBezier/PerformanceBezier.xcodeproj/project.pbxproj delete mode 100644 ios/PerformanceBezier/PerformanceBezier/Info.plist delete mode 100644 ios/PerformanceBezier/PerformanceBezier/JRSwizzle.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/JRSwizzle.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/PerformanceBezier-Info.plist delete mode 100644 ios/PerformanceBezier/PerformanceBezier/PerformanceBezier.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX_Private.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance_Private.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.m delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.h delete mode 100644 ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.m delete mode 100644 ios/PerformanceBezier/PerformanceBezierTests/Info.plist delete mode 100644 ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.h delete mode 100644 ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.m delete mode 100644 ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierClockwiseTests.m delete mode 100644 ios/PerformanceBezier/README.md delete mode 100644 ios/PerformanceBezier/SubdivideLicense diff --git a/.gitmodules b/.gitmodules index 3c3d57e0..120d2ae8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,7 @@ [submodule "Example"] path = Example url = https://github.com/magicismight/react-native-svg-example.git + +[submodule "ios/PerformanceBezier"] + path = ios/PerformanceBezier + url = https://github.com/adamwulf/PerformanceBezier.git diff --git a/ios/PerformanceBezier b/ios/PerformanceBezier new file mode 160000 index 00000000..0e0ad4b0 --- /dev/null +++ b/ios/PerformanceBezier @@ -0,0 +1 @@ +Subproject commit 0e0ad4b0303ec80c3c32257addfef9ef6e2a2eb7 diff --git a/ios/PerformanceBezier/.gitignore b/ios/PerformanceBezier/.gitignore deleted file mode 100644 index a3cd143a..00000000 --- a/ios/PerformanceBezier/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate - -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# -# Pods/ diff --git a/ios/PerformanceBezier/LICENSE b/ios/PerformanceBezier/LICENSE deleted file mode 100644 index a7fe54e4..00000000 --- a/ios/PerformanceBezier/LICENSE +++ /dev/null @@ -1,319 +0,0 @@ -Creative Commons Legal Code - -Attribution 3.0 Unported - -CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE -LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN -ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS -INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES -REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR -DAMAGES RESULTING FROM ITS USE. - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE -COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY -COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS -AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE -TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY -BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS -CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND -CONDITIONS. - -1. Definitions - -a. "Adaptation" means a work based upon the Work, or upon the Work and -other pre-existing works, such as a translation, adaptation, -derivative work, arrangement of music or other alterations of a -literary or artistic work, or phonogram or performance and includes -cinematographic adaptations or any other form in which the Work may be -recast, transformed, or adapted including in any form recognizably -derived from the original, except that a work that constitutes a -Collection will not be considered an Adaptation for the purpose of -this License. For the avoidance of doubt, where the Work is a musical -work, performance or phonogram, the synchronization of the Work in -timed-relation with a moving image ("synching") will be considered an -Adaptation for the purpose of this License. -b. "Collection" means a collection of literary or artistic works, such as -encyclopedias and anthologies, or performances, phonograms or -broadcasts, or other works or subject matter other than works listed -in Section 1(f) below, which, by reason of the selection and -arrangement of their contents, constitute intellectual creations, in -which the Work is included in its entirety in unmodified form along -with one or more other contributions, each constituting separate and -independent works in themselves, which together are assembled into a -collective whole. A work that constitutes a Collection will not be -considered an Adaptation (as defined above) for the purposes of this -License. -c. "Distribute" means to make available to the public the original and -copies of the Work or Adaptation, as appropriate, through sale or -other transfer of ownership. -d. "Licensor" means the individual, individuals, entity or entities that -offer(s) the Work under the terms of this License. -e. "Original Author" means, in the case of a literary or artistic work, -the individual, individuals, entity or entities who created the Work -or if no individual or entity can be identified, the publisher; and in -addition (i) in the case of a performance the actors, singers, -musicians, dancers, and other persons who act, sing, deliver, declaim, -play in, interpret or otherwise perform literary or artistic works or -expressions of folklore; (ii) in the case of a phonogram the producer -being the person or legal entity who first fixes the sounds of a -performance or other sounds; and, (iii) in the case of broadcasts, the -organization that transmits the broadcast. -f. "Work" means the literary and/or artistic work offered under the terms -of this License including without limitation any production in the -literary, scientific and artistic domain, whatever may be the mode or -form of its expression including digital form, such as a book, -pamphlet and other writing; a lecture, address, sermon or other work -of the same nature; a dramatic or dramatico-musical work; a -choreographic work or entertainment in dumb show; a musical -composition with or without words; a cinematographic work to which are -assimilated works expressed by a process analogous to cinematography; -a work of drawing, painting, architecture, sculpture, engraving or -lithography; a photographic work to which are assimilated works -expressed by a process analogous to photography; a work of applied -art; an illustration, map, plan, sketch or three-dimensional work -relative to geography, topography, architecture or science; a -performance; a broadcast; a phonogram; a compilation of data to the -extent it is protected as a copyrightable work; or a work performed by -a variety or circus performer to the extent it is not otherwise -considered a literary or artistic work. -g. "You" means an individual or entity exercising rights under this -License who has not previously violated the terms of this License with -respect to the Work, or who has received express permission from the -Licensor to exercise rights under this License despite a previous -violation. -h. "Publicly Perform" means to perform public recitations of the Work and -to communicate to the public those public recitations, by any means or -process, including by wire or wireless means or public digital -performances; to make available to the public Works in such a way that -members of the public may access these Works from a place and at a -place individually chosen by them; to perform the Work to the public -by any means or process and the communication to the public of the -performances of the Work, including by public digital performance; to -broadcast and rebroadcast the Work by any means including signs, -sounds or images. -i. "Reproduce" means to make copies of the Work by any means including -without limitation by sound or visual recordings and the right of -fixation and reproducing fixations of the Work, including storage of a -protected performance or phonogram in digital form or other electronic -medium. - -2. Fair Dealing Rights. Nothing in this License is intended to reduce, -limit, or restrict any uses free from copyright or rights arising from -limitations or exceptions that are provided for in connection with the -copyright protection under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, -Licensor hereby grants You a worldwide, royalty-free, non-exclusive, -perpetual (for the duration of the applicable copyright) license to -exercise the rights in the Work as stated below: - -a. to Reproduce the Work, to incorporate the Work into one or more -Collections, and to Reproduce the Work as incorporated in the -Collections; -b. to create and Reproduce Adaptations provided that any such Adaptation, -including any translation in any medium, takes reasonable steps to -clearly label, demarcate or otherwise identify that changes were made -to the original Work. For example, a translation could be marked "The -original work was translated from English to Spanish," or a -modification could indicate "The original work has been modified."; -c. to Distribute and Publicly Perform the Work including as incorporated -in Collections; and, -d. to Distribute and Publicly Perform Adaptations. -e. For the avoidance of doubt: - -i. Non-waivable Compulsory License Schemes. In those jurisdictions in -which the right to collect royalties through any statutory or -compulsory licensing scheme cannot be waived, the Licensor -reserves the exclusive right to collect such royalties for any -exercise by You of the rights granted under this License; -ii. Waivable Compulsory License Schemes. In those jurisdictions in -which the right to collect royalties through any statutory or -compulsory licensing scheme can be waived, the Licensor waives the -exclusive right to collect such royalties for any exercise by You -of the rights granted under this License; and, -iii. Voluntary License Schemes. The Licensor waives the right to -collect royalties, whether individually or, in the event that the -Licensor is a member of a collecting society that administers -voluntary licensing schemes, via that society, from any exercise -by You of the rights granted under this License. - -The above rights may be exercised in all media and formats whether now -known or hereafter devised. The above rights include the right to make -such modifications as are technically necessary to exercise the rights in -other media and formats. Subject to Section 8(f), all rights not expressly -granted by Licensor are hereby reserved. - -4. Restrictions. The license granted in Section 3 above is expressly made -subject to and limited by the following restrictions: - -a. You may Distribute or Publicly Perform the Work only under the terms -of this License. You must include a copy of, or the Uniform Resource -Identifier (URI) for, this License with every copy of the Work You -Distribute or Publicly Perform. You may not offer or impose any terms -on the Work that restrict the terms of this License or the ability of -the recipient of the Work to exercise the rights granted to that -recipient under the terms of the License. You may not sublicense the -Work. You must keep intact all notices that refer to this License and -to the disclaimer of warranties with every copy of the Work You -Distribute or Publicly Perform. When You Distribute or Publicly -Perform the Work, You may not impose any effective technological -measures on the Work that restrict the ability of a recipient of the -Work from You to exercise the rights granted to that recipient under -the terms of the License. This Section 4(a) applies to the Work as -incorporated in a Collection, but this does not require the Collection -apart from the Work itself to be made subject to the terms of this -License. If You create a Collection, upon notice from any Licensor You -must, to the extent practicable, remove from the Collection any credit -as required by Section 4(b), as requested. If You create an -Adaptation, upon notice from any Licensor You must, to the extent -practicable, remove from the Adaptation any credit as required by -Section 4(b), as requested. -b. If You Distribute, or Publicly Perform the Work or any Adaptations or -Collections, You must, unless a request has been made pursuant to -Section 4(a), keep intact all copyright notices for the Work and -provide, reasonable to the medium or means You are utilizing: (i) the -name of the Original Author (or pseudonym, if applicable) if supplied, -and/or if the Original Author and/or Licensor designate another party -or parties (e.g., a sponsor institute, publishing entity, journal) for -attribution ("Attribution Parties") in Licensor's copyright notice, -terms of service or by other reasonable means, the name of such party -or parties; (ii) the title of the Work if supplied; (iii) to the -extent reasonably practicable, the URI, if any, that Licensor -specifies to be associated with the Work, unless such URI does not -refer to the copyright notice or licensing information for the Work; -and (iv) , consistent with Section 3(b), in the case of an Adaptation, -a credit identifying the use of the Work in the Adaptation (e.g., -"French translation of the Work by Original Author," or "Screenplay -based on original Work by Original Author"). The credit required by -this Section 4 (b) may be implemented in any reasonable manner; -provided, however, that in the case of a Adaptation or Collection, at -a minimum such credit will appear, if a credit for all contributing -authors of the Adaptation or Collection appears, then as part of these -credits and in a manner at least as prominent as the credits for the -other contributing authors. For the avoidance of doubt, You may only -use the credit required by this Section for the purpose of attribution -in the manner set out above and, by exercising Your rights under this -License, You may not implicitly or explicitly assert or imply any -connection with, sponsorship or endorsement by the Original Author, -Licensor and/or Attribution Parties, as appropriate, of You or Your -use of the Work, without the separate, express prior written -permission of the Original Author, Licensor and/or Attribution -Parties. -c. Except as otherwise agreed in writing by the Licensor or as may be -otherwise permitted by applicable law, if You Reproduce, Distribute or -Publicly Perform the Work either by itself or as part of any -Adaptations or Collections, You must not distort, mutilate, modify or -take other derogatory action in relation to the Work which would be -prejudicial to the Original Author's honor or reputation. Licensor -agrees that in those jurisdictions (e.g. Japan), in which any exercise -of the right granted in Section 3(b) of this License (the right to -make Adaptations) would be deemed to be a distortion, mutilation, -modification or other derogatory action prejudicial to the Original -Author's honor and reputation, the Licensor will waive or not assert, -as appropriate, this Section, to the fullest extent permitted by the -applicable national law, to enable You to reasonably exercise Your -right under Section 3(b) of this License (right to make Adaptations) -but not otherwise. - -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR -OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY -KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, -INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, -FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF -LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, -WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION -OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE -LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR -ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES -ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. Termination - -a. This License and the rights granted hereunder will terminate -automatically upon any breach by You of the terms of this License. -Individuals or entities who have received Adaptations or Collections -from You under this License, however, will not have their licenses -terminated provided such individuals or entities remain in full -compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will -survive any termination of this License. -b. Subject to the above terms and conditions, the license granted here is -perpetual (for the duration of the applicable copyright in the Work). -Notwithstanding the above, Licensor reserves the right to release the -Work under different license terms or to stop distributing the Work at -any time; provided, however that any such election will not serve to -withdraw this License (or any other license that has been, or is -required to be, granted under the terms of this License), and this -License will continue in full force and effect unless terminated as -stated above. - -8. Miscellaneous - -a. Each time You Distribute or Publicly Perform the Work or a Collection, -the Licensor offers to the recipient a license to the Work on the same -terms and conditions as the license granted to You under this License. -b. Each time You Distribute or Publicly Perform an Adaptation, Licensor -offers to the recipient a license to the original Work on the same -terms and conditions as the license granted to You under this License. -c. If any provision of this License is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of -the remainder of the terms of this License, and without further action -by the parties to this agreement, such provision shall be reformed to -the minimum extent necessary to make such provision valid and -enforceable. -d. No term or provision of this License shall be deemed waived and no -breach consented to unless such waiver or consent shall be in writing -and signed by the party to be charged with such waiver or consent. -e. This License constitutes the entire agreement between the parties with -respect to the Work licensed here. There are no understandings, -agreements or representations with respect to the Work not specified -here. Licensor shall not be bound by any additional provisions that -may appear in any communication from You. This License may not be -modified without the mutual written agreement of the Licensor and You. -f. The rights granted under, and the subject matter referenced, in this -License were drafted utilizing the terminology of the Berne Convention -for the Protection of Literary and Artistic Works (as amended on -September 28, 1979), the Rome Convention of 1961, the WIPO Copyright -Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 -and the Universal Copyright Convention (as revised on July 24, 1971). -These rights and subject matter take effect in the relevant -jurisdiction in which the License terms are sought to be enforced -according to the corresponding provisions of the implementation of -those treaty provisions in the applicable national law. If the -standard suite of rights granted under applicable copyright law -includes additional rights not granted under this License, such -additional rights are deemed to be included in the License; this -License is not intended to restrict the license of any rights under -applicable law. - - -Creative Commons Notice - -Creative Commons is not a party to this License, and makes no warranty -whatsoever in connection with the Work. Creative Commons will not be -liable to You or any party on any legal theory for any damages -whatsoever, including without limitation any general, special, -incidental or consequential damages arising in connection to this -license. Notwithstanding the foregoing two (2) sentences, if Creative -Commons has expressly identified itself as the Licensor hereunder, it -shall have all rights and obligations of Licensor. - -Except for the limited purpose of indicating to the public that the -Work is licensed under the CCPL, Creative Commons does not authorize -the use by either party of the trademark "Creative Commons" or any -related trademark or logo of Creative Commons without the prior -written consent of Creative Commons. Any permitted use will be in -compliance with Creative Commons' then-current trademark usage -guidelines, as may be published on its website or otherwise made -available upon request from time to time. For the avoidance of doubt, -this trademark restriction does not form part of this License. - -Creative Commons may be contacted at https://creativecommons.org/. \ No newline at end of file diff --git a/ios/PerformanceBezier/PerformanceBezier.xcodeproj/project.pbxproj b/ios/PerformanceBezier/PerformanceBezier.xcodeproj/project.pbxproj deleted file mode 100644 index 1148c484..00000000 --- a/ios/PerformanceBezier/PerformanceBezier.xcodeproj/project.pbxproj +++ /dev/null @@ -1,724 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 6617530D1A8DC45A0051D5CB /* PerformanceBezier.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66F2EBE31A8DC05100D536E9 /* PerformanceBezier.framework */; }; - 66AB566C1B0D9830005E6FB1 /* UIBezierPath+Util.h in Headers */ = {isa = PBXBuildFile; fileRef = 66AB566A1B0D9830005E6FB1 /* UIBezierPath+Util.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66AB566D1B0D9830005E6FB1 /* UIBezierPath+Util.m in Sources */ = {isa = PBXBuildFile; fileRef = 66AB566B1B0D9830005E6FB1 /* UIBezierPath+Util.m */; }; - 66B9D2A61A8D609200CAC341 /* PerformanceBezierAbstractTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 66D4021F1A7EDACA00043802 /* PerformanceBezierAbstractTest.m */; }; - 66B9D2A71A8D609300CAC341 /* PerformanceBezierClockwiseTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 66D4021C1A7EDA9000043802 /* PerformanceBezierClockwiseTests.m */; }; - 66D1B7971AFEAC6F00210262 /* UIBezierPath+Trim.h in Headers */ = {isa = PBXBuildFile; fileRef = 66D1B7951AFEAC6F00210262 /* UIBezierPath+Trim.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66D1B7981AFEAC6F00210262 /* UIBezierPath+Trim.m in Sources */ = {isa = PBXBuildFile; fileRef = 66D1B7961AFEAC6F00210262 /* UIBezierPath+Trim.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 66F2EBE41A8DC05100D536E9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6682FF251A8DBACF00187325 /* Foundation.framework */; }; - 66F2EBF61A8DC12600D536E9 /* UIBezierPath+Center.m in Sources */ = {isa = PBXBuildFile; fileRef = 660E0FD81A80055300F19D8A /* UIBezierPath+Center.m */; }; - 66F2EBF71A8DC12800D536E9 /* UIBezierPath+Clockwise.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617D01A7EB88200C0B447 /* UIBezierPath+Clockwise.m */; }; - 66F2EBF81A8DC13100D536E9 /* UIBezierPath+Equals.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617CC1A7EB86200C0B447 /* UIBezierPath+Equals.m */; }; - 66F2EBF91A8DC13300D536E9 /* UIBezierPath+Description.m in Sources */ = {isa = PBXBuildFile; fileRef = 663355CC1A8575F600C45718 /* UIBezierPath+Description.m */; }; - 66F2EBFA1A8DC13500D536E9 /* UIBezierPath+NSOSX.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617C11A7EB79F00C0B447 /* UIBezierPath+NSOSX.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 66F2EBFB1A8DC13700D536E9 /* UIBezierPath+Performance.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617F61A7EC58700C0B447 /* UIBezierPath+Performance.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 66F2EBFC1A8DC13900D536E9 /* UIBezierPath+Uncached.m in Sources */ = {isa = PBXBuildFile; fileRef = 663355D61A857A2700C45718 /* UIBezierPath+Uncached.m */; }; - 66F2EBFD1A8DC13D00D536E9 /* UIBezierPath+FirstLast.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617FB1A7EC5D400C0B447 /* UIBezierPath+FirstLast.m */; }; - 66F2EBFE1A8DC13F00D536E9 /* UIBezierPathProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617B81A7EB73A00C0B447 /* UIBezierPathProperties.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 66F2EBFF1A8DC14100D536E9 /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 667617D41A7EB9AC00C0B447 /* JRSwizzle.m */; }; - 66F2EC001A8DC15600D536E9 /* UIBezierPath+Uncached.h in Headers */ = {isa = PBXBuildFile; fileRef = 663355D51A857A2700C45718 /* UIBezierPath+Uncached.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC011A8DC15800D536E9 /* UIBezierPath+Performance.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617F41A7EC58700C0B447 /* UIBezierPath+Performance.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC021A8DC15A00D536E9 /* UIBezierPath+NSOSX.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617C01A7EB79F00C0B447 /* UIBezierPath+NSOSX.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC031A8DC15B00D536E9 /* UIBezierPath+Description.h in Headers */ = {isa = PBXBuildFile; fileRef = 663355CB1A8575F600C45718 /* UIBezierPath+Description.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC041A8DC15E00D536E9 /* UIBezierPath+Equals.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617CB1A7EB86200C0B447 /* UIBezierPath+Equals.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC051A8DC16000D536E9 /* UIBezierPath+Clockwise.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617CF1A7EB88200C0B447 /* UIBezierPath+Clockwise.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC061A8DC16100D536E9 /* UIBezierPath+Center.h in Headers */ = {isa = PBXBuildFile; fileRef = 660E0FD71A80055300F19D8A /* UIBezierPath+Center.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC071A8DC16300D536E9 /* UIBezierPath+Performance_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617F51A7EC58700C0B447 /* UIBezierPath+Performance_Private.h */; }; - 66F2EC081A8DC16500D536E9 /* UIBezierPath+NSOSX_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617BF1A7EB79F00C0B447 /* UIBezierPath+NSOSX_Private.h */; }; - 66F2EC091A8DC16600D536E9 /* UIBezierPath+FirstLast.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617FA1A7EC5D400C0B447 /* UIBezierPath+FirstLast.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC0A1A8DC16800D536E9 /* UIBezierPathProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617B71A7EB73A00C0B447 /* UIBezierPathProperties.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC0B1A8DC16900D536E9 /* JRSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617D31A7EB9AC00C0B447 /* JRSwizzle.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC0C1A8DC16B00D536E9 /* PerformanceBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = 667617AF1A7EB5CB00C0B447 /* PerformanceBezier.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 66F2EC0D1A8DC22000D536E9 /* PerformanceBezier-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 66F2EBEA1A8DC05100D536E9 /* PerformanceBezier-Info.plist */; }; - 9494C4A01F4715A000D5BCFD /* UIBezierPath+Trimming.h in Headers */ = {isa = PBXBuildFile; fileRef = 9494C49E1F4715A000D5BCFD /* UIBezierPath+Trimming.h */; }; - 9494C4A11F4715A000D5BCFD /* UIBezierPath+Trimming.m in Sources */ = {isa = PBXBuildFile; fileRef = 9494C49F1F4715A000D5BCFD /* UIBezierPath+Trimming.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 6617530E1A8DC8300051D5CB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 661B30C91A7EB43A008549C7 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 66F2EBE21A8DC05100D536E9; - remoteInfo = PerformanceBezier; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 660E0FD71A80055300F19D8A /* UIBezierPath+Center.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Center.h"; sourceTree = ""; }; - 660E0FD81A80055300F19D8A /* UIBezierPath+Center.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Center.m"; sourceTree = ""; }; - 660E0FDB1A80226100F19D8A /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 660E0FDC1A80284C00F19D8A /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; - 663355CB1A8575F600C45718 /* UIBezierPath+Description.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Description.h"; sourceTree = ""; }; - 663355CC1A8575F600C45718 /* UIBezierPath+Description.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Description.m"; sourceTree = ""; }; - 663355D51A857A2700C45718 /* UIBezierPath+Uncached.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Uncached.h"; sourceTree = ""; }; - 663355D61A857A2700C45718 /* UIBezierPath+Uncached.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Uncached.m"; sourceTree = ""; }; - 667617AF1A7EB5CB00C0B447 /* PerformanceBezier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PerformanceBezier.h; sourceTree = ""; }; - 667617B71A7EB73A00C0B447 /* UIBezierPathProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIBezierPathProperties.h; sourceTree = ""; }; - 667617B81A7EB73A00C0B447 /* UIBezierPathProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIBezierPathProperties.m; sourceTree = ""; }; - 667617BF1A7EB79F00C0B447 /* UIBezierPath+NSOSX_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+NSOSX_Private.h"; sourceTree = ""; }; - 667617C01A7EB79F00C0B447 /* UIBezierPath+NSOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+NSOSX.h"; sourceTree = ""; }; - 667617C11A7EB79F00C0B447 /* UIBezierPath+NSOSX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+NSOSX.m"; sourceTree = ""; }; - 667617CB1A7EB86200C0B447 /* UIBezierPath+Equals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Equals.h"; sourceTree = ""; }; - 667617CC1A7EB86200C0B447 /* UIBezierPath+Equals.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Equals.m"; sourceTree = ""; }; - 667617CF1A7EB88200C0B447 /* UIBezierPath+Clockwise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Clockwise.h"; sourceTree = ""; }; - 667617D01A7EB88200C0B447 /* UIBezierPath+Clockwise.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Clockwise.m"; sourceTree = ""; }; - 667617D31A7EB9AC00C0B447 /* JRSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JRSwizzle.h; sourceTree = ""; }; - 667617D41A7EB9AC00C0B447 /* JRSwizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JRSwizzle.m; sourceTree = ""; }; - 667617F41A7EC58700C0B447 /* UIBezierPath+Performance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Performance.h"; sourceTree = ""; }; - 667617F51A7EC58700C0B447 /* UIBezierPath+Performance_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Performance_Private.h"; sourceTree = ""; }; - 667617F61A7EC58700C0B447 /* UIBezierPath+Performance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Performance.m"; sourceTree = ""; }; - 667617FA1A7EC5D400C0B447 /* UIBezierPath+FirstLast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+FirstLast.h"; sourceTree = ""; }; - 667617FB1A7EC5D400C0B447 /* UIBezierPath+FirstLast.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+FirstLast.m"; sourceTree = ""; }; - 66767CC71AFEE4BB00443B03 /* SubdivideLicense */ = {isa = PBXFileReference; lastKnownFileType = text; path = SubdivideLicense; sourceTree = ""; }; - 6682FF251A8DBACF00187325 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 66AB566A1B0D9830005E6FB1 /* UIBezierPath+Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Util.h"; sourceTree = ""; }; - 66AB566B1B0D9830005E6FB1 /* UIBezierPath+Util.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Util.m"; sourceTree = ""; }; - 66B9D28C1A8D5FDE00CAC341 /* PerformanceBezierTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PerformanceBezierTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 66B9D2921A8D5FDF00CAC341 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 66D1B7951AFEAC6F00210262 /* UIBezierPath+Trim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Trim.h"; sourceTree = ""; }; - 66D1B7961AFEAC6F00210262 /* UIBezierPath+Trim.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Trim.m"; sourceTree = ""; }; - 66D4021C1A7EDA9000043802 /* PerformanceBezierClockwiseTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PerformanceBezierClockwiseTests.m; sourceTree = ""; }; - 66D4021E1A7EDACA00043802 /* PerformanceBezierAbstractTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerformanceBezierAbstractTest.h; sourceTree = ""; }; - 66D4021F1A7EDACA00043802 /* PerformanceBezierAbstractTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PerformanceBezierAbstractTest.m; sourceTree = ""; }; - 66F2EBE31A8DC05100D536E9 /* PerformanceBezier.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework.static; includeInIndex = 0; path = PerformanceBezier.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 66F2EBE71A8DC05100D536E9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 66F2EBEA1A8DC05100D536E9 /* PerformanceBezier-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PerformanceBezier-Info.plist"; sourceTree = ""; }; - 9494C49E1F4715A000D5BCFD /* UIBezierPath+Trimming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBezierPath+Trimming.h"; sourceTree = ""; }; - 9494C49F1F4715A000D5BCFD /* UIBezierPath+Trimming.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIBezierPath+Trimming.m"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 66B9D2891A8D5FDE00CAC341 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6617530D1A8DC45A0051D5CB /* PerformanceBezier.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 66F2EBDE1A8DC05100D536E9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 66F2EBE41A8DC05100D536E9 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 661B30C81A7EB43A008549C7 = { - isa = PBXGroup; - children = ( - 660E0FDB1A80226100F19D8A /* README.md */, - 66767CC71AFEE4BB00443B03 /* SubdivideLicense */, - 660E0FDC1A80284C00F19D8A /* LICENSE */, - 66B9D2831A8D5FDE00CAC341 /* PerformanceBezier */, - 66B9D2901A8D5FDF00CAC341 /* PerformanceBezierTests */, - 66F2EBE51A8DC05100D536E9 /* Supporting Files */, - 6682FF241A8DBACF00187325 /* Frameworks */, - 667617871A7EB50A00C0B447 /* Products */, - ); - sourceTree = ""; - }; - 667617871A7EB50A00C0B447 /* Products */ = { - isa = PBXGroup; - children = ( - 66B9D28C1A8D5FDE00CAC341 /* PerformanceBezierTests.xctest */, - 66F2EBE31A8DC05100D536E9 /* PerformanceBezier.framework */, - ); - name = Products; - sourceTree = ""; - }; - 667617B61A7EB72F00C0B447 /* Categories */ = { - isa = PBXGroup; - children = ( - 9494C49E1F4715A000D5BCFD /* UIBezierPath+Trimming.h */, - 9494C49F1F4715A000D5BCFD /* UIBezierPath+Trimming.m */, - 660E0FD71A80055300F19D8A /* UIBezierPath+Center.h */, - 660E0FD81A80055300F19D8A /* UIBezierPath+Center.m */, - 667617CF1A7EB88200C0B447 /* UIBezierPath+Clockwise.h */, - 667617D01A7EB88200C0B447 /* UIBezierPath+Clockwise.m */, - 667617CB1A7EB86200C0B447 /* UIBezierPath+Equals.h */, - 667617CC1A7EB86200C0B447 /* UIBezierPath+Equals.m */, - 663355CB1A8575F600C45718 /* UIBezierPath+Description.h */, - 663355CC1A8575F600C45718 /* UIBezierPath+Description.m */, - 667617C01A7EB79F00C0B447 /* UIBezierPath+NSOSX.h */, - 667617C11A7EB79F00C0B447 /* UIBezierPath+NSOSX.m */, - 667617F41A7EC58700C0B447 /* UIBezierPath+Performance.h */, - 667617F61A7EC58700C0B447 /* UIBezierPath+Performance.m */, - 66D1B7951AFEAC6F00210262 /* UIBezierPath+Trim.h */, - 66D1B7961AFEAC6F00210262 /* UIBezierPath+Trim.m */, - 663355D51A857A2700C45718 /* UIBezierPath+Uncached.h */, - 663355D61A857A2700C45718 /* UIBezierPath+Uncached.m */, - 66AB566A1B0D9830005E6FB1 /* UIBezierPath+Util.h */, - 66AB566B1B0D9830005E6FB1 /* UIBezierPath+Util.m */, - ); - name = Categories; - sourceTree = ""; - }; - 667617DB1A7EB9B000C0B447 /* Protected */ = { - isa = PBXGroup; - children = ( - 667617D31A7EB9AC00C0B447 /* JRSwizzle.h */, - 667617D41A7EB9AC00C0B447 /* JRSwizzle.m */, - 667617B71A7EB73A00C0B447 /* UIBezierPathProperties.h */, - 667617B81A7EB73A00C0B447 /* UIBezierPathProperties.m */, - 667617FA1A7EC5D400C0B447 /* UIBezierPath+FirstLast.h */, - 667617FB1A7EC5D400C0B447 /* UIBezierPath+FirstLast.m */, - 667617BF1A7EB79F00C0B447 /* UIBezierPath+NSOSX_Private.h */, - 667617F51A7EC58700C0B447 /* UIBezierPath+Performance_Private.h */, - ); - name = Protected; - sourceTree = ""; - }; - 6682FF241A8DBACF00187325 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6682FF251A8DBACF00187325 /* Foundation.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 66B9D2831A8D5FDE00CAC341 /* PerformanceBezier */ = { - isa = PBXGroup; - children = ( - 667617AF1A7EB5CB00C0B447 /* PerformanceBezier.h */, - 667617DB1A7EB9B000C0B447 /* Protected */, - 667617B61A7EB72F00C0B447 /* Categories */, - ); - path = PerformanceBezier; - sourceTree = ""; - }; - 66B9D2901A8D5FDF00CAC341 /* PerformanceBezierTests */ = { - isa = PBXGroup; - children = ( - 66D4021E1A7EDACA00043802 /* PerformanceBezierAbstractTest.h */, - 66D4021F1A7EDACA00043802 /* PerformanceBezierAbstractTest.m */, - 66D4021C1A7EDA9000043802 /* PerformanceBezierClockwiseTests.m */, - 66B9D2911A8D5FDF00CAC341 /* Supporting Files */, - ); - path = PerformanceBezierTests; - sourceTree = ""; - }; - 66B9D2911A8D5FDF00CAC341 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 66B9D2921A8D5FDF00CAC341 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 66F2EBE51A8DC05100D536E9 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 66F2EBEA1A8DC05100D536E9 /* PerformanceBezier-Info.plist */, - 66F2EBE71A8DC05100D536E9 /* Info.plist */, - ); - name = "Supporting Files"; - path = PerformanceBezier; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 66F2EBDF1A8DC05100D536E9 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 66F2EC0C1A8DC16B00D536E9 /* PerformanceBezier.h in Headers */, - 66F2EC001A8DC15600D536E9 /* UIBezierPath+Uncached.h in Headers */, - 66F2EC0B1A8DC16900D536E9 /* JRSwizzle.h in Headers */, - 66F2EC011A8DC15800D536E9 /* UIBezierPath+Performance.h in Headers */, - 66F2EC0A1A8DC16800D536E9 /* UIBezierPathProperties.h in Headers */, - 66F2EC041A8DC15E00D536E9 /* UIBezierPath+Equals.h in Headers */, - 66F2EC061A8DC16100D536E9 /* UIBezierPath+Center.h in Headers */, - 66F2EC091A8DC16600D536E9 /* UIBezierPath+FirstLast.h in Headers */, - 66F2EC051A8DC16000D536E9 /* UIBezierPath+Clockwise.h in Headers */, - 66AB566C1B0D9830005E6FB1 /* UIBezierPath+Util.h in Headers */, - 66D1B7971AFEAC6F00210262 /* UIBezierPath+Trim.h in Headers */, - 9494C4A01F4715A000D5BCFD /* UIBezierPath+Trimming.h in Headers */, - 66F2EC031A8DC15B00D536E9 /* UIBezierPath+Description.h in Headers */, - 66F2EC021A8DC15A00D536E9 /* UIBezierPath+NSOSX.h in Headers */, - 66F2EC071A8DC16300D536E9 /* UIBezierPath+Performance_Private.h in Headers */, - 66F2EC081A8DC16500D536E9 /* UIBezierPath+NSOSX_Private.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 66B9D28B1A8D5FDE00CAC341 /* PerformanceBezierTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 66B9D2961A8D5FDF00CAC341 /* Build configuration list for PBXNativeTarget "PerformanceBezierTests" */; - buildPhases = ( - 66B9D2881A8D5FDE00CAC341 /* Sources */, - 66B9D2891A8D5FDE00CAC341 /* Frameworks */, - 66B9D28A1A8D5FDE00CAC341 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 6617530F1A8DC8300051D5CB /* PBXTargetDependency */, - ); - name = PerformanceBezierTests; - productName = PerformanceBezierTests; - productReference = 66B9D28C1A8D5FDE00CAC341 /* PerformanceBezierTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 66F2EBE21A8DC05100D536E9 /* PerformanceBezier */ = { - isa = PBXNativeTarget; - buildConfigurationList = 66F2EBF01A8DC05100D536E9 /* Build configuration list for PBXNativeTarget "PerformanceBezier" */; - buildPhases = ( - 66F2EBF31A8DC05E00D536E9 /* Prepare Build Script */, - 66F2EBDD1A8DC05100D536E9 /* Sources */, - 66F2EBDE1A8DC05100D536E9 /* Frameworks */, - 66F2EBDF1A8DC05100D536E9 /* Headers */, - 66F2EBE01A8DC05100D536E9 /* Resources */, - 66F2EBF41A8DC0AB00D536E9 /* Process Headers Script */, - 66F2EBF51A8DC0CD00D536E9 /* Build Framework Script */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PerformanceBezier; - productName = PerformanceBezier; - productReference = 66F2EBE31A8DC05100D536E9 /* PerformanceBezier.framework */; - productType = "com.apple.product-type.framework.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 661B30C91A7EB43A008549C7 /* Project object */ = { - isa = PBXProject; - attributes = { - CLASSPREFIX = MM; - LastUpgradeCheck = 0830; - ORGANIZATIONNAME = "Milestone Made"; - TargetAttributes = { - 66B9D28B1A8D5FDE00CAC341 = { - CreatedOnToolsVersion = 6.1.1; - }; - 66F2EBE21A8DC05100D536E9 = { - CreatedOnToolsVersion = 6.1.1; - }; - }; - }; - buildConfigurationList = 661B30CC1A7EB43A008549C7 /* Build configuration list for PBXProject "PerformanceBezier" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 661B30C81A7EB43A008549C7; - productRefGroup = 667617871A7EB50A00C0B447 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 66F2EBE21A8DC05100D536E9 /* PerformanceBezier */, - 66B9D28B1A8D5FDE00CAC341 /* PerformanceBezierTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 66B9D28A1A8D5FDE00CAC341 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 66F2EBE01A8DC05100D536E9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 66F2EC0D1A8DC22000D536E9 /* PerformanceBezier-Info.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 66F2EBF31A8DC05E00D536E9 /* Prepare Build Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Prepare Build Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "set -e\n\nset +u\nif [[ $UFW_MASTER_SCRIPT_RUNNING ]]\nthen\n# Nothing for the slave script to do\nexit 0\nfi\nset -u\n\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]\nthen\nUFW_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho \"Could not find platform name from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]\nthen\nUFW_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$UFW_SDK_PLATFORM\" = \"iphoneos\" ]]\nthen\nUFW_OTHER_PLATFORM=iphonesimulator\nelse\nUFW_OTHER_PLATFORM=iphoneos\nfi\n\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$UFW_SDK_PLATFORM$ ]]\nthen\nUFW_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${UFW_OTHER_PLATFORM}\"\nelse\necho \"Could not find $UFW_SDK_PLATFORM in $BUILT_PRODUCTS_DIR\"\nexit 1\nfi\n\nONLY_ACTIVE_PLATFORM=${ONLY_ACTIVE_PLATFORM:-$ONLY_ACTIVE_ARCH}\n\n# Short-circuit if all binaries are up to date\n\nif [[ -f \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" ]] && \\\n[[ -f \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/${EXECUTABLE_PATH}\" ]] && \\\n[[ ! \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" -nt \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/${EXECUTABLE_PATH}\" ]] && \\\n([[ \"${ONLY_ACTIVE_PLATFORM}\" == \"YES\" ]] || \\\n([[ -f \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" ]] && \\\n[[ -f \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/${EXECUTABLE_PATH}\" ]] && \\\n[[ ! \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" -nt \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/${EXECUTABLE_PATH}\" ]]\n)\n)\nthen\nexit 0\nfi\n\n\n# Clean other platform if needed\n\nif [[ ! -f \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" ]] && [[ \"${ONLY_ACTIVE_PLATFORM}\" != \"YES\" ]]\nthen\necho \"Platform \\\"$UFW_SDK_PLATFORM\\\" was cleaned recently. Cleaning \\\"$UFW_OTHER_PLATFORM\\\" as well\"\necho xcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" CONFIGURATION_TEMP_DIR=\"${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\" clean\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" CONFIGURATION_TEMP_DIR=\"${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\" clean\nfi\n\n\n# Make sure we are building from fresh binaries\n\nrm -rf \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nrm -rf \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework\"\n\nif [[ \"${ONLY_ACTIVE_PLATFORM}\" != \"YES\" ]]\nthen\nrm -rf \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\nrm -rf \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework\"\nfi\n"; - }; - 66F2EBF41A8DC0AB00D536E9 /* Process Headers Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Process Headers Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\nHEADERS_ROOT=$SRCROOT/$PRODUCT_NAME\nFRAMEWORK_HEADERS_DIR=\"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Versions/$FRAMEWORK_VERSION/Headers\"\n\n## only header files expected at this point\nPUBLIC_HEADERS=$(find $FRAMEWORK_HEADERS_DIR/. -not -type d 2> /dev/null | sed -e \"s@.*/@@g\")\n\nFIND_OPTS=\"\"\nfor PUBLIC_HEADER in $PUBLIC_HEADERS; do\nif [ -n \"$FIND_OPTS\" ]; then\nFIND_OPTS=\"$FIND_OPTS -o\"\nfi\nFIND_OPTS=\"$FIND_OPTS -name '$PUBLIC_HEADER'\"\ndone\n\nif [ -n \"$FIND_OPTS\" ]; then\nfor ORIG_HEADER in $(eval \"find $HEADERS_ROOT/. $FIND_OPTS\" 2> /dev/null | sed -e \"s@^$HEADERS_ROOT/./@@g\"); do\nPUBLIC_HEADER=$(basename $ORIG_HEADER)\nRELATIVE_PATH=$(dirname $ORIG_HEADER)\nif [ -e $FRAMEWORK_HEADERS_DIR/$PUBLIC_HEADER ]; then\nmkdir -p \"$FRAMEWORK_HEADERS_DIR/$RELATIVE_PATH\"\nmv \"$FRAMEWORK_HEADERS_DIR/$PUBLIC_HEADER\" \"$FRAMEWORK_HEADERS_DIR/$RELATIVE_PATH/$PUBLIC_HEADER\"\nfi\ndone\nfi\n"; - }; - 66F2EBF51A8DC0CD00D536E9 /* Build Framework Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Build Framework Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\nset -e\n\nset +u\nif [[ $UFW_MASTER_SCRIPT_RUNNING ]]\nthen\n# Nothing for the slave script to do\nexit 0\nfi\nset -u\nexport UFW_MASTER_SCRIPT_RUNNING=1\n\n\n# Functions\n\n## List files in the specified directory, storing to the specified array.\n#\n# @param $1 The path to list\n# @param $2 The name of the array to fill\n#\n##\nlist_files ()\n{\n filelist=$(ls \"$1\")\n while read line\n do\n eval \"$2[\\${#$2[*]}]=\\\"\\$line\\\"\"\n done <<< \"$filelist\"\n}\n\n\n# Sanity check\n\nif [[ ! -f \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" ]]\nthen\necho \"Framework target \\\"${TARGET_NAME}\\\" had no source files to build from. Make sure your source files have the correct target membership\"\nexit 1\nfi\n\necho \"Target Executable: ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\n\n\n# Gather information\n\nif [[ \"$SDK_NAME\" =~ ([A-Za-z]+) ]]\nthen\nUFW_SDK_PLATFORM=${BASH_REMATCH[1]}\nelse\necho \"Could not find platform name from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$SDK_NAME\" =~ ([0-9]+.*$) ]]\nthen\nUFW_SDK_VERSION=${BASH_REMATCH[1]}\nelse\necho \"Could not find sdk version from SDK_NAME: $SDK_NAME\"\nexit 1\nfi\n\nif [[ \"$UFW_SDK_PLATFORM\" = \"iphoneos\" ]]\nthen\nUFW_OTHER_PLATFORM=iphonesimulator\nelse\nUFW_OTHER_PLATFORM=iphoneos\nfi\n\nif [[ \"$BUILT_PRODUCTS_DIR\" =~ (.*)$UFW_SDK_PLATFORM$ ]]\nthen\nUFW_OTHER_BUILT_PRODUCTS_DIR=\"${BASH_REMATCH[1]}${UFW_OTHER_PLATFORM}\"\nelse\necho \"Could not find $UFW_SDK_PLATFORM in $BUILT_PRODUCTS_DIR\"\nexit 1\nfi\n\nONLY_ACTIVE_PLATFORM=${ONLY_ACTIVE_PLATFORM:-$ONLY_ACTIVE_ARCH}\n\n# Short-circuit if all binaries are up to date.\n# We already checked the other platform in the prerun script.\n\nif [[ -f \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\" ]] && [[ -f \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/${PRODUCT_NAME}\" ]] && [[ ! \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\" -nt \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/${PRODUCT_NAME}\" ]]\nthen\nexit 0\nfi\n\nif [ \"${ONLY_ACTIVE_PLATFORM}\" == \"YES\" ]\nthen\necho \"ONLY_ACTIVE_PLATFORM=${ONLY_ACTIVE_PLATFORM}: Skipping other platform build\"\nelse\n# Make sure the other platform gets built\n\necho \"Build other platform\"\n\necho xcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" CONFIGURATION_TEMP_DIR=\"${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\" $ACTION\nxcodebuild -project \"${PROJECT_FILE_PATH}\" -target \"${TARGET_NAME}\" -configuration \"${CONFIGURATION}\" -sdk ${UFW_OTHER_PLATFORM}${UFW_SDK_VERSION} BUILD_DIR=\"${BUILD_DIR}\" CONFIGURATION_TEMP_DIR=\"${PROJECT_TEMP_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\" $ACTION\n\n\n# Build the fat static library binary\n\necho \"Create universal static library\"\n\necho \"$PLATFORM_DEVELOPER_BIN_DIR/libtool\" -static \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" -o \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp\"\n\"$PLATFORM_DEVELOPER_BIN_DIR/libtool\" -static \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" \"${UFW_OTHER_BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" -o \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp\"\n\necho mv \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}\"\nmv \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}.temp\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}\"\nfi\n\n# Move executable to product name location\n\necho \"Moving Executable\"\necho \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\necho \"to\"\necho \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\"\n\nmv \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}\"\n\n# Build embedded framework structure\n\necho \"Build Embedded Framework\"\n\necho rm -rf \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework\"\nrm -rf \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework\"\necho mkdir -p \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/Resources\"\nmkdir -p \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/Resources\"\necho cp -a \"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/\"\ncp -a \"${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/\"\n\ndeclare -a UFW_FILE_LIST\nlist_files \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\" UFW_FILE_LIST\nfor filename in \"${UFW_FILE_LIST[@]}\"\ndo\nif [[ \"${filename}\" != \"Info.plist\" ]] && [[ ! \"${filename}\" =~ .*\\.lproj$ ]]\nthen\necho ln -sfh \"../${WRAPPER_NAME}/Resources/${filename}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/Resources/${filename}\"\nln -sfh \"../${WRAPPER_NAME}/Resources/${filename}\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.embeddedframework/Resources/${filename}\"\nfi\ndone\n\n\nif [ \"${ONLY_ACTIVE_PLATFORM}\" != \"YES\" ]\nthen\n# Replace other platform's framework with a copy of this one (so that both have the same universal binary)\n\necho \"Copy from $UFW_SDK_PLATFORM to $UFW_OTHER_PLATFORM\"\n\necho rm -rf \"${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\"\nrm -rf \"${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\"\necho cp -a \"${BUILD_DIR}/${CONFIGURATION}-${UFW_SDK_PLATFORM}\" \"${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\"\ncp -a \"${BUILD_DIR}/${CONFIGURATION}-${UFW_SDK_PLATFORM}\" \"${BUILD_DIR}/${CONFIGURATION}-${UFW_OTHER_PLATFORM}\"\nfi\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 66B9D2881A8D5FDE00CAC341 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 66B9D2A61A8D609200CAC341 /* PerformanceBezierAbstractTest.m in Sources */, - 66B9D2A71A8D609300CAC341 /* PerformanceBezierClockwiseTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 66F2EBDD1A8DC05100D536E9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 66F2EBF61A8DC12600D536E9 /* UIBezierPath+Center.m in Sources */, - 66F2EBF71A8DC12800D536E9 /* UIBezierPath+Clockwise.m in Sources */, - 66F2EBFD1A8DC13D00D536E9 /* UIBezierPath+FirstLast.m in Sources */, - 66F2EBFC1A8DC13900D536E9 /* UIBezierPath+Uncached.m in Sources */, - 66F2EBFF1A8DC14100D536E9 /* JRSwizzle.m in Sources */, - 66F2EBFB1A8DC13700D536E9 /* UIBezierPath+Performance.m in Sources */, - 66F2EBFE1A8DC13F00D536E9 /* UIBezierPathProperties.m in Sources */, - 66AB566D1B0D9830005E6FB1 /* UIBezierPath+Util.m in Sources */, - 66F2EBF91A8DC13300D536E9 /* UIBezierPath+Description.m in Sources */, - 66F2EBFA1A8DC13500D536E9 /* UIBezierPath+NSOSX.m in Sources */, - 66F2EBF81A8DC13100D536E9 /* UIBezierPath+Equals.m in Sources */, - 9494C4A11F4715A000D5BCFD /* UIBezierPath+Trimming.m in Sources */, - 66D1B7981AFEAC6F00210262 /* UIBezierPath+Trim.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 6617530F1A8DC8300051D5CB /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 66F2EBE21A8DC05100D536E9 /* PerformanceBezier */; - targetProxy = 6617530E1A8DC8300051D5CB /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 661B30CD1A7EB43A008549C7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - STRIP_INSTALLED_PRODUCT = NO; - STRIP_STYLE = "non-global"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 661B30CE1A7EB43A008549C7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - SDKROOT = iphoneos; - STRIP_INSTALLED_PRODUCT = NO; - STRIP_STYLE = "non-global"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 66B9D2971A8D5FDF00CAC341 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(BUILT_PRODUCTS_DIR)/**", - ); - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = PerformanceBezierTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC++", - "-lstdc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.milestonemade.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 66B9D2981A8D5FDF00CAC341 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(BUILT_PRODUCTS_DIR)/**", - ); - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = PerformanceBezierTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.1; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC++", - "-lstdc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.milestonemade.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 66F2EBF11A8DC05100D536E9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_VERSION = A; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = PerformanceBezier/Info.plist; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_PLATFORM = YES; - OTHER_LDFLAGS = "-ObjC++"; - PRODUCT_BUNDLE_IDENTIFIER = "com.milestonemade.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 66F2EBF21A8DC05100D536E9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_VERSION = A; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = PerformanceBezier/Info.plist; - MTL_ENABLE_DEBUG_INFO = NO; - ONLY_ACTIVE_PLATFORM = YES; - OTHER_LDFLAGS = "-ObjC++"; - PRODUCT_BUNDLE_IDENTIFIER = "com.milestonemade.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 661B30CC1A7EB43A008549C7 /* Build configuration list for PBXProject "PerformanceBezier" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 661B30CD1A7EB43A008549C7 /* Debug */, - 661B30CE1A7EB43A008549C7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 66B9D2961A8D5FDF00CAC341 /* Build configuration list for PBXNativeTarget "PerformanceBezierTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 66B9D2971A8D5FDF00CAC341 /* Debug */, - 66B9D2981A8D5FDF00CAC341 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 66F2EBF01A8DC05100D536E9 /* Build configuration list for PBXNativeTarget "PerformanceBezier" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 66F2EBF11A8DC05100D536E9 /* Debug */, - 66F2EBF21A8DC05100D536E9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 661B30C91A7EB43A008549C7 /* Project object */; -} diff --git a/ios/PerformanceBezier/PerformanceBezier/Info.plist b/ios/PerformanceBezier/PerformanceBezier/Info.plist deleted file mode 100644 index 2c15fb5c..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/ios/PerformanceBezier/PerformanceBezier/JRSwizzle.h b/ios/PerformanceBezier/PerformanceBezier/JRSwizzle.h deleted file mode 100644 index 7d29bc2e..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/JRSwizzle.h +++ /dev/null @@ -1,13 +0,0 @@ -// JRSwizzle.h semver:1.0 -// Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com -// Some rights reserved: http://opensource.org/licenses/MIT -// https://github.com/rentzsch/jrswizzle - -#import - -@interface NSObject (JRSwizzle) - -+ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_; -+ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/JRSwizzle.m b/ios/PerformanceBezier/PerformanceBezier/JRSwizzle.m deleted file mode 100644 index 4e582bf5..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/JRSwizzle.m +++ /dev/null @@ -1,134 +0,0 @@ -// JRSwizzle.m semver:1.0 -// Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com -// Some rights reserved: http://opensource.org/licenses/MIT -// https://github.com/rentzsch/jrswizzle - -#import "JRSwizzle.h" - -#if TARGET_OS_IPHONE - #import - #import -#else - #import -#endif - -#define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \ - if (ERROR_VAR) { \ - NSString *errStr = [NSString stringWithFormat:@"%s: " FORMAT,FUNC,##__VA_ARGS__]; \ - *ERROR_VAR = [NSError errorWithDomain:@"NSCocoaErrorDomain" \ - code:-1 \ - userInfo:[NSDictionary dictionaryWithObject:errStr forKey:NSLocalizedDescriptionKey]]; \ - } -#define SetNSError(ERROR_VAR, FORMAT,...) SetNSErrorFor(__func__, ERROR_VAR, FORMAT, ##__VA_ARGS__) - -#if OBJC_API_VERSION >= 2 -#define GetClass(obj) object_getClass(obj) -#else -#define GetClass(obj) (obj ? obj->isa : Nil) -#endif - -@implementation NSObject (JRSwizzle) - -+ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_ { -#if OBJC_API_VERSION >= 2 - Method origMethod = class_getInstanceMethod(self, origSel_); - if (!origMethod) { -#if TARGET_OS_IPHONE - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); -#else - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); -#endif - return NO; - } - - Method altMethod = class_getInstanceMethod(self, altSel_); - if (!altMethod) { -#if TARGET_OS_IPHONE - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); -#else - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); -#endif - return NO; - } - - class_addMethod(self, - origSel_, - class_getMethodImplementation(self, origSel_), - method_getTypeEncoding(origMethod)); - class_addMethod(self, - altSel_, - class_getMethodImplementation(self, altSel_), - method_getTypeEncoding(altMethod)); - - method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); - return YES; -#else - // Scan for non-inherited methods. - Method directOriginalMethod = NULL, directAlternateMethod = NULL; - - void *iterator = NULL; - struct objc_method_list *mlist = class_nextMethodList(self, &iterator); - while (mlist) { - int method_index = 0; - for (; method_index < mlist->method_count; method_index++) { - if (mlist->method_list[method_index].method_name == origSel_) { - assert(!directOriginalMethod); - directOriginalMethod = &mlist->method_list[method_index]; - } - if (mlist->method_list[method_index].method_name == altSel_) { - assert(!directAlternateMethod); - directAlternateMethod = &mlist->method_list[method_index]; - } - } - mlist = class_nextMethodList(self, &iterator); - } - - // If either method is inherited, copy it up to the target class to make it non-inherited. - if (!directOriginalMethod || !directAlternateMethod) { - Method inheritedOriginalMethod = NULL, inheritedAlternateMethod = NULL; - if (!directOriginalMethod) { - inheritedOriginalMethod = class_getInstanceMethod(self, origSel_); - if (!inheritedOriginalMethod) { - SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); - return NO; - } - } - if (!directAlternateMethod) { - inheritedAlternateMethod = class_getInstanceMethod(self, altSel_); - if (!inheritedAlternateMethod) { - SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); - return NO; - } - } - - int hoisted_method_count = !directOriginalMethod && !directAlternateMethod ? 2 : 1; - struct objc_method_list *hoisted_method_list = malloc(sizeof(struct objc_method_list) + (sizeof(struct objc_method)*(hoisted_method_count-1))); - hoisted_method_list->obsolete = NULL; // soothe valgrind - apparently ObjC runtime accesses this value and it shows as uninitialized in valgrind - hoisted_method_list->method_count = hoisted_method_count; - Method hoisted_method = hoisted_method_list->method_list; - - if (!directOriginalMethod) { - bcopy(inheritedOriginalMethod, hoisted_method, sizeof(struct objc_method)); - directOriginalMethod = hoisted_method++; - } - if (!directAlternateMethod) { - bcopy(inheritedAlternateMethod, hoisted_method, sizeof(struct objc_method)); - directAlternateMethod = hoisted_method; - } - class_addMethods(self, hoisted_method_list); - } - - // Swizzle. - IMP temp = directOriginalMethod->method_imp; - directOriginalMethod->method_imp = directAlternateMethod->method_imp; - directAlternateMethod->method_imp = temp; - - return YES; -#endif -} - -+ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_ { - return [GetClass((id)self) jr_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; -} - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/PerformanceBezier-Info.plist b/ios/PerformanceBezier/PerformanceBezier/PerformanceBezier-Info.plist deleted file mode 100644 index c03188bc..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/PerformanceBezier-Info.plist +++ /dev/null @@ -1,5 +0,0 @@ - - - -CFBundleDevelopmentRegion - diff --git a/ios/PerformanceBezier/PerformanceBezier/PerformanceBezier.h b/ios/PerformanceBezier/PerformanceBezier/PerformanceBezier.h deleted file mode 100644 index aa2986e4..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/PerformanceBezier.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// PerformanceBezier.h -// PerformanceBezier -// -// Created by Adam Wulf on 2/1/15. -// Copyright (c) 2015 Milestone Made, LLC. All rights reserved. -// - -#define CGPointNotFound CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX) - -#import -#import "UIBezierPathProperties.h" -#import "UIBezierPath+Clockwise.h" -#import "UIBezierPath+Performance.h" -#import "UIBezierPath+NSOSX.h" -#import "UIBezierPath+Equals.h" -#import "UIBezierPath+Center.h" -#import "UIBezierPath+Trim.h" -#import "UIBezierPath+Util.h" -#import "UIBezierPath+Trimming.h" diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.h deleted file mode 100644 index fc40810a..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIBezierPath+Center.h -// ios-hand-shadows -// -// Created by Adam Wulf on 2/2/15. -// Copyright (c) 2015 Milestone Made. All rights reserved. -// - -#import - -@interface UIBezierPath (Center) - -// returns a point in the center of -// the path's bounds --(CGPoint) center; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.m deleted file mode 100644 index 6273ccd1..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Center.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// UIBezierPath+Center.m -// ios-hand-shadows -// -// Created by Adam Wulf on 2/2/15. -// Copyright (c) 2015 Milestone Made. All rights reserved. -// - -#import "UIBezierPath+Center.h" - -@implementation UIBezierPath (Center) - - --(CGPoint) center{ - return CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); -} - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.h deleted file mode 100644 index 146377de..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// UIBezierPath+Clockwise.h -// PerformanceBezier -// -// Created by Adam Wulf on 1/7/14. -// Copyright (c) 2014 Milestone Made, LLC. All rights reserved. -// - -#import - -@interface UIBezierPath (Clockwise) - -// -// returns YES if the path elements curve -// around in clockwise direction --(BOOL) isClockwise; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.m deleted file mode 100644 index 18e34c84..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Clockwise.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// UIBezierPath+Clockwise.m -// PerformanceBezier -// -// Created by Adam Wulf on 1/7/14. -// Copyright (c) 2014 Milestone Made, LLC. All rights reserved. -// - -#import "UIBezierPath+Clockwise.h" -#import "PerformanceBezier.h" - -@implementation UIBezierPath (Clockwise) - --(BOOL) isClockwise{ - - __block CGPoint lastMoveTo = CGPointZero; - __block CGPoint lastPoint = CGPointZero; - __block CGFloat sum = 0; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger idx){ - if(element.type == kCGPathElementMoveToPoint){ - lastMoveTo = element.points[0]; - lastPoint = lastMoveTo; - }else if(element.type == kCGPathElementAddLineToPoint){ - sum += [self calculateAreaFor:element.points[0] andPoint:lastPoint]; - lastPoint = element.points[0]; - }else if(element.type == kCGPathElementAddQuadCurveToPoint){ - sum += [self calculateAreaFor:element.points[0] andPoint:lastPoint]; - sum += [self calculateAreaFor:element.points[1] andPoint:element.points[0]]; - lastPoint = element.points[1]; - }else if(element.type == kCGPathElementAddCurveToPoint){ - sum += [self calculateAreaFor:element.points[0] andPoint:lastPoint]; - sum += [self calculateAreaFor:element.points[1] andPoint:element.points[0]]; - sum += [self calculateAreaFor:element.points[2] andPoint:element.points[1]]; - lastPoint = element.points[2]; - }else if(element.type == kCGPathElementCloseSubpath){ - sum += [self calculateAreaFor:lastMoveTo andPoint:lastPoint]; - lastPoint = element.points[0]; - lastPoint = lastMoveTo; - } - }]; - return sum >= 0; -} - - -- (CGFloat) calculateAreaFor:(CGPoint)point1 andPoint:(CGPoint)point2{ - return (point2.x - point1.x) * (point2.y + point1.y); -} - - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.h deleted file mode 100644 index b125ce4d..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// UIBezierPath+Description.h -// LooseLeaf -// -// Created by Adam Wulf on 12/17/13. -// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. -// - -#import - -@interface UIBezierPath (Description) - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.m deleted file mode 100644 index 371c61f4..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Description.m +++ /dev/null @@ -1,57 +0,0 @@ -// -// UIBezierPath+Description.m -// LooseLeaf -// -// Created by Adam Wulf on 12/17/13. -// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. -// - -#import "UIBezierPath+Description.h" -#import "UIBezierPath+NSOSX.h" -#import "JRSwizzle.h" - -@implementation UIBezierPath (Description) - - -// -// create a human readable objective-c string for -// the path. this lets a dev easily print out the bezier -// from the debugger, and copy the result directly back into -// code. Perfect for printing out runtime generated beziers -// for use later in tests. --(NSString*) swizzle_description{ - __block NSString* str = @"path = [UIBezierPath bezierPath];\n"; - [self iteratePathWithBlock:^(CGPathElement ele, NSUInteger idx){ - if(ele.type == kCGPathElementAddCurveToPoint){ - CGPoint curveTo = ele.points[2]; - CGPoint ctrl1 = ele.points[0]; - CGPoint ctrl2 = ele.points[1]; - str = [str stringByAppendingFormat:@"[path addCurveToPoint:CGPointMake(%f, %f) controlPoint1:CGPointMake(%f, %f) controlPoint2:CGPointMake(%f, %f)];\n", curveTo.x, curveTo.y, ctrl1.x, ctrl1.y, ctrl2.x, ctrl2.y]; - }else if(ele.type == kCGPathElementAddLineToPoint){ - CGPoint lineTo = ele.points[0]; - str = [str stringByAppendingFormat:@"[path addLineToPoint:CGPointMake(%f, %f)];\n", lineTo.x, lineTo.y]; - }else if(ele.type == kCGPathElementAddQuadCurveToPoint){ - CGPoint curveTo = ele.points[2]; - CGPoint ctrl = ele.points[0]; - str = [str stringByAppendingFormat:@"[path addQuadCurveToPoint:CGPointMake(%f, %f) controlPoint:CGPointMake(%f, %f)];\n", curveTo.x, curveTo.y, ctrl.x, ctrl.y]; - }else if(ele.type == kCGPathElementCloseSubpath){ - [self closePath]; - str = [str stringByAppendingString:@"[path closePath];\n"]; - }else if(ele.type == kCGPathElementMoveToPoint){ - CGPoint moveTo = ele.points[0]; - str = [str stringByAppendingFormat:@"[path moveToPoint:CGPointMake(%f, %f)];\n", moveTo.x, moveTo.y]; - } - }]; - return str; -} - - -+(void)load{ - @autoreleasepool { - NSError *error = nil; - [UIBezierPath jr_swizzleMethod:@selector(description) - withMethod:@selector(swizzle_description) - error:&error]; - } -} -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.h deleted file mode 100644 index 7b052d98..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// UIBezierPath+Equals.h -// LooseLeaf -// -// Created by Adam Wulf on 6/3/14. -// Copyright (c) 2014 Milestone Made, LLC. All rights reserved. -// - -#import - -@interface UIBezierPath (Equals) - -// returns YES if the input path is equal -// to the current path. convenience wrapper -// around CGPathEqualToPath --(BOOL) isEqualToBezierPath:(UIBezierPath*)path; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.m deleted file mode 100644 index 8649e471..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Equals.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// UIBezierPath+Debug.m -// LooseLeaf -// -// Created by Adam Wulf on 6/3/14. -// Copyright (c) 2014 Milestone Made, LLC. All rights reserved. -// - -#import "UIBezierPath+Equals.h" -#import "PerformanceBezier.h" - -@implementation UIBezierPath (Equals) - --(BOOL) isEqualToBezierPath:(UIBezierPath*)path{ - return CGPathEqualToPath(self.CGPath, path.CGPath); -} - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.h deleted file mode 100644 index 14e2bc8f..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// UIBezierPath+FirstLast.h -// iOS-UIBezierPath-Performance -// -// Created by Adam Wulf on 2/1/15. -// -// - -#import - -@interface UIBezierPath (FirstLast) - -// calculates the first point of the path, -// useful if its not already cached --(CGPoint) lastPointCalculated; - -// calculates the last point of the path, -// useful if its not already cached --(CGPoint) firstPointCalculated; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.m deleted file mode 100644 index 89c98cea..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+FirstLast.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// UIBezierPath+FirstLast.m -// iOS-UIBezierPath-Performance -// -// Created by Adam Wulf on 2/1/15. -// -// - -#import "UIBezierPath+FirstLast.h" -#import "UIBezierPath+NSOSX.h" - -@implementation UIBezierPath (FirstLast) - --(CGPoint) lastPointCalculated{ - __block CGPoint firstPoint = CGPointZero; - __block CGPoint lastPoint = CGPointZero; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger idx) { - CGPoint currPoint = CGPointZero; - if(element.type == kCGPathElementMoveToPoint){ - currPoint = element.points[0]; - firstPoint = currPoint; - }else if(element.type == kCGPathElementAddLineToPoint){ - currPoint = element.points[0]; - }else if(element.type == kCGPathElementCloseSubpath){ - currPoint = firstPoint; - }else if(element.type == kCGPathElementAddCurveToPoint){ - currPoint = element.points[2]; - }else if(element.type == kCGPathElementAddQuadCurveToPoint){ - currPoint = element.points[1]; - } - if(idx == 0){ - // path should've begun with a moveTo, - // but this is a sanity check for malformed - // paths - firstPoint = currPoint; - } - lastPoint = currPoint; - }]; - return lastPoint; -} - --(CGPoint) firstPointCalculated{ - __block CGPoint firstPoint = CGPointZero; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger idx) { - if(idx == 0){ - if(element.type == kCGPathElementMoveToPoint || - element.type == kCGPathElementAddLineToPoint){ - firstPoint = element.points[0]; - }else if(element.type == kCGPathElementCloseSubpath){ - firstPoint = firstPoint; - }else if(element.type == kCGPathElementAddCurveToPoint){ - firstPoint = element.points[2]; - }else if(element.type == kCGPathElementAddQuadCurveToPoint){ - firstPoint = element.points[1]; - } - } - }]; - return firstPoint; -} - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.h deleted file mode 100644 index 53732baa..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// UIBezierPath+NSOSX.h -// PaintingSample -// -// Created by Adam Wulf on 10/5/12. -// -// - -#import - -@interface UIBezierPath (NSOSX) - -// A flattened version of the path object. -@property(nonatomic,readonly) UIBezierPath* bezierPathByFlatteningPath; -// returns the number of elements in this path -@property(nonatomic,readonly) NSInteger elementCount; -// YES if the path is made without curves, NO otherwise -@property(nonatomic,assign) BOOL isFlat; - --(UIBezierPath*) bezierPathByFlatteningPathAndImmutable:(BOOL)returnCopy; - -// returns the element at the given index, and also -// fills the points[] array with the element's points. -// the points property of the CGPathElement is owned by -// the internal cache, so if you need the points, you should -// retrieve them through the points parameter. -- (CGPathElement)elementAtIndex:(NSInteger)index associatedPoints:(CGPoint[])points; - -// returns the element at the given index. If you also need -// access to the element's points, then use the method above. -- (CGPathElement)elementAtIndex:(NSInteger)index; - -// modifies the element at the index to have the input -// points associated with it. This allows modifying the -// path in place -- (void)setAssociatedPoints:(CGPoint[])points atIndex:(NSInteger)index; - -// returns the bounds of the path including its control points --(CGRect) controlPointBounds; - -// iterate over each element in the path with the input block --(void) iteratePathWithBlock:(void (^)(CGPathElement element,NSUInteger idx))block; - -// helper method to return the number of points for any input element -// based on its type. ie, an element of type -// kCGPathElementAddCurveToPoint returns 3 -+(NSInteger) numberOfPointsForElement:(CGPathElement)element; - -// helper method to copy a path element to a new element. -// Note: you are responsible for calling free(yourElement.points) -// when you are done with its return value. -+(CGPathElement*) copyCGPathElement:(CGPathElement*)element; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.m deleted file mode 100644 index 320dffb7..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX.m +++ /dev/null @@ -1,522 +0,0 @@ -// -// UIBezierPath+NSOSX.m -// PaintingSample -// -// Created by Adam Wulf on 10/5/12. -// -// - -#import "UIBezierPath+NSOSX.h" -#import -#import "JRSwizzle.h" -#import "UIBezierPath+NSOSX_Private.h" -#import "UIBezierPath+Performance_Private.h" -#import "UIBezierPath+Performance.h" -#import "UIBezierPath+Uncached.h" -#import "UIBezierPath+Util.h" - - -static char ELEMENT_ARRAY; -static CGFloat idealFlatness = .01; - -@implementation UIBezierPath (NSOSX) - - -#pragma mark - Properties - -/** - * this is a property on the category, as described in: - * https://github.com/techpaa/iProperties - * - * - * this array is for private PerformanceBezier use only - * - * Since iOS doesn't allow for index lookup of CGPath elements (only option is CGPathApply) - * this array will cache the elements after they've been looked up once - */ --(void) freeCurrentElementCacheArray{ - NSMutableArray* currentArray = objc_getAssociatedObject(self, &ELEMENT_ARRAY); - if([currentArray count]){ - while([currentArray count]){ - NSValue* val = [currentArray lastObject]; - CGPathElement* element = [val pointerValue]; - free(element->points); - free(element); - [currentArray removeLastObject]; - } - } - objc_setAssociatedObject(self, &ELEMENT_ARRAY, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} --(void)setElementCacheArray:(NSMutableArray *)_elementCacheArray{ - [self freeCurrentElementCacheArray]; - NSMutableArray* newArray = [NSMutableArray array]; - for(NSValue* val in _elementCacheArray){ - CGPathElement* element = [val pointerValue]; - CGPathElement* copiedElement = [UIBezierPath copyCGPathElement:element]; - [newArray addObject:[NSValue valueWithPointer:copiedElement]]; - } - objc_setAssociatedObject(self, &ELEMENT_ARRAY, newArray, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} --(NSMutableArray*)elementCacheArray{ - NSMutableArray* ret = objc_getAssociatedObject(self, &ELEMENT_ARRAY); - if(!ret){ - ret = [NSMutableArray array]; - self.elementCacheArray = ret; - } - return ret; -} - - - -#pragma mark - UIBezierPath - -/** - * returns the CGPathElement at the specified index, optionally - * also returning the elements points in the 2nd parameter - * - * this method is meant to mimic UIBezierPath's method of the same name - */ -- (CGPathElement)elementAtIndex:(NSInteger)askingForIndex associatedPoints:(CGPoint[])points{ - __block BOOL didReturn = NO; - __block CGPathElement returnVal; - if(askingForIndex < [self.elementCacheArray count]){ - returnVal = *(CGPathElement*)[[self.elementCacheArray objectAtIndex:askingForIndex] pointerValue]; -#ifdef MMPreventBezierPerformance - [self simulateNoBezierCaching]; -#endif - }else{ - __block UIBezierPath* this = self; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger currentIndex){ - int numberInCache = (int) [this.elementCacheArray count]; - if(!didReturn || currentIndex == [this.elementCacheArray count]){ - if(currentIndex == numberInCache){ - [this.elementCacheArray addObject:[NSValue valueWithPointer:[UIBezierPath copyCGPathElement:&element]]]; - } - if(currentIndex == askingForIndex){ - returnVal = *(CGPathElement*)[[this.elementCacheArray objectAtIndex:askingForIndex] pointerValue]; - didReturn = YES; - } - } - }]; - } - - if(points){ - for(int i=0;i<[UIBezierPath numberOfPointsForElement:returnVal];i++){ - points[i] = returnVal.points[i]; - } - } - return returnVal; -} - - -/** - * returns the CGPathElement at the specified index - * - * this method is meant to mimic UIBezierPath's method of the same name - */ -- (CGPathElement)elementAtIndex:(NSInteger)index{ - return [self elementAtIndex:index associatedPoints:NULL]; -} - - -/** - * updates the point in the path with the new input points - * - * TODO: this method is entirely untested - */ -- (void)setAssociatedPoints:(CGPoint[])points atIndex:(NSInteger)index{ - NSMutableDictionary* params = [NSMutableDictionary dictionary]; - [params setObject:[NSNumber numberWithInteger:index] forKey:@"index"]; - [params setObject:[NSValue valueWithPointer:points] forKey:@"points"]; - CGPathApply(self.CGPath, params, updatePathElementAtIndex); - -} -// -// helper function for the setAssociatedPoints: method -void updatePathElementAtIndex(void* info, const CGPathElement* element) { - NSMutableDictionary* params = (NSMutableDictionary*)info; - int currentIndex = 0; - if([params objectForKey:@"curr"]){ - currentIndex = [[params objectForKey:@"curr"] intValue] + 1; - } - if(currentIndex == [[params objectForKey:@"index"] intValue]){ - CGPoint* points = [[params objectForKey:@"points"] pointerValue]; - for(int i=0;i<[UIBezierPath numberOfPointsForElement:*element];i++){ - element->points[i] = points[i]; - } - CGPathElement* returnVal = [UIBezierPath copyCGPathElement:(CGPathElement*)element]; - [params setObject:[NSValue valueWithPointer:returnVal] forKey:@"element"]; - } - [params setObject:[NSNumber numberWithInt:currentIndex] forKey:@"curr"]; -} - -/** - * Returns the bounding box containing all points in a graphics path. - * The bounding box is the smallest rectangle completely enclosing - * all points in the path, including control points for Bézier and - * quadratic curves. - * - * this method is meant to mimic UIBezierPath's method of the same name - */ --(CGRect) controlPointBounds{ - return CGPathGetBoundingBox(self.CGPath); -} - - -- (NSInteger)elementCount{ - UIBezierPathProperties* props = [self pathProperties]; - if(props.cachedElementCount){ -#ifdef MMPreventBezierPerformance - [self simulateNoBezierCaching]; -#endif - return props.cachedElementCount; - } - NSMutableDictionary* params = [NSMutableDictionary dictionary]; - [params setObject:[NSNumber numberWithInteger:0] forKey:@"count"]; - [params setObject:self forKey:@"self"]; - [self retain]; - CGPathApply(self.CGPath, params, countPathElement); - [self release]; - NSInteger ret = [[params objectForKey:@"count"] integerValue]; - props.cachedElementCount = ret; - return ret; -} -// helper function -void countPathElement(void* info, const CGPathElement* element) { - NSMutableDictionary* params = (NSMutableDictionary*) info; - UIBezierPath* this = [params objectForKey:@"self"]; - NSInteger count = [[params objectForKey:@"count"] integerValue]; - [params setObject:[NSNumber numberWithInteger:(count + 1)] forKey:@"count"]; - if(count == [this.elementCacheArray count]){ - [this.elementCacheArray addObject:[NSValue valueWithPointer:[UIBezierPath copyCGPathElement:(CGPathElement*)element]]]; - } -} - --(void) iteratePathWithBlock:(void (^)(CGPathElement element,NSUInteger idx))block{ - void (^copiedBlock)(CGPathElement element) = [block copy]; - NSMutableDictionary* params = [NSMutableDictionary dictionary]; - [params setObject:copiedBlock forKey:@"block"]; - CGPathApply(self.CGPath, params, blockWithElement); - [copiedBlock release]; -} - -// helper function -static void blockWithElement(void* info, const CGPathElement* element) { - NSMutableDictionary* params = (NSMutableDictionary*) info; - void (^block)(CGPathElement element,NSUInteger idx) = [params objectForKey:@"block"]; - NSUInteger index = [[params objectForKey:@"index"] unsignedIntegerValue]; - block(*element, index); - [params setObject:@(index+1) forKey:@"index"]; -} - -#pragma mark - Flat - - - -#pragma mark - Properties - - -/** - * this is a property on the category, as described in: - * https://github.com/techpaa/iProperties - */ --(void)setIsFlat:(BOOL)isFlat{ - [self pathProperties].isFlat = isFlat; -} - -/** - * return YES if this bezier path is made up of only - * moveTo, closePath, and lineTo elements - * - * TODO - * this method helps caching flattened paths internally - * to this category, but is not yet fit for public use. - * - * detecting when this path is flat would mean we'd have - * to also swizzle the constructors to bezier paths - */ --(BOOL) isFlat{ - return [self pathProperties].isFlat; -} - -#pragma mark - UIBezierPath - - -/** - * call this method on a UIBezierPath to generate - * a new flattened path - * - * This category is named after Athar Luqman Ahmad, who - * wrote a masters thesis about minimizing the number of - * lines required to flatten a bezier curve - * - * The thesis is available here: - * http://www.cis.usouthal.edu/~hain/general/Theses/Ahmad_thesis.pdf - * - * The algorithm that I use as of 10/09/2012 is a simple - * recursive algorithm that doesn't use any of ahmed's - * optimizations yet - * - * TODO: add in Ahmed's optimizations - */ --(UIBezierPath*) bezierPathByFlatteningPath{ - return [self bezierPathByFlatteningPathAndImmutable:NO]; -} -/** - * @param shouldBeImmutable: YES if this function should return a distinct UIBezier, NO otherwise - * - * if the caller plans to modify the returned path, then shouldBeImmutable should - * be called with NO. - * - * if the caller only plans to iterate over and look at the returned value, - * then shouldBeImmutable should be YES - this is considerably faster to not - * return a copy if the value will be treated as immutable - */ --(UIBezierPath*) bezierPathByFlatteningPathAndImmutable:(BOOL)willBeImmutable{ - UIBezierPathProperties* props = [self pathProperties]; - UIBezierPath* ret = props.bezierPathByFlatteningPath; - if(ret){ - if(willBeImmutable) return ret; - return [[ret copy] autorelease]; - } - if(self.isFlat){ - if(willBeImmutable) return self; - return [[self copy] autorelease]; - } - - __block NSInteger flattenedElementCount = 0; - UIBezierPath *newPath = [UIBezierPath bezierPath]; - NSInteger elements = [self elementCount]; - NSInteger n; - CGPoint pointForClose = CGPointMake (0.0, 0.0); - CGPoint lastPoint = CGPointMake (0.0, 0.0); - - for (n = 0; n < elements; ++n) - { - CGPoint points[3]; - CGPathElement element = [self elementAtIndex:n associatedPoints:points]; - - switch (element.type) - { - case kCGPathElementMoveToPoint: - [newPath moveToPoint:points[0]]; - pointForClose = lastPoint = points[0]; - flattenedElementCount++; - continue; - - case kCGPathElementAddLineToPoint: - [newPath addLineToPoint:points[0]]; - lastPoint = points[0]; - flattenedElementCount++; - break; - - case kCGPathElementAddQuadCurveToPoint: - case kCGPathElementAddCurveToPoint: - { - - // - // handle both curve types gracefully - CGPoint curveTo; - CGPoint ctrl1; - CGPoint ctrl2; - if(element.type == kCGPathElementAddQuadCurveToPoint){ - curveTo = element.points[1]; - ctrl1 = element.points[0]; - ctrl2 = ctrl1; - }else if(element.type == kCGPathElementAddCurveToPoint){ - curveTo = element.points[2]; - ctrl1 = element.points[0]; - ctrl2 = element.points[1]; - } - - // - // ok, this is the bezier for our current element - CGPoint bezier[4] = { lastPoint, ctrl1, ctrl2, curveTo }; - - - // - // define our recursive function that will - // help us split the curve up as needed - void (^__block flattenCurve)(UIBezierPath* newPath, CGPoint startPoint, CGPoint bez[4]) = ^(UIBezierPath* newPath, CGPoint startPoint, CGPoint bez[4]){ - // - // first, calculate the error rate for - // a line segement between the start/end points - // vs the curve - - CGPoint onCurve = bezierPointAtT(bez, .5); - - CGFloat error = distanceOfPointToLine(onCurve, startPoint, bez[2]); - - - // - // if that error is less than our accepted - // level of error, then just add a line, - // - // otherwise, split the curve in half and recur - if (error <= idealFlatness) - { - [newPath addLineToPoint:bez[3]]; - flattenedElementCount++; - } - else - { - CGPoint bez1[4], bez2[4]; - subdivideBezierAtT(bez, bez1, bez2, .5); - // now we've split the curve in half, and have - // two bezier curves bez1 and bez2. recur - // on these two halves - flattenCurve(newPath, startPoint, bez1); - flattenCurve(newPath, startPoint, bez2); - } - }; - - flattenCurve(newPath, lastPoint, bezier); - - lastPoint = points[2]; - break; - } - - case kCGPathElementCloseSubpath: - [newPath closePath]; - lastPoint = pointForClose; - flattenedElementCount++; - break; - - default: - break; - } - } - - // since we just built the flattened path - // we know how many elements there are, so cache that - UIBezierPathProperties* newPathProps = [newPath pathProperties]; - newPathProps.cachedElementCount = flattenedElementCount; - - props.bezierPathByFlatteningPath = newPath; - - return [self bezierPathByFlatteningPathAndImmutable:willBeImmutable]; -} - - -#pragma mark - Helper - -/** - * returns the length of the points array for the input - * CGPathElement element - */ -+(NSInteger) numberOfPointsForElement:(CGPathElement)element{ - NSInteger nPoints = 0; - switch (element.type) - { - case kCGPathElementMoveToPoint: - nPoints = 1; - break; - case kCGPathElementAddLineToPoint: - nPoints = 1; - break; - case kCGPathElementAddQuadCurveToPoint: - nPoints = 2; - break; - case kCGPathElementAddCurveToPoint: - nPoints = 3; - break; - case kCGPathElementCloseSubpath: - nPoints = 0; - break; - default: - nPoints = 0; - } - return nPoints; -} - - -/** - * copies the input CGPathElement - * - * TODO: I currently never free the memory assigned for the points array - * https://github.com/adamwulf/DrawKit-iOS/issues/4 - */ -+(CGPathElement*) copyCGPathElement:(CGPathElement*)element{ - CGPathElement* ret = malloc(sizeof(CGPathElement)); - if(!ret){ - @throw [NSException exceptionWithName:@"Memory Exception" reason:@"can't malloc" userInfo:nil]; - } - NSInteger numberOfPoints = [UIBezierPath numberOfPointsForElement:*element]; - if(numberOfPoints){ - ret->points = malloc(sizeof(CGPoint) * numberOfPoints); - }else{ - ret->points = NULL; - } - ret->type = element->type; - - for(int i=0;ipoints[i] = element->points[i]; - } - return ret; -} - - - - -#pragma mark - Swizzling - -/////////////////////////////////////////////////////////////////////////// -// -// All of these methods are to listen to UIBezierPath method calls -// so that we can add new functionality on top of them without -// changing any of the default behavior. -// -// These methods help maintain: -// 1. cachedElementCount -// 2. elementCacheArray -// 3. keeping cache's valid across copying - - --(void) nsosx_swizzle_removeAllPoints{ - [self setElementCacheArray:nil]; - [self nsosx_swizzle_removeAllPoints]; -} - --(UIBezierPath*) nsosx_swizzle_copy{ - UIBezierPath* ret = [self nsosx_swizzle_copy]; - // note, when setting the array here, it will actually be making - // a mutable copy of the input array, so the copied - // path will have its own version. - [ret setElementCacheArray:self.elementCacheArray]; - return ret; -} --(void) nsosx_swizzle_applyTransform:(CGAffineTransform)transform{ - [self setElementCacheArray:nil]; - [self pathProperties].hasLastPoint = NO; - [self pathProperties].hasFirstPoint = NO; - [self nsosx_swizzle_applyTransform:transform]; -} - - - --(void) nsosx_swizzle_dealloc{ - [self freeCurrentElementCacheArray]; - [self nsosx_swizzle_dealloc]; -} - -+(void)load{ - @autoreleasepool { - NSError *error = nil; - [UIBezierPath jr_swizzleMethod:@selector(removeAllPoints) - withMethod:@selector(nsosx_swizzle_removeAllPoints) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(applyTransform:) - withMethod:@selector(nsosx_swizzle_applyTransform:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(copy) - withMethod:@selector(nsosx_swizzle_copy) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(dealloc) - withMethod:@selector(nsosx_swizzle_dealloc) - error:&error]; - } -} - - - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX_Private.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX_Private.h deleted file mode 100644 index 91dd1c78..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+NSOSX_Private.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// UIBezierPath+NSOSX_Private.h -// PerformanceBezier -// -// Created by Adam Wulf on 10/9/12. -// Copyright (c) 2012 Milestone Made, LLC. All rights reserved. -// - -#ifndef PerformanceBezier_UIBezierPath_NSOSX_Private_h -#define PerformanceBezier_UIBezierPath_NSOSX_Private_h - - -@interface UIBezierPath (NSOSX_Private) - -// cache of path elements -@property(nonatomic,retain) NSMutableArray* elementCacheArray; - -// cache of element count -@property(nonatomic,assign) NSInteger cachedElementCount; - -// helper functions to prime the above caches -void countPathElement(void* info, const CGPathElement* element); - -void updatePathElementAtIndex(void* info, const CGPathElement* element); - -@end - - -#endif diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.h deleted file mode 100644 index 58f56c93..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// UIBezierPath+Performance.h -// PerformanceBezier -// -// Created by Adam Wulf on 1/31/15. -// Copyright (c) 2015 Milestone Made, LLC. All rights reserved. -// - -#import -#import "UIBezierPathProperties.h" - -CGPoint bezierPointAtT(const CGPoint bez[4], CGFloat t); - -@interface UIBezierPath (Performance) - --(UIBezierPathProperties*) pathProperties; - -// returns the last point of the bezier path. -// if the path ends with a kCGPathElementClosed, -// then the first point of that subpath is returned --(CGPoint) lastPoint; - -// returns the first point of the bezier path --(CGPoint) firstPoint; - -// returns the tangent at the very end of the path -// in radians --(CGFloat) tangentAtEnd; - -// returns YES if the path is closed (or contains at least 1 closed subpath) -// returns NO otherwise --(BOOL) isClosed; - -// returns the tangent of the bezier path at the given t value -- (CGPoint) tangentOnPathAtElement:(NSInteger)elementIndex andTValue:(CGFloat)tVal; - -// for the input bezier curve [start, ctrl1, ctrl2, end] -// return the point at the input T value -+(CGPoint) pointAtT:(CGFloat)t forBezier:(CGPoint*)bez; - -// for the input bezier curve [start, ctrl1, ctrl2, end] -// return the tangent at the input T value -+(CGPoint) tangentAtT:(CGFloat)t forBezier:(CGPoint*)bez; - -// fill the input point array with [start, ctrl1, ctrl2, end] -// for the element at the given index --(void) fillBezier:(CGPoint[4])bezier forElement:(NSInteger)elementIndex; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.m deleted file mode 100644 index 11cf809a..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance.m +++ /dev/null @@ -1,525 +0,0 @@ -// -// UIBezierPath+Performance.m -// PerformanceBezier -// -// Created by Adam Wulf on 1/31/15. -// Copyright (c) 2015 Milestone Made, LLC. All rights reserved. -// - -#import "UIBezierPath+Performance.h" -#import "UIBezierPath+Performance_Private.h" -#import "UIBezierPath+FirstLast.h" -#import "UIBezierPath+NSOSX.h" -#import "UIBezierPath+Uncached.h" -#import -#import "JRSwizzle.h" - -static char BEZIER_PROPERTIES; - -@implementation UIBezierPath (Performance) - --(UIBezierPathProperties*) pathProperties{ - UIBezierPathProperties* props = objc_getAssociatedObject(self, &BEZIER_PROPERTIES); - if(!props){ - props = [[[UIBezierPathProperties alloc] init] autorelease]; - objc_setAssociatedObject(self, &BEZIER_PROPERTIES, props, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - return props; -} - --(void)setTangentAtEnd:(CGFloat)tangent{ - [self pathProperties].tangentAtEnd = tangent; -} - --(CGPoint)lastPoint{ - UIBezierPathProperties* props = [self pathProperties]; - if(!props.hasLastPoint){ - props.hasLastPoint = YES; - props.lastPoint = [self lastPointCalculated]; -#ifdef MMPreventBezierPerformance - }else{ - [self simulateNoBezierCaching]; -#endif - } - return props.lastPoint; -} --(CGPoint)firstPoint{ - UIBezierPathProperties* props = [self pathProperties]; - if(!props.hasFirstPoint){ - props.hasFirstPoint = YES; - props.firstPoint = [self firstPointCalculated]; -#ifdef MMPreventBezierPerformance - }else{ - [self simulateNoBezierCaching]; -#endif - } - return props.firstPoint; -} --(BOOL) isClosed{ - UIBezierPathProperties* props = [self pathProperties]; - if(!props.knowsIfClosed){ - // we dont know if the path is closed, so - // find a close element if we have one - [self iteratePathWithBlock:^(CGPathElement ele, NSUInteger idx){ - if(ele.type == kCGPathElementCloseSubpath){ - props.isClosed = YES; - } - }]; - props.knowsIfClosed = YES; -#ifdef MMPreventBezierPerformance - }else{ - [self simulateNoBezierCaching]; -#endif - } - return props.isClosed; -} --(CGFloat) tangentAtEnd{ -#ifdef MMPreventBezierPerformance - [self simulateNoBezierCaching]; -#endif - return [self pathProperties].tangentAtEnd; -} - -/** - * this is a property on the category, as described in: - * https://github.com/techpaa/iProperties - */ --(void)setBezierPathByFlatteningPath:(UIBezierPath *)bezierPathByFlatteningPath{ - [self pathProperties].bezierPathByFlatteningPath = bezierPathByFlatteningPath; -} - - - -/** - * this is a property on the category, as described in: - * https://github.com/techpaa/iProperties - * - * - * this is for internal PerformanceBezier use only - * - * Since iOS doesn't allow a quick lookup for element count, - * this property will act as a cache for the element count after - * it has been calculated once - */ --(void)setCachedElementCount:(NSInteger)_cachedElementCount{ - [self pathProperties].cachedElementCount = _cachedElementCount; -} - --(NSInteger)cachedElementCount{ - return [self pathProperties].cachedElementCount; -} - - - - --(void) fillBezier:(CGPoint[4])bezier forElement:(NSInteger)elementIndex{ - if(elementIndex >= [self elementCount] || elementIndex < 0){ - @throw [NSException exceptionWithName:@"BezierElementException" reason:@"Element index is out of range" userInfo:nil]; - } - if(elementIndex == 0){ - bezier[0] = self.firstPoint; - bezier[1] = self.firstPoint; - bezier[2] = self.firstPoint; - bezier[3] = self.firstPoint; - return; - } - - CGPathElement previousElement = [self elementAtIndex:elementIndex-1]; - CGPathElement thisElement = [self elementAtIndex:elementIndex]; - - if(previousElement.type == kCGPathElementMoveToPoint || - previousElement.type == kCGPathElementAddLineToPoint){ - bezier[0] = previousElement.points[0]; - }else if(previousElement.type == kCGPathElementAddQuadCurveToPoint){ - bezier[0] = previousElement.points[1]; - }else if(previousElement.type == kCGPathElementAddCurveToPoint){ - bezier[0] = previousElement.points[2]; - } - - if(thisElement.type == kCGPathElementCloseSubpath){ - bezier[1] = bezier[0]; - bezier[2] = self.firstPoint; - bezier[3] = self.firstPoint; - }else if (thisElement.type == kCGPathElementMoveToPoint || - thisElement.type == kCGPathElementAddLineToPoint){ -// bezier[1] = CGPointMake(bezier[0].x + (thisElement.points[0].x - bezier[0].x)/3, -// bezier[0].y + (thisElement.points[0].y - bezier[0].y)/3); -// bezier[2] = CGPointMake(bezier[0].x + (thisElement.points[0].x - bezier[0].x)*2/3, -// bezier[0].y + (thisElement.points[0].y - bezier[0].y)*2/3); - bezier[1] = bezier[0]; - bezier[2] = thisElement.points[0]; - bezier[3] = thisElement.points[0]; - }else if (thisElement.type == kCGPathElementAddQuadCurveToPoint){ - bezier[1] = thisElement.points[0]; - bezier[2] = thisElement.points[0]; - bezier[3] = thisElement.points[1]; - }else if (thisElement.type == kCGPathElementAddCurveToPoint){ - bezier[1] = thisElement.points[0]; - bezier[2] = thisElement.points[1]; - bezier[3] = thisElement.points[2]; - } -} - -- (CGPoint) tangentOnPathAtElement:(NSInteger)elementIndex andTValue:(CGFloat)tVal{ - if(elementIndex >= [self elementCount] || elementIndex < 0){ - @throw [NSException exceptionWithName:@"BezierElementException" reason:@"Element index is out of range" userInfo:nil]; - } - if(elementIndex == 0){ - return self.firstPoint; - } - - CGPoint bezier[4]; - - [self fillBezier:bezier forElement:elementIndex]; - return [UIBezierPath tangentAtT:tVal forBezier:bezier]; -} - - - -+(CGPoint) pointAtT:(CGFloat)t forBezier:(CGPoint*)bez{ - return bezierPointAtT(bez, t); -} - -+(CGPoint) tangentAtT:(CGFloat)t forBezier:(CGPoint*)bez{ - return bezierTangentAtT(bez, t); -} - - - - - - - - -#pragma mark - Swizzle - -/////////////////////////////////////////////////////////////////////////// -// -// All of these methods are to listen to UIBezierPath method calls -// so that we can add new functionality on top of them without -// changing any of the default behavior. -// -// These methods help maintain: -// 1. the cached flat version of this path -// 2. the flag for if this path is already flat or not - - --(void) ahmed_swizzle_dealloc{ - objc_setAssociatedObject(self, &BEZIER_PROPERTIES, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - [self ahmed_swizzle_dealloc]; -} - -- (id)swizzle_initWithCoder:(NSCoder *)decoder{ - self = [self swizzle_initWithCoder:decoder]; - UIBezierPathProperties* props = [decoder decodeObjectForKey:@"pathProperties"]; - objc_setAssociatedObject(self, &BEZIER_PROPERTIES, props, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - return self; -} - --(void) swizzle_encodeWithCoder:(NSCoder *)aCoder{ - [self swizzle_encodeWithCoder:aCoder]; - [aCoder encodeObject:self.pathProperties forKey:@"pathProperties"]; -} --(void) ahmed_swizzle_applyTransform:(CGAffineTransform)transform{ - // reset our path properties - BOOL isClosed = [self pathProperties].isClosed; - UIBezierPathProperties* props = [[[UIBezierPathProperties alloc] init] autorelease]; - props.isClosed = isClosed; - objc_setAssociatedObject(self, &BEZIER_PROPERTIES, props, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - [self ahmed_swizzle_applyTransform:transform]; -} - --(void) swizzle_moveToPoint:(CGPoint)point{ - UIBezierPathProperties* props = [self pathProperties]; - props.bezierPathByFlatteningPath = nil; - BOOL isEmpty = [self isEmpty]; - if(isEmpty || props.isFlat){ - props.isFlat = YES; - } - if(isEmpty){ - props.hasFirstPoint = YES; - props.firstPoint = point; - props.cachedElementCount = 1; - }else if(props.cachedElementCount){ - if(!props.lastAddedElementWasMoveTo){ - // when adding multiple moveTo elements to a path - // in a row, iOS actually just modifies the last moveTo - // instead of having tons of useless moveTos - props.cachedElementCount = props.cachedElementCount + 1; - }else if(props.cachedElementCount == 1){ - // otherwise, the first and only point was - // a move to, so update our first point - props.firstPoint = point; - } - } - props.hasLastPoint = YES; - props.lastPoint = point; - props.tangentAtEnd = 0; - props.lastAddedElementWasMoveTo = YES; - [self swizzle_moveToPoint:point]; -} --(void) swizzle_addLineToPoint:(CGPoint)point{ - UIBezierPathProperties* props = [self pathProperties]; - props.lastAddedElementWasMoveTo = NO; - props.bezierPathByFlatteningPath = nil; - if([self isEmpty] || props.isFlat){ - props.isFlat = YES; - } - if(props.cachedElementCount){ - props.cachedElementCount = props.cachedElementCount + 1; - } - props.tangentAtEnd = [self calculateTangentBetween:point andPoint:props.lastPoint]; - props.hasLastPoint = YES; - props.lastPoint = point; - [self swizzle_addLineToPoint:point]; -} --(void) swizzle_addCurveToPoint:(CGPoint)point controlPoint1:(CGPoint)ctrl1 controlPoint2:(CGPoint)ctrl2{ - UIBezierPathProperties* props = [self pathProperties]; - props.lastAddedElementWasMoveTo = NO; - props.bezierPathByFlatteningPath = nil; - if([self isEmpty] || props.isFlat){ - props.isFlat = NO; - } - if(props.cachedElementCount){ - props.cachedElementCount = props.cachedElementCount + 1; - } - props.tangentAtEnd = [self calculateTangentBetween:point andPoint:ctrl2]; - props.hasLastPoint = YES; - props.lastPoint = point; - [self swizzle_addCurveToPoint:point controlPoint1:ctrl1 controlPoint2:ctrl2]; -} --(void) swizzle_quadCurveToPoint:(CGPoint)point controlPoint:(CGPoint)ctrl1{ - UIBezierPathProperties* props = [self pathProperties]; - props.lastAddedElementWasMoveTo = NO; - props.bezierPathByFlatteningPath = nil; - if([self isEmpty] || props.isFlat){ - props.isFlat = NO; - } - if(props.cachedElementCount){ - props.cachedElementCount = props.cachedElementCount + 1; - } - props.hasLastPoint = YES; - props.lastPoint = point; - props.tangentAtEnd = [self calculateTangentBetween:point andPoint:ctrl1]; - [self swizzle_quadCurveToPoint:point controlPoint:ctrl1]; -} --(void) swizzle_closePath{ - UIBezierPathProperties* props = [self pathProperties]; - props.isClosed = YES; - props.knowsIfClosed = YES; - props.lastAddedElementWasMoveTo = NO; - props.bezierPathByFlatteningPath = nil; - if([self isEmpty] || props.isFlat){ - props.isFlat = YES; - } - if(props.cachedElementCount){ - props.cachedElementCount = props.cachedElementCount + 1; - } - if(props.hasLastPoint && props.hasFirstPoint){ - props.lastPoint = props.firstPoint; - }else{ - props.hasLastPoint = NO; - } - [self swizzle_closePath]; -} --(void)swizzle_arcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise{ - UIBezierPathProperties* props = [self pathProperties]; - props.lastAddedElementWasMoveTo = NO; - props.bezierPathByFlatteningPath = nil; - if([self isEmpty] || props.isFlat){ - props.isFlat = NO; - } - if(props.cachedElementCount){ - props.cachedElementCount = props.cachedElementCount + 1; - } - [self swizzle_arcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:clockwise]; -} --(void) swizzle_removeAllPoints{ - UIBezierPathProperties* props = [self pathProperties]; - props.lastAddedElementWasMoveTo = NO; - props.bezierPathByFlatteningPath = nil; - [self swizzle_removeAllPoints]; - props.cachedElementCount = 0; - props.tangentAtEnd = 0; - props.hasLastPoint = NO; - props.hasFirstPoint = NO; - props.isClosed = NO; - props.knowsIfClosed = YES; - if([self isEmpty] || props.isFlat){ - props.isFlat = YES; - } -} -- (void)swizzle_appendPath:(UIBezierPath *)bezierPath{ - UIBezierPathProperties* props = [self pathProperties]; - props.lastAddedElementWasMoveTo = NO; - UIBezierPathProperties* bezierPathProps = [bezierPath pathProperties]; - props.bezierPathByFlatteningPath = nil; - if(([self isEmpty] && bezierPathProps.isFlat) || (props.isFlat && bezierPathProps.isFlat)){ - props.isFlat = YES; - }else{ - props.isFlat = NO; - } - [self swizzle_appendPath:bezierPath]; - props.hasLastPoint = bezierPathProps.hasLastPoint; - props.lastPoint = bezierPathProps.lastPoint; - props.tangentAtEnd = bezierPathProps.tangentAtEnd; - props.cachedElementCount = 0; -} --(UIBezierPath*) swizzle_copy{ - UIBezierPathProperties* props = [self pathProperties]; - UIBezierPath* ret = [self swizzle_copy]; - CGMutablePathRef pathRef = CGPathCreateMutableCopy(self.CGPath); - ret.CGPath = pathRef; - CGPathRelease(pathRef); - UIBezierPathProperties* retProps = [ret pathProperties]; - retProps.lastAddedElementWasMoveTo = props.lastAddedElementWasMoveTo; - retProps.isFlat = props.isFlat; - retProps.hasLastPoint = props.hasLastPoint; - retProps.lastPoint = props.lastPoint; - retProps.hasFirstPoint = props.hasFirstPoint; - retProps.firstPoint = props.firstPoint; - retProps.tangentAtEnd = props.tangentAtEnd; - retProps.cachedElementCount = props.cachedElementCount; - retProps.isClosed = props.isClosed; - return ret; -} - -+(UIBezierPath*) swizzle_bezierPathWithRect:(CGRect)rect{ - UIBezierPath* path = [UIBezierPath swizzle_bezierPathWithRect:rect]; - UIBezierPathProperties* props = [path pathProperties]; - props.isFlat = YES; - props.knowsIfClosed = YES; - props.isClosed = YES; - return path; -} - -+(UIBezierPath*) swizzle_bezierPathWithOvalInRect:(CGRect)rect{ - UIBezierPath* path = [UIBezierPath swizzle_bezierPathWithOvalInRect:rect]; - UIBezierPathProperties* props = [path pathProperties]; - props.isFlat = YES; - props.knowsIfClosed = YES; - props.isClosed = YES; - return path; -} - -+(UIBezierPath*) swizzle_bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii{ - UIBezierPath* path = [UIBezierPath swizzle_bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:cornerRadii]; - UIBezierPathProperties* props = [path pathProperties]; - props.isFlat = YES; - props.knowsIfClosed = YES; - props.isClosed = YES; - return path; -} - -+(UIBezierPath*) swizzle_bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadii{ - UIBezierPath* path = [UIBezierPath swizzle_bezierPathWithRoundedRect:rect cornerRadius:cornerRadii]; - UIBezierPathProperties* props = [path pathProperties]; - props.isFlat = YES; - props.knowsIfClosed = YES; - props.isClosed = YES; - return path; -} - - - -+(void)load{ - @autoreleasepool { - NSError *error = nil; - [UIBezierPath jr_swizzleClassMethod:@selector(bezierPathWithRect:) - withClassMethod:@selector(swizzle_bezierPathWithRect:) - error:&error]; - [UIBezierPath jr_swizzleClassMethod:@selector(bezierPathWithOvalInRect:) - withClassMethod:@selector(swizzle_bezierPathWithOvalInRect:) - error:&error]; - [UIBezierPath jr_swizzleClassMethod:@selector(bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:) - withClassMethod:@selector(swizzle_bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:) - error:&error]; - [UIBezierPath jr_swizzleClassMethod:@selector(bezierPathWithRoundedRect:cornerRadius:) - withClassMethod:@selector(swizzle_bezierPathWithRoundedRect:cornerRadius:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(moveToPoint:) - withMethod:@selector(swizzle_moveToPoint:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(addLineToPoint:) - withMethod:@selector(swizzle_addLineToPoint:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(addCurveToPoint:controlPoint1:controlPoint2:) - withMethod:@selector(swizzle_addCurveToPoint:controlPoint1:controlPoint2:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(addQuadCurveToPoint:controlPoint:) - withMethod:@selector(swizzle_quadCurveToPoint:controlPoint:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(closePath) - withMethod:@selector(swizzle_closePath) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(addArcWithCenter:radius:startAngle:endAngle:clockwise:) - withMethod:@selector(swizzle_arcWithCenter:radius:startAngle:endAngle:clockwise:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(removeAllPoints) - withMethod:@selector(swizzle_removeAllPoints) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(appendPath:) - withMethod:@selector(swizzle_appendPath:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(copy) - withMethod:@selector(swizzle_copy) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(initWithCoder:) - withMethod:@selector(swizzle_initWithCoder:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(encodeWithCoder:) - withMethod:@selector(swizzle_encodeWithCoder:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(applyTransform:) - withMethod:@selector(ahmed_swizzle_applyTransform:) - error:&error]; - [UIBezierPath jr_swizzleMethod:@selector(dealloc) - withMethod:@selector(ahmed_swizzle_dealloc) - error:&error]; - } -} - - - -/** - * if a curve, the ctrlpoint should be point1, and end point is point2 - * if line, prev point is point1, and end point is point2 - */ -- (CGFloat) calculateTangentBetween:(CGPoint)point1 andPoint:(CGPoint)point2{ - return atan2f( point1.y - point2.y, point1.x - point2.x ); -} - - - -/** - * calculate the point on a bezier at time t - * where 0 < t < 1 - */ -CGPoint bezierPointAtT(const CGPoint bez[4], CGFloat t) -{ - CGPoint q; - CGFloat mt = 1 - t; - - CGPoint bez1[4]; - CGPoint bez2[4]; - - q.x = mt * bez[1].x + t * bez[2].x; - q.y = mt * bez[1].y + t * bez[2].y; - bez1[1].x = mt * bez[0].x + t * bez[1].x; - bez1[1].y = mt * bez[0].y + t * bez[1].y; - bez2[2].x = mt * bez[2].x + t * bez[3].x; - bez2[2].y = mt * bez[2].y + t * bez[3].y; - - bez1[2].x = mt * bez1[1].x + t * q.x; - bez1[2].y = mt * bez1[1].y + t * q.y; - bez2[1].x = mt * q.x + t * bez2[2].x; - bez2[1].y = mt * q.y + t * bez2[2].y; - - bez1[3].x = bez2[0].x = mt * bez1[2].x + t * bez2[1].x; - bez1[3].y = bez2[0].y = mt * bez1[2].y + t * bez2[1].y; - - return CGPointMake(bez1[3].x, bez1[3].y); -} - -@end - diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance_Private.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance_Private.h deleted file mode 100644 index aaa7d348..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Performance_Private.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// UIBezierPath+Performance_Private.h -// PerformanceBezier -// -// Created by Adam Wulf on 10/16/12. -// Copyright (c) 2012 Milestone Made, LLC. All rights reserved. -// - -#ifndef PerformanceBezier_UIBezierPath_Performance_Private_h -#define PerformanceBezier_UIBezierPath_Performance_Private_h - -#import "UIBezierPathProperties.h" - -@interface UIBezierPath (Performance_Private) - -// helper functions for finding points and tangents -// on a bezier curve -CGPoint bezierPointAtT(const CGPoint bez[4], CGFloat t); -CGPoint bezierTangentAtT(const CGPoint bez[4], CGFloat t); -CGFloat bezierTangent(CGFloat t, CGFloat a, CGFloat b, CGFloat c, CGFloat d); -CGFloat dotProduct(const CGPoint p1, const CGPoint p2); - -@end - - -#endif diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.h deleted file mode 100644 index b667e35c..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// UIBezierPath+Ahmed.h -// PerformanceBezier -// -// Created by Adam Wulf on 10/6/12. -// Copyright (c) 2012 Milestone Made, LLC. All rights reserved. -// -// -// -// -// This category is motivated by the masters thesis of Athar Ahmad -// available at http://www.cis.usouthal.edu/~hain/general/Theses/Ahmad_thesis.pdf -// -// More information available at -// http://www.cis.usouthal.edu/~hain/general/Thesis.htm -// -// subdivide code license in included SubdiviceLicense file - -#import -#include - - - -@interface UIBezierPath (Trim) - --(UIBezierPath*) bezierPathByTrimmingElement:(NSInteger)elementIndex fromTValue:(double)fromTValue toTValue:(double)toTValue; --(UIBezierPath*) bezierPathByTrimmingToElement:(NSInteger)elementIndex andTValue:(double)tValue; --(UIBezierPath*) bezierPathByTrimmingFromElement:(NSInteger)elementIndex andTValue:(double)tValue; - -+(void) subdivideBezier:(const CGPoint[4])bez intoLeft:(CGPoint[4])bez1 andRight:(CGPoint[4])bez2 atT:(CGFloat)t; - -+(void) subdivideBezier:(const CGPoint[4])bez intoLeft:(CGPoint[4])bez1 andRight:(CGPoint[4])bez2 atLength:(CGFloat)length withAcceptableError:(CGFloat)acceptableError withCache:(CGFloat*) subBezierlengthCache; - - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.m deleted file mode 100644 index c397993d..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trim.m +++ /dev/null @@ -1,209 +0,0 @@ -// -// UIBezierPath+Trim.m -// PerformanceBezier -// -// Created by Adam Wulf on 10/6/12. -// Copyright (c) 2012 Milestone Made, LLC. All rights reserved. -// - -#import "UIBezierPath+Trim.h" -#import -#import - -@implementation UIBezierPath (Trim) - -/** - * this will trim a specific element from a tvalue to a tvalue - */ --(UIBezierPath*) bezierPathByTrimmingElement:(NSInteger)elementIndex fromTValue:(double)fromTValue toTValue:(double)toTValue{ - __block CGPoint previousEndpoint; - __block UIBezierPath* outputPath = [UIBezierPath bezierPath]; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger currentIndex){ - if(currentIndex < elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - previousEndpoint = element.points[2]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - previousEndpoint = element.points[0]; - } - }else if(currentIndex == elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - [outputPath moveToPoint:element.points[0]]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - CGPoint bez[4]; - bez[0] = previousEndpoint; - bez[1] = element.points[0]; - bez[2] = element.points[1]; - bez[3] = element.points[2]; - - previousEndpoint = element.points[2]; - - CGPoint left[4], right[4]; - subdivideBezierAtT(bez, left, right, toTValue); - bez[0] = left[0]; - bez[1] = left[1]; - bez[2] = left[2]; - bez[3] = left[3]; - subdivideBezierAtT(bez, left, right, fromTValue / toTValue); - [outputPath moveToPoint:right[0]]; - [outputPath addCurveToPoint:right[3] controlPoint1:right[1] controlPoint2:right[2]]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - CGPoint startPoint = CGPointMake(previousEndpoint.x + fromTValue * (element.points[0].x - previousEndpoint.x), - previousEndpoint.y + fromTValue * (element.points[0].y - previousEndpoint.y)); - CGPoint endPoint = CGPointMake(previousEndpoint.x + toTValue * (element.points[0].x - previousEndpoint.x), - previousEndpoint.y + toTValue * (element.points[0].y - previousEndpoint.y)); - previousEndpoint = element.points[0]; - [outputPath moveToPoint:startPoint]; - [outputPath addLineToPoint:endPoint]; - } - } - }]; - - return outputPath; -} - - - - -/** - * this will trim a uibezier path from the input element index - * and that element's tvalue. it will return all elements after - * that input - */ --(UIBezierPath*) bezierPathByTrimmingFromElement:(NSInteger)elementIndex andTValue:(double)tValue{ - __block CGPoint previousEndpoint; - __block UIBezierPath* outputPath = [UIBezierPath bezierPath]; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger currentIndex){ - if(currentIndex < elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - previousEndpoint = element.points[2]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - previousEndpoint = element.points[0]; - } - }else if(currentIndex == elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - [outputPath moveToPoint:element.points[0]]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - CGPoint bez[4]; - bez[0] = previousEndpoint; - bez[1] = element.points[0]; - bez[2] = element.points[1]; - bez[3] = element.points[2]; - - previousEndpoint = element.points[2]; - - CGPoint left[4], right[4]; - subdivideBezierAtT(bez, left, right, tValue); - [outputPath moveToPoint:right[0]]; - [outputPath addCurveToPoint:right[3] controlPoint1:right[1] controlPoint2:right[2]]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - CGPoint startPoint = CGPointMake(previousEndpoint.x + tValue * (element.points[0].x - previousEndpoint.x), - previousEndpoint.y + tValue * (element.points[0].y - previousEndpoint.y)); - previousEndpoint = element.points[0]; - [outputPath moveToPoint:startPoint]; - [outputPath addLineToPoint:element.points[0]]; - } - }else if(currentIndex > elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - [outputPath moveToPoint:element.points[0]]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - previousEndpoint = element.points[2]; - [outputPath addCurveToPoint:element.points[2] controlPoint1:element.points[0] controlPoint2:element.points[1]]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - previousEndpoint = element.points[0]; - [outputPath addLineToPoint:element.points[0]]; - } - } - }]; - - return outputPath; -} - -/** - * this will trim a uibezier path to the input element index - * and that element's tvalue. it will return all elements before - * that input - */ --(UIBezierPath*) bezierPathByTrimmingToElement:(NSInteger)elementIndex andTValue:(double)tValue{ - __block CGPoint previousEndpoint; - __block UIBezierPath* outputPath = [UIBezierPath bezierPath]; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger currentIndex){ - if(currentIndex == elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - [outputPath moveToPoint:element.points[0]]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - CGPoint bez[4]; - bez[0] = previousEndpoint; - bez[1] = element.points[0]; - bez[2] = element.points[1]; - bez[3] = element.points[2]; - - previousEndpoint = element.points[2]; - - CGPoint left[4], right[4]; - subdivideBezierAtT(bez, left, right, tValue); - [outputPath addCurveToPoint:left[3] controlPoint1:left[1] controlPoint2:left[2]]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - CGPoint endPoint = CGPointMake(previousEndpoint.x + tValue * (element.points[0].x - previousEndpoint.x), - previousEndpoint.y + tValue * (element.points[0].y - previousEndpoint.y)); - previousEndpoint = element.points[0]; - [outputPath addLineToPoint:endPoint]; - } - }else if(currentIndex < elementIndex){ - if(element.type == kCGPathElementMoveToPoint){ - // moveto - previousEndpoint = element.points[0]; - [outputPath moveToPoint:element.points[0]]; - }else if(element.type == kCGPathElementAddCurveToPoint ){ - // curve - previousEndpoint = element.points[2]; - [outputPath addCurveToPoint:element.points[2] controlPoint1:element.points[0] controlPoint2:element.points[1]]; - }else if(element.type == kCGPathElementAddLineToPoint){ - // line - previousEndpoint = element.points[0]; - [outputPath addLineToPoint:element.points[0]]; - } - } - }]; - - return outputPath; -} - -+(void) subdivideBezier:(const CGPoint[4])bez intoLeft:(CGPoint[4])bez1 andRight:(CGPoint[4])bez2 atT:(CGFloat)t{ - subdivideBezierAtT(bez, bez1, bez2, t); -} - -+(void) subdivideBezier:(const CGPoint[4])bez intoLeft:(CGPoint[4])bez1 andRight:(CGPoint[4])bez2{ - subdivideBezierAtT(bez, bez1, bez2, .5); -} - -+(void) subdivideBezier:(const CGPoint[4])bez intoLeft:(CGPoint[4])bez1 andRight:(CGPoint[4])bez2 atLength:(CGFloat)length withAcceptableError:(CGFloat)acceptableError withCache:(CGFloat*) subBezierlengthCache{ - subdivideBezierAtLengthWithCache(bez, bez1, bez2, length, acceptableError,subBezierlengthCache); -} - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.h deleted file mode 100644 index 323ad9cc..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// UIBezierPath+DKFix.h -// ClippingBezier -// -// Created by Adam Wulf on 5/9/15. -// -// - -#import - -@interface UIBezierPath (Trimming) - --(void) appendPathRemovingInitialMoveToPoint:(UIBezierPath*)otherPath; - --(NSArray*) subPaths; - --(NSInteger) countSubPaths; - -- (NSInteger) subpathIndexForElement:(NSInteger) element; - -- (CGFloat) length; - -- (CGFloat) tangentAtStart; - -- (CGFloat) tangentAtStartOfSubpath:(NSInteger)index; - -- (UIBezierPath*) bezierPathByTrimmingFromLength:(CGFloat)trimLength; - -- (UIBezierPath*) bezierPathByTrimmingToLength:(CGFloat)trimLength; - -- (UIBezierPath*) bezierPathByTrimmingToLength:(CGFloat)trimLength withMaximumError:(CGFloat)err; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.m deleted file mode 100644 index 0b474c00..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Trimming.m +++ /dev/null @@ -1,365 +0,0 @@ -// -// UIBezierPath+DKFix.m -// ClippingBezier -// -// Created by Adam Wulf on 5/9/15. -// -// - -#import "UIBezierPath+Trimming.h" -#import -#pragma mark - Subdivide helpers by Alastair J. Houghton -/* - * Bezier path utility category (trimming) - * - * (c) 2004 Alastair J. Houghton - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. The name of the author of this software may not be used to endorse - * or promote products derived from the software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - - -@implementation UIBezierPath (Trimming) - --(NSInteger) countSubPaths{ - return [[self subPaths] count]; -} - -/* Return an NSBezierPath corresponding to the first trimLength units - of this NSBezierPath. */ -- (UIBezierPath *)bezierPathByTrimmingToLength:(CGFloat)trimLength - withMaximumError:(CGFloat)maxError -{ - UIBezierPath *newPath = [UIBezierPath bezierPath]; - NSInteger elements = [self elementCount]; - int n; - double length = 0.0; - CGPoint pointForClose = CGPointMake(0.0, 0.0); - CGPoint lastPoint = CGPointMake (0.0, 0.0); - - for (n = 0; n < elements; ++n) { - CGPoint points[3]; - CGPathElement element = [self elementAtIndex:n - associatedPoints:points]; - double elementLength; - double remainingLength = trimLength - length; - - if(remainingLength == 0){ - break; - } - - switch (element.type) { - case kCGPathElementMoveToPoint: - [newPath moveToPoint:points[0]]; - pointForClose = lastPoint = points[0]; - continue; - - case kCGPathElementAddLineToPoint: - elementLength = distance (lastPoint, points[0]); - - if (length + elementLength <= trimLength) - [newPath addLineToPoint:points[0]]; - else { - double f = remainingLength / elementLength; - [newPath addLineToPoint:CGPointMake (lastPoint.x - + f * (points[0].x - lastPoint.x), - lastPoint.y - + f * (points[0].y - lastPoint.y))]; - return newPath; - } - - length += elementLength; - lastPoint = points[0]; - break; - - case kCGPathElementAddCurveToPoint: - case kCGPathElementAddQuadCurveToPoint: { - CGPoint bezier[4]; - if(element.type == kCGPathElementAddCurveToPoint){ - bezier[0] = lastPoint; - bezier[1] = points[0]; - bezier[2] = points[1]; - bezier[3] = points[2]; - }else{ - bezier[0] = lastPoint; - bezier[1] = points[0]; - bezier[2] = points[0]; - bezier[3] = points[1]; - } - elementLength = lengthOfBezier (bezier, maxError); - - if (length + elementLength <= trimLength) - [newPath addCurveToPoint:points[2] controlPoint1:points[0] controlPoint2:points[1]]; - else { - CGPoint bez1[4], bez2[4]; - subdivideBezierAtLength (bezier, bez1, bez2, - remainingLength, maxError); - [newPath addCurveToPoint:bez1[3] controlPoint1:bez1[1] controlPoint2:bez1[2]]; - return newPath; - } - - length += elementLength; - lastPoint = points[2]; - break; - } - - case kCGPathElementCloseSubpath: - elementLength = distance (lastPoint, pointForClose); - - if (length + elementLength <= trimLength) - [newPath closePath]; - else { - double f = remainingLength / elementLength; - [newPath addLineToPoint:CGPointMake(lastPoint.x - + f * (points[0].x - lastPoint.x), - lastPoint.y - + f * (points[0].y - lastPoint.y))]; - return newPath; - } - - length += elementLength; - lastPoint = pointForClose; - break; - } - } - - return newPath; -} - -// Convenience method -- (UIBezierPath *)bezierPathByTrimmingToLength:(CGFloat)trimLength -{ - return [self bezierPathByTrimmingToLength:trimLength withMaximumError:0.1]; -} - -/* Return an NSBezierPath corresponding to the part *after* the first - trimLength units of this NSBezierPath. */ -- (UIBezierPath *)bezierPathByTrimmingFromLength:(CGFloat)trimLength - withMaximumError:(CGFloat)maxError -{ - UIBezierPath *newPath = [UIBezierPath bezierPath]; - NSInteger elements = [self elementCount]; - int n; - double length = 0.0; - CGPoint pointForClose = CGPointMake (0.0, 0.0); - CGPoint lastPoint = CGPointMake (0.0, 0.0); - BOOL legitMoveTo = NO; - - for (n = 0; n < elements; ++n) { - CGPoint points[3]; - CGPathElement element = [self elementAtIndex:n - associatedPoints:points]; - double elementLength; - double remainingLength = trimLength - length; - - switch (element.type) { - case kCGPathElementMoveToPoint: - if(remainingLength < 0){ - [newPath moveToPoint:points[0]]; - legitMoveTo = YES; - } - pointForClose = lastPoint = points[0]; - continue; - - case kCGPathElementAddLineToPoint: - elementLength = distance (lastPoint, points[0]); - - if (length > trimLength){ - [newPath addLineToPoint:points[0]]; - }else if (length + elementLength > trimLength) { - double f = remainingLength / elementLength; - [newPath moveToPoint:CGPointMake (lastPoint.x - + f * (points[0].x - lastPoint.x), - lastPoint.y - + f * (points[0].y - lastPoint.y))]; - [newPath addLineToPoint:points[0]]; - } - - length += elementLength; - lastPoint = points[0]; - break; - - case kCGPathElementAddCurveToPoint: - case kCGPathElementAddQuadCurveToPoint: { - CGPoint bezier[4]; - if(element.type == kCGPathElementAddCurveToPoint){ - bezier[0] = lastPoint; - bezier[1] = points[0]; - bezier[2] = points[1]; - bezier[3] = points[2]; - }else{ - bezier[0] = lastPoint; - bezier[1] = points[0]; - bezier[2] = points[0]; - bezier[3] = points[1]; - } - elementLength = lengthOfBezier (bezier, maxError); - - if (length > trimLength){ - [newPath addCurveToPoint:points[2] - controlPoint1:points[0] - controlPoint2:points[1]]; - }else if (length + elementLength > trimLength) { - CGPoint bez1[4], bez2[4]; - subdivideBezierAtLength (bezier, bez1, bez2, - remainingLength, maxError); - [newPath moveToPoint:bez2[0]]; - [newPath addCurveToPoint:bez2[3] - controlPoint1:bez2[1] - controlPoint2:bez2[2]]; - } - - length += elementLength; - lastPoint = points[2]; - break; - } - - case kCGPathElementCloseSubpath: - elementLength = distance (lastPoint, pointForClose); - - if (length > trimLength){ - if(legitMoveTo){ - [newPath closePath]; - }else{ - [newPath addLineToPoint:pointForClose]; - } - } else if (length + elementLength > trimLength) { - double f = remainingLength / elementLength; - [newPath moveToPoint:CGPointMake (lastPoint.x - + f * (points[0].x - lastPoint.x), - lastPoint.y - + f * (points[0].y - lastPoint.y))]; - [newPath addLineToPoint:points[0]]; - } - - length += elementLength; - lastPoint = pointForClose; - break; - } - } - - return newPath; -} - -// Convenience method -- (UIBezierPath *)bezierPathByTrimmingFromLength:(CGFloat)trimLength -{ - return [self bezierPathByTrimmingFromLength:trimLength withMaximumError:0.1]; -} - -- (NSInteger) subpathIndexForElement:(NSInteger) element{ - __block NSInteger subpathIndex = -1; - __block BOOL lastWasMoveTo = NO; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger idx) { - if(element.type == kCGPathElementMoveToPoint){ - if(!lastWasMoveTo){ - subpathIndex += 1; - } - lastWasMoveTo = YES; - }else{ - lastWasMoveTo = NO; - } - }]; - return subpathIndex; -} - -- (CGFloat) length{ - __block CGFloat length = 0; - __block CGPoint lastMoveToPoint = CGPointNotFound; - __block CGPoint lastElementEndPoint = CGPointNotFound; - [self iteratePathWithBlock:^(CGPathElement element, NSUInteger idx) { - if(element.type == kCGPathElementMoveToPoint){ - lastElementEndPoint = element.points[0]; - lastMoveToPoint = element.points[0]; - }else if(element.type == kCGPathElementCloseSubpath){ - length += distance(lastElementEndPoint, lastMoveToPoint); - lastElementEndPoint = lastMoveToPoint; - }else if(element.type == kCGPathElementAddLineToPoint){ - length += distance(lastElementEndPoint, element.points[0]); - lastElementEndPoint = element.points[0]; - }else if(element.type == kCGPathElementAddQuadCurveToPoint || - element.type == kCGPathElementAddCurveToPoint){ - - CGPoint bez[4]; - bez[0] = lastElementEndPoint; - - if(element.type == kCGPathElementAddQuadCurveToPoint){ - bez[1] = element.points[0]; - bez[2] = element.points[0]; - bez[3] = element.points[1]; - lastElementEndPoint = element.points[1]; - }else if(element.type == kCGPathElementAddCurveToPoint){ - bez[1] = element.points[0]; - bez[2] = element.points[1]; - bez[3] = element.points[2]; - lastElementEndPoint = element.points[2]; - } - - length += lengthOfBezier(bez, .5);; - } - }]; - return length; -} - -- (CGFloat) tangentAtStart{ - if([self elementCount] < 2){ - return 0.0; - } - - CGPathElement ele1 = [self elementAtIndex:0]; - CGPathElement ele2 = [self elementAtIndex:1]; - - if(ele1.type != kCGPathElementMoveToPoint){ - return 0.0; - } - - CGPoint point1 = ele1.points[0]; - CGPoint point2 = CGPointZero; - - switch (ele2.type) { - case kCGPathElementMoveToPoint: - return 0.0; - break; - case kCGPathElementAddCurveToPoint: - case kCGPathElementAddQuadCurveToPoint: - case kCGPathElementAddLineToPoint: - point2 = ele2.points[0]; - break; - case kCGPathElementCloseSubpath: - return 0.0; - break; - } - - return atan2f( point2.y - point1.y, point2.x - point1.x ) + M_PI; -} - -- (CGFloat) tangentAtStartOfSubpath:(NSInteger)index{ - return [[[self subPaths] objectAtIndex:index] tangentAtStart]; -} - - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.h deleted file mode 100644 index 0ba08f33..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// UIBezierPath+Uncached.h -// PerformanceBezier -// -// Created by Adam Wulf on 2/6/15. -// -// - -#import - -@interface UIBezierPath (Uncached) - -#ifdef MMPreventBezierPerformance --(void) simulateNoBezierCaching; -#endif - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.m deleted file mode 100644 index 791bfc51..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Uncached.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// UIBezierPath+Uncached.m -// PerformanceBezier -// -// Created by Adam Wulf on 2/6/15. -// -// - -#import "UIBezierPath+Uncached.h" -#import "UIBezierPath+NSOSX.h" - -@implementation UIBezierPath (Uncached) - - -#ifdef MMPreventBezierPerformance --(void) simulateNoBezierCaching{ - [self iteratePathWithBlock:^(CGPathElement ele, NSUInteger idx){ - // noop - }]; -} -#endif - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.h deleted file mode 100644 index b7b1017b..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// UIBezierPath+Util.h -// PerformanceBezier -// -// Created by Adam Wulf on 5/20/15. -// -// - -#import - -@interface UIBezierPath (Util) - -+(CGFloat) lengthOfBezier:(const CGPoint[4])bez withAccuracy:(CGFloat)accuracy; - -@end - -#if defined __cplusplus -extern "C" { -#endif - - // simple helper function to return the distance of a point to a line - CGFloat distanceOfPointToLine(CGPoint point, CGPoint start, CGPoint end); - - // returns the distance between two points - CGFloat distance(const CGPoint p1, const CGPoint p2); - - void subdivideBezierAtT(const CGPoint bez[4], CGPoint bez1[4], CGPoint bez2[4], CGFloat t); - - CGFloat subdivideBezierAtLength (const CGPoint bez[4], CGPoint bez1[4], CGPoint bez2[4], CGFloat length, CGFloat acceptableError); - - CGFloat subdivideBezierAtLengthWithCache(const CGPoint bez[4], CGPoint bez1[4], CGPoint bez2[4], CGFloat length, CGFloat acceptableError, - CGFloat* subBezierLengthCache); - - CGFloat lengthOfBezier(const CGPoint bez[4], CGFloat acceptableError); - - - CGPoint lineSegmentIntersection(CGPoint A, CGPoint B, CGPoint C, CGPoint D); - - CGPoint bezierTangentAtT(const CGPoint bez[4], CGFloat t); - - CGFloat bezierTangent(CGFloat t, CGFloat a, CGFloat b, CGFloat c, CGFloat d); - - - -#if defined __cplusplus -}; -#endif - diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.m deleted file mode 100644 index 5688f8a8..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPath+Util.m +++ /dev/null @@ -1,316 +0,0 @@ -// -// UIBezierPath+Util.m -// PerformanceBezier -// -// Created by Adam Wulf on 5/20/15. -// -// - -#import "PerformanceBezier.h" -#import "UIBezierPath+Util.h" -#import "UIBezierPath+Trim.h" -#import "UIBezierPath+Performance.h" - -@implementation UIBezierPath (Util) - -+(CGFloat) lengthOfBezier:(const CGPoint[4])bez withAccuracy:(CGFloat)accuracy{ - return lengthOfBezier(bez, accuracy); -} - -#pragma mark - Subdivide helpers by Alastair J. Houghton -/* - * Bezier path utility category (trimming) - * - * (c) 2004 Alastair J. Houghton - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. The name of the author of this software may not be used to endorse - * or promote products derived from the software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -// Subdivide a Bézier (50% subdivision) -inline static void subdivideBezier(const CGPoint bez[4], CGPoint bez1[4], CGPoint bez2[4]) -{ - CGPoint q; - - bez1[0].x = bez[0].x; - bez1[0].y = bez[0].y; - bez2[3].x = bez[3].x; - bez2[3].y = bez[3].y; - - q.x = (bez[1].x + bez[2].x) / 2.0; - q.y = (bez[1].y + bez[2].y) / 2.0; - bez1[1].x = (bez[0].x + bez[1].x) / 2.0; - bez1[1].y = (bez[0].y + bez[1].y) / 2.0; - bez2[2].x = (bez[2].x + bez[3].x) / 2.0; - bez2[2].y = (bez[2].y + bez[3].y) / 2.0; - - bez1[2].x = (bez1[1].x + q.x) / 2.0; - bez1[2].y = (bez1[1].y + q.y) / 2.0; - bez2[1].x = (q.x + bez2[2].x) / 2.0; - bez2[1].y = (q.y + bez2[2].y) / 2.0; - - bez1[3].x = bez2[0].x = (bez1[2].x + bez2[1].x) / 2.0; - bez1[3].y = bez2[0].y = (bez1[2].y + bez2[1].y) / 2.0; -} - -// Subdivide a Bézier (specific division) -void subdivideBezierAtT(const CGPoint bez[4], CGPoint bez1[4], CGPoint bez2[4], CGFloat t) -{ - CGPoint q; - CGFloat mt = 1 - t; - - bez1[0].x = bez[0].x; - bez1[0].y = bez[0].y; - bez2[3].x = bez[3].x; - bez2[3].y = bez[3].y; - - q.x = mt * bez[1].x + t * bez[2].x; - q.y = mt * bez[1].y + t * bez[2].y; - bez1[1].x = mt * bez[0].x + t * bez[1].x; - bez1[1].y = mt * bez[0].y + t * bez[1].y; - bez2[2].x = mt * bez[2].x + t * bez[3].x; - bez2[2].y = mt * bez[2].y + t * bez[3].y; - - bez1[2].x = mt * bez1[1].x + t * q.x; - bez1[2].y = mt * bez1[1].y + t * q.y; - bez2[1].x = mt * q.x + t * bez2[2].x; - bez2[1].y = mt * q.y + t * bez2[2].y; - - bez1[3].x = bez2[0].x = mt * bez1[2].x + t * bez2[1].x; - bez1[3].y = bez2[0].y = mt * bez1[2].y + t * bez2[1].y; -} - - -// Length of a curve -CGFloat lengthOfBezier(const CGPoint bez[4], CGFloat acceptableError) -{ - CGFloat polyLen = 0.0; - CGFloat chordLen = distance(bez[0], bez[3]); - CGFloat retLen, errLen; - NSUInteger n; - - for (n = 0; n < 3; ++n) - polyLen += distance(bez[n], bez[n + 1]); - - errLen = polyLen - chordLen; - - if (errLen > acceptableError) { - CGPoint left[4], right[4]; - subdivideBezier (bez, left, right); - retLen = (lengthOfBezier (left, acceptableError) - + lengthOfBezier (right, acceptableError)); - } else { - retLen = 0.5 * (polyLen + chordLen); - } - - return retLen; -} - -// Split a Bézier curve at a specific length -CGFloat subdivideBezierAtLength (const CGPoint bez[4], - CGPoint bez1[4], - CGPoint bez2[4], - CGFloat length, - CGFloat acceptableError) -{ - return subdivideBezierAtLengthWithCache(bez, bez1, bez2, length, acceptableError, NULL); -} - -/** - * will split the input bezier curve at the input length - * within a given margin of error - * - * the two curves will exactly match the original curve - */ -CGFloat subdivideBezierAtLengthWithCache(const CGPoint bez[4], - CGPoint bez1[4], - CGPoint bez2[4], - CGFloat length, - CGFloat acceptableError, - CGFloat* subBezierLengthCache){ - CGFloat top = 1.0, bottom = 0.0; - CGFloat t, prevT; - BOOL needsDealloc = NO; - - if(!subBezierLengthCache){ - subBezierLengthCache = calloc(1000, sizeof(CGFloat)); - needsDealloc = YES; - } - - prevT = t = 0.5; - for (;;) { - CGFloat len1; - - subdivideBezierAtT (bez, bez1, bez2, t); - - int lengthCacheIndex = (int)floorf(t*1000); - len1 = subBezierLengthCache[lengthCacheIndex]; - if(!len1){ - len1 = [UIBezierPath lengthOfBezier:bez1 withAccuracy:0.5 * acceptableError]; - subBezierLengthCache[lengthCacheIndex] = len1; - } - - if (fabs (length - len1) < acceptableError){ - return len1; - } - - if (length > len1) { - bottom = t; - t = 0.5 * (t + top); - } else if (length < len1) { - top = t; - t = 0.5 * (bottom + t); - } - - if (t == prevT){ - subBezierLengthCache[lengthCacheIndex] = len1; - - if(needsDealloc){ - free(subBezierLengthCache); - } - return len1; - } - - prevT = t; - } -} - - - -// public domain function by Darel Rex Finley, 2006 - -// Determines the intersection point of the line segment defined by points A and B -// with the line segment defined by points C and D. -// -// Returns YES if the intersection point was found, and stores that point in X,Y. -// Returns NO if there is no determinable intersection point, in which case X,Y will -// be unmodified. - -CGPoint lineSegmentIntersection(CGPoint A, CGPoint B, CGPoint C, CGPoint D) { - - double distAB, theCos, theSin, newX, ABpos ; - - // Fail if either line segment is zero-length. - if ((A.x==B.x && A.y==B.y) || (C.x==D.x && C.y==D.y)) return CGPointNotFound; - - // Fail if the segments share an end-point. - if ((A.x==C.x && A.y==C.y) || - (B.x==C.x && B.y==C.y) || - (A.x==D.x && A.y==D.y) || - (B.x==D.x && B.y==D.y)) { - return CGPointNotFound; - } - - // (1) Translate the system so that point A is on the origin. - B.x-=A.x; B.y-=A.y; - C.x-=A.x; C.y-=A.y; - D.x-=A.x; D.y-=A.y; - - // Discover the length of segment A-B. - distAB=sqrt(B.x*B.x+B.y*B.y); - - // (2) Rotate the system so that point B is on the positive X axis. - theCos=B.x/distAB; - theSin=B.y/distAB; - newX=C.x*theCos+C.y*theSin; - C.y =C.y*theCos-C.x*theSin; - C.x=newX; - newX=D.x*theCos+D.y*theSin; - D.y =D.y*theCos-D.x*theSin; - D.x=newX; - - // Fail if segment C-D doesn't cross line A-B. - if ((C.y<0. && D.y<0.) || (C.y>=0. && D.y>=0.)) return CGPointNotFound; - - // (3) Discover the position of the intersection point along line A-B. - ABpos=D.x+(C.x-D.x)*D.y/(D.y-C.y); - - // Fail if segment C-D crosses line A-B outside of segment A-B. - if (ABpos<0. || ABpos>distAB) return CGPointNotFound; - - // (4) Apply the discovered position to line A-B in the original coordinate system. - // Success. - return CGPointMake(A.x+ABpos*theCos, A.y+ABpos*theSin); -} - - -#pragma mark - Helper - - -// primary algorithm from: -// http://stackoverflow.com/questions/4089443/find-the-tangent-of-a-point-on-a-cubic-bezier-curve-on-an-iphone -CGPoint bezierTangentAtT(const CGPoint bez[4], CGFloat t) -{ - return CGPointMake(bezierTangent(t, bez[0].x, bez[1].x, bez[2].x, bez[3].x), - bezierTangent(t, bez[0].y, bez[1].y, bez[2].y, bez[3].y)); -} -CGFloat bezierTangent(CGFloat t, CGFloat a, CGFloat b, CGFloat c, CGFloat d) -{ - CGFloat C1 = ( d - (3.0 * c) + (3.0 * b) - a ); - CGFloat C2 = ( (3.0 * c) - (6.0 * b) + (3.0 * a) ); - CGFloat C3 = ( (3.0 * b) - (3.0 * a) ); - return ( ( 3.0 * C1 * t* t ) + ( 2.0 * C2 * t ) + C3 ); -} - - -/** - * returns the shortest distance from a point to a line - */ -CGFloat distanceOfPointToLine(CGPoint point, CGPoint start, CGPoint end){ - CGPoint v = CGPointMake(end.x - start.x, end.y - start.y); - CGPoint w = CGPointMake(point.x - start.x, point.y - start.y); - CGFloat c1 = dotProduct(w, v); - CGFloat c2 = dotProduct(v, v); - CGFloat d; - if (c1 <= 0) { - d = distance(point, start); - } - else if (c2 <= c1) { - d = distance(point, end); - } - else { - CGFloat b = c1 / c2; - CGPoint Pb = CGPointMake(start.x + b * v.x, start.y + b * v.y); - d = distance(point, Pb); - } - return d; -} -/** - * returns the distance between two points - */ -CGFloat distance(const CGPoint p1, const CGPoint p2) { - return sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2)); -} -/** - * returns the dot product of two coordinates - */ -CGFloat dotProduct(const CGPoint p1, const CGPoint p2) { - return p1.x * p2.x + p1.y * p2.y; -} - - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.h b/ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.h deleted file mode 100644 index be99d063..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// UIBezierPathProperties.h -// PerformanceBezier -// -// Created by Adam Wulf on 2/1/15. -// Copyright (c) 2015 Milestone Made, LLC. All rights reserved. -// - -#import -#import - -@interface UIBezierPathProperties : NSObject -@property (nonatomic) BOOL isClosed; -@property (nonatomic) BOOL knowsIfClosed; -@property (nonatomic) BOOL isFlat; -@property (nonatomic) BOOL hasLastPoint; -@property (nonatomic) CGPoint lastPoint; -@property (nonatomic) BOOL hasFirstPoint; -@property (nonatomic) CGPoint firstPoint; -@property (nonatomic) CGFloat tangentAtEnd; -@property (nonatomic) NSInteger cachedElementCount; -@property (nonatomic, retain) UIBezierPath* bezierPathByFlatteningPath; -@property (nonatomic) BOOL lastAddedElementWasMoveTo; - -@end diff --git a/ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.m b/ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.m deleted file mode 100644 index bb5e9041..00000000 --- a/ios/PerformanceBezier/PerformanceBezier/UIBezierPathProperties.m +++ /dev/null @@ -1,81 +0,0 @@ -// -// UIBezierPathProperties.m -// PerformanceBezier -// -// Created by Adam Wulf on 2/1/15. -// Copyright (c) 2015 Milestone Made, LLC. All rights reserved. -// - -#import "UIBezierPathProperties.h" - -@implementation UIBezierPathProperties{ - BOOL isFlat; - BOOL knowsIfClosed; - BOOL isClosed; - BOOL hasLastPoint; - CGPoint lastPoint; - BOOL hasFirstPoint; - CGPoint firstPoint; - CGFloat tangentAtEnd; - NSInteger cachedElementCount; - UIBezierPath* bezierPathByFlatteningPath; -} - -@synthesize isFlat; -@synthesize knowsIfClosed; -@synthesize isClosed; -@synthesize hasLastPoint; -@synthesize lastPoint; -@synthesize tangentAtEnd; -@synthesize cachedElementCount; -@synthesize bezierPathByFlatteningPath; -@synthesize hasFirstPoint; -@synthesize firstPoint; - -- (id)initWithCoder:(NSCoder *)decoder{ - self = [super init]; - if (!self) { - return nil; - } - isFlat = [decoder decodeBoolForKey:@"pathProperties_isFlat"]; - knowsIfClosed = [decoder decodeBoolForKey:@"pathProperties_knowsIfClosed"]; - isClosed = [decoder decodeBoolForKey:@"pathProperties_isClosed"]; - hasLastPoint = [decoder decodeBoolForKey:@"pathProperties_hasLastPoint"]; - lastPoint = [decoder decodeCGPointForKey:@"pathProperties_lastPoint"]; - hasFirstPoint = [decoder decodeBoolForKey:@"pathProperties_hasFirstPoint"]; - firstPoint = [decoder decodeCGPointForKey:@"pathProperties_firstPoint"]; - tangentAtEnd = [decoder decodeFloatForKey:@"pathProperties_tangentAtEnd"]; - cachedElementCount = [decoder decodeIntegerForKey:@"pathProperties_cachedElementCount"]; - return self; -} - --(void) encodeWithCoder:(NSCoder *)aCoder{ - [aCoder encodeBool:isFlat forKey:@"pathProperties_isFlat"]; - [aCoder encodeBool:knowsIfClosed forKey:@"pathProperties_knowsIfClosed"]; - [aCoder encodeBool:isClosed forKey:@"pathProperties_isClosed"]; - [aCoder encodeBool:hasLastPoint forKey:@"pathProperties_hasLastPoint"]; - [aCoder encodeCGPoint:lastPoint forKey:@"pathProperties_lastPoint"]; - [aCoder encodeBool:hasFirstPoint forKey:@"pathProperties_hasFirstPoint"]; - [aCoder encodeCGPoint:firstPoint forKey:@"pathProperties_firstPoint"]; - [aCoder encodeFloat:tangentAtEnd forKey:@"pathProperties_tangentAtEnd"]; - [aCoder encodeInteger:cachedElementCount forKey:@"pathProperties_cachedElementCount"]; -} - -// for some reason the iPad 1 on iOS 5 needs to have this -// method coded and not synthesized. --(void) setBezierPathByFlatteningPath:(UIBezierPath *)_bezierPathByFlatteningPath{ - if(bezierPathByFlatteningPath != _bezierPathByFlatteningPath){ - [bezierPathByFlatteningPath release]; - [_bezierPathByFlatteningPath retain]; - } - bezierPathByFlatteningPath = _bezierPathByFlatteningPath; -} - --(void) dealloc{ - [bezierPathByFlatteningPath release]; - bezierPathByFlatteningPath = nil; - [super dealloc]; -} - - -@end diff --git a/ios/PerformanceBezier/PerformanceBezierTests/Info.plist b/ios/PerformanceBezier/PerformanceBezierTests/Info.plist deleted file mode 100644 index ba72822e..00000000 --- a/ios/PerformanceBezier/PerformanceBezierTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.h b/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.h deleted file mode 100644 index 775c30ac..00000000 --- a/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// PerformanceBezierAbstractTest.h -// PerformanceBezier -// -// Created by Adam Wulf on 11/20/13. -// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. -// - -#import "PerformanceBezier.h" - -@interface PerformanceBezierAbstractTest : XCTestCase - -@property (nonatomic, readonly) UIBezierPath* complexShape; - --(CGFloat) round:(CGFloat)val to:(int)digits; - --(BOOL) point:(CGPoint)p1 isNearTo:(CGPoint)p2; - --(BOOL) checkTanPoint:(CGFloat) f1 isLessThan:(CGFloat)f2; --(BOOL) check:(CGFloat) f1 isLessThan:(CGFloat)f2 within:(CGFloat)marginOfError; - -@end - diff --git a/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.m b/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.m deleted file mode 100644 index b7120121..00000000 --- a/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierAbstractTest.m +++ /dev/null @@ -1,161 +0,0 @@ -// -// PerformanceBezierAbstractTest.m -// PerformanceBezier -// -// Created by Adam Wulf on 11/20/13. -// Copyright (c) 2013 Milestone Made, LLC. All rights reserved. -// - -#import -#import "PerformanceBezierAbstractTest.h" - -#define kIntersectionPointPrecision .1 - -@implementation PerformanceBezierAbstractTest{ - UIBezierPath* complexShape; -} - -@synthesize complexShape; - --(void) setUp{ - complexShape = [UIBezierPath bezierPath]; - [complexShape moveToPoint:CGPointMake(218.500000,376.000000)]; - [complexShape addCurveToPoint:CGPointMake(227.000000,362.000000) controlPoint1:CGPointMake(218.100235,369.321564) controlPoint2:CGPointMake(222.816589,365.945923)]; - // [complexShape addCurveToPoint:CGPointMake(213.000000,372.000000) controlPoint1:CGPointMake(237.447144,352.833008) controlPoint2:CGPointMake(255.082840,326.966705)]; - [complexShape addCurveToPoint:CGPointMake(243.000000,316.000000) controlPoint1:CGPointMake(232.801880,363.107697) controlPoint2:CGPointMake(248.582321,338.033752)]; - [complexShape addCurveToPoint:CGPointMake(172.000000,218.000000) controlPoint1:CGPointMake(215.326599,286.866608) controlPoint2:CGPointMake(182.880371,258.374298)]; - [complexShape addCurveToPoint:CGPointMake(242.000000,111.000000) controlPoint1:CGPointMake(149.812820,168.222122) controlPoint2:CGPointMake(195.466583,119.790573)]; - [complexShape addCurveToPoint:CGPointMake(265.000000,109.000000) controlPoint1:CGPointMake(249.474472,108.948883) controlPoint2:CGPointMake(257.298248,108.285248)]; - [complexShape addCurveToPoint:CGPointMake(302.000000,116.000000) controlPoint1:CGPointMake(277.539948,110.401459) controlPoint2:CGPointMake(291.623962,104.844376)]; - [complexShape addCurveToPoint:CGPointMake(310.000000,148.000000) controlPoint1:CGPointMake(310.890778,124.607719) controlPoint2:CGPointMake(310.189972,136.988098)]; - [complexShape addCurveToPoint:CGPointMake(302.000000,184.000000) controlPoint1:CGPointMake(310.722900,160.600952) controlPoint2:CGPointMake(305.109131,172.145187)]; - [complexShape addCurveToPoint:CGPointMake(295.000000,221.000000) controlPoint1:CGPointMake(299.082794,196.217377) controlPoint2:CGPointMake(297.024170,208.612000)]; - [complexShape addCurveToPoint:CGPointMake(304.000000,294.000000) controlPoint1:CGPointMake(297.367493,244.586227) controlPoint2:CGPointMake(286.870880,273.642609)]; - [complexShape addCurveToPoint:CGPointMake(343.000000,305.000000) controlPoint1:CGPointMake(315.167755,304.101868) controlPoint2:CGPointMake(329.526489,302.807587)]; - [complexShape addCurveToPoint:CGPointMake(395.000000,297.000000) controlPoint1:CGPointMake(361.147430,306.169556) controlPoint2:CGPointMake(378.948700,305.707855)]; - [complexShape addCurveToPoint:CGPointMake(413.000000,285.000000) controlPoint1:CGPointMake(401.931854,294.629944) controlPoint2:CGPointMake(408.147980,290.431854)]; - [complexShape addCurveToPoint:CGPointMake(435.000000,255.000000) controlPoint1:CGPointMake(423.555023,278.199219) controlPoint2:CGPointMake(433.437531,268.110229)]; - [complexShape addCurveToPoint:CGPointMake(424.000000,228.000000) controlPoint1:CGPointMake(436.063995,245.070923) controlPoint2:CGPointMake(432.549713,233.803619)]; - [complexShape addCurveToPoint:CGPointMake(402.000000,209.000000) controlPoint1:CGPointMake(416.571869,221.776123) controlPoint2:CGPointMake(409.428101,215.223877)]; - [complexShape addCurveToPoint:CGPointMake(385.000000,183.000000) controlPoint1:CGPointMake(392.239838,203.283615) controlPoint2:CGPointMake(390.379822,191.873459)]; - [complexShape addCurveToPoint:CGPointMake(385.000000,128.000000) controlPoint1:CGPointMake(378.582947,166.163315) controlPoint2:CGPointMake(374.234924,143.960587)]; - [complexShape addCurveToPoint:CGPointMake(472.000000,105.000000) controlPoint1:CGPointMake(405.864136,103.071175) controlPoint2:CGPointMake(442.110016,95.355499)]; - [complexShape addLineToPoint:CGPointMake(472.000000,105.000000)]; - [complexShape addLineToPoint:CGPointMake(488.000000,177.000000)]; - [complexShape addCurveToPoint:CGPointMake(534.000000,177.000000) controlPoint1:CGPointMake(498.942047,187.308975) controlPoint2:CGPointMake(522.349426,190.655228)]; - [complexShape addLineToPoint:CGPointMake(534.000000,177.000000)]; - [complexShape addLineToPoint:CGPointMake(611.000000,77.000000)]; - [complexShape addCurveToPoint:CGPointMake(700.000000,111.000000) controlPoint1:CGPointMake(643.743652,54.625603) controlPoint2:CGPointMake(684.106140,80.752876)]; - [complexShape addCurveToPoint:CGPointMake(704.000000,126.000000) controlPoint1:CGPointMake(703.098755,115.324257) controlPoint2:CGPointMake(704.460693,120.742104)]; - [complexShape addCurveToPoint:CGPointMake(700.000000,156.000000) controlPoint1:CGPointMake(703.210999,136.088333) controlPoint2:CGPointMake(706.451782,146.830612)]; - [complexShape addCurveToPoint:CGPointMake(681.000000,196.000000) controlPoint1:CGPointMake(695.262329,170.166794) controlPoint2:CGPointMake(684.152832,181.086166)]; - [complexShape addCurveToPoint:CGPointMake(655.000000,246.000000) controlPoint1:CGPointMake(672.227966,212.611191) controlPoint2:CGPointMake(663.084045,229.033600)]; - [complexShape addCurveToPoint:CGPointMake(636.000000,300.000000) controlPoint1:CGPointMake(649.778381,264.429260) controlPoint2:CGPointMake(639.110535,280.894592)]; - [complexShape addCurveToPoint:CGPointMake(637.000000,374.000000) controlPoint1:CGPointMake(633.264893,324.262054) controlPoint2:CGPointMake(629.540955,350.094421)]; - [complexShape addCurveToPoint:CGPointMake(692.000000,512.000000) controlPoint1:CGPointMake(666.332947,413.789734) controlPoint2:CGPointMake(699.608032,459.043060)]; - [complexShape addCurveToPoint:CGPointMake(683.000000,536.000000) controlPoint1:CGPointMake(688.852905,519.944031) controlPoint2:CGPointMake(685.852539,527.945801)]; - [complexShape addCurveToPoint:CGPointMake(661.000000,571.000000) controlPoint1:CGPointMake(677.198853,548.592712) controlPoint2:CGPointMake(668.260010,559.289062)]; - [complexShape addCurveToPoint:CGPointMake(610.000000,619.000000) controlPoint1:CGPointMake(648.250000,590.532715) controlPoint2:CGPointMake(631.222351,608.483521)]; - [complexShape addCurveToPoint:CGPointMake(585.000000,625.000000) controlPoint1:CGPointMake(602.312439,623.111694) controlPoint2:CGPointMake(593.647827,625.135620)]; - [complexShape addCurveToPoint:CGPointMake(542.000000,612.000000) controlPoint1:CGPointMake(569.838867,626.477356) controlPoint2:CGPointMake(551.172668,629.067810)]; - [complexShape addCurveToPoint:CGPointMake(530.000000,557.000000) controlPoint1:CGPointMake(525.270691,596.196289) controlPoint2:CGPointMake(531.172729,575.895203)]; - [complexShape addCurveToPoint:CGPointMake(539.000000,514.000000) controlPoint1:CGPointMake(528.119263,541.759460) controlPoint2:CGPointMake(537.465271,528.714905)]; - [complexShape addCurveToPoint:CGPointMake(557.000000,458.000000) controlPoint1:CGPointMake(546.810364,495.904419) controlPoint2:CGPointMake(549.387146,476.172821)]; - [complexShape addCurveToPoint:CGPointMake(577.000000,334.000000) controlPoint1:CGPointMake(570.620544,419.011993) controlPoint2:CGPointMake(584.251587,375.770599)]; - [complexShape addCurveToPoint:CGPointMake(552.000000,307.000000) controlPoint1:CGPointMake(572.811646,321.661407) controlPoint2:CGPointMake(563.442261,312.060883)]; - [complexShape addCurveToPoint:CGPointMake(505.000000,304.000000) controlPoint1:CGPointMake(537.517578,299.902161) controlPoint2:CGPointMake(520.555420,301.162994)]; - [complexShape addCurveToPoint:CGPointMake(417.000000,395.000000) controlPoint1:CGPointMake(471.423096,326.244507) controlPoint2:CGPointMake(426.598511,351.118713)]; - [complexShape addCurveToPoint:CGPointMake(412.000000,423.000000) controlPoint1:CGPointMake(413.398468,403.873810) controlPoint2:CGPointMake(411.718628,413.460388)]; - [complexShape addCurveToPoint:CGPointMake(418.000000,460.000000) controlPoint1:CGPointMake(412.695190,435.349243) controlPoint2:CGPointMake(409.621643,449.299377)]; - [complexShape addCurveToPoint:CGPointMake(445.000000,488.000000) controlPoint1:CGPointMake(425.380219,470.784973) controlPoint2:CGPointMake(435.315186,479.392761)]; - [complexShape addCurveToPoint:CGPointMake(469.000000,514.000000) controlPoint1:CGPointMake(453.446838,496.144928) controlPoint2:CGPointMake(463.737061,503.078857)]; - [complexShape addCurveToPoint:CGPointMake(476.000000,562.000000) controlPoint1:CGPointMake(477.951324,528.615112) controlPoint2:CGPointMake(475.631348,545.762817)]; - [complexShape addLineToPoint:CGPointMake(476.000000,562.000000)]; - [complexShape addLineToPoint:CGPointMake(384.000000,717.000000)]; - [complexShape addCurveToPoint:CGPointMake(382.000000,740.000000) controlPoint1:CGPointMake(381.948761,724.474304) controlPoint2:CGPointMake(381.285309,732.298340)]; - [complexShape addCurveToPoint:CGPointMake(394.000000,768.000000) controlPoint1:CGPointMake(373.999329,755.779053) controlPoint2:CGPointMake(424.795959,792.055847)]; - [complexShape addCurveToPoint:CGPointMake(466.000000,790.000000) controlPoint1:CGPointMake(413.033173,794.757141) controlPoint2:CGPointMake(440.293671,789.339783)]; - [complexShape addCurveToPoint:CGPointMake(509.000000,769.000000) controlPoint1:CGPointMake(479.958252,782.095642) controlPoint2:CGPointMake(496.425812,779.557007)]; - [complexShape addCurveToPoint:CGPointMake(570.000000,717.000000) controlPoint1:CGPointMake(536.317139,759.409058) controlPoint2:CGPointMake(549.962769,734.921936)]; - [complexShape addCurveToPoint:CGPointMake(632.000000,663.000000) controlPoint1:CGPointMake(586.772034,695.344360) controlPoint2:CGPointMake(605.504700,673.223633)]; - [complexShape addCurveToPoint:CGPointMake(679.000000,654.000000) controlPoint1:CGPointMake(645.724731,654.867432) controlPoint2:CGPointMake(663.048096,650.318481)]; - [complexShape addCurveToPoint:CGPointMake(696.000000,730.000000) controlPoint1:CGPointMake(702.263611,671.121704) controlPoint2:CGPointMake(698.817200,704.461426)]; - [complexShape addCurveToPoint:CGPointMake(685.000000,758.000000) controlPoint1:CGPointMake(693.381836,739.709473) controlPoint2:CGPointMake(689.682678,749.111511)]; - [complexShape addCurveToPoint:CGPointMake(639.000000,805.000000) controlPoint1:CGPointMake(674.516968,777.568542) controlPoint2:CGPointMake(664.349304,799.584106)]; - [complexShape addCurveToPoint:CGPointMake(605.000000,809.000000) controlPoint1:CGPointMake(627.873596,807.853577) controlPoint2:CGPointMake(616.339233,807.757568)]; - [complexShape addCurveToPoint:CGPointMake(559.000000,810.000000) controlPoint1:CGPointMake(589.680847,809.707275) controlPoint2:CGPointMake(574.264648,807.876892)]; - [complexShape addCurveToPoint:CGPointMake(491.000000,832.000000) controlPoint1:CGPointMake(535.253113,811.682922) controlPoint2:CGPointMake(510.867584,818.326538)]; - [complexShape addCurveToPoint:CGPointMake(483.000000,949.000000) controlPoint1:CGPointMake(452.488922,868.759766) controlPoint2:CGPointMake(506.715942,910.094971)]; - [complexShape addCurveToPoint:CGPointMake(438.000000,971.000000) controlPoint1:CGPointMake(471.816193,962.527100) controlPoint2:CGPointMake(455.094940,970.199341)]; - [complexShape addCurveToPoint:CGPointMake(381.000000,969.000000) controlPoint1:CGPointMake(419.703827,973.256775) controlPoint2:CGPointMake(398.264557,978.824951)]; - [complexShape addCurveToPoint:CGPointMake(332.000000,894.000000) controlPoint1:CGPointMake(336.834229,961.446167) controlPoint2:CGPointMake(348.029205,921.138672)]; - [complexShape addCurveToPoint:CGPointMake(201.000000,838.000000) controlPoint1:CGPointMake(307.704529,850.152588) controlPoint2:CGPointMake(249.883804,820.437744)]; - [complexShape addCurveToPoint:CGPointMake(167.000000,881.000000) controlPoint1:CGPointMake(182.977020,844.574768) controlPoint2:CGPointMake(166.990494,861.006348)]; - [complexShape addCurveToPoint:CGPointMake(175.000000,930.000000) controlPoint1:CGPointMake(165.412155,897.691711) controlPoint2:CGPointMake(168.718536,914.566101)]; - [complexShape addCurveToPoint:CGPointMake(169.000000,974.000000) controlPoint1:CGPointMake(175.880753,944.083801) controlPoint2:CGPointMake(184.246262,962.543579)]; - [complexShape addCurveToPoint:CGPointMake(112.000000,969.000000) controlPoint1:CGPointMake(153.879868,987.139404) controlPoint2:CGPointMake(121.948792,989.663391)]; - [complexShape addCurveToPoint:CGPointMake(99.000000,945.000000) controlPoint1:CGPointMake(105.050240,962.664062) controlPoint2:CGPointMake(100.558395,954.098572)]; - [complexShape addCurveToPoint:CGPointMake(97.000000,875.000000) controlPoint1:CGPointMake(95.831497,921.925537) controlPoint2:CGPointMake(94.644936,898.300354)]; - [complexShape addCurveToPoint:CGPointMake(132.000000,821.000000) controlPoint1:CGPointMake(107.640190,856.536194) controlPoint2:CGPointMake(116.238022,835.936340)]; - [complexShape addCurveToPoint:CGPointMake(184.000000,750.000000) controlPoint1:CGPointMake(155.798218,802.971130) controlPoint2:CGPointMake(173.768723,777.893677)]; - [complexShape addCurveToPoint:CGPointMake(187.000000,687.000000) controlPoint1:CGPointMake(185.273651,729.554688) controlPoint2:CGPointMake(197.039795,707.556824)]; - [complexShape addCurveToPoint:CGPointMake(154.000000,656.000000) controlPoint1:CGPointMake(180.328445,672.368408) controlPoint2:CGPointMake(164.994644,666.234436)]; - [complexShape addCurveToPoint:CGPointMake(196.000000,600.000000) controlPoint1:CGPointMake(149.363876,627.436218) controlPoint2:CGPointMake(180.133606,615.870422)]; - [complexShape addCurveToPoint:CGPointMake(268.000000,553.000000) controlPoint1:CGPointMake(219.965149,584.441223) controlPoint2:CGPointMake(243.722717,568.280640)]; - [complexShape addCurveToPoint:CGPointMake(295.000000,494.000000) controlPoint1:CGPointMake(285.621643,544.794250) controlPoint2:CGPointMake(308.387665,515.697510)]; - [complexShape addCurveToPoint:CGPointMake(223.000000,479.000000) controlPoint1:CGPointMake(274.950104,475.730682) controlPoint2:CGPointMake(247.686523,476.989319)]; - [complexShape addCurveToPoint:CGPointMake(115.000000,488.000000) controlPoint1:CGPointMake(190.196381,488.207886) controlPoint2:CGPointMake(149.008881,507.599640)]; - [complexShape addCurveToPoint:CGPointMake(92.000000,430.000000) controlPoint1:CGPointMake(91.723808,479.934326) controlPoint2:CGPointMake(81.161568,451.403015)]; - [complexShape addCurveToPoint:CGPointMake(185.000000,434.000000) controlPoint1:CGPointMake(119.158417,409.750031) controlPoint2:CGPointMake(157.642273,416.770874)]; - [complexShape addCurveToPoint:CGPointMake(298.000000,425.000000) controlPoint1:CGPointMake(219.467361,450.346191) controlPoint2:CGPointMake(268.697144,455.229706)]; - [complexShape addCurveToPoint:CGPointMake(339.000000,443.000000) controlPoint1:CGPointMake(312.625793,410.994751) controlPoint2:CGPointMake(331.307281,429.430817)]; - [complexShape addCurveToPoint:CGPointMake(349.000000,478.000000) controlPoint1:CGPointMake(344.453400,453.933380) controlPoint2:CGPointMake(347.832184,465.856812)]; - [complexShape addCurveToPoint:CGPointMake(344.000000,540.000000) controlPoint1:CGPointMake(351.007965,498.725006) controlPoint2:CGPointMake(352.137878,520.179993)]; - [complexShape addCurveToPoint:CGPointMake(316.000000,580.000000) controlPoint1:CGPointMake(339.491791,556.244446) controlPoint2:CGPointMake(328.167419,569.066284)]; - [complexShape addCurveToPoint:CGPointMake(273.000000,620.000000) controlPoint1:CGPointMake(299.305786,590.606079) controlPoint2:CGPointMake(286.016296,605.359131)]; - [complexShape addCurveToPoint:CGPointMake(219.000000,737.000000) controlPoint1:CGPointMake(253.199554,654.579529) controlPoint2:CGPointMake(210.386047,692.031433)]; - [complexShape addCurveToPoint:CGPointMake(249.000000,759.000000) controlPoint1:CGPointMake(225.442154,748.286621) controlPoint2:CGPointMake(236.628326,756.096069)]; - [complexShape addCurveToPoint:CGPointMake(334.000000,704.000000) controlPoint1:CGPointMake(285.551544,759.768677) controlPoint2:CGPointMake(315.180786,732.848572)]; - [complexShape addCurveToPoint:CGPointMake(352.000000,664.000000) controlPoint1:CGPointMake(342.386566,691.840271) controlPoint2:CGPointMake(348.465118,678.245239)]; - [complexShape addCurveToPoint:CGPointMake(363.000000,594.000000) controlPoint1:CGPointMake(356.415161,640.814575) controlPoint2:CGPointMake(362.213562,617.716248)]; - [complexShape addCurveToPoint:CGPointMake(375.000000,545.000000) controlPoint1:CGPointMake(364.278687,577.084534) controlPoint2:CGPointMake(369.613586,560.946472)]; - [complexShape addCurveToPoint:CGPointMake(370.000000,449.000000) controlPoint1:CGPointMake(385.057648,514.062866) controlPoint2:CGPointMake(387.877350,477.758911)]; - [complexShape addLineToPoint:CGPointMake(370.000000,449.000000)]; - [complexShape addLineToPoint:CGPointMake(349.000000,394.000000)]; - [complexShape addCurveToPoint:CGPointMake(317.000000,376.000000) controlPoint1:CGPointMake(342.462463,381.669800) controlPoint2:CGPointMake(329.632996,375.483673)]; - [complexShape addCurveToPoint:CGPointMake(288.000000,392.000000) controlPoint1:CGPointMake(302.854156,369.438843) controlPoint2:CGPointMake(296.932526,386.031342)]; - [complexShape closePath]; - [super setUp]; -} - -- (void)tearDown -{ - // Put teardown code here; it will be run once, after the last test case. - [super tearDown]; -} - --(CGFloat) round:(CGFloat)val to:(int)digits{ - double factor = pow(10, digits); - return roundf(val * factor) / factor; -} - --(BOOL) point:(CGPoint)p1 isNearTo:(CGPoint)p2{ - CGFloat xDiff = ABS(p2.x - p1.x); - CGFloat yDiff = ABS(p2.y - p1.y); - return xDiff < kIntersectionPointPrecision && yDiff < kIntersectionPointPrecision; -} - - --(BOOL) check:(CGFloat) f1 isLessThan:(CGFloat)f2 within:(CGFloat)marginOfError{ - if(f1 <= (f2 * (1.0f+marginOfError))){ - return YES; - } - NSLog(@"float value %f is > %f", f1, f2); - return NO; -} - --(BOOL) checkTanPoint:(CGFloat) f1 isLessThan:(CGFloat)f2{ - return [self check:f1 isLessThan:f2 within:.2]; -} - -@end diff --git a/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierClockwiseTests.m b/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierClockwiseTests.m deleted file mode 100644 index 5cbd788e..00000000 --- a/ios/PerformanceBezier/PerformanceBezierTests/PerformanceBezierClockwiseTests.m +++ /dev/null @@ -1,189 +0,0 @@ -// -// PerformanceBezierClockwiseTests.m -// PerformanceBezier -// -// Created by Adam Wulf on 1/7/14. -// Copyright (c) 2014 Milestone Made, LLC. All rights reserved. -// - -#import -#import "PerformanceBezierAbstractTest.h" - -@interface PerformanceBezierClockwiseTests : PerformanceBezierAbstractTest - -@end - -@implementation PerformanceBezierClockwiseTests - -- (void)setUp -{ - [super setUp]; - // Put setup code here; it will be run once, before the first test case. -} - -- (void)tearDown -{ - // Put teardown code here; it will be run once, after the last test case. - [super tearDown]; -} - -- (void)testLinearCounterClockwise -{ - UIBezierPath* simplePath = [UIBezierPath bezierPath]; - [simplePath moveToPoint:CGPointMake(100, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 99)]; - - XCTAssertTrue(![simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testLinearClockwise -{ - UIBezierPath* simplePath = [UIBezierPath bezierPath]; - [simplePath moveToPoint:CGPointMake(100, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 101)]; - - XCTAssertTrue(![simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testLinearEmptyShape -{ - UIBezierPath* simplePath = [UIBezierPath bezierPath]; - [simplePath moveToPoint:CGPointMake(100, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 101)]; - [simplePath closePath]; - - XCTAssertTrue([simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testLinearEmptyShape2 -{ - UIBezierPath* simplePath = [UIBezierPath bezierPath]; - [simplePath moveToPoint:CGPointMake(100, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 100)]; - [simplePath addLineToPoint:CGPointMake(200, 99)]; - [simplePath closePath]; - - XCTAssertTrue(![simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testSimpleClockwiseCurve -{ - UIBezierPath* simplePath = [UIBezierPath bezierPath]; - [simplePath moveToPoint:CGPointMake(100, 100)]; - [simplePath addCurveToPoint:CGPointMake(200, 100) controlPoint1:CGPointMake(100, 0) controlPoint2:CGPointMake(200, 0)]; - - XCTAssertTrue([simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testSimpleCounterClockwiseCurve -{ - UIBezierPath* simplePath = [UIBezierPath bezierPath]; - [simplePath moveToPoint:CGPointMake(100, 100)]; - [simplePath addCurveToPoint:CGPointMake(200, 100) controlPoint1:CGPointMake(100, 200) controlPoint2:CGPointMake(200, 200)]; - - XCTAssertTrue(![simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testSimplePath -{ - UIBezierPath* simplePath = [UIBezierPath bezierPathWithArcCenter:CGPointZero radius:10 startAngle:0 endAngle:M_PI clockwise:YES]; - - XCTAssertTrue([simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testSimplePath2 -{ - UIBezierPath* simplePath = [UIBezierPath bezierPathWithArcCenter:CGPointZero radius:10 startAngle:0 endAngle:M_PI clockwise:NO]; - - XCTAssertTrue(![simplePath isClockwise], @"clockwise is correct"); -} - -- (void)testComplexPath -{ - XCTAssertTrue([self.complexShape isClockwise], @"clockwise is correct"); -} - -- (void)testReversedComplexPath -{ - XCTAssertTrue(![[self.complexShape bezierPathByReversingPath] isClockwise], @"clockwise is correct"); -} - -- (void)testFirstAndLastPointRect { - // This is an example of a functional test case. - - UIBezierPath* path1 = [UIBezierPath bezierPathWithRect:CGRectMake(10, 10, 20, 20)]; - XCTAssertEqual([path1 elementCount], 5, "element count is correct"); - XCTAssertEqual([path1 firstPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 firstPoint].y, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].y, (CGFloat) 10, "element count is correct"); -} - -- (void)testFirstAndLastPointLine { - // This is an example of a functional test case. - - UIBezierPath* path1 = [UIBezierPath bezierPath]; - [path1 moveToPoint:CGPointMake(10, 10)]; - [path1 addLineToPoint:CGPointMake(30, 30)]; - XCTAssertEqual([path1 elementCount], 2, "element count is correct"); - XCTAssertEqual([path1 firstPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 firstPoint].y, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].x, (CGFloat) 30, "element count is correct"); - XCTAssertEqual([path1 lastPoint].y, (CGFloat) 30, "element count is correct"); -} - - -- (void)testFirstAndLastPointCurve { - // This is an example of a functional test case. - - UIBezierPath* path1 = [UIBezierPath bezierPath]; - [path1 moveToPoint:CGPointMake(10, 10)]; - [path1 addCurveToPoint:CGPointMake(30, 30) controlPoint1:CGPointMake(15, 15) controlPoint2:CGPointMake(25, 25)]; - XCTAssertEqual([path1 elementCount], 2, "element count is correct"); - XCTAssertEqual([path1 firstPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 firstPoint].y, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].x, (CGFloat) 30, "element count is correct"); - XCTAssertEqual([path1 lastPoint].y, (CGFloat) 30, "element count is correct"); -} - -- (void)testFirstAndLastPointQuadCurve { - // This is an example of a functional test case. - - UIBezierPath* path1 = [UIBezierPath bezierPath]; - [path1 moveToPoint:CGPointMake(10, 10)]; - [path1 addQuadCurveToPoint:CGPointMake(30, 30) controlPoint:CGPointMake(20, 20)]; - XCTAssertEqual([path1 elementCount], 2, "element count is correct"); - XCTAssertEqual([path1 firstPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 firstPoint].y, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].x, (CGFloat) 30, "element count is correct"); - XCTAssertEqual([path1 lastPoint].y, (CGFloat) 30, "element count is correct"); -} - -- (void)testFirstAndLastPointMoveTo { - // This is an example of a functional test case. - - UIBezierPath* path1 = [UIBezierPath bezierPath]; - [path1 moveToPoint:CGPointMake(10, 10)]; - XCTAssertEqual([path1 elementCount], 1, "element count is correct"); - XCTAssertEqual([path1 firstPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 firstPoint].y, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].y, (CGFloat) 10, "element count is correct"); -} - -- (void)testFirstAndLastPointMoveTo2 { - // This is an example of a functional test case. - - UIBezierPath* path1 = [UIBezierPath bezierPathWithRect:CGRectMake(10, 10, 20, 20)]; - [path1 moveToPoint:CGPointMake(50, 50)]; - XCTAssertEqual([path1 elementCount], 6, "element count is correct"); - XCTAssertEqual([path1 firstPoint].x, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 firstPoint].y, (CGFloat) 10, "element count is correct"); - XCTAssertEqual([path1 lastPoint].x, (CGFloat) 50, "element count is correct"); - XCTAssertEqual([path1 lastPoint].y, (CGFloat) 50, "element count is correct"); -} - -@end diff --git a/ios/PerformanceBezier/README.md b/ios/PerformanceBezier/README.md deleted file mode 100644 index efebe748..00000000 --- a/ios/PerformanceBezier/README.md +++ /dev/null @@ -1,67 +0,0 @@ -iOS UIBezierPath Performance -===== - -This code dramatically improves performance for common UIBezierPath operations, and it also -brings UIBezierPath API closer to its NSBezierPath counterpart. For full background of this -repo, checkout [the blogpost explaining what this framework does](http://blog.getlooseleaf.com/post/110511009139/improving-uibezierpath-performance-and-api). - -This code was originally part of [Loose Leaf](https://getlooseleaf.com/). Additional components and -libraries from the app [have also been open sourced](https://getlooseleaf.com/opensource/). - -## What is this? - -This framework adds caching into every UIBezierPath so that common operations can -be performed in constant time. It also adds some missing NSBezierPath methods to the -UIBezierPath class. - -After linking this framework into your project, all Bezier paths will automatically be upgraded -to use this new caching. No custom UIBezierPath allocation or initialization is required. - -For example, by default there is no O(1) way to retrieve elements from a UIBezierPath. In order to -retrieve the first point of the curve, you must CGPathApply() and interate over the entire path -to retrieve that single point. This framework changes that. For many algorithms, this can -dramatically affect performance. - -## Are you using PerformanceBezier? - -Let me know! I'd love to know where PerformanceBezier is using and how it's affecting your apps. Ping me -at [@adamwulf](https://twitter.com/adamwulf)! - -Also - If you like PerformanceBezier, then you'll _love_ [ClippingBezier](https://github.com/adamwulf/ClippingBezier) - an easy way to find intersecting points, lines, and shapes between two UIBezierPaths. - -## Documentation - -View the header files for full documentation. - -## Building the framework - -This library will generate a proper static framework bundle that can be used in any iOS7+ project. - -## Including in your project - -1. Link against the built framework. -2. Add "-ObjC++ -lstdc++" to the Other Linker Flags in the project's Settings -3. #import <PerformanceBezier/PerformanceBezier.h> - -## JRSwizzle - -This framework includes and uses the [JRSwizzle](https://github.com/rentzsch/jrswizzle) library, which is -licensed under the MIT license. - -## License - -Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 United States License. - -For attribution, please include: - -1. Mention original author "Adam Wulf for Loose Leaf app" -2. Link to https://getlooseleaf.com/opensource/ -3. Link to https://github.com/adamwulf/PerformanceBezier - - - -## Support this framework - -This framework is created by Adam Wulf ([@adamwulf](https://twitter.com/adamwulf)) as a part of the [Loose Leaf app](https://getlooseleaf.com). - -[Buy the app](https://itunes.apple.com/us/app/loose-leaf/id625659452?mt=8&uo=4&at=10lNUI&ct=github) to show your support! :) diff --git a/ios/PerformanceBezier/SubdivideLicense b/ios/PerformanceBezier/SubdivideLicense deleted file mode 100644 index 119a1a69..00000000 --- a/ios/PerformanceBezier/SubdivideLicense +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Bezier path utility category (trimming) -* -* (c) 2004 Alastair J. Houghton -* All Rights Reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* -* 3. The name of the author of this software may not be used to endorse -* or promote products derived from the software without specific prior -* written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS -* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -* IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO -* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; -* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ \ No newline at end of file diff --git a/ios/Text/RNSVGTSpan.m b/ios/Text/RNSVGTSpan.m index 7cbac8ab..ddb63881 100644 --- a/ios/Text/RNSVGTSpan.m +++ b/ios/Text/RNSVGTSpan.m @@ -825,7 +825,7 @@ CGFloat getTextAnchorOffset(enum TextAnchor textAnchor, CGFloat width) textPathPath = [textPath getPath]; _path = [UIBezierPath bezierPathWithCGPath:[textPathPath getPath:nil]]; _path = [_path bezierPathByFlatteningPathAndImmutable:YES]; - pathLength = [_path length]; + pathLength = [_path pathLength]; isClosed = [_path isClosed]; return NO; } diff --git a/package.json b/package.json index c50cfcb7..5a25a8c7 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "5.4.1", + "version": "6.0.0-rc1", "name": "react-native-svg", "description": "SVG library for react-native", "repository": {