From 1aa4f36c80ff11faf5562474f65cf466e480b210 Mon Sep 17 00:00:00 2001 From: Wade Brainerd Date: Tue, 01 Apr 2008 12:22:16 +0000 Subject: Initial commit of Colors! v3. --- diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..10926e8 --- /dev/null +++ b/COPYING @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..d51bc81 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,29 @@ +NEWS +MANIFEST +COPYING +colors.py +colorsc.py +_colorsc.so +setup.py +src/gtk_types.h +src/canvas.h +src/setup.py +src/colorsc.h +src/palette.cpp +src/canvas.cpp +src/colorsc_wrap.cxx +src/drwfile.h +src/palette.h +src/colorsc.i +data/INDEX +data/lounge.png +data/lounge.drw +data/intro.png +data/intro.drw +data/castle.png +data/castle.drw +icons/erase.svg +icons/palette.svg +icons/reference.svg +activity/activity.info +activity/activity.svg diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..3739edd --- /dev/null +++ b/NEWS @@ -0,0 +1,14 @@ +Colors-3 + +* Add icons & descriptions to samples. +* Fix various bugs. + +Colors-2 + +* Fixed palette display. +* Fixed Journal integration. + +Colors-1 + +* Initial release. Most features basically work, but there are bugs, usability and +memory issues. diff --git a/_colorsc.so b/_colorsc.so new file mode 100755 index 0000000..ed1e62a --- /dev/null +++ b/_colorsc.so Binary files differ diff --git a/activity/activity.info b/activity/activity.info new file mode 100644 index 0000000..7ccb003 --- /dev/null +++ b/activity/activity.info @@ -0,0 +1,7 @@ +[Activity] +name = Colors! +activity_version = 3 +host_version = 1 +service_name = org.laptop.community.Colors +icon = activity +exec = sugar-activity colors.Colors diff --git a/activity/activity.svg b/activity/activity.svg new file mode 100644 index 0000000..8ed9c46 --- /dev/null +++ b/activity/activity.svg @@ -0,0 +1,96 @@ + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/colors.changes b/colors.changes new file mode 100644 index 0000000..21efe12 --- /dev/null +++ b/colors.changes @@ -0,0 +1,5 @@ +Colors-3.xo + + * Initial push of Colors!. + + -- Wade Brainerd March 25th, 2008 diff --git a/colors.py b/colors.py new file mode 100755 index 0000000..4666f6d --- /dev/null +++ b/colors.py @@ -0,0 +1,1539 @@ +# Copyright 2008 by Jens Andersson and Wade Brainerd. +# This file is part of Colors! XO. +# +# Colors is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Colors is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Colors. If not, see . +#!/usr/bin/env python +"""Colors! XO painting activity. Based on Colors! by Collecting Smiles.""" + +# Note- I had to rename the self.canvas object *self.easel* for now, because the stupid sugar.window.Window +# super class of Activity has its own "canvas" member. If anyone has a better name, feel free to change it. + +# Reference links: +# +# Colors! - http://wiki.laptop.org/go/Colors! +# PyGTK - http://www.pygtk.org/pygtk2reference/ +# Sugar - http://dev.laptop.org/~cscott/joyride-1477-api/ +# GStreamer - http://pygstdocs.berlios.de/pygst-reference/index.html +# Activities - http://wiki.laptop.org/go/Sugar_Activity_Tutorial +# Sharing - http://wiki.laptop.org/go/Shared_Sugar_Activities + +# Import standard Python modules. +import logging, os, math, time, copy, json +from gettext import gettext as _ + +# Import the C++ component of the activity. +from colorsc import * + +# Import PyGTK. +import gobject, pygtk, gtk, pango +# Needed to avoid thread crashes with GStreamer +gobject.threads_init() + +# Import DBUS and mesh networking modules. +import dbus, telepathy, telepathy.client +from dbus import Interface +from dbus.service import method, signal +from dbus.gobject_service import ExportedGObject +from sugar.presence.tubeconn import TubeConnection +from sugar.presence import presenceservice + +# Import Sugar UI modules. +from sugar import graphics +from sugar.activity import activity +from sugar.graphics import * +from sugar.graphics import toggletoolbutton + +# Import GStreamer (for camera access). +import pygst, gst + +# Initialize logging. +log = logging.getLogger('Colors run') +log.setLevel(logging.DEBUG) +logging.basicConfig() + +# Track memory leaks. +#import gc +#gc.set_debug(gc.DEBUG_LEAK) + +# DBUS identifiers are used to uniquely identify the activity for network communcations. +DBUS_IFACE = "org.laptop.community.Colors" +DBUS_PATH = "/org/laptop/community/Colors" +DBUS_SERVICE = DBUS_IFACE + +# This is the overlay that appears when the user presses the Palette toobar button. It covers the entire screen, +# and offers controls for brush type, size, opacity, and color. +# +# The color wheel and triangle are rendered into GdkImage objects by C++ code in palette.h / palette.cpp which +# is compiled into the colorsc module. +class BrushControlsPanel(gtk.HBox): + PALETTE_SIZE = 500 + PREVIEW_SIZE = 250 + BRUSHTYPE_SIZE = 100 + + def __init__ (self): + gtk.HBox.__init__(self) + self.set_property("spacing", 20) + self.set_border_width(50) + + # Locally managed Brush object. + self.brush = Brush() + + # Palette wheel widget. + palbox = gtk.VBox() + self.palette = Palette(BrushControlsPanel.PALETTE_SIZE) + self.paletteimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), BrushControlsPanel.PALETTE_SIZE, BrushControlsPanel.PALETTE_SIZE) + self.palette.render_wheel(self.paletteimage) + self.palette.render_triangle(self.paletteimage) + self.palettearea = gtk.DrawingArea() + self.palettearea.set_size_request(BrushControlsPanel.PALETTE_SIZE, BrushControlsPanel.PALETTE_SIZE) + self.palettearea.add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK) + self.palettearea.connect('expose-event', self.on_palette_expose) + self.palettearea.connect('motion-notify-event', self.on_palette_mouse) + self.palettearea.connect('button-press-event', self.on_palette_mouse) + self.palettearea.connect('button-release-event', self.on_palette_mouse) + palbox.pack_start(self.palettearea, False, False) + self.pack_start(palbox, False) + + # Brush size scrollbar, label and pressure sensitivity checkbox. + sizebox = gtk.VBox() + sizelabel = gtk.Label(_('Brush Size')) + sizebox.pack_end(sizelabel, False) + self.size = gtk.Adjustment(50, 1, 260, 1, 10, 10) + self.sizebar = gtk.VScale(self.size) + self.sizebar.set_property("draw-value", False) + self.sizebar.set_property("inverted", True) + self.sizebar.connect('value-changed', self.on_size_change) + sizebox.pack_end(self.sizebar) + self.sizecheck = gtk.CheckButton(_('Pressure\nSensitive')) + self.sizecheck.connect('toggled', self.on_variable_size_toggle) + sizebox.pack_end(self.sizecheck, False) + self.pack_start(sizebox, False) + + # Brush opacity scrollbar, label and pressure sensitivity checkbox. + opacitybox = gtk.VBox() + opacitylabel = gtk.Label(_('Brush Opacity')) + opacitybox.pack_end(opacitylabel, False) + self.opacity = gtk.Adjustment(0, 0, 1.1, 0.001, 0.1, 0.1) + self.opacitybar = gtk.VScale(self.opacity) + self.opacitybar.set_property("draw-value", False) + self.opacitybar.set_property("inverted", True) + self.opacitybar.connect('value-changed', self.on_opacity_change) + opacitybox.pack_end(self.opacitybar) + self.opacitycheck = gtk.CheckButton(_('Pressure\nSensitive')) + self.opacitycheck.connect('toggled', self.on_variable_opacity_toggle) + opacitybox.pack_end(self.opacitycheck, False) + self.pack_start(opacitybox, False) + + # Force column scrollbars to be equal width. + group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) + group.add_widget(sizebox) + group.add_widget(opacitybox) + + # Brush preview widget. + brushbox = gtk.VBox() + brushbox.set_property("spacing", 20) + + self.preview = BrushPreview(BrushControlsPanel.PREVIEW_SIZE) + self.previewimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), BrushControlsPanel.PREVIEW_SIZE, BrushControlsPanel.PREVIEW_SIZE) + self.previewarea = gtk.DrawingArea() + self.previewarea.set_size_request(BrushControlsPanel.PREVIEW_SIZE, BrushControlsPanel.PREVIEW_SIZE) + self.previewarea.connect('expose-event', self.on_preview_expose) + brushbox.pack_start(self.previewarea, False) + + # Brush type selection widgets. + self.brushbtns = [] + brushtbl = gtk.Table(1, 2) + brushtbl.set_col_spacings(5) + brushtbl.attach(self.create_brushtype_widget(BrushType.BRUSHTYPE_SOFT), 0, 1, 0, 1) + brushtbl.attach(self.create_brushtype_widget(BrushType.BRUSHTYPE_HARD), 1, 2, 0, 1) + + brushbox.pack_start(brushtbl, False) + + self.pack_start(brushbox, False) + + self.in_toggle_cb = False + + def create_brushtype_widget (self, type): + brusharea = gtk.DrawingArea() + brusharea.set_size_request(BrushControlsPanel.BRUSHTYPE_SIZE, BrushControlsPanel.BRUSHTYPE_SIZE) + brusharea.connect('expose-event', self.on_brushtype_expose) + brusharea.preview = BrushPreview(BrushControlsPanel.BRUSHTYPE_SIZE) + brusharea.preview.brush.size = int(BrushControlsPanel.BRUSHTYPE_SIZE*0.75) + brusharea.preview.brush.type = type + brusharea.preview.brush.color = Color(0,0,0,0) + brusharea.previewimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), BrushControlsPanel.BRUSHTYPE_SIZE, BrushControlsPanel.BRUSHTYPE_SIZE) + brusharea.preview.render(brusharea.previewimage) + brushbtn = gtk.ToggleButton() + brushbtn.set_image(brusharea) + brushbtn.connect('toggled', self.on_brushtype_toggle) + brushbtn.brushtype = type + self.brushbtns.append(brushbtn) + return brushbtn + + def set_brush (self, brush): + self.brush = brush + self.opacity.set_value(brush.opacity) + self.size.set_value(brush.size) + self.palette.set_color(brush.color) + self.opacitycheck.set_active((brush.control & Brush.BRUSHCONTROL_VARIABLEOPACITY) != 0) + self.sizecheck.set_active((brush.control & Brush.BRUSHCONTROL_VARIABLESIZE) != 0) + self.update_brushtype_btns() + + def on_size_change (self, event): + self.brush.size = int(self.size.get_value()) + self.previewarea.queue_draw() + + def on_opacity_change (self, event): + self.brush.opacity = self.opacity.get_value() + self.previewarea.queue_draw() + + def on_variable_size_toggle (self, event): + if self.sizecheck.get_active(): + self.brush.control |= Brush.BRUSHCONTROL_VARIABLESIZE + else: + self.brush.control &= ~Brush.BRUSHCONTROL_VARIABLESIZE + + def on_variable_opacity_toggle (self, event): + if self.opacitycheck.get_active(): + self.brush.control |= Brush.BRUSHCONTROL_VARIABLEOPACITY + else: + self.brush.control &= ~Brush.BRUSHCONTROL_VARIABLEOPACITY + + def on_palette_expose (self, widget, event): + self.cur_style = self.palettearea.get_style() + self.cur_gc = self.cur_style.fg_gc[gtk.STATE_NORMAL] + + # Draw palette image. + self.palette.render_triangle(self.paletteimage) + self.palettearea.window.draw_image(self.cur_gc, self.paletteimage, 0, 0, 0, 0, -1, -1) + + # Draw circles to indicate selected color. + # todo- Better looking circles. + r = int(self.palette.WHEEL_WIDTH*0.75) + + self.cur_gc.foreground = self.palettearea.get_colormap().alloc_color(16384,16384,16384) + self.cur_gc.line_width = 2 + + wheel_pos = self.palette.get_wheel_pos() + tri_pos = self.palette.get_triangle_pos() + + self.palettearea.window.draw_arc(self.cur_gc, False, int(wheel_pos.x-r/2+2), int(wheel_pos.y-r/2+2), r-4, r-4, 0, 360*64) + self.palettearea.window.draw_arc(self.cur_gc, False, int(tri_pos.x-r/2+2), int(tri_pos.y-r/2+2), r-4, r-4, 0, 360*64) + + self.cur_gc.foreground = self.palettearea.get_colormap().alloc_color(65535,65535,65535) + self.cur_gc.line_width = 2 + + self.palettearea.window.draw_arc(self.cur_gc, False, int(wheel_pos.x-r/2), int(wheel_pos.y-r/2), r, r, 0, 360*64) + self.palettearea.window.draw_arc(self.cur_gc, False, int(tri_pos.x-r/2), int(tri_pos.y-r/2), r, r, 0, 360*64) + + def on_palette_mouse (self, widget, event): + if event.state & gtk.gdk.BUTTON1_MASK: + widget.grab_focus() + self.palette.process_mouse(int(event.x), int(event.y)) + self.palettearea.queue_draw() + self.brush.color = self.palette.get_color() + self.previewarea.queue_draw() + if event.type == gtk.gdk.BUTTON_RELEASE: + self.palette.process_mouse_release() + + def on_preview_expose (self, widget, event): + self.preview.brush = self.brush + self.preview.brush.size = self.brush.size*2 # Mimic 2x canvas scaling. + self.preview.render(self.previewimage) + self.previewarea.window.draw_image(widget.get_style().fg_gc[gtk.STATE_NORMAL], self.previewimage, 0, 0, 0, 0, -1, -1) + + def on_brushtype_expose (self, widget, event): + widget.window.draw_image(widget.get_style().fg_gc[gtk.STATE_NORMAL], widget.previewimage, 0, 0, 0, 0, -1, -1) + + # Manually implemented radio button using ToggleButtons. + def update_brushtype_btns (self): + for b in self.brushbtns: + b.set_active(b.brushtype == self.brush.type) + + def on_brushtype_toggle (self, widget): + if self.in_toggle_cb: + return + self.in_toggle_cb = True + + self.brush.type = widget.brushtype + self.update_brushtype_btns() + self.previewarea.queue_draw() + + self.in_toggle_cb = False + +# This is the overlay that appears when playing back large numbers of drawing commands. +# It simply shows how much work is left to do and that progress is taking place. +class ProgressPanel(gtk.VBox): + def __init__ (self): + gtk.VBox.__init__(self) + self.set_border_width(50) + + self.label = gtk.Label() + self.label.set_markup(""+_("Working...")+"") + self.progress = gtk.ProgressBar() + self.progress.set_fraction(0.5) + self.progress.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT) + + vbox = gtk.VBox() + vbox.set_property("spacing", 20) + + vbox.pack_start(self.label, False) + vbox.pack_start(self.progress, False) + + self.pack_start(vbox, True, False) + +# This is the main Colors! activity class. +# +# It owns the main application window, the painting canvas, and all the various toolbars and options. +class Colors(activity.Activity, ExportedGObject): + # Application mode definitions. + MODE_INTRO = 0 + MODE_PLAYBACK = 1 + MODE_CANVAS = 2 + MODE_SCROLL = 3 + MODE_PALETTE = 4 + MODE_REFERENCE = 5 + + # Button definitions + BUTTON_PALETTE = 1<<0 + BUTTON_REFERENCE = 1<<1 + BUTTON_VIDEOPAINT = 1<<2 + BUTTON_SCROLL = 1<<3 + BUTTON_PICK = 1<<4 + BUTTON_ZOOM_IN = 1<<5 + BUTTON_ZOOM_OUT = 1<<6 + BUTTON_SIZE_0 = 1<<7 + BUTTON_SIZE_1 = 1<<8 + BUTTON_SIZE_2 = 1<<9 + BUTTON_SIZE_3 = 1<<10 + BUTTON_TOUCH = 1<<11 + + # Number of drawing steps to execute between progress bar updates. More updates means faster overall drawing + # but a less responsive UI. + PROGRESS_DELTA = 50 + + def __init__ (self, handle): + activity.Activity.__init__(self, handle) + self.set_title(_("Colors!")) + + # Uncomment to test out a bunch of the C++ heavy lifting APIs. Takes awhile on the XO though. + #self.benchmark() + + # Get activity size. What we really need is the size of the canvasarea, not including the toolbox. + # This will be figured out on the first paint event, once everything is resized. + self.width = gtk.gdk.screen_width() + self.height = gtk.gdk.screen_height() + + # Set up various systems. + self.init_input() + self.init_zoom() + self.init_scroll() + + # Build the toolbar. + self.build_toolbar() + + # Set up drawing canvas (which is also the parent for any popup widgets like the brush controls). + self.build_canvas() + + # Build the brush control popup window. + self.build_brush_controls() + + # Build the progress display popup window. + self.build_progress() + + # Start camera processing. + self.init_camera() + + # Set the initial mode to None, it will be set to Intro on the first update. + self.mode = None + + # Set up mesh networking. + self.init_mesh() + + # Start the framerate timer. + gobject.idle_add(self.tick) + + # This has to happen last, because it calls the read_file method when restoring from the Journal. + self.set_canvas(self.easelarea) + + # Reveal the main window (but not the panels). + self.show_all() + self.brush_controls.hide() + self.progress.hide() + self.overlay_active = False + + #----------------------------------------------------------------------------------------------------------------- + # User interface construction + + def build_canvas (self): + # The canvasarea is the main window which covers the entire screen below the toolbar. + self.easelarea = gtk.Layout() + self.easelarea.set_size_request(gtk.gdk.screen_width(), gtk.gdk.screen_height()) + self.easelarea.set_flags(gtk.CAN_FOCUS) + + self.set_double_buffered(False) + self.easelarea.set_double_buffered(False) + + # Set up GTK events for the canvasarea. + self.easelarea.add_events(gtk.gdk.POINTER_MOTION_MASK|gtk.gdk.POINTER_MOTION_HINT_MASK) + self.easelarea.add_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.BUTTON_RELEASE_MASK) + self.easelarea.add_events(gtk.gdk.KEY_PRESS_MASK|gtk.gdk.KEY_RELEASE_MASK) + + # The actual drawing canvas is at 1/2 resolution, which improves performance by 4x and still leaves a decent + # painting resolution of 600x400 on the XO. + self.easel = Canvas(self.width/2, self.height/2) + self.set_brush(self.easel.brush) + + # The Canvas internally stores the image as 32bit. When rendering, it scales up and blits into canvasimage, + # which is in the native 565 resolution of the XO. Then canvasimage is drawn into the canvasarea DrawingArea. + self.easelimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), self.width, self.height) + + # Now that we have a canvas, connect the rest of the events. + self.easelarea.connect('expose-event', self.on_canvasarea_expose) + self.easelarea.connect('expose-event', self.on_canvasarea_expose) + self.easelarea.connect('key-press-event', self.on_key_event) + self.easelarea.connect('key-release-event', self.on_key_event) + self.easelarea.connect('button-press-event', self.on_mouse_button) + self.easelarea.connect('button-release-event', self.on_mouse_button) + self.easelarea.connect('motion-notify-event', self.on_mouse_motion) + + def build_brush_controls (self): + self.brush_controls = BrushControlsPanel() + self.brush_controls.set_size_request(gtk.gdk.screen_width(), gtk.gdk.screen_height()) + self.easelarea.put(self.brush_controls, 0, 0) + + def build_progress (self): + self.progress = ProgressPanel() + self.progress.set_size_request(gtk.gdk.screen_width(), gtk.gdk.screen_height()) + self.easelarea.put(self.progress, 0, 0) + + def build_toolbar (self): + # Painting controls (palette, zoom, etc) + self.palettebtn = toggletoolbutton.ToggleToolButton('palette') + self.palettebtn.set_tooltip(_("Palette")) + self.palettebtn.connect('clicked', self.on_palette) + self.palette_forced = False + + # todo- Color picker button, similar semantics to palette button. + + #self.zoomoutbtn = toolbutton.ToolButton('zoom-out') + #self.zoomoutbtn.set_tooltip(_("Zoom Out")) + #self.zoominbtn = toolbutton.ToolButton('zoom-in') + #self.zoominbtn.set_tooltip(_("Zoom In")) + + self.refsep = gtk.SeparatorToolItem() + + self.takerefbtn = toolbutton.ToolButton('reference') + self.takerefbtn.set_tooltip(_("Take Reference Picture")) + self.takerefbtn.connect('clicked', self.on_take_reference) + self.take_reference = False + + self.showrefbtn = toggletoolbutton.ToggleToolButton('zoom-out') + self.showrefbtn.set_tooltip(_("Show Reference Picture")) + self.showrefbtn.connect('clicked', self.on_show_reference) + self.reference_forced = False + + self.videopaintsep = gtk.SeparatorToolItem() + + self.videopaintbtn = toggletoolbutton.ToggleToolButton('zoom-out') + self.videopaintbtn.set_tooltip(_("Video Paint")) + self.videopaintbtn.connect('clicked', self.on_videopaint) + self.videopaintpreview = gtk.DrawingArea() + self.videopaintpreview.set_size_request(Canvas.VIDEO_WIDTH, Canvas.VIDEO_HEIGHT) + self.videopaintpreview.connect('expose-event', self.on_videopaintpreview_expose) + self.videopaintitem = gtk.ToolItem() + self.videopaintitem.add(self.videopaintpreview) + self.videopaintimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), Canvas.VIDEO_WIDTH, Canvas.VIDEO_HEIGHT) + self.videopaint_enabled = False + + self.clearsep = gtk.SeparatorToolItem() + self.clearsep.set_expand(True) + self.clearsep.set_draw(False) + + self.clearbtn = toolbutton.ToolButton('erase') + self.clearbtn.set_tooltip(_("Start Over")) + self.clearbtn.connect('clicked', self.on_clear) + + paintbox = gtk.Toolbar() + paintbox.insert(self.palettebtn, -1) + #paintbox.insert(self.zoomoutbtn, -1) + #paintbox.insert(self.zoominbtn, -1) + paintbox.insert(self.refsep, -1) + paintbox.insert(self.takerefbtn, -1) + paintbox.insert(self.showrefbtn, -1) + paintbox.insert(self.videopaintsep, -1) + paintbox.insert(self.videopaintbtn, -1) + paintbox.insert(self.videopaintitem, -1) + paintbox.insert(self.clearsep, -1) + paintbox.insert(self.clearbtn, -1) + + # Playback controls + self.startbtn = toolbutton.ToolButton('media-playback-start') + self.startbtn.set_tooltip(_("Start Playback")) + self.startbtn.connect('clicked', self.on_play) + + self.pausebtn = toolbutton.ToolButton('media-playback-pause') + self.pausebtn.set_tooltip(_("Pause Playback")) + self.pausebtn.connect('clicked', self.on_pause) + + self.beginbtn = toolbutton.ToolButton('media-seek-backward') + self.beginbtn.set_tooltip(_("Skip To Beginning")) + self.beginbtn.connect('clicked', self.on_skip_begin) + + self.endbtn = toolbutton.ToolButton('media-seek-forward') + self.endbtn.connect('clicked', self.on_skip_end) + self.endbtn.set_tooltip(_("Skip To End")) + + # Position bar + self.playbackpossep = gtk.SeparatorToolItem() + self.playbackpossep.set_draw(True) + + self.playbackpos = gtk.Adjustment(0, 0, 110, 1, 10, 10) + self.playbackposbar = gtk.HScale(self.playbackpos) + self.playbackposbar.connect('value-changed', self.on_playbackposbar_change) + self.playbackposbar.ignore_change = 0 + + self.playbackpositem = gtk.ToolItem() + self.playbackpositem.set_expand(True) + self.playbackpositem.add(self.playbackposbar) + + playbox = gtk.Toolbar() + playbox.insert(self.startbtn, -1) + playbox.insert(self.pausebtn, -1) + playbox.insert(self.beginbtn, -1) + playbox.insert(self.endbtn, -1) + playbox.insert(self.playbackpossep, -1) + playbox.insert(self.playbackpositem, -1) + + # Sample files to learn from. Reads the list from an INDEX file in the data folder. + samplebox = gtk.Toolbar() + self.samplebtns = [] + + samples = [] + fd = open(activity.get_bundle_path() + '/data/INDEX', 'r') + try: + samples = json.read(fd.read()) + finally: + fd.close() + + log.debug("Samples: %r", samples) + for s in samples: + btn = toolbutton.ToolButton('media-playback-start') + btn.filename = activity.get_bundle_path() + '/data/' + s['drw'] + btn.set_tooltip(s['title']) + img = gtk.Image() + img.set_from_file(activity.get_bundle_path() + '/data/' + s['icon']) + btn.set_icon_widget(img) + btn.connect('clicked', self.on_sample) + samplebox.insert(btn, -1) + self.samplebtns.append(btn) + + toolbar = activity.ActivityToolbox(self) + toolbar.add_toolbar(_("Paint"),paintbox) + toolbar.add_toolbar(_("Watch"),playbox) + toolbar.add_toolbar(_("Learn"),samplebox) + toolbar.show_all() + self.set_toolbox(toolbar) + + #----------------------------------------------------------------------------------------------------------------- + # Camera access + # + # todo- Consider going straight to video4linux2's C API, we aren't really using any features of GStreamer. + + def init_camera (self): + self.gstpipe = gst.parse_launch("v4l2src ! fakesink name=fakesink signal-handoffs=true") + self.gstfakesink = self.gstpipe.get_by_name('fakesink') + self.gstfakesink.connect("handoff", self.on_gst_buffer) + self.easelarea.connect("destroy", self.on_gst_destroy) + + self.gstpipe.set_state(gst.STATE_PLAYING) + + def on_gst_buffer(self, element, buffer, pad): + if self.take_reference: + self.easel.set_reference_buffer(buffer, 640, 480) + # Bring up the reference screen and update. + self.showrefbtn.set_active(True) + self.easel.render_reference_overlay() + self.flush_entire_canvas() + self.take_reference = False + + if self.videopaint_enabled: + self.easel.videopaint_motion(buffer, 640, 480) + + # todo- This isn't working right, for some reason the GST pipe keeps playing after the window is destroyed, leading + # to Python exceptions in on_gst_buffer. + def on_gst_destroy (self, widget): + self.gstpipe.set_state(gst.STATE_NULL) + + #----------------------------------------------------------------------------------------------------------------- + # Mesh networking + # + # The mesh networking system is a little bit wacky, but works reasonably well at the moment. It might need to + # be redone in the future for less stable networking environments. + # + # Each user maintains the current state of the canvas, as well as a 'shared image' state which represents the + # 'master' state of the canvas that is shared by all the users. The command index in the drawing command list + # that corresponds to the master state is also recorded. + # + # Each user is allowed to paint 'ahead' of the master state, by appending commands to their local command list. + # After each stroke, the commands of the stroke are broadcast as the new master state to the other users. + # + # Whenever a new master state is received, it will contain a list of commands that follow the old master state + # to reach the new one. The user simply rewinds their canvas to the old master state, replaces their local image + # with the shared one, and appends the received commands to reach the new master state. + # + # The net effect is that when the user paints something, they broadcast their own commands, and then *receive* + # their own commands, rewinding and then playing them back immediately. So, every users canvas state is simply the + # sum of all the broadcasts from themselves and the other users. Since the broadcasts are serialized, every + # user has the same state all the time. + + def init_mesh (self): + self.connected = False # If True, the activity is shared with other users. + self.initiating = False # If True, this instance started the activity. Otherwise, we joined it. + + # Set up the drawing send and receive state. + # See send_and_receive_draw_commands for more information. + self.draw_command_sent = 0 + self.draw_command_received = 0 + self.draw_command_queue = DrawCommandBuffer() + + # Get the presence server and self handle. + self.pservice = presenceservice.get_instance() + self.owner = self.pservice.get_owner() + + self.connect('shared', self.on_shared) # Called when the user clicks the Share button in the toolbar. + self.connect('joined', self.on_join) # Called when the activity joins a remote activity. + + def on_shared (self, activity): + self.initiating = True + self.setup_sharing() + + # Offer a DBus tube that everyone else can connect to. + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube(DBUS_SERVICE, {}) + + # Cancel the intro if playing. + self.set_mode(Colors.MODE_CANVAS) + + def on_list_tubes_reply(self, tubes): # Called by on_join. + for tube_info in tubes: + self.on_tube(*tube_info) + + def on_list_tubes_error(self, e): # Called by on_join. + pass + + def on_join (self, activity): + self.initiating = False + self.setup_sharing() + + # List existing tubes. There should only be one, which will invoke the on_new_tube callback. + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes( + reply_handler=self.on_list_tubes_reply, error_handler=self.on_list_tubes_error) + + # Limit UI choices for non-host users. + self.disable_shared_commands() + + # Cancel the intro if playing. + self.set_mode(Colors.MODE_CANVAS) + + def setup_sharing (self): + """Called to initialize mesh networking objects when the activity becomes shared (on_shared) or joins an + existing shared activity (on_join).""" + # Cache connection related objects. + self.conn = self._shared_activity.telepathy_conn + self.tubes_chan = self._shared_activity.telepathy_tubes_chan + self.text_chan = self._shared_activity.telepathy_text_chan + + # This will get called as soon as the connection is established. + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].connect_to_signal('NewTube', self.on_tube) + + # Called when a buddy joins us or leaves (does nothing right now). + self._shared_activity.connect('buddy-joined', self.on_buddy_joined) + self._shared_activity.connect('buddy-left', self.on_buddy_left) + + def on_tube (self, id, initiator, type, service, params, state): + """Called by the NewTube callback or the ListTubes enumeration, when a real connection finally exists.""" + if (type == telepathy.TUBE_TYPE_DBUS and service == DBUS_SERVICE): + # If the new tube is waiting for us to finalize it, do so. + if state == telepathy.TUBE_STATE_LOCAL_PENDING: + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id) + + if not self.connected: + # Create the TubeConnection object to manage the connection. + self.tube = TubeConnection(self.conn, + self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], + id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) + ExportedGObject.__init__(self, self.tube, DBUS_PATH) + + # Set up DBUS Signal receiviers. + self.tube.add_signal_receiver(self.ReceiveHello, 'BroadcastHello', DBUS_IFACE, path=DBUS_PATH) + self.tube.add_signal_receiver(self.ReceiveCanvasMode, 'BroadcastCanvasMode', DBUS_IFACE, path=DBUS_PATH) + self.tube.add_signal_receiver(self.ReceiveClear, 'BroadcastClear', DBUS_IFACE, path=DBUS_PATH) + self.tube.add_signal_receiver(self.ReceiveDrawCommands, 'BroadcastDrawCommands', DBUS_IFACE, path=DBUS_PATH) + self.tube.add_signal_receiver(self.ReceivePlayback, 'BroadcastPlayback', DBUS_IFACE, path=DBUS_PATH) + + log.debug("Connected.") + self.connected = True + + # Announce our presence to the server. + if not self.initiating: + self.BroadcastHello() + + # Notes about DBUS signals: + # - When you call a @signal function, its implementation is invoked, and the registered callback is invoked on all + # the peers (including the one who invoked the signal!). So it's usually best for the @signal function to do + # nothing at all. + # - The 'signature' describes the parameters to the function. + + @signal(dbus_interface=DBUS_IFACE, signature='') + def BroadcastHello (self): + """Broadcast signal sent when a client joins the shared activity.""" + pass + def ReceiveHello (self): + if not self.initiating: return # Only the initiating peer responds to Hello commands. + log.debug("Received Hello. Responding with canvas state (%d commands).", self.easel.playback_length()) + self.BroadcastCanvasMode() + self.BroadcastClear() + buf = self.easel.send_drw_commands(0, self.easel.get_num_commands()) + self.BroadcastDrawCommands(buf.get_bytes(), buf.ncommands) + + @signal(dbus_interface=DBUS_IFACE, signature='') + def BroadcastCanvasMode (self): + """Broadcast signal for forcing clients into Canvas mode.""" + pass + def ReceiveCanvasMode (self): + log.debug("ReceiveCanvasMode") + if self.mode != Colors.MODE_CANVAS: + self.set_mode(Colors.MODE_CANVAS) + + @signal(dbus_interface=DBUS_IFACE, signature='') + def BroadcastClear (self): + """Broadcast signal for clearing the canvas.""" + pass + def ReceiveClear (self): + log.debug("ReceiveClear") + self.easel.clear() + self.easel.save_shared_image() + + @signal(dbus_interface=DBUS_IFACE, signature='ayi') + def BroadcastDrawCommands (self, cmds, ncommands): + """Broadcast signal for drawing commands.""" + pass + def ReceiveDrawCommands (self, cmds, ncommands): + log.debug("ReceiveDrawCommands") + s = "".join(chr(b) for b in cmds) # Convert dbus.ByteArray to Python string. + self.draw_command_queue.append(DrawCommandBuffer(s, ncommands)) + + @signal(dbus_interface=DBUS_IFACE, signature='bii') + def BroadcastPlayback (self, playing, playback_pos, playback_speed): + """Broadcast signal controlling playback. Not yet used.""" + pass + def ReceivePlayback (self): + log.debug("ReceivePlayback") + if playing: + if self.mode != Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_PLAYBACK) + else: + if self.mode == Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_CANVAS) + self.easel.playback_to(playback_pos) + self.easel.set_playback_speed(playback_speed) + + def on_buddy_joined (self, activity, buddy): + log.debug('Buddy %s joined', buddy.props.nick) + + def on_buddy_left (self, activity, buddy): + log.debug('Buddy %s left', buddy.props.nick) + + def send_and_receive_draw_commands (self): + if self.connected: + # Broadcast drawing commands that were generated by this user since the last call to this function. + if self.draw_command_sent < self.easel.get_num_commands(): + buf = self.easel.send_drw_commands(self.draw_command_sent, self.easel.get_num_commands()-self.draw_command_sent) + self.BroadcastDrawCommands(buf.get_bytes(), buf.ncommands) + + # Play any queued draw commands that were received from the host. If there are any, we first reset the + # canvas contents back to the last received state and then play them back. + if self.draw_command_queue.ncommands: + # Also, we have to save and restore the brush around the queued commands. + saved_brush = self.easel.brush + self.easel.receive_drw_commands(self.draw_command_queue, self.draw_command_sent) + self.easel.restore_shared_image() + self.easel.play_range(self.draw_command_sent, self.easel.get_num_commands()) + self.easel.save_shared_image() + self.draw_command_queue.clear() + self.set_brush(saved_brush) + self.flush_dirty_canvas() + + # Note that resetting the state above means "undoing" the commands we just broadcast. We will receive them + # again by our ReceiveDrawCommands callback immediately, and will play them back so the user shouldn't notice. + self.draw_command_sent = self.easel.get_num_commands() + + def disable_shared_commands (self): + """Disables UI controls which cannot be activated by non-host peers.""" + # Cannot clear the canvas. + self.clearbtn.set_sensitive(False) + + # Cannot control playback. + self.startbtn.set_sensitive(False) + self.pausebtn.set_sensitive(False) + self.beginbtn.set_sensitive(False) + self.endbtn.set_sensitive(False) + self.playbackposbar.set_sensitive(False) + + # Cannot activate sample drawings. + for s in self.samplebtns: + s.set_sensitive(False) + + #----------------------------------------------------------------------------------------------------------------- + # Input code + + def init_input (self): + self.cur_buttons = 0 + self.pending_press = 0 + self.pending_release = 0 + self.mx = 0 + self.my = 0 + self.pressure = 255 + self.lastmx = 0 + self.lastmy = 0 + self.lastr = 0 + + def on_key_event (self, widget, event): + log.debug("on_key_event: %d", event.keyval) # Useful for manually working out keyvals for OLPC keys. + + # OLPC keymap is designed to allow left or right handed stylus use, with lots of redundancy. + # So each major key should appear at least once on each side of the keyboard. + button = 0 + + # 'p' for Palette (todo- need something better!). + if event.keyval == ord('p'): + button = Colors.BUTTON_PALETTE + + # 'r' for Reference (todo- need something better!). + if event.keyval == ord('r'): + button = Colors.BUTTON_REFERENCE + + # 'v' for Videopaint (todo- need something better!). + if event.keyval == ord('v'): + button = Colors.BUTTON_VIDEOPAINT + + # 's' hotkey to save PNG thumbnail of the current canvas as 'thumb.png'. + if event.keyval == ord('s'): + self.save_thumbnail(activity.get_bundle_path() + '/thumb.png') + + # OLPC 'hand' buttons for scrolling. + if event.keyval == 311 or event.keyval == 312 or event.keyval == ord('s'): + button = Colors.BUTTON_SCROLL + + # OLPC 'size' buttons for intensity. + #if event.keyval == 286: button = Colors.BUTTON_SIZE_0 + #if event.keyval == 287: button = Colors.BUTTON_SIZE_1 + #if event.keyval == 288: button = Colors.BUTTON_SIZE_2 + #if event.keyval == 289: button = Colors.BUTTON_SIZE_3 + + # Arrow keys, gamepad 'face' buttons, or 'z' and 'x' for Zoom. + if event.keyval == ord('z') or event.keyval == 264 or event.keyval == 265 or event.keyval == 273: + button = Colors.BUTTON_ZOOM_IN + if event.keyval == ord('x') or event.keyval == 258 or event.keyval == 259 or event.keyval == 274: + button = Colors.BUTTON_ZOOM_OUT + + # Either Alt key for pick. + if event.keyval == 313 or event.keyval == 308: + button = Colors.BUTTON_PICK + + if button != 0: + if event.type == gtk.gdk.KEY_PRESS: + self.pending_press = self.pending_press | button + else: + self.pending_release = self.pending_release | button + + def on_mouse_button(self, widget, event): + if self.overlay_active: + return + if event.button == 1: + if event.type == gtk.gdk.BUTTON_PRESS: + self.pending_press = self.pending_press | Colors.BUTTON_TOUCH + if event.type == gtk.gdk.BUTTON_RELEASE: + self.pending_release = self.pending_release | Colors.BUTTON_TOUCH + #else: + # if event.type == gtk.gdk.BUTTON_PRESS: + # self.pending_press = self.pending_press | Colors.BUTTON_PALETTE + # if event.type == gtk.gdk.BUTTON_RELEASE: + # self.pending_release = self.pending_release | Colors.BUTTON_PALETTE + if not widget.is_focus(): + widget.grab_focus() + self.update() + return True + + def on_mouse_motion (self, widget, event): + if self.overlay_active: + return + # Process mouse event normally. + if event.is_hint: + x, y, state = event.window.get_pointer() + else: + x = event.x + y = event.y + state = event.state + self.mx = int(x) + self.my = int(y) + if not widget.is_focus(): + widget.grab_focus() + self.update() + self.flush_cursor() + return True + + def update_input (self): + buttons = self.cur_buttons + + buttons = buttons | self.pending_press + self.pending_press = 0 + + buttons = buttons & ~self.pending_release + self.pending_release = 0 + + hold = buttons & self.cur_buttons + + if self.cur_buttons != buttons: + changed = self.cur_buttons ^ buttons + press = changed & buttons + release = changed & self.cur_buttons + self.cur_buttons = buttons + if press != 0: + self.on_press(press) + if release != 0: + self.on_release(release) + + if hold != 0: + self.on_hold(hold) + + def on_press (self, button): + if button & Colors.BUTTON_ZOOM_IN: + self.zoom_in() + + if button & Colors.BUTTON_ZOOM_OUT: + self.zoom_out() + + if button & Colors.BUTTON_VIDEOPAINT: + self.videopaintbtn.set_active(not self.videopaint_enabled) + + def on_release (self, button): + pass + + def on_hold (self, button): + pass + + #----------------------------------------------------------------------------------------------------------------- + # Scroll code + # + # todo- Scrolling is currently broken. It needs to be bound to a key and the issues need to be fixed. + + def init_scroll (self): + self.scroll = Pos(0,0) + self.scrollref = None + + def scroll_to (self, pos): + self.scroll = pos + + # Clamp scroll position to within absolute limits. + scroll.x = min(max(scroll.x, -self.easel.width * 0.125), self.easel.width * 0.125) + scroll.y = min(max(scroll.y, -self.easel.height * 0.125), self.easel.height * 0.125) + + def snap_scroll (self): + """Animates the scroll position back towards reasonable bounds.""" + if self.scroll.x < self.easel.width *-0.05: self.scroll.x = self.scroll.x * 0.9 + if self.scroll.y < self.easel.height*-0.05: self.scroll.y = self.scroll.y * 0.9 + if self.scroll.x+self.width > self.easel.width*1.05: + self.scroll.x = (self.easel.width - self.width)*0.5 + self.scroll.x*0.5 + if self.scroll.y+self.height > self.easel.height*1.05: + self.scroll.y = (self.easel.height - self.height)*0.5 + self.scroll.x*0.5 + + #----------------------------------------------------------------------------------------------------------------- + # Zoom code + # + # todo- Zooming is currently broken. It needs to be bound to a key and the issues need to be fixed. + # + # The main issue is probably that the underlying canvas doesn't support enough scaled blit options and also + # doesn't support clipping. + + def init_zoom (self): + self.zoom = 1.0 + self.zoomref = None + + def zoom_to (self, zoom): + # End any current stroke. + self.end_draw() + + # Adjust scroll position to keep the same point centered on screen while the zoom changes. + # This is either the reference point (the center of the last stroke) or else the screen center. + #if self.zoomref != None: + # scrollcenter = self.zoomref + #else: + scrollcenter = self.scroll + Pos(self.width*0.5/self.zoom, self.height*0.5/self.zoom) + self.zoom = zoom + self.scroll_to(scrollcenter - Pos(self.width*0.5/self.zoom, self.height*0.5/self.zoom)) + self.zoomref = None + + def zoom_in (self): + if self.zoom == 0.75: + self.zoom_to(1.0) + self.scroll_to(Pos(0,0)) + elif self.zoom == 1.0: + self.zoom_to(2.0) + + def zoom_out (self): + if self.zoom == 2.0: + self.zoom_to(1.0) + self.scroll_to(Pos(0,0)) + elif self.zoom == 1.0: + self.zoom_to(0.75) + + #----------------------------------------------------------------------------------------------------------------- + # Drawing commands + # + # These commands instruct the underlying canvas to execute commands which modify the canvas. + # + # All drawing operations become commands which are executed immediately and also recorded so that the painting can + # be played back. + + def draw (self, pos): + relpos = pos * Pos(self.easel.width, self.easel.height) / Pos(self.zoom, self.zoom) + self.scroll + relpos = relpos / Pos(self.easel.width, self.easel.height) + self.easel.play_command(DrawCommand.create_draw(relpos, int(self.pressure)), True) + + def end_draw (self): + if self.easel.stroke: + self.easel.play_command(DrawCommand.create_end_draw(int(self.pressure)), True) + + # Send to sharing participants. + self.send_and_receive_draw_commands() + + # Record a new default zoom-in focal point. + #self.zoomref = (self.easel.strokemin + self.easel.strokemax) * Pos(0.5,0.5) + self.zoomref = Pos(self.mx, self.my) + + def set_brush (self, brush): + self.easel.play_command(DrawCommand.create_color_change(brush.color), True) + self.easel.play_command(DrawCommand.create_size_change(brush.control, brush.type, brush.size/float(self.easel.width), brush.opacity), True) + + def play_to_playbackpos (self): + """Plays drawing commands until playbackpos.get_value() is reached. This may involve resetting the canvas if + the given position is before the current position, since it is impossible to play commands backwards. + Called to skip the playback position, for example when fast forwarding or rewinding or dragging the scrollbar.""" + self.playbackposbar.ignore_change += 1 + + total_left = 0 + + # This used to be in the while True: loop, such that the overlay would only appear when + # there is a lot of work to do. It might go back there later. + self.progress.set_size_request(self.width, self.height) + self.progress.show_all() + self.easelarea.set_double_buffered(True) + self.overlay_active = True + self.flush_entire_canvas() + # Display and run the GTK loop. This hack takes a set number of events per loop, + # as checking the gtk.events_pending() function leads to an infinite loop. + for i in range(0, 5): + if gtk.main_iteration(False): + return + + # Keep looping until the position is reached. Since we activate the GTK event loop processing from within + # our inner loop, the user can actually move the scrollbar while this function is running! + while True: + to = int(self.playbackpos.get_value()/100.0*self.easel.playback_length()) + if self.easel.playback_pos() == to: + break + + # Rewind if needed. + if self.easel.playback_pos() > to: + self.easel.clear_image() + self.easel.start_playback() + + total_left = max(total_left, to - self.easel.playback_pos()) + + # Advance playback by as much as we can in 1/10th of a second. + startpos = self.easel.playback_pos() + starttk = time.time() + endtk = starttk + 1.0/10.0 + while self.easel.playback_pos() < to: + self.easel.playback_step_to(to) + if time.time() >= endtk: + break + #log.debug("from %d to %d in %fs", startpos, self.easel.playback_pos(), time.time()-starttk) + + # This is currently disabled as it leads to the playback position passing the requested position, which + # can cause infinite "Working..." loops when the mouse is held down. + # Leaving it out can lead to inaccurate playback, when the play-to position is mid-stroke. + #self.easel.playback_finish_stroke() + + # Update the progress bar. + if total_left > 0: + f = 1.0-float(to - self.easel.playback_pos())/total_left + self.progress.progress.set_fraction(f) + + # Comment this in to watch the painting and slow things down. + #self.flush_entire_canvas() + + # Display and run the GTK loop. This hack takes a set number of events per loop, + # as checking the gtk.events_pending() function leads to an infinite loop. + for i in range(0, 5): + if gtk.main_iteration(False): + return + + self.overlay_active = False + self.progress.hide_all() + self.easelarea.set_double_buffered(False) + + self.flush_entire_canvas() + self.playbackposbar.ignore_change -= 1 + + # Canvas repainting. These methods draw portions of the canvas to the canvasarea. + def flush_dirty_canvas (self): + """Causes a redraw of the canvas area which has been modified since the last call to this function.""" + self.easelarea.queue_draw_area( + int(self.easel.dirtymin.x*2), int(self.easel.dirtymin.y*2), + int(self.easel.dirtymax.x*2-self.easel.dirtymin.x*2+1), + int(self.easel.dirtymax.y*2-self.easel.dirtymin.y*2+1)) + self.easel.reset_dirty_rect() + + def flush_entire_canvas (self): + """Causes a redraw of the entire canvas area.""" + self.easelarea.queue_draw() + + def flush_cursor (self): + """Causes a redraw of the canvas area covered by the cursor.""" + r = int(self.easel.brush.size*2*self.pressure/256) + x0 = min(self.lastmx-self.lastr/2, self.mx-r/2) + y0 = min(self.lastmy-self.lastr/2, self.my-r/2) + x1 = max(self.lastmx+self.lastr/2, self.mx+r/2) + y1 = max(self.lastmy+self.lastr/2, self.my+r/2) + self.easelarea.queue_draw_area(x0, y0, x1-x0+2, y1-y0+2) + + #----------------------------------------------------------------------------------------------------------------- + # Application states + # + # Colors is controlled by a finite state machine which keeps track of the current application mode (painting, + # playing back, scrolling, zooming, etc) and manages transitions between states. + # + # Each state is allowed to process code when it is entered or left, for the purpose of initializing variables and + # cleaning up afterwards. + # + # todo- Consider breaking up into enter_intro, enter_playback, enter_canvas, etc. + + def enter_mode (self): + if self.mode == Colors.MODE_INTRO: + # Load and play intro movie. It was created on a DS at 60hz, so we need to speed it up drastically to + # make it watchable. + self.easel.clear() + self.easel.load(activity.get_bundle_path() + "/data/intro.drw") + self.easel.set_playback_speed(8) + self.easel.start_playback() + + if self.mode == Colors.MODE_PLAYBACK: + self.easel.set_playback_speed(1) + self.easel.start_playback() + + if self.mode == Colors.MODE_CANVAS: + # Clear any existing button pressure to avoid a blotch on the screen when entering Canvas mode. + self.cur_buttons = 0 + # Reset the brush. + self.set_brush(self.easel.brush) + + if self.mode == Colors.MODE_SCROLL: + self.scrollref = None + + if self.mode == Colors.MODE_PALETTE: + # This simply darkens the canvas slightly to prepare for an overlay to be drawn on top. + #self.easel.render_overlay() + # Show the brush controls window. + self.easelarea.set_double_buffered(True) + self.brush_controls.set_brush(self.easel.brush) + self.brush_controls.show_all() + self.flush_entire_canvas() + self.overlay_active = True + + if self.mode == Colors.MODE_REFERENCE: + self.easel.render_reference_overlay() + self.flush_entire_canvas() + + def leave_mode (self): + if self.mode == Colors.MODE_INTRO: + self.easel.stop_playback() + self.easel.clear() + self.easel.reset_brush() + self.flush_entire_canvas() + + if self.mode == Colors.MODE_PLAYBACK: + self.easel.stop_playback() + # Progress bar goes to 100 when painting. + self.playbackposbar.ignore_change += 1 + self.playbackpos.set_value(100) + self.playbackposbar.ignore_change -= 1 + + if self.mode == Colors.MODE_CANVAS: + self.end_draw() + + if self.mode == Colors.MODE_SCROLL: + pass + + if self.mode == Colors.MODE_PALETTE: + self.set_brush(self.brush_controls.brush) + #self.easel.clear_overlay() + self.brush_controls.hide() + self.easelarea.set_double_buffered(False) + self.flush_entire_canvas() + self.overlay_active = False + + if self.mode == Colors.MODE_REFERENCE: + self.easel.clear_overlay() + self.flush_entire_canvas() + + def update_mode (self): + if self.mode == None: + self.set_mode(Colors.MODE_INTRO) + + if self.mode == Colors.MODE_INTRO: + self.easel.update_playback() + if not self.easel.playback_done(): + self.flush_dirty_canvas() + if self.cur_buttons & Colors.BUTTON_TOUCH: + self.set_mode(Colors.MODE_CANVAS) + return + + if self.mode == Colors.MODE_PLAYBACK: + self.easel.update_playback() + if not self.easel.playback_done(): + self.flush_dirty_canvas() + # Update the progress bar. + progress_percent = int(100*float(self.easel.playback)/(self.easel.playback_length()+1)) + if self.easel.playing and progress_percent != self.playbackpos.get_value(): + self.playbackposbar.ignore_change += 1 + self.playbackpos.set_value(progress_percent) + self.playbackposbar.ignore_change -= 1 + # Painting during playback mode allows you start where the painter left off. + if self.cur_buttons & Colors.BUTTON_TOUCH: + self.easel.truncate_at_playback() + self.set_mode(Colors.MODE_CANVAS) + return + + if self.mode == Colors.MODE_CANVAS: + # Receive any drawing commands from peers, if not currently drawing. + if not self.easel.stroke: + self.send_and_receive_draw_commands() + # Update drawing. + if self.cur_buttons & Colors.BUTTON_TOUCH: + if self.mx != self.lastmx or self.my != self.lastmy: + mpos = Pos(float(self.mx)/self.width, float(self.my)/self.height) + self.draw(mpos) + self.flush_dirty_canvas() + elif self.easel.stroke: + self.end_draw() + self.flush_dirty_canvas() + # Bring up palette if requested. + if self.cur_buttons & Colors.BUTTON_PALETTE: + self.set_mode(Colors.MODE_PALETTE) + return + # Bring up reference image if requested. + if self.cur_buttons & Colors.BUTTON_REFERENCE: + self.set_mode(Colors.MODE_REFERENCE) + return + # Start scrolling if requested. + if self.cur_buttons & Colors.BUTTON_SCROLL: + self.set_mode(Colors.MODE_SCROLL) + return + + if self.mode == Colors.MODE_SCROLL: + if self.cur_buttons & Colors.BUTTON_TOUCH: + mpos = Pos(self.mx, self.my) + if self.scrollref == None: + self.scrollref = mpos + else: + move = mpos - self.scrollref + if move.x != 0 or move.y != 0: + self.scroll_to(self.scroll - move) + self.scrollref = mpos + else: + self.scrollref = None + # Smoothly pull back towards the image when out of reasonable bounds. + self.snap_scroll() + self.flush_entire_canvas() + if not (self.cur_buttons & Colors.BUTTON_SCROLL): + self.set_mode(Colors.MODE_CANVAS) + + if self.mode == Colors.MODE_PALETTE: + if not self.palette_forced: + if not self.cur_buttons & Colors.BUTTON_PALETTE: + self.set_mode(Colors.MODE_CANVAS) + return + + if self.mode == Colors.MODE_REFERENCE: + if not self.reference_forced: + if not self.cur_buttons & Colors.BUTTON_REFERENCE: + self.set_mode(Colors.MODE_CANVAS) + return + + def set_mode (self, mode): + if self.mode != None: + self.leave_mode() + self.mode = mode + self.enter_mode() + + def update (self): + if self.overlay_active: + return + if self.easel == None: + return + self.update_input() + self.update_mode() + + def tick (self): + # todo- Return False when nothing is going on (to idle the XO), then restart the idle event when something happens. + self.update() + return True + + #----------------------------------------------------------------------------------------------------------------- + # Event handlers + + def on_canvasarea_resize (self): + rect = self.easelarea.get_allocation() + log.debug("Canvas resized to %dx%d", rect[2], rect[3]) + self.width = rect[2] + self.height = rect[3] + + # Rebuild easelimage. + self.easelimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), rect[2], rect[3]) + + # Reconfigure canvas. + self.easel.resize(rect[2]/2, rect[3]/2) + + # Resize panels. + self.brush_controls.set_size_request(rect[2], rect[3]) + self.progress.set_size_request(rect[2], rect[3]) + + return True + + def on_canvasarea_expose (self, widget, event): + if not self.easelarea.bin_window: + return True + + rect = self.easelarea.get_allocation() + if self.easelimage is None or (rect[2] != self.width or rect[3] != self.height): + self.on_canvasarea_resize() + + gc = self.easelarea.get_style().fg_gc[gtk.STATE_NORMAL] + + # Blit dirty rectangle of canvas into the image. + self.easel.blit_2x( + self.easelimage, + int(event.area.x/2), int(event.area.y/2), int(event.area.width/2), int(event.area.height/2), + self.overlay_active) + + # Then draw the image to the screen. + self.easelarea.bin_window.draw_image( + gc, self.easelimage, + event.area.x, event.area.y, + event.area.x, event.area.y, event.area.width, event.area.height) + + # Draw introduction text. + if self.mode == Colors.MODE_INTRO: + context = self.easelarea.create_pango_context() + layout = self.easelarea.create_pango_layout(_('Click anywhere to begin painting!')) + layout.set_font_description(pango.FontDescription('Times 14')) + size = layout.get_size() + x = (self.width-size[0]/pango.SCALE)/2 + y = self.height-50-size[1]/pango.SCALE + self.easelarea.bin_window.draw_layout(gc, x, y, layout) + + self.draw_cursor() + + # Hack to keep toolbar up to date. For some reason it fails to draw pretty often. + #self.toolbox.queue_draw() + + def draw_cursor (self): + r = int(self.easel.brush.size*2*self.pressure/256) + self.easelarea.bin_window.draw_arc(self.easelarea.get_style().black_gc, False, self.mx-r/2, self.my-r/2, r, r, 0, 360*64) + self.lastr = r + self.lastmx = self.mx + self.lastmy = self.my + + def on_palette (self, button): + if button.get_active(): + self.set_mode(Colors.MODE_PALETTE) + self.palette_forced = True + else: + self.set_mode(Colors.MODE_CANVAS) + self.palette_forced = False + + def on_take_reference (self, button): + self.take_reference = True + + def on_show_reference (self, button): + if button.get_active(): + self.set_mode(Colors.MODE_REFERENCE) + self.reference_forced = True + else: + self.set_mode(Colors.MODE_CANVAS) + self.reference_forced = False + + def on_videopaint (self, button): + self.videopaint_enabled = button.get_active() + if button.get_active(): + gobject.timeout_add(33, self.on_videopaint_tick) + + def on_videopaintpreview_expose (self, widget, event): + self.easel.blit_videopaint(self.videopaintimage) + size = self.videopaintpreview.window.get_size() + x = (size[0]-self.easel.VIDEO_WIDTH)/2 + y = (size[1]-self.easel.VIDEO_HEIGHT)/2 + self.videopaintpreview.window.draw_image( + self.videopaintpreview.get_style().fg_gc[gtk.STATE_NORMAL], + self.videopaintimage, + 0, 0, x, y, -1, -1) + + def on_videopaint_tick (self): + if not self.videopaint_enabled: + return False + + # Update "pressure" from image (uses blob size). + self.pressure = self.easel.videopaint_pressure + + # Move the mouse to follow the videopaint cursor. + # Note that we do not allow it to reach the corners, to avoid bringing up the Sugar overlay. + size = self.window.get_size() + self.mx = int(25+max(0.0, min(1.0, self.easel.videopaint_pos.x))*(size[0]-50)) + self.my = int(25+max(0.0, min(1.0, self.easel.videopaint_pos.y))*(size[1]-50)) + #gtk.gdk.display_get_default().warp_pointer(self.get_screen(), self.mx, self.my) + self.flush_cursor() + + # Update the preview window. + self.videopaintpreview.queue_draw() + + # Process drawing. + self.update() + + return True + + def on_clear (self, button): + if self.mode != Colors.MODE_CANVAS: + self.set_mode(Colors.MODE_CANVAS) + self.easel.clear() + self.flush_entire_canvas() + + def on_play (self, button): + # Change to playback mode when the Play button is first pressed. + if self.mode != Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_PLAYBACK) + # Resume playback. + self.easel.resume_playback() + + def on_pause (self, button): + if self.mode != Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_PLAYBACK) + self.easel.pause_playback() + + def on_skip_begin (self, button): + if self.mode != Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_PLAYBACK) + self.playbackpos.set_value(0) + + def on_skip_end (self, button): + if self.mode != Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_PLAYBACK) + self.playbackpos.set_value(100) + + def on_sample (self, button): + self.set_mode(Colors.MODE_PLAYBACK) + self.easel.clear() + self.easel.load(button.filename) + self.easel.set_playback_speed(8) + self.flush_entire_canvas() + self.toolbox.set_current_toolbar(2) # Switch to 'watch' toolbar. + + def on_playbackposbar_change (self, progress): + if self.playbackposbar.ignore_change > 0: + return + if self.mode != Colors.MODE_PLAYBACK: + self.set_mode(Colors.MODE_PLAYBACK) + self.play_to_playbackpos() + self.easel.pause_playback() + + #----------------------------------------------------------------------------------------------------------------- + # Journal integration + + def read_file(self, file_path): + log.debug("Loading from journal %s", file_path) + self.set_mode(Colors.MODE_CANVAS) + self.easel.clear() + self.easel.load(file_path.encode()) + log.debug("Playing back %d commands", self.easel.playback_length()) + self.set_mode(Colors.MODE_PLAYBACK) + self.playbackpos.set_value(100) + + def write_file(self, file_path): + log.debug("Saving to journal %s", file_path) + log.debug("Saving %d commands", self.easel.playback_length()) + self.easel.save(file_path.encode()) + + def take_screenshot (self): + if self.easelarea and self.easelarea.bin_window: + self._preview.take_screenshot(self.easelarea.bin_window) + + def save_thumbnail(self, filename): + pbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, self.width, self.height) + pbuf = pbuf.get_from_image(self.easelimage, self.easelarea.get_colormap(), 0, 0, 0, 0, self.width, self.height) + pbuf = pbuf.scale_simple(80, 60, gtk.gdk.INTERP_BILINEAR) + pbuf.save(filename, "png") + + #----------------------------------------------------------------------------------------------------------------- + # Benchmarking + # + # Simply causes the C++ code to do a bunch of work and prints out the time used. Useful for testing the benefits + # of optimization. + + def benchmark (self): + # Benchmark a Canvas object. + canvas = Canvas(600, 400) + canvas.clear() + canvas.load(activity.get_bundle_path() + "/data/intro.drw") + start = time.time() + for i in range(0,100): + canvas.start_playback() + canvas.finish_playback() + log.debug("Canvas playback benchmark: %f sec", time.time()-start) + + #canvasimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), 600, 400) + #start = time.time() + #for i in range(0,100): + # canvas.blit_2x(canvasimage, 0, 0, 600, 400) + #log.debug("Canvas 1.0x blit benchmark: %f sec", time.time()-start) + + canvasimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), 1200, 800) + start = time.time() + for i in range(0,100): + canvas.blit_2x(canvasimage, 0, 0, 600, 400) + log.debug("Canvas 2.0x blit benchmark: %f sec", time.time()-start) + + # Benchmark a Palette object. + palette = Palette(500) + paletteimage = gtk.gdk.Image(gtk.gdk.IMAGE_FASTEST, gtk.gdk.visual_get_system(), 500, 500) + start = time.time() + for i in range(0,100): + palette.render_wheel(paletteimage) + log.debug("Palette wheel benchmark: %f sec", time.time()-start) + + start = time.time() + for i in range(0,100): + palette.render_triangle(paletteimage) + log.debug("Palette triangle benchmark: %f sec", time.time()-start) + diff --git a/colorsc.py b/colorsc.py new file mode 100644 index 0000000..c28c15f --- /dev/null +++ b/colorsc.py @@ -0,0 +1,600 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 1.3.33 +# +# Don't modify this file, modify the SWIG interface instead. +# This file is compatible with both classic and new-style classes. + +import _colorsc +import new +new_instancemethod = new.instancemethod +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'PySwigObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static) or hasattr(self,name): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError,name + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +import types +try: + _object = types.ObjectType + _newclass = 1 +except AttributeError: + class _object : pass + _newclass = 0 +del types + + +sgn = _colorsc.sgn +sqr = _colorsc.sqr +clamp = _colorsc.clamp +to_rad = _colorsc.to_rad +to_deg = _colorsc.to_deg +fixed_scale = _colorsc.fixed_scale +endian_swap = _colorsc.endian_swap +class Pos(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Pos, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Pos, name) + __repr__ = _swig_repr + __swig_setmethods__["x"] = _colorsc.Pos_x_set + __swig_getmethods__["x"] = _colorsc.Pos_x_get + if _newclass:x = _swig_property(_colorsc.Pos_x_get, _colorsc.Pos_x_set) + __swig_setmethods__["y"] = _colorsc.Pos_y_set + __swig_getmethods__["y"] = _colorsc.Pos_y_get + if _newclass:y = _swig_property(_colorsc.Pos_y_get, _colorsc.Pos_y_set) + def __init__(self, *args): + this = _colorsc.new_Pos(*args) + try: self.this.append(this) + except: self.this = this + def __add__(*args): return _colorsc.Pos___add__(*args) + def __sub__(*args): return _colorsc.Pos___sub__(*args) + def __mul__(*args): return _colorsc.Pos___mul__(*args) + def __div__(*args): return _colorsc.Pos___div__(*args) + __swig_getmethods__["create_from_min"] = lambda x: _colorsc.Pos_create_from_min + if _newclass:create_from_min = staticmethod(_colorsc.Pos_create_from_min) + __swig_getmethods__["create_from_max"] = lambda x: _colorsc.Pos_create_from_max + if _newclass:create_from_max = staticmethod(_colorsc.Pos_create_from_max) + __swig_getmethods__["create_from_angle"] = lambda x: _colorsc.Pos_create_from_angle + if _newclass:create_from_angle = staticmethod(_colorsc.Pos_create_from_angle) + __swig_getmethods__["create_from_rotation"] = lambda x: _colorsc.Pos_create_from_rotation + if _newclass:create_from_rotation = staticmethod(_colorsc.Pos_create_from_rotation) + __swig_destroy__ = _colorsc.delete_Pos + __del__ = lambda self : None; +Pos_swigregister = _colorsc.Pos_swigregister +Pos_swigregister(Pos) +cvar = _colorsc.cvar +PI = cvar.PI +map_range = _colorsc.map_range +Pos_create_from_min = _colorsc.Pos_create_from_min +Pos_create_from_max = _colorsc.Pos_create_from_max +Pos_create_from_angle = _colorsc.Pos_create_from_angle +Pos_create_from_rotation = _colorsc.Pos_create_from_rotation + +class Color(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Color, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Color, name) + __repr__ = _swig_repr + __swig_setmethods__["r"] = _colorsc.Color_r_set + __swig_getmethods__["r"] = _colorsc.Color_r_get + if _newclass:r = _swig_property(_colorsc.Color_r_get, _colorsc.Color_r_set) + __swig_setmethods__["g"] = _colorsc.Color_g_set + __swig_getmethods__["g"] = _colorsc.Color_g_get + if _newclass:g = _swig_property(_colorsc.Color_g_get, _colorsc.Color_g_set) + __swig_setmethods__["b"] = _colorsc.Color_b_set + __swig_getmethods__["b"] = _colorsc.Color_b_get + if _newclass:b = _swig_property(_colorsc.Color_b_get, _colorsc.Color_b_set) + __swig_setmethods__["a"] = _colorsc.Color_a_set + __swig_getmethods__["a"] = _colorsc.Color_a_get + if _newclass:a = _swig_property(_colorsc.Color_a_get, _colorsc.Color_a_set) + def __init__(self, *args): + this = _colorsc.new_Color(*args) + try: self.this.append(this) + except: self.this = this + def get_a8r8g8b8(*args): return _colorsc.Color_get_a8r8g8b8(*args) + __swig_getmethods__["create_from_a8r8g8b8"] = lambda x: _colorsc.Color_create_from_a8r8g8b8 + if _newclass:create_from_a8r8g8b8 = staticmethod(_colorsc.Color_create_from_a8r8g8b8) + def get_a8b8g8r8(*args): return _colorsc.Color_get_a8b8g8r8(*args) + __swig_getmethods__["create_from_a8b8g8r8"] = lambda x: _colorsc.Color_create_from_a8b8g8r8 + if _newclass:create_from_a8b8g8r8 = staticmethod(_colorsc.Color_create_from_a8b8g8r8) + def get_r5g6b5(*args): return _colorsc.Color_get_r5g6b5(*args) + __swig_getmethods__["create_from_r5g6b5"] = lambda x: _colorsc.Color_create_from_r5g6b5 + if _newclass:create_from_r5g6b5 = staticmethod(_colorsc.Color_create_from_r5g6b5) + def get_b5g6r5(*args): return _colorsc.Color_get_b5g6r5(*args) + __swig_getmethods__["create_from_float"] = lambda x: _colorsc.Color_create_from_float + if _newclass:create_from_float = staticmethod(_colorsc.Color_create_from_float) + __swig_getmethods__["create_from_blend"] = lambda x: _colorsc.Color_create_from_blend + if _newclass:create_from_blend = staticmethod(_colorsc.Color_create_from_blend) + __swig_getmethods__["create_from_lerp"] = lambda x: _colorsc.Color_create_from_lerp + if _newclass:create_from_lerp = staticmethod(_colorsc.Color_create_from_lerp) + __swig_getmethods__["create_from_yuv"] = lambda x: _colorsc.Color_create_from_yuv + if _newclass:create_from_yuv = staticmethod(_colorsc.Color_create_from_yuv) + __swig_getmethods__["yuv_to_hsv"] = lambda x: _colorsc.Color_yuv_to_hsv + if _newclass:yuv_to_hsv = staticmethod(_colorsc.Color_yuv_to_hsv) + __swig_destroy__ = _colorsc.delete_Color + __del__ = lambda self : None; +Color_swigregister = _colorsc.Color_swigregister +Color_swigregister(Color) +Color_create_from_a8r8g8b8 = _colorsc.Color_create_from_a8r8g8b8 +Color_create_from_a8b8g8r8 = _colorsc.Color_create_from_a8b8g8r8 +Color_create_from_r5g6b5 = _colorsc.Color_create_from_r5g6b5 +Color_create_from_float = _colorsc.Color_create_from_float +Color_create_from_blend = _colorsc.Color_create_from_blend +Color_create_from_lerp = _colorsc.Color_create_from_lerp +Color_create_from_yuv = _colorsc.Color_create_from_yuv +Color_yuv_to_hsv = _colorsc.Color_yuv_to_hsv + +class ByteBuffer(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, ByteBuffer, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, ByteBuffer, name) + __repr__ = _swig_repr + __swig_setmethods__["size"] = _colorsc.ByteBuffer_size_set + __swig_getmethods__["size"] = _colorsc.ByteBuffer_size_get + if _newclass:size = _swig_property(_colorsc.ByteBuffer_size_get, _colorsc.ByteBuffer_size_set) + __swig_setmethods__["data"] = _colorsc.ByteBuffer_data_set + __swig_getmethods__["data"] = _colorsc.ByteBuffer_data_get + if _newclass:data = _swig_property(_colorsc.ByteBuffer_data_get, _colorsc.ByteBuffer_data_set) + def __init__(self, *args): + this = _colorsc.new_ByteBuffer(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _colorsc.delete_ByteBuffer + __del__ = lambda self : None; +ByteBuffer_swigregister = _colorsc.ByteBuffer_swigregister +ByteBuffer_swigregister(ByteBuffer) + +class SurfaceA8R8G8B8(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, SurfaceA8R8G8B8, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, SurfaceA8R8G8B8, name) + __repr__ = _swig_repr + __swig_setmethods__["width"] = _colorsc.SurfaceA8R8G8B8_width_set + __swig_getmethods__["width"] = _colorsc.SurfaceA8R8G8B8_width_get + if _newclass:width = _swig_property(_colorsc.SurfaceA8R8G8B8_width_get, _colorsc.SurfaceA8R8G8B8_width_set) + __swig_setmethods__["height"] = _colorsc.SurfaceA8R8G8B8_height_set + __swig_getmethods__["height"] = _colorsc.SurfaceA8R8G8B8_height_get + if _newclass:height = _swig_property(_colorsc.SurfaceA8R8G8B8_height_get, _colorsc.SurfaceA8R8G8B8_height_set) + __swig_setmethods__["stride"] = _colorsc.SurfaceA8R8G8B8_stride_set + __swig_getmethods__["stride"] = _colorsc.SurfaceA8R8G8B8_stride_get + if _newclass:stride = _swig_property(_colorsc.SurfaceA8R8G8B8_stride_get, _colorsc.SurfaceA8R8G8B8_stride_set) + __swig_setmethods__["pixels"] = _colorsc.SurfaceA8R8G8B8_pixels_set + __swig_getmethods__["pixels"] = _colorsc.SurfaceA8R8G8B8_pixels_get + if _newclass:pixels = _swig_property(_colorsc.SurfaceA8R8G8B8_pixels_get, _colorsc.SurfaceA8R8G8B8_pixels_set) + def __init__(self, *args): + this = _colorsc.new_SurfaceA8R8G8B8(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _colorsc.delete_SurfaceA8R8G8B8 + __del__ = lambda self : None; +SurfaceA8R8G8B8_swigregister = _colorsc.SurfaceA8R8G8B8_swigregister +SurfaceA8R8G8B8_swigregister(SurfaceA8R8G8B8) + +class DrawCommandBuffer(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, DrawCommandBuffer, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, DrawCommandBuffer, name) + __repr__ = _swig_repr + def __init__(self, *args): + this = _colorsc.new_DrawCommandBuffer(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _colorsc.delete_DrawCommandBuffer + __del__ = lambda self : None; + def append(*args): return _colorsc.DrawCommandBuffer_append(*args) + def clear(*args): return _colorsc.DrawCommandBuffer_clear(*args) + def get_bytes(*args): return _colorsc.DrawCommandBuffer_get_bytes(*args) + __swig_setmethods__["cmds"] = _colorsc.DrawCommandBuffer_cmds_set + __swig_getmethods__["cmds"] = _colorsc.DrawCommandBuffer_cmds_get + if _newclass:cmds = _swig_property(_colorsc.DrawCommandBuffer_cmds_get, _colorsc.DrawCommandBuffer_cmds_set) + __swig_setmethods__["ncommands"] = _colorsc.DrawCommandBuffer_ncommands_set + __swig_getmethods__["ncommands"] = _colorsc.DrawCommandBuffer_ncommands_get + if _newclass:ncommands = _swig_property(_colorsc.DrawCommandBuffer_ncommands_get, _colorsc.DrawCommandBuffer_ncommands_set) + __swig_getmethods__["create_from_string"] = lambda x: _colorsc.DrawCommandBuffer_create_from_string + if _newclass:create_from_string = staticmethod(_colorsc.DrawCommandBuffer_create_from_string) +DrawCommandBuffer_swigregister = _colorsc.DrawCommandBuffer_swigregister +DrawCommandBuffer_swigregister(DrawCommandBuffer) +DrawCommandBuffer_create_from_string = _colorsc.DrawCommandBuffer_create_from_string + +class DrawCommand(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, DrawCommand, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, DrawCommand, name) + __repr__ = _swig_repr + TYPE_DRAW = _colorsc.DrawCommand_TYPE_DRAW + TYPE_DRAWEND = _colorsc.DrawCommand_TYPE_DRAWEND + TYPE_COLORCHANGE = _colorsc.DrawCommand_TYPE_COLORCHANGE + TYPE_SIZECHANGE = _colorsc.DrawCommand_TYPE_SIZECHANGE + __swig_setmethods__["type"] = _colorsc.DrawCommand_type_set + __swig_getmethods__["type"] = _colorsc.DrawCommand_type_get + if _newclass:type = _swig_property(_colorsc.DrawCommand_type_get, _colorsc.DrawCommand_type_set) + __swig_setmethods__["pos"] = _colorsc.DrawCommand_pos_set + __swig_getmethods__["pos"] = _colorsc.DrawCommand_pos_get + if _newclass:pos = _swig_property(_colorsc.DrawCommand_pos_get, _colorsc.DrawCommand_pos_set) + __swig_setmethods__["color"] = _colorsc.DrawCommand_color_set + __swig_getmethods__["color"] = _colorsc.DrawCommand_color_get + if _newclass:color = _swig_property(_colorsc.DrawCommand_color_get, _colorsc.DrawCommand_color_set) + __swig_setmethods__["pressure"] = _colorsc.DrawCommand_pressure_set + __swig_getmethods__["pressure"] = _colorsc.DrawCommand_pressure_get + if _newclass:pressure = _swig_property(_colorsc.DrawCommand_pressure_get, _colorsc.DrawCommand_pressure_set) + __swig_setmethods__["flipx"] = _colorsc.DrawCommand_flipx_set + __swig_getmethods__["flipx"] = _colorsc.DrawCommand_flipx_get + if _newclass:flipx = _swig_property(_colorsc.DrawCommand_flipx_get, _colorsc.DrawCommand_flipx_set) + __swig_setmethods__["flipy"] = _colorsc.DrawCommand_flipy_set + __swig_getmethods__["flipy"] = _colorsc.DrawCommand_flipy_get + if _newclass:flipy = _swig_property(_colorsc.DrawCommand_flipy_get, _colorsc.DrawCommand_flipy_set) + __swig_setmethods__["is_text"] = _colorsc.DrawCommand_is_text_set + __swig_getmethods__["is_text"] = _colorsc.DrawCommand_is_text_get + if _newclass:is_text = _swig_property(_colorsc.DrawCommand_is_text_get, _colorsc.DrawCommand_is_text_set) + __swig_setmethods__["text"] = _colorsc.DrawCommand_text_set + __swig_getmethods__["text"] = _colorsc.DrawCommand_text_get + if _newclass:text = _swig_property(_colorsc.DrawCommand_text_get, _colorsc.DrawCommand_text_set) + __swig_setmethods__["brush_control"] = _colorsc.DrawCommand_brush_control_set + __swig_getmethods__["brush_control"] = _colorsc.DrawCommand_brush_control_get + if _newclass:brush_control = _swig_property(_colorsc.DrawCommand_brush_control_get, _colorsc.DrawCommand_brush_control_set) + __swig_setmethods__["brush_type"] = _colorsc.DrawCommand_brush_type_set + __swig_getmethods__["brush_type"] = _colorsc.DrawCommand_brush_type_get + if _newclass:brush_type = _swig_property(_colorsc.DrawCommand_brush_type_get, _colorsc.DrawCommand_brush_type_set) + __swig_setmethods__["size"] = _colorsc.DrawCommand_size_set + __swig_getmethods__["size"] = _colorsc.DrawCommand_size_get + if _newclass:size = _swig_property(_colorsc.DrawCommand_size_get, _colorsc.DrawCommand_size_set) + __swig_setmethods__["opacity"] = _colorsc.DrawCommand_opacity_set + __swig_getmethods__["opacity"] = _colorsc.DrawCommand_opacity_get + if _newclass:opacity = _swig_property(_colorsc.DrawCommand_opacity_get, _colorsc.DrawCommand_opacity_set) + def __init__(self, *args): + this = _colorsc.new_DrawCommand(*args) + try: self.this.append(this) + except: self.this = this + __swig_getmethods__["create_color_change"] = lambda x: _colorsc.DrawCommand_create_color_change + if _newclass:create_color_change = staticmethod(_colorsc.DrawCommand_create_color_change) + __swig_getmethods__["create_draw"] = lambda x: _colorsc.DrawCommand_create_draw + if _newclass:create_draw = staticmethod(_colorsc.DrawCommand_create_draw) + __swig_getmethods__["create_end_draw"] = lambda x: _colorsc.DrawCommand_create_end_draw + if _newclass:create_end_draw = staticmethod(_colorsc.DrawCommand_create_end_draw) + __swig_getmethods__["create_size_change"] = lambda x: _colorsc.DrawCommand_create_size_change + if _newclass:create_size_change = staticmethod(_colorsc.DrawCommand_create_size_change) + __swig_getmethods__["create_flip"] = lambda x: _colorsc.DrawCommand_create_flip + if _newclass:create_flip = staticmethod(_colorsc.DrawCommand_create_flip) + __swig_destroy__ = _colorsc.delete_DrawCommand + __del__ = lambda self : None; +DrawCommand_swigregister = _colorsc.DrawCommand_swigregister +DrawCommand_swigregister(DrawCommand) +DrawCommand_create_color_change = _colorsc.DrawCommand_create_color_change +DrawCommand_create_draw = _colorsc.DrawCommand_create_draw +DrawCommand_create_end_draw = _colorsc.DrawCommand_create_end_draw +DrawCommand_create_size_change = _colorsc.DrawCommand_create_size_change +DrawCommand_create_flip = _colorsc.DrawCommand_create_flip + +class BrushType(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, BrushType, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, BrushType, name) + __repr__ = _swig_repr + BRUSHTYPE_HARD = _colorsc.BrushType_BRUSHTYPE_HARD + BRUSHTYPE_SOFT = _colorsc.BrushType_BRUSHTYPE_SOFT + BRUSHTYPE_CURSOR = _colorsc.BrushType_BRUSHTYPE_CURSOR + NUM_BRUSHES = _colorsc.BrushType_NUM_BRUSHES + DIST_TABLE_WIDTH = _colorsc.BrushType_DIST_TABLE_WIDTH + DIST_TABLE_CENTER = _colorsc.BrushType_DIST_TABLE_CENTER + BRUSH_TABLE_WIDTH = _colorsc.BrushType_BRUSH_TABLE_WIDTH + BRUSH_TABLE_HEIGHT = _colorsc.BrushType_BRUSH_TABLE_HEIGHT + EXTRA_BRUSH_SCALE = _colorsc.BrushType_EXTRA_BRUSH_SCALE + __swig_setmethods__["distance_tbl"] = _colorsc.BrushType_distance_tbl_set + __swig_getmethods__["distance_tbl"] = _colorsc.BrushType_distance_tbl_get + if _newclass:distance_tbl = _swig_property(_colorsc.BrushType_distance_tbl_get, _colorsc.BrushType_distance_tbl_set) + __swig_setmethods__["intensity_tbl"] = _colorsc.BrushType_intensity_tbl_set + __swig_getmethods__["intensity_tbl"] = _colorsc.BrushType_intensity_tbl_get + if _newclass:intensity_tbl = _swig_property(_colorsc.BrushType_intensity_tbl_get, _colorsc.BrushType_intensity_tbl_set) + __swig_getmethods__["create_distance_table"] = lambda x: _colorsc.BrushType_create_distance_table + if _newclass:create_distance_table = staticmethod(_colorsc.BrushType_create_distance_table) + def smooth_step(*args): return _colorsc.BrushType_smooth_step(*args) + def create_brush(*args): return _colorsc.BrushType_create_brush(*args) + def create_hard_brush(*args): return _colorsc.BrushType_create_hard_brush(*args) + def create_soft_brush(*args): return _colorsc.BrushType_create_soft_brush(*args) + def create_cursor(*args): return _colorsc.BrushType_create_cursor(*args) + def __init__(self, *args): + this = _colorsc.new_BrushType(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _colorsc.delete_BrushType + __del__ = lambda self : None; +BrushType_swigregister = _colorsc.BrushType_swigregister +BrushType_swigregister(BrushType) +BrushType_create_distance_table = _colorsc.BrushType_create_distance_table + +class Brush(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Brush, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Brush, name) + __repr__ = _swig_repr + BRUSHCONTROL_VARIABLEOPACITY = _colorsc.Brush_BRUSHCONTROL_VARIABLEOPACITY + BRUSHCONTROL_VARIABLESIZE = _colorsc.Brush_BRUSHCONTROL_VARIABLESIZE + __swig_setmethods__["brush_type"] = _colorsc.Brush_brush_type_set + __swig_getmethods__["brush_type"] = _colorsc.Brush_brush_type_get + if _newclass:brush_type = _swig_property(_colorsc.Brush_brush_type_get, _colorsc.Brush_brush_type_set) + __swig_setmethods__["color"] = _colorsc.Brush_color_set + __swig_getmethods__["color"] = _colorsc.Brush_color_get + if _newclass:color = _swig_property(_colorsc.Brush_color_get, _colorsc.Brush_color_set) + __swig_setmethods__["type"] = _colorsc.Brush_type_set + __swig_getmethods__["type"] = _colorsc.Brush_type_get + if _newclass:type = _swig_property(_colorsc.Brush_type_get, _colorsc.Brush_type_set) + __swig_setmethods__["size"] = _colorsc.Brush_size_set + __swig_getmethods__["size"] = _colorsc.Brush_size_get + if _newclass:size = _swig_property(_colorsc.Brush_size_get, _colorsc.Brush_size_set) + __swig_setmethods__["control"] = _colorsc.Brush_control_set + __swig_getmethods__["control"] = _colorsc.Brush_control_get + if _newclass:control = _swig_property(_colorsc.Brush_control_get, _colorsc.Brush_control_set) + __swig_setmethods__["opacity"] = _colorsc.Brush_opacity_set + __swig_getmethods__["opacity"] = _colorsc.Brush_opacity_get + if _newclass:opacity = _swig_property(_colorsc.Brush_opacity_get, _colorsc.Brush_opacity_set) + def __init__(self, *args): + this = _colorsc.new_Brush(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _colorsc.delete_Brush + __del__ = lambda self : None; +Brush_swigregister = _colorsc.Brush_swigregister +Brush_swigregister(Brush) + +class Canvas(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Canvas, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Canvas, name) + __repr__ = _swig_repr + REFERENCE_WIDTH = _colorsc.Canvas_REFERENCE_WIDTH + REFERENCE_HEIGHT = _colorsc.Canvas_REFERENCE_HEIGHT + VIDEO_WIDTH = _colorsc.Canvas_VIDEO_WIDTH + VIDEO_HEIGHT = _colorsc.Canvas_VIDEO_HEIGHT + DRAWBRUSH_TYPE_NORMAL = _colorsc.Canvas_DRAWBRUSH_TYPE_NORMAL + DRAWBRUSH_TYPE_OLDCURSOR = _colorsc.Canvas_DRAWBRUSH_TYPE_OLDCURSOR + DRAWBRUSH_TYPE_DIRECT = _colorsc.Canvas_DRAWBRUSH_TYPE_DIRECT + DRAWBRUSH_TYPE_GETCOLOR = _colorsc.Canvas_DRAWBRUSH_TYPE_GETCOLOR + DRAWBRUSH_TYPE_CURSOR = _colorsc.Canvas_DRAWBRUSH_TYPE_CURSOR + __swig_setmethods__["commands"] = _colorsc.Canvas_commands_set + __swig_getmethods__["commands"] = _colorsc.Canvas_commands_get + if _newclass:commands = _swig_property(_colorsc.Canvas_commands_get, _colorsc.Canvas_commands_set) + __swig_setmethods__["width"] = _colorsc.Canvas_width_set + __swig_getmethods__["width"] = _colorsc.Canvas_width_get + if _newclass:width = _swig_property(_colorsc.Canvas_width_get, _colorsc.Canvas_width_set) + __swig_setmethods__["height"] = _colorsc.Canvas_height_set + __swig_getmethods__["height"] = _colorsc.Canvas_height_get + if _newclass:height = _swig_property(_colorsc.Canvas_height_get, _colorsc.Canvas_height_set) + __swig_setmethods__["image"] = _colorsc.Canvas_image_set + __swig_getmethods__["image"] = _colorsc.Canvas_image_get + if _newclass:image = _swig_property(_colorsc.Canvas_image_get, _colorsc.Canvas_image_set) + __swig_setmethods__["image_backup"] = _colorsc.Canvas_image_backup_set + __swig_getmethods__["image_backup"] = _colorsc.Canvas_image_backup_get + if _newclass:image_backup = _swig_property(_colorsc.Canvas_image_backup_get, _colorsc.Canvas_image_backup_set) + __swig_setmethods__["alpha"] = _colorsc.Canvas_alpha_set + __swig_getmethods__["alpha"] = _colorsc.Canvas_alpha_get + if _newclass:alpha = _swig_property(_colorsc.Canvas_alpha_get, _colorsc.Canvas_alpha_set) + __swig_setmethods__["image_shared"] = _colorsc.Canvas_image_shared_set + __swig_getmethods__["image_shared"] = _colorsc.Canvas_image_shared_get + if _newclass:image_shared = _swig_property(_colorsc.Canvas_image_shared_get, _colorsc.Canvas_image_shared_set) + __swig_setmethods__["image_reference"] = _colorsc.Canvas_image_reference_set + __swig_getmethods__["image_reference"] = _colorsc.Canvas_image_reference_get + if _newclass:image_reference = _swig_property(_colorsc.Canvas_image_reference_get, _colorsc.Canvas_image_reference_set) + __swig_setmethods__["image_video"] = _colorsc.Canvas_image_video_set + __swig_getmethods__["image_video"] = _colorsc.Canvas_image_video_get + if _newclass:image_video = _swig_property(_colorsc.Canvas_image_video_get, _colorsc.Canvas_image_video_set) + __swig_setmethods__["video_idx"] = _colorsc.Canvas_video_idx_set + __swig_getmethods__["video_idx"] = _colorsc.Canvas_video_idx_get + if _newclass:video_idx = _swig_property(_colorsc.Canvas_video_idx_get, _colorsc.Canvas_video_idx_set) + __swig_setmethods__["videopaint_pos"] = _colorsc.Canvas_videopaint_pos_set + __swig_getmethods__["videopaint_pos"] = _colorsc.Canvas_videopaint_pos_get + if _newclass:videopaint_pos = _swig_property(_colorsc.Canvas_videopaint_pos_get, _colorsc.Canvas_videopaint_pos_set) + __swig_setmethods__["videopaint_pressure"] = _colorsc.Canvas_videopaint_pressure_set + __swig_getmethods__["videopaint_pressure"] = _colorsc.Canvas_videopaint_pressure_get + if _newclass:videopaint_pressure = _swig_property(_colorsc.Canvas_videopaint_pressure_get, _colorsc.Canvas_videopaint_pressure_set) + __swig_setmethods__["brush"] = _colorsc.Canvas_brush_set + __swig_getmethods__["brush"] = _colorsc.Canvas_brush_get + if _newclass:brush = _swig_property(_colorsc.Canvas_brush_get, _colorsc.Canvas_brush_set) + __swig_setmethods__["lastpos"] = _colorsc.Canvas_lastpos_set + __swig_getmethods__["lastpos"] = _colorsc.Canvas_lastpos_get + if _newclass:lastpos = _swig_property(_colorsc.Canvas_lastpos_get, _colorsc.Canvas_lastpos_set) + __swig_setmethods__["lastorgpos"] = _colorsc.Canvas_lastorgpos_set + __swig_getmethods__["lastorgpos"] = _colorsc.Canvas_lastorgpos_get + if _newclass:lastorgpos = _swig_property(_colorsc.Canvas_lastorgpos_get, _colorsc.Canvas_lastorgpos_set) + __swig_setmethods__["lastpressure"] = _colorsc.Canvas_lastpressure_set + __swig_getmethods__["lastpressure"] = _colorsc.Canvas_lastpressure_get + if _newclass:lastpressure = _swig_property(_colorsc.Canvas_lastpressure_get, _colorsc.Canvas_lastpressure_set) + __swig_setmethods__["dirtymin"] = _colorsc.Canvas_dirtymin_set + __swig_getmethods__["dirtymin"] = _colorsc.Canvas_dirtymin_get + if _newclass:dirtymin = _swig_property(_colorsc.Canvas_dirtymin_get, _colorsc.Canvas_dirtymin_set) + __swig_setmethods__["dirtymax"] = _colorsc.Canvas_dirtymax_set + __swig_getmethods__["dirtymax"] = _colorsc.Canvas_dirtymax_get + if _newclass:dirtymax = _swig_property(_colorsc.Canvas_dirtymax_get, _colorsc.Canvas_dirtymax_set) + __swig_setmethods__["strokemin"] = _colorsc.Canvas_strokemin_set + __swig_getmethods__["strokemin"] = _colorsc.Canvas_strokemin_get + if _newclass:strokemin = _swig_property(_colorsc.Canvas_strokemin_get, _colorsc.Canvas_strokemin_set) + __swig_setmethods__["strokemax"] = _colorsc.Canvas_strokemax_set + __swig_getmethods__["strokemax"] = _colorsc.Canvas_strokemax_get + if _newclass:strokemax = _swig_property(_colorsc.Canvas_strokemax_get, _colorsc.Canvas_strokemax_set) + __swig_setmethods__["stroke"] = _colorsc.Canvas_stroke_set + __swig_getmethods__["stroke"] = _colorsc.Canvas_stroke_get + if _newclass:stroke = _swig_property(_colorsc.Canvas_stroke_get, _colorsc.Canvas_stroke_set) + __swig_setmethods__["idle_while_drawing"] = _colorsc.Canvas_idle_while_drawing_set + __swig_getmethods__["idle_while_drawing"] = _colorsc.Canvas_idle_while_drawing_get + if _newclass:idle_while_drawing = _swig_property(_colorsc.Canvas_idle_while_drawing_get, _colorsc.Canvas_idle_while_drawing_set) + __swig_setmethods__["drawtype"] = _colorsc.Canvas_drawtype_set + __swig_getmethods__["drawtype"] = _colorsc.Canvas_drawtype_get + if _newclass:drawtype = _swig_property(_colorsc.Canvas_drawtype_get, _colorsc.Canvas_drawtype_set) + __swig_setmethods__["playing"] = _colorsc.Canvas_playing_set + __swig_getmethods__["playing"] = _colorsc.Canvas_playing_get + if _newclass:playing = _swig_property(_colorsc.Canvas_playing_get, _colorsc.Canvas_playing_set) + __swig_setmethods__["playback"] = _colorsc.Canvas_playback_set + __swig_getmethods__["playback"] = _colorsc.Canvas_playback_get + if _newclass:playback = _swig_property(_colorsc.Canvas_playback_get, _colorsc.Canvas_playback_set) + __swig_setmethods__["playback_speed"] = _colorsc.Canvas_playback_speed_set + __swig_getmethods__["playback_speed"] = _colorsc.Canvas_playback_speed_get + if _newclass:playback_speed = _swig_property(_colorsc.Canvas_playback_speed_get, _colorsc.Canvas_playback_speed_set) + __swig_setmethods__["modified"] = _colorsc.Canvas_modified_set + __swig_getmethods__["modified"] = _colorsc.Canvas_modified_get + if _newclass:modified = _swig_property(_colorsc.Canvas_modified_get, _colorsc.Canvas_modified_set) + def __init__(self, *args): + this = _colorsc.new_Canvas(*args) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _colorsc.delete_Canvas + __del__ = lambda self : None; + def clear(*args): return _colorsc.Canvas_clear(*args) + def resize(*args): return _colorsc.Canvas_resize(*args) + def reset_brush(*args): return _colorsc.Canvas_reset_brush(*args) + def save_shared_image(*args): return _colorsc.Canvas_save_shared_image(*args) + def restore_shared_image(*args): return _colorsc.Canvas_restore_shared_image(*args) + def clear_image(*args): return _colorsc.Canvas_clear_image(*args) + def get_variable_brush_size(*args): return _colorsc.Canvas_get_variable_brush_size(*args) + def command_draw(*args): return _colorsc.Canvas_command_draw(*args) + def command_enddraw(*args): return _colorsc.Canvas_command_enddraw(*args) + def reset_dirty_rect(*args): return _colorsc.Canvas_reset_dirty_rect(*args) + def draw_brush(*args): return _colorsc.Canvas_draw_brush(*args) + def add_command(*args): return _colorsc.Canvas_add_command(*args) + def play_command(*args): return _colorsc.Canvas_play_command(*args) + def playback_done(*args): return _colorsc.Canvas_playback_done(*args) + def playback_length(*args): return _colorsc.Canvas_playback_length(*args) + def playback_pos(*args): return _colorsc.Canvas_playback_pos(*args) + def start_playback(*args): return _colorsc.Canvas_start_playback(*args) + def pause_playback(*args): return _colorsc.Canvas_pause_playback(*args) + def resume_playback(*args): return _colorsc.Canvas_resume_playback(*args) + def stop_playback(*args): return _colorsc.Canvas_stop_playback(*args) + def finish_playback(*args): return _colorsc.Canvas_finish_playback(*args) + def playback_finish_stroke(*args): return _colorsc.Canvas_playback_finish_stroke(*args) + def playback_to(*args): return _colorsc.Canvas_playback_to(*args) + def playback_step_to(*args): return _colorsc.Canvas_playback_step_to(*args) + def playback_to_timed(*args): return _colorsc.Canvas_playback_to_timed(*args) + def set_playback_speed(*args): return _colorsc.Canvas_set_playback_speed(*args) + def truncate_at_playback(*args): return _colorsc.Canvas_truncate_at_playback(*args) + def update_playback(*args): return _colorsc.Canvas_update_playback(*args) + def get_num_commands(*args): return _colorsc.Canvas_get_num_commands(*args) + def play_range(*args): return _colorsc.Canvas_play_range(*args) + def blit_2x(*args): return _colorsc.Canvas_blit_2x(*args) + def downsize_video(*args): return _colorsc.Canvas_downsize_video(*args) + def videopaint_motion(*args): return _colorsc.Canvas_videopaint_motion(*args) + def blit_videopaint(*args): return _colorsc.Canvas_blit_videopaint(*args) + def set_reference_buffer(*args): return _colorsc.Canvas_set_reference_buffer(*args) + def render_reference_overlay(*args): return _colorsc.Canvas_render_reference_overlay(*args) + def render_overlay(*args): return _colorsc.Canvas_render_overlay(*args) + def clear_overlay(*args): return _colorsc.Canvas_clear_overlay(*args) + def upgrade_drw_header(*args): return _colorsc.Canvas_upgrade_drw_header(*args) + def load(*args): return _colorsc.Canvas_load(*args) + def save(*args): return _colorsc.Canvas_save(*args) + def convert_from_drw(*args): return _colorsc.Canvas_convert_from_drw(*args) + def convert_to_drw(*args): return _colorsc.Canvas_convert_to_drw(*args) + def send_drw_commands(*args): return _colorsc.Canvas_send_drw_commands(*args) + def receive_drw_commands(*args): return _colorsc.Canvas_receive_drw_commands(*args) +Canvas_swigregister = _colorsc.Canvas_swigregister +Canvas_swigregister(Canvas) + +class Palette(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Palette, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Palette, name) + __repr__ = _swig_repr + WHEEL_WIDTH = _colorsc.Palette_WHEEL_WIDTH + __swig_setmethods__["size"] = _colorsc.Palette_size_set + __swig_getmethods__["size"] = _colorsc.Palette_size_get + if _newclass:size = _swig_property(_colorsc.Palette_size_get, _colorsc.Palette_size_set) + __swig_setmethods__["palette_h"] = _colorsc.Palette_palette_h_set + __swig_getmethods__["palette_h"] = _colorsc.Palette_palette_h_get + if _newclass:palette_h = _swig_property(_colorsc.Palette_palette_h_get, _colorsc.Palette_palette_h_set) + __swig_setmethods__["palette_s"] = _colorsc.Palette_palette_s_set + __swig_getmethods__["palette_s"] = _colorsc.Palette_palette_s_get + if _newclass:palette_s = _swig_property(_colorsc.Palette_palette_s_get, _colorsc.Palette_palette_s_set) + __swig_setmethods__["palette_v"] = _colorsc.Palette_palette_v_set + __swig_getmethods__["palette_v"] = _colorsc.Palette_palette_v_get + if _newclass:palette_v = _swig_property(_colorsc.Palette_palette_v_get, _colorsc.Palette_palette_v_set) + __swig_setmethods__["triangle_cursor"] = _colorsc.Palette_triangle_cursor_set + __swig_getmethods__["triangle_cursor"] = _colorsc.Palette_triangle_cursor_get + if _newclass:triangle_cursor = _swig_property(_colorsc.Palette_triangle_cursor_get, _colorsc.Palette_triangle_cursor_set) + __swig_setmethods__["triangle_capture"] = _colorsc.Palette_triangle_capture_set + __swig_getmethods__["triangle_capture"] = _colorsc.Palette_triangle_capture_get + if _newclass:triangle_capture = _swig_property(_colorsc.Palette_triangle_capture_get, _colorsc.Palette_triangle_capture_set) + __swig_setmethods__["wheel_capture"] = _colorsc.Palette_wheel_capture_set + __swig_getmethods__["wheel_capture"] = _colorsc.Palette_wheel_capture_get + if _newclass:wheel_capture = _swig_property(_colorsc.Palette_wheel_capture_get, _colorsc.Palette_wheel_capture_set) + def __init__(self, *args): + this = _colorsc.new_Palette(*args) + try: self.this.append(this) + except: self.this = this + def get_wheel_radius(*args): return _colorsc.Palette_get_wheel_radius(*args) + def rgb_to_hsv(*args): return _colorsc.Palette_rgb_to_hsv(*args) + def hsv_to_rgb(*args): return _colorsc.Palette_hsv_to_rgb(*args) + def set_color(*args): return _colorsc.Palette_set_color(*args) + def get_color(*args): return _colorsc.Palette_get_color(*args) + def sqr(*args): return _colorsc.Palette_sqr(*args) + def dot(*args): return _colorsc.Palette_dot(*args) + def length(*args): return _colorsc.Palette_length(*args) + def length_sqr(*args): return _colorsc.Palette_length_sqr(*args) + def distance(*args): return _colorsc.Palette_distance(*args) + def distance_sqr(*args): return _colorsc.Palette_distance_sqr(*args) + def normalize(*args): return _colorsc.Palette_normalize(*args) + def get_triangle_points(*args): return _colorsc.Palette_get_triangle_points(*args) + def render_wheel(*args): return _colorsc.Palette_render_wheel(*args) + def render_triangle(*args): return _colorsc.Palette_render_triangle(*args) + def get_wheel_pos(*args): return _colorsc.Palette_get_wheel_pos(*args) + def get_triangle_pos(*args): return _colorsc.Palette_get_triangle_pos(*args) + def process_mouse(*args): return _colorsc.Palette_process_mouse(*args) + def process_mouse_release(*args): return _colorsc.Palette_process_mouse_release(*args) + __swig_destroy__ = _colorsc.delete_Palette + __del__ = lambda self : None; +Palette_swigregister = _colorsc.Palette_swigregister +Palette_swigregister(Palette) + +class BrushPreview(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, BrushPreview, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, BrushPreview, name) + __repr__ = _swig_repr + __swig_setmethods__["size"] = _colorsc.BrushPreview_size_set + __swig_getmethods__["size"] = _colorsc.BrushPreview_size_get + if _newclass:size = _swig_property(_colorsc.BrushPreview_size_get, _colorsc.BrushPreview_size_set) + __swig_setmethods__["brush"] = _colorsc.BrushPreview_brush_set + __swig_getmethods__["brush"] = _colorsc.BrushPreview_brush_get + if _newclass:brush = _swig_property(_colorsc.BrushPreview_brush_get, _colorsc.BrushPreview_brush_set) + def __init__(self, *args): + this = _colorsc.new_BrushPreview(*args) + try: self.this.append(this) + except: self.this = this + def render(*args): return _colorsc.BrushPreview_render(*args) + __swig_destroy__ = _colorsc.delete_BrushPreview + __del__ = lambda self : None; +BrushPreview_swigregister = _colorsc.BrushPreview_swigregister +BrushPreview_swigregister(BrushPreview) + + + diff --git a/data/INDEX b/data/INDEX new file mode 100644 index 0000000..d528188 --- /dev/null +++ b/data/INDEX @@ -0,0 +1,5 @@ +[ + {"title":"Intro","icon":"intro.png","drw":"intro.drw"}, + {"title":"Castle by Mikko Kinnunen","icon":"castle.png","drw":"castle.drw"}, + {"title":"Lounge by Mikko Kinnunen","icon":"lounge.png","drw":"lounge.drw"} +] diff --git a/data/castle.drw b/data/castle.drw new file mode 100644 index 0000000..ebcbb68 --- /dev/null +++ b/data/castle.drw Binary files differ diff --git a/data/castle.png b/data/castle.png new file mode 100644 index 0000000..54825c7 --- /dev/null +++ b/data/castle.png Binary files differ diff --git a/data/intro.drw b/data/intro.drw new file mode 100644 index 0000000..be2b6f7 --- /dev/null +++ b/data/intro.drw Binary files differ diff --git a/data/intro.png b/data/intro.png new file mode 100644 index 0000000..afc589a --- /dev/null +++ b/data/intro.png Binary files differ diff --git a/data/lounge.drw b/data/lounge.drw new file mode 100644 index 0000000..04f73c2 --- /dev/null +++ b/data/lounge.drw Binary files differ diff --git a/data/lounge.png b/data/lounge.png new file mode 100644 index 0000000..f7cb297 --- /dev/null +++ b/data/lounge.png Binary files differ diff --git a/icons/erase.svg b/icons/erase.svg new file mode 100644 index 0000000..dfa47de --- /dev/null +++ b/icons/erase.svg @@ -0,0 +1,56 @@ + + +image/svg+xml + + + \ No newline at end of file diff --git a/icons/palette.svg b/icons/palette.svg new file mode 100644 index 0000000..c4f10bf --- /dev/null +++ b/icons/palette.svg @@ -0,0 +1,20 @@ + + +]> + + + + + + + + + + + + + + + + diff --git a/icons/reference.svg b/icons/reference.svg new file mode 100644 index 0000000..a3a81e7 --- /dev/null +++ b/icons/reference.svg @@ -0,0 +1,12 @@ + + +]> + + + + + + + + \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..ed7e7c6 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +from sugar.activity import bundlebuilder +if __name__ == "__main__": + bundlebuilder.start("Colors") diff --git a/src/build.sh b/src/build.sh new file mode 100755 index 0000000..6b7678b --- /dev/null +++ b/src/build.sh @@ -0,0 +1,5 @@ +swig -c++ -python colorsc.i +python setup.py build_ext --inplace +mv _colorsc.so ../ +mv colorsc.py ../ + diff --git a/src/canvas.cpp b/src/canvas.cpp new file mode 100644 index 0000000..ecdc11e --- /dev/null +++ b/src/canvas.cpp @@ -0,0 +1,28 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +#include "canvas.h" + +unsigned char BrushType::distance_tbl[DIST_TABLE_WIDTH][DIST_TABLE_WIDTH]; + +BrushType Brush::brush_type[BrushType::NUM_BRUSHES]; + +void test_method(void* data) +{ +} + + diff --git a/src/canvas.h b/src/canvas.h new file mode 100644 index 0000000..8556d54 --- /dev/null +++ b/src/canvas.h @@ -0,0 +1,1434 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +#ifndef _CANVAS_H_ +#define _CANVAS_H_ + +#include "colorsc.h" +#include "drwfile.h" + +// Uncomment this to print all executed drawing commands to stdout. +//#define CANVAS_DEBUG_COMMANDS + +// Structure for passing pixel data to and from Python. +struct SurfaceA8R8G8B8 +{ + int width, height; + int stride; + unsigned int* pixels; +}; + +// Structure for passing buffers of draw commands to and from Python. +struct DrawCommandBuffer +{ + DrawCommandBuffer() + { + cmds = NULL; + ncommands = 0; + } + + DrawCommandBuffer(const char* _cmds, int _ncommands) + { + cmds = (char*)malloc(_ncommands*sizeof(unsigned int)); + memcpy(cmds, _cmds, _ncommands*sizeof(unsigned int)); + ncommands = _ncommands; + } + + DrawCommandBuffer(const DrawCommandBuffer& b) + { + cmds = (char*)malloc(b.ncommands*sizeof(unsigned int)); + memcpy(cmds, b.cmds, b.ncommands*sizeof(unsigned int)); + ncommands = b.ncommands; + } + + ~DrawCommandBuffer() + { + if (cmds) + { + free((void*)cmds); + cmds = NULL; + } + } + + const DrawCommandBuffer& operator=(const DrawCommandBuffer& b) + { + if (cmds) + free((void*)cmds); + cmds = (char*)malloc(b.ncommands*sizeof(unsigned int)); + memcpy(cmds, b.cmds, b.ncommands*sizeof(unsigned int)); + ncommands = b.ncommands; + return *this; + } + + void append(const DrawCommandBuffer& b) + { + char* newcmds = (char*)malloc((ncommands+b.ncommands)*sizeof(unsigned int)); + if (cmds) + { + memcpy(newcmds, cmds, ncommands*sizeof(unsigned int)); + free(cmds); + } + memcpy(newcmds + ncommands*sizeof(unsigned int), b.cmds, b.ncommands*sizeof(unsigned int)); + cmds = newcmds; + ncommands = ncommands + b.ncommands; + } + + void clear() + { + if (cmds) + { + free(cmds); + cmds = NULL; + } + ncommands = 0; + } + + ByteBuffer get_bytes() + { + ByteBuffer buf; + buf.size = ncommands*sizeof(unsigned int); + buf.data = cmds; + return buf; + } + + char* cmds; + int ncommands; + + static DrawCommandBuffer create_from_string(const char* cmds, int ncommands) + { + return DrawCommandBuffer(cmds, ncommands); + } +}; + +struct DrawCommand +{ + enum + { + TYPE_DRAW = 0, + TYPE_DRAWEND = 1, + TYPE_COLORCHANGE = 2, + TYPE_SIZECHANGE = 3, + }; + + int type; + Pos pos; + Color color; + int pressure; + bool flipx; + bool flipy; + bool is_text; + uint32_t text; + int brush_control; + int brush_type; + float size; + float opacity; + + DrawCommand() + { + type = TYPE_DRAW; + pressure = 0; + flipx = false; + flipy = false; + is_text = false; + text = 0; + brush_control = 0; + brush_type = 0; + size = 0; + opacity = 0; + } + + static DrawCommand create_color_change(const Color& c) + { + DrawCommand cmd; + cmd.type = TYPE_COLORCHANGE; + cmd.color = c; + return cmd; + } + + static DrawCommand create_draw(const Pos& pos, int pressure) + { + DrawCommand cmd; + cmd.type = TYPE_DRAW; + cmd.pos = pos; + cmd.pressure = pressure; + return cmd; + } + + static DrawCommand create_end_draw(int pressure) + { + DrawCommand cmd; + cmd.type = TYPE_DRAWEND; + cmd.pressure = pressure; + return cmd; + } + + static DrawCommand create_size_change(int brush_control, int brush_type, float size, float opacity) + { + DrawCommand cmd; + cmd.type = TYPE_SIZECHANGE; + cmd.brush_control = brush_control; + cmd.brush_type = brush_type; + cmd.size = size; + cmd.opacity = opacity; + return cmd; + } + + static DrawCommand create_flip(bool flipx) + { + DrawCommand cmd; + cmd.type = TYPE_COLORCHANGE; + cmd.flipx = flipx; + cmd.flipy = !flipx; + return cmd; + } +}; + +struct BrushType +{ + enum + { + BRUSHTYPE_HARD = 0, + BRUSHTYPE_SOFT = 1, + BRUSHTYPE_CURSOR = 2, + NUM_BRUSHES = 3, + }; + + static const int DIST_TABLE_WIDTH = 256; // Width of distance lookup-table + static const int DIST_TABLE_CENTER = DIST_TABLE_WIDTH / 2; // Center of distance lookup-table + + static const int BRUSH_TABLE_WIDTH = 256; // Width of brush lookup-table + static const int BRUSH_TABLE_HEIGHT = 65; // Height of 65 allows a brushsize down to 1.0f + + static const float EXTRA_BRUSH_SCALE = 1.023f; // Scales down the brush-size so we don't index-out-of-range. + + static unsigned char distance_tbl[DIST_TABLE_WIDTH][DIST_TABLE_WIDTH]; + + unsigned char intensity_tbl[BRUSH_TABLE_WIDTH][BRUSH_TABLE_HEIGHT]; + + // Creates a simple sqrt-lookup table. + static void create_distance_table() + { + for (int x = 0; x < DIST_TABLE_WIDTH; x++) + for (int y = 0; y < DIST_TABLE_WIDTH; y++) + { + int dx = x - DIST_TABLE_CENTER; + int dy = y - DIST_TABLE_CENTER; + float dist = sqrtf(float(dx * dx + dy * dy)); + distance_tbl[x][y] = (unsigned char)min(255.0f, dist*255/DIST_TABLE_CENTER); + } + } + + // Calculates a gradient between 0 and 1 where the derivate of both 0 and 1 is 0. + // This function is used to calculate the falloff of the brushes. + float smooth_step(float a) + { + return sinf((a*a - 0.5f) * 3.14159f) * 0.5f + 0.5f; + } + + void create_brush(float brush_border, float amp) + { + // Find at what range from brush-center the brush intensity goes below 2 + float max_r = 0; + for (int i = BRUSH_TABLE_WIDTH-1; i >= 0; i--) + { + float f = float(i) / BRUSH_TABLE_WIDTH; + float f2 = 1.0f - (f - brush_border) / (1.0f - brush_border); + if (round(smooth_step(f2) * amp) >= 2) + { + max_r = i; + break; + } + } + + // Calculate a scale-factor so the brush optimally uses the area + float r = float(max_r + 2) / BRUSH_TABLE_WIDTH / BRUSH_TABLE_WIDTH; + + for (int y = 0; y < BRUSH_TABLE_HEIGHT; y++) + { + // Each line in the brush-table is calculated for a specific brush-size + // This has two functions: + // 1. Be able to simulate the effect of resampling of the "perfect" big brush to a smaller one to improve precision + // 2. Compensate for the need to scale small brushes to avoid index out of range during rastering + + // Calculate scale for this width + float brushscale = EXTRA_BRUSH_SCALE + y * 2.0f / 64.0f; + + // Calculate brush + unsigned int intensity_row[BRUSH_TABLE_WIDTH]; + for (int i = 0; i < BRUSH_TABLE_WIDTH; i++) + { + float f = min(i * r * brushscale, 1.0f); // Apply the two different scales + if (f < brush_border) + intensity_row[i] = int(amp); + else + { + float f2 = 1.0f - (f - brush_border) / (1.0f - brush_border); + f2 = smooth_step(f2) * amp; // Make sure the border-falloff is smooth + intensity_row[i] = int(round(f2)); + } + } + + // Simulate the effect of resampling + int blurradius = int(round(y * BRUSH_TABLE_WIDTH / (brushscale * 64.0f))); + float maxintensity = 0; + for (int x = 0; x < BRUSH_TABLE_WIDTH; x++) + { + float l = 0; + for (int x2 = x - blurradius; x2 < x + blurradius + 1; x2++) + { + int i = min(max(x2, 0), BRUSH_TABLE_WIDTH-1); + if (i < BRUSH_TABLE_WIDTH) + l += intensity_row[i]; + } + float intensity = l / (blurradius * 2 + 1); + if (intensity > maxintensity) + maxintensity = intensity; + intensity_tbl[x][y] = int(intensity); + } + } + } + + void create_hard_brush() + { + create_brush(0.8f, 255); + } + + void create_soft_brush() + { + create_brush(0.0f, 128); + } + + void create_cursor() + { + } +}; + +class Brush +{ +public: + enum + { + BRUSHCONTROL_VARIABLEOPACITY = 1, + BRUSHCONTROL_VARIABLESIZE = 2, + }; + + static BrushType brush_type[BrushType::NUM_BRUSHES]; + + Color color; + int type; + int size; + int control; + float opacity; + + Brush() + { + type = BrushType::BRUSHTYPE_HARD; + color = Color(255, 255, 255, 255); + size = 32; + control = 0; + opacity = 1.0f; + } +}; + +// The canvas represents the current state of the user's painting. It maintains both the pixels representing the +// image, and also the complete list of drawing commands that contributed to the image. +class Canvas +{ +public: + // Dimensions of the reference picture (webcam snapshot). + static const int REFERENCE_WIDTH = 640; + static const int REFERENCE_HEIGHT = 480; + + // Dimensions of the videopaint buffer. + static const int VIDEO_WIDTH = 80; + static const int VIDEO_HEIGHT = 60; + + enum + { + DRAWBRUSH_TYPE_NORMAL = 0, + DRAWBRUSH_TYPE_OLDCURSOR = 1, + DRAWBRUSH_TYPE_DIRECT = 2, + DRAWBRUSH_TYPE_GETCOLOR = 3, + DRAWBRUSH_TYPE_CURSOR = 4, + }; + + // List of drawing commands that make up the painting. + vector commands; + + // Canvas dimensions. + int width; + int height; + + // Current state of the canvas pixels. + unsigned int* image; + + // Backup and alpha channel are used for multiple purposes. See description in Drawing section. + unsigned int* image_backup; + unsigned char* alpha; + + // Shared (master) picture for collaborative painting. + unsigned int* image_shared; + + // Reference (webcam snapshot) picture. + unsigned short* image_reference; + + // Videopaint variables. + unsigned int* image_video[2]; + int video_idx; + Pos videopaint_pos; + float videopaint_pressure; + + // Current brush state. + Brush brush; + + // Variables for interpolating the brush across strokes. + Pos lastpos; + Pos lastorgpos; + float lastpressure; + + // Dimensions of the canvas that have been modified since the last call to reset_dirty_rect. + Pos dirtymin; + Pos dirtymax; + + // Dimensions and state of the current stroke. + Pos strokemin; + Pos strokemax; + bool stroke; + int idle_while_drawing; + int drawtype; + + // VCR playback variables. + bool playing; + int playback; + int playback_speed; + + // True if the canvas has been modified since the last save. + bool modified; + + Canvas(int width, int height) : width(width), height(height) + { + image = new unsigned int[width*height]; + image_backup = new unsigned int[width*height]; + alpha = new unsigned char[width*height]; + + image_shared = new unsigned int[width*height]; + image_reference = new unsigned short[REFERENCE_WIDTH*REFERENCE_HEIGHT]; + + image_video[0] = new unsigned int[VIDEO_WIDTH*VIDEO_HEIGHT]; + image_video[1] = new unsigned int[VIDEO_WIDTH*VIDEO_HEIGHT]; + video_idx = 0; + + clear(); + + // Initialize lookup table. + BrushType::create_distance_table(); + + // Initialize brushes. + Brush::brush_type[BrushType::BRUSHTYPE_HARD].create_hard_brush(); + Brush::brush_type[BrushType::BRUSHTYPE_SOFT].create_soft_brush(); + Brush::brush_type[BrushType::BRUSHTYPE_CURSOR].create_cursor(); + + reset_brush(); + + lastpos = Pos(0,0); + lastorgpos = Pos(0,0); + lastpressure = 0; + + dirtymin = Pos(-1,-1); + dirtymax = Pos(-1,-1); + + strokemin = Pos(0,0); + strokemax = Pos(0,0); + stroke = false; + + playing = false; + playback = 0; + playback_speed = 1; + modified = false; + + idle_while_drawing = 0; + + drawtype = DRAWBRUSH_TYPE_NORMAL; + } + + ~Canvas() + { + delete[] image; + delete[] image_backup; + delete[] image_shared; + delete[] alpha; + } + + // Clears the entire canvas (command history and image). + void clear() + { + commands.clear(); + clear_image(); + } + + // Changes the size of the canvas. + // Rather than trying to repaint everything from scratch, we simply quickly rescale it. + void resize(int new_width, int new_height) + { + unsigned int* new_image = new unsigned int[new_width*new_height]; + unsigned int* new_image_backup = new unsigned int[new_width*new_height]; + unsigned char* new_alpha = new unsigned char[new_width*new_height]; + unsigned int* new_image_shared = new unsigned int[new_width*new_height]; + + int dx = (1<<16) * width / new_width; + int dy = (1<<16) * height / new_height; + int ry = 0; + for (int y = 0; y < new_height; y++) + { + int rx = 0; + for (int x = 0; x < new_width; x++) + { + int sofs = (ry>>16)*width + (rx>>16); + int dofs = y*new_width+x; + new_image[dofs] = image[sofs]; + new_image_backup[dofs] = image_backup[sofs]; + new_alpha[dofs] = alpha[sofs]; + new_image_shared[dofs] = image_shared[sofs]; + rx += dx; + } + ry += dy; + } + + delete[] image; + delete[] image_backup; + delete[] alpha; + delete[] image_shared; + + width = new_width; + height = new_height; + + image = new_image; + image_backup = new_image_backup; + alpha = new_alpha; + image_shared = new_image_shared; + } + + // Resets the brush to a random color and a default size and type. + void reset_brush() + { + // Choose a suitable random brush color. + srand(clock()); + int c0 = rand()%3; + int c1 = c0 + 1 + rand()%2; + if (c1 > 2) + c1 -= 3; + brush.type = BrushType::BRUSHTYPE_HARD; + brush.color = Color::create_from_a8r8g8b8(0xff000000 | (255 << (c0 * 8) | ((rand()%255) << (c1 * 8)))); + brush.size = width/16; + brush.control = 0; //Brush::BRUSHCONTROL_VARIABLEOPACITY; + brush.opacity = 1.0f; + } + + //--------------------------------------------------------------------------------------------- + // Shared image. + // + // The shared image is used in collaborative painting, and contains the current 'master' state of the canvas + // + // The user can paint ahead of the master state, but when a new master state is received the canvas + // state will be reset to the shared image. Before this happens though, the user commands are transmitted + // to the activity host, so they will be received again as a new master image later and not be lost. + void save_shared_image() + { + memcpy(image_shared, image, width*height*sizeof(unsigned int)); + } + + void restore_shared_image() + { + memcpy(image, image_shared, width*height*sizeof(unsigned int)); + memcpy(image_backup, image_shared, width*height*sizeof(unsigned int)); + } + + //--------------------------------------------------------------------------------------------- + // Drawing + // + // These methods are for drawing to and clearing the canvas. + // + // Drawing is not done directly to the canvas. The way the brush system works, the brush shapes are + // actually drawn into the alpha channel of the canvas, and the alpha channel is used to blend the + // brush color over the backup image to create the real image. + // + // The net effect this is that during a stroke, which may overlap itself many times over, the brush color + // will only be applied to any particular canvas pixel up to the defined brush transparency level. + // This is the core of our "natural media" engine. + + void clear_image() + { + memset(image, 0xff, width*height*sizeof(unsigned int)); + memset(image_backup, 0xff, width*height*sizeof(unsigned int)); + memset(alpha, 0, width*height*sizeof(unsigned char)); + + memset(image_shared, 0xff, width*height*sizeof(unsigned int)); + + memset(image_reference, 0, REFERENCE_WIDTH*REFERENCE_HEIGHT*sizeof(unsigned short)); + memset(image_video[0], 0, VIDEO_WIDTH*VIDEO_HEIGHT*sizeof(unsigned short)); + memset(image_video[1], 0, VIDEO_WIDTH*VIDEO_HEIGHT*sizeof(unsigned short)); + + dirtymin = Pos(0, 0); + dirtymax = Pos(width, height); + } + + // Called from command_draw and calculates a temporary brush size depending on pressure/alpha (0-255). + float get_variable_brush_size(float pressure) + { + if (brush.control & Brush::BRUSHCONTROL_VARIABLESIZE) + { + float size = pressure * brush.size / 255.0f; + if (size < 2.0f) + size = 2.0f; + return size; + } + else + return brush.size; + } + + // Called each tick while stylus is touching the screen and draws the selected brush into the Alpha of the Canvas. + void command_draw(const Pos& pos, int pressure, bool forced) + { + lastorgpos = pos; + + if (brush.control == 0) + pressure = 255; + + int size, opacity; + if (!stroke) + { + // This is a new stroke. Just draw the brush on incoming position, store the information needed for interpolation and wait for next call + if (brush.control & Brush::BRUSHCONTROL_VARIABLESIZE) + size = int(get_variable_brush_size(pressure)); + else + size = brush.size; + + if (brush.control & Brush::BRUSHCONTROL_VARIABLEOPACITY) + opacity = int(round(pressure * brush.opacity)); + else + opacity = int(round(255.0f * brush.opacity)); + draw_brush(pos, size, opacity); + + // Reset stroke dirty regions + strokemin = Pos(-1, -1); + strokemax = Pos(-1, -1); + + lastpos = pos; + lastpressure = pressure; + idle_while_drawing = 0; + stroke = true; + } + else + { + // This is continous stroke. Interpolate from last postion/pressure + + // Calculate the stroke-distance + float distx = pos.x - lastpos.x; + float disty = pos.y - lastpos.y; + float dista = pressure - lastpressure; + float distance = sqrtf(distx * distx + disty * disty); + if (distance == 0.0f) // To avoid division by zero. None or very small movements are handled later + distance = 0.0001f; + + // Calculate interpolation constants + float dx = distx / distance; + float dy = disty / distance; + float da = dista / distance; + + // Calculate the spacing between two brush-stamp. Normal spacing is 25% of brushsize. + float spacing = 0.225f; + + // Do this special spacing only for just VariableOpacity with Hard brush to avoid banding + // Decrease spacing if pressure is changing rapidly + if (da != 0 && brush.control == Brush::BRUSHCONTROL_VARIABLEOPACITY && brush.type == BrushType::BRUSHTYPE_HARD) + spacing = min(0.225f, max(fabsf(15.0f / brush.size / (da * brush.opacity)), 0.05f)); + + // Calculate the distance between two brushes from spacing + float spacingdistance = get_variable_brush_size(lastpressure) * spacing; + if (distance < spacingdistance) + { + // Too small movement to interpolate + idle_while_drawing++; + if (idle_while_drawing > 15 || forced) + { + // We've been idling too long. Draw the brush and reduce idle-counter + // Idle-counter is invalid during playback, since playback only records input that actually drew something + idle_while_drawing = 10; + + lastpos = pos; + lastpressure = pressure; + if (brush.control & Brush::BRUSHCONTROL_VARIABLEOPACITY) + draw_brush(pos, int(get_variable_brush_size(lastpressure)), int(round(pressure * brush.opacity))); + else + draw_brush(pos, int(get_variable_brush_size(lastpressure)), int(round(255.0f * brush.opacity))); + } + return; + } + + if (brush.control & Brush::BRUSHCONTROL_VARIABLESIZE) + { + // Brush size is controlled by pressure + while (distance >= spacingdistance) + { + // Interpolate stroke + lastpressure += da * spacingdistance; + lastpos.x += dx * spacingdistance; + lastpos.y += dy * spacingdistance; + distance -= spacingdistance; + + float brushsize = get_variable_brush_size(int(lastpressure)); + if (brush.control & Brush::BRUSHCONTROL_VARIABLEOPACITY) + draw_brush(lastpos, int(get_variable_brush_size(int(lastpressure))), int(round(pressure * brush.opacity))); + else + draw_brush(lastpos, int(get_variable_brush_size(int(lastpressure))), int(round(255.0f * brush.opacity))); + + // Since brush-size may have changed, we need to calculate new spacing + spacingdistance = brushsize * spacing; + } + } + else + { + // Brush size is static, so we can pre-multiply the interpolation constants + dx *= spacingdistance; + dy *= spacingdistance; + da *= spacingdistance; + while (distance >= spacingdistance) + { + lastpressure += da; + lastpos.x += dx; + lastpos.y += dy; + distance -= spacingdistance; + + draw_brush(lastpos, brush.size, int(round(lastpressure * brush.opacity))); + } + } + } + } + + // Called when stylus stops touching the screen. + void command_enddraw() + { + if (!stroke) + return; + + // Copy current image to backup image and clear alpha in the region of the stroke. + int x0 = max(min(int(strokemin.x), width), 0); + int x1 = max(min(int(strokemax.x), width), 0); + int y0 = max(min(int(strokemin.y), height), 0); + int y1 = max(min(int(strokemax.y), height), 0); + for (int y = y0; y < y1; y++) + { + memcpy(&image_backup[y*width+x0], &image[y*width+x0], (x1-x0)*sizeof(unsigned int)); + memset(&alpha[y*width+x0], 0, (x1-x0)*sizeof(unsigned char)); + } + + stroke = false; + } + + // The canvas keeps track of the area that has been modified by draw commands, this is called the 'dirty' rectangle. + // The dirty rectangle keeps accumulating until reset_dirty_rect is called, at which point it is cleared to empty. + void reset_dirty_rect() + { + dirtymin = Pos(-1,-1); + dirtymax = Pos(-1,-1); + } + + // Rasters a brush with specified width and opacity into alpha at a specified position using lookup-tables. + void draw_brush(const Pos& pos, int brushwidth, int opacity) + { + //printf("draw_brush %f,%f width=%d opacity=%d\n", pos.x, pos.y, brushwidth, opacity); + + // Enforce minimum brush size. + if (brushwidth<2) brushwidth = 2; + + // Calculate drawing rectangle. + float halfwidth = brushwidth/2; + float p0x = pos.x - halfwidth; + float p0y = pos.y - halfwidth; + float p1x = pos.x + halfwidth + 1; + float p1y = pos.y + halfwidth + 1; + + int x0 = int(max(min(p0x, p1x), 0.0f)); + int x1 = int(min(max(p0x, p1x), float(width))); + int y0 = int(max(min(p0y, p1y), 0.0f)); + int y1 = int(min(max(p0y, p1y), float(height))); + + // Accumulate dirty regions. + strokemin = Pos::create_from_min(strokemin, Pos(x0, y0)); + strokemax = Pos::create_from_max(strokemax, Pos(x1, y1)); + if (dirtymin.x == -1) + { + dirtymin = strokemin; + dirtymax = strokemax; + } + else + { + dirtymin = Pos::create_from_min(dirtymin, strokemin); + dirtymax = Pos::create_from_max(dirtymax, strokemax); + } + + // Calculate interpolation constants + float db = (BrushType::DIST_TABLE_WIDTH-1) / float(brushwidth); + + float xb = max(0.0f, BrushType::DIST_TABLE_CENTER - (pos.x - x0) * db); + float yb = max(0.0f, BrushType::DIST_TABLE_CENTER - (pos.y - y0) * db); + + // Select which line of the brush-lookup-table to use that most closely matches the current brush width + int brushidx = int(float(BrushType::BRUSH_TABLE_HEIGHT) / brushwidth); + + // Interpolate the distance table over the area. For each pixel find the distance, and look the + // brush-intensity up in the brush-table + if (drawtype == DRAWBRUSH_TYPE_NORMAL) + { + for (int y = y0; y < y1; y++) + { + float x2b = xb; + for (int x = x0; x < x1; x++) + { + // Find brush-intensity and mulitply that with incoming opacity + int lookup = BrushType::distance_tbl[int(x2b)][int(yb)]; + int intensity = fixed_scale(Brush::brush_type[brush.type].intensity_tbl[lookup][brushidx], opacity); + + // New Alpha = Brush Intensity + Old Alpha - (Brush Intensity * Old Alpha) + // Also make sure the result is clamped to the incoming opacity and isn't lower than the alpha + // already stored + int base = alpha[y*width+x]; + int a = max(min(intensity + base - ((intensity * base) >> 8), opacity), base); + alpha[y*width+x] = a; + + Color i = Color::create_from_a8r8g8b8(image_backup[y*width+x]); + i = Color::create_from_lerp(brush.color, i, a); + image[y*width+x] = i.get_a8r8g8b8(); + + x2b += db; + } + yb += db; + } + } + else if (drawtype == DRAWBRUSH_TYPE_GETCOLOR) + { + // Calculate color from a weighted average of the area that the brush touches. + Color c(0, 0, 0, 0); + for (int y = y0; y < y1; y++) + { + float x2b = xb; + for (int x = x0; x < x1; x++) + { + int lookup = BrushType::distance_tbl[int(x2b)][int(yb)]; + int intensity = fixed_scale(Brush::brush_type[brush.type].intensity_tbl[lookup][brushidx], opacity); + Color i = Color::create_from_a8r8g8b8(image[y*width+x]); + c.r += i.r * intensity; + c.g += i.g * intensity; + c.b += i.b * intensity; + c.a += intensity; + x2b += db; + } + yb += db; + } + brush.color.r = c.r / c.a; + brush.color.g = c.g / c.a; + brush.color.b = c.b / c.a; + } + } + + //--------------------------------------------------------------------------------------------- + // Playback + // + // These allow the canvas to be treated like a VCR, playing back and rewinding drawing commands + // to recreate the state of the canvas at different times. + + void add_command(const DrawCommand& cmd) + { + commands.push_back(cmd); + modified = true; + } + + void play_command(const DrawCommand& cmd, bool add) + { + if (cmd.type == DrawCommand::TYPE_DRAW) + { +#ifdef CANVAS_DEBUG_COMMANDS + printf("TYPE_DRAW x=%f y=%f pressure=%d\n", cmd.pos.x, cmd.pos.y, cmd.pressure); +#endif + Pos relpos = cmd.pos * Pos(width, height); + bool forcedraw = !add; // If we are not adding, we are playing back + command_draw(relpos, cmd.pressure, forcedraw); + } + else if (cmd.type == DrawCommand::TYPE_DRAWEND) + { +#ifdef CANVAS_DEBUG_COMMANDS + printf("TYPE_DRAWEND pressure=%d\n", cmd.pressure); +#endif + //if self.stroke and (self.lastpos.x != self.lastorgpos.x or self.lastpos.y != self.lastorgpos.y): + // self.command_draw(self.lastorgpos, cmd.pressure, add) + command_enddraw(); + } + else if (cmd.type == DrawCommand::TYPE_COLORCHANGE) + { +#ifdef CANVAS_DEBUG_COMMANDS + printf("TYPE_COLORCHANGE flipx=%d flipy=%d r=%d g=%d b=%d a=%d\n", cmd.flipx, cmd.flipy, cmd.color.r, cmd.color.g, cmd.color.b, cmd.color.a); +#endif + if (cmd.flipx || cmd.flipy) + { + // fixme + //pygame.transform.flip(self.image, cmd.flipx, cmd.flipy) + } + else + brush.color = cmd.color; + } + else if (cmd.type == DrawCommand::TYPE_SIZECHANGE) + { +#ifdef CANVAS_DEBUG_COMMANDS + printf("TYPE_SIZECHANGE size=%f control=%d type=%d opacity=%f\n", cmd.size, cmd.brush_control, cmd.brush_type, cmd.opacity); +#endif + brush.size = int(cmd.size * width); + if (brush.size < 2) + brush.size = 2; + brush.control = cmd.brush_control; + brush.type = cmd.brush_type; + if (cmd.opacity > 0) + brush.opacity = cmd.opacity; + } + +#ifdef CANVAS_DEBUG_COMMANDS + fflush(stdout); +#endif + + if (add) + add_command(cmd); + } + + bool playback_done() + { + return playback < 0 || playback >= (int)commands.size(); + } + + int playback_length() + { + return (int)commands.size(); + } + + int playback_pos() + { + return playback; + } + + void start_playback() + { + command_enddraw(); + clear_image(); + playback = 0; + playing = true; + } + + void pause_playback() + { + playing = false; + } + + void resume_playback() + { + playing = true; + } + + void stop_playback() + { + command_enddraw(); + playback = -1; + playing = false; + } + + void finish_playback() + { + while (!playback_done()) + play_command(commands[playback++], false); + } + + // This is used to avoid leaving the playback state in the middle of a stroke. + void playback_finish_stroke() + { + while (stroke && !playback_done()) + play_command(commands[playback++], false); + } + + void playback_to(int pos) + { + while (playback < pos && !playback_done()) + play_command(commands[playback++], false); + } + + void playback_step_to(int pos) + { + if (playback < pos && !playback_done()) + play_command(commands[playback++], false); + } + + // Same as playback_to, except it breaks if more than timeout seconds are taken. + void playback_to_timed(int pos, float timeout) + { + clock_t start = clock(); + clock_t end = (clock_t)(start + timeout * CLOCKS_PER_SEC); + printf("start: %d end: %d CLOCKS_PER_SEC: %d\n", (int)start, (int)end, (int)CLOCKS_PER_SEC); + while (playback < pos && !playback_done() && clock() < end) + play_command(commands[playback++], false); + //if (clock() > end) + // printf("killed by timeout.\n"); + } + + void set_playback_speed(int speed) + { + playback_speed = speed; + } + + void truncate_at_playback() + { + commands.resize(playback+1); + } + + void update_playback() + { + if (playing) + { + for (int i = 0; i < playback_speed; i++) + { + if (!playback_done()) + play_command(commands[playback++], false); + } + } + } + + int get_num_commands() + { + return commands.size(); + } + + void play_range(int from, int to) + { + for (int i = from; i < to; i++) + play_command(commands[i], false); + } + + //--------------------------------------------------------------------------------------------- + // Blit + // + // Draws a region of the canvas into a GdkImage for display on the screen, with optional scaling + // and darkening. + + void blit_2x(GdkImage* img, int x, int y, int w, int h, bool overlay) + { + if (overlay) + { + unsigned short* pixels = (unsigned short*)img->mem; + int pitch = img->bpl/sizeof(unsigned short); + + for (int cy = 0; cy < h; cy++) + { + unsigned int* __restrict src = &image[(y+cy)*width+x]; + unsigned short* __restrict row0 = &pixels[((y+cy)*2+0)*pitch+x*2]; + unsigned short* __restrict row1 = &pixels[((y+cy)*2+1)*pitch+x*2]; + for (int cx = 0; cx < w; cx++) + { + unsigned int p = *src++; + p &= ~0x03030303; + p >>= 2; + unsigned int r = (((p>>16)&0xff)>>3)<<11; + unsigned int g = (((p>> 8)&0xff)>>2)<<5; + unsigned int b = (((p>> 0)&0xff)>>3); + unsigned int rgb = r|g|b; + row0[0] = rgb; + row0[1] = rgb; + row1[0] = rgb; + row1[1] = rgb; + row0 += 2; + row1 += 2; + } + } + } + else + { + unsigned short* pixels = (unsigned short*)img->mem; + int pitch = img->bpl/sizeof(unsigned short); + + for (int cy = 0; cy < h; cy++) + { + unsigned int* __restrict src = &image[(y+cy)*width+x]; + unsigned short* __restrict row0 = &pixels[((y+cy)*2+0)*pitch+x*2]; + unsigned short* __restrict row1 = &pixels[((y+cy)*2+1)*pitch+x*2]; + for (int cx = 0; cx < w; cx++) + { + unsigned int p = *src++; + unsigned int r = (((p>>16)&0xff)>>3)<<11; + unsigned int g = (((p>> 8)&0xff)>>2)<<5; + unsigned int b = (((p>> 0)&0xff)>>3); + unsigned int rgb = r|g|b; + row0[0] = rgb; + row0[1] = rgb; + row1[0] = rgb; + row1[1] = rgb; + row0 += 2; + row1 += 2; + } + } + } + } + + //--------------------------------------------------------------------------------------------- + // Videopaint + // + // This code currently attempts to track a green object in the webcam and treat it as a + // mouse cursor, using the detected size to control the brush size. + + void downsize_video(unsigned int* dest_pixels, GstBuffer* buf, int vwidth, int vheight) + { + if (vwidth != VIDEO_WIDTH*8 || vheight != VIDEO_HEIGHT*8 || buf->size != vwidth*vheight*sizeof(unsigned short)) + { + printf("Invalid Gst video buffer size %d (%dx%d)\n", buf->size, vwidth, vheight); + return; + } + + unsigned int* source_pixels = (unsigned int*)buf->data; + + for (int y = 0; y < VIDEO_HEIGHT; y++) + { + unsigned int* __restrict src = &source_pixels[(y*4)*vwidth]; + unsigned int* __restrict dest = &dest_pixels[y*VIDEO_WIDTH]; + for (int x = 0; x < VIDEO_WIDTH; x++) + { + *dest = *src; + src += 4; + dest++; + } + } + } + + void videopaint_motion(GstBuffer* buf, int vwidth, int vheight) + { + downsize_video(image_video[1], buf, vwidth, vheight); + + unsigned int* pixels0 = image_video[0]; + unsigned int* pixels1 = image_video[1]; + double cx = 0, cy = 0, cnt = 0; + for (int y = 0; y < VIDEO_HEIGHT; y++) + { + unsigned int* __restrict row = &pixels1[y*VIDEO_WIDTH]; + unsigned int* destrow = &pixels0[y*VIDEO_WIDTH]; + for (int x = 0; x < VIDEO_WIDTH; x++) + { + // Convert YUYV to HSV + Color c = Color::yuv_to_hsv(*row); + // Threshold green + if ((c.r > 80) && (c.r < 150) && (c.g > 100)) { + destrow[0] = 0xffff; + cnt++; + cx += (80-x); + cy += y; + } else { + destrow[0] = 0; + } + row++; + destrow++; + } + } + + if (cnt > 0) + { + cx /= cnt; + cy /= cnt; + // The mouse coordinates are scaled somewhat, as the nature of the video processing causes the blob to leave + // the screen partially and become smaller (and less significant) towards the edges. + videopaint_pos = Pos( + map_range(cx, 0, VIDEO_WIDTH, -0.2f, 1.2f), + map_range(cy, 0, VIDEO_HEIGHT, -0.2f, 1.2f)); + // todo- estimate size + videopaint_pressure = map_range(cnt, 0, (VIDEO_WIDTH*VIDEO_HEIGHT)/8, 0, 255); + // Mark mouse pixel in red. + int rx = int(cx); + int ry = int(cy); + unsigned short red = Color(255,0,0,0).get_r5g6b5(); + for (int x = -3; x <= 3; x++) + for (int y = -3; y <= 3; y++) + image_video[0][ry+y*VIDEO_WIDTH+rx+x] = red; + } + } + + void blit_videopaint(GdkImage* img) + { + unsigned short* pixels = (unsigned short*)img->mem; + int pitch = img->bpl/sizeof(unsigned short); + + for (int y = 0; y < VIDEO_HEIGHT; y++) + { + unsigned int* __restrict src = &image_video[0][y*VIDEO_WIDTH]; + unsigned short* __restrict dest = &pixels[y*pitch]; + for (int x = 0; x < VIDEO_WIDTH; x++) + { + unsigned int p = *src++; + unsigned int r = (((p>>16)&0xff)>>3)<<11; + unsigned int g = (((p>> 8)&0xff)>>2)<<5; + unsigned int b = (((p>> 0)&0xff)>>3); + unsigned int rgb = r|g|b; + *dest++ = rgb; + } + } + } + + //--------------------------------------------------------------------------------------------- + // Reference image + // + // The reference image is a snapshot taken by the webcam that can transparently displayed over the canvas. + // Note that painting currently cannot take place while the reference image is shown. + + void set_reference_buffer(GstBuffer* buf, int vwidth, int vheight) + { + if (vwidth != REFERENCE_WIDTH || vheight != REFERENCE_HEIGHT || buf->size != vwidth*vheight*sizeof(unsigned short)) + { + printf("Invalid Gst reference buffer size %d\n", buf->size); + return; + } + memcpy(image_reference, buf->data, min(buf->size, REFERENCE_WIDTH*REFERENCE_HEIGHT*sizeof(unsigned short))); + } + + void render_reference_overlay() + { + // Uses image_backup to blend over the canvas without affecting the contents of the canvas. + // Scales up from whatever REFERENCE_WIDTH/REFERENCE_HEIGHT are to the canvas size. + int dx = (1<<16) * REFERENCE_WIDTH / width; + int dy = (1<<16) * REFERENCE_HEIGHT / height; + int ry = 0; + for (int y = 0; y < height; y++, ry += dy) + { + int rx = 0; + for (int x = 0; x < width; x++, rx += dx) + { + Color r = Color::create_from_r5g6b5(image_reference[(ry>>16)*REFERENCE_WIDTH+(rx>>16)]); + r = Color::create_from_yuv(r.r, r.g, r.b); + Color b = Color::create_from_a8r8g8b8(image_backup[y*width+x]); + image[y*width+x] = Color::create_from_lerp(r, b, 192).get_a8r8g8b8(); + } + } + } + + //--------------------------------------------------------------------------------------------- + // Overlay + // + // These functions basically just temporarily darken the entire canvas so that a PyGTK overlay + // like the brush controls can be drawn on top, and look like it has a translucent black background. + + void render_overlay() + { + // Since the image is backed up in image_backup, it's ok to destroy the contents of image since + // clear_overlay will just restore it from image_backup. + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++) + { + unsigned int i = image_backup[y*width+x]; + i &= ~0x03030303; + i >>= 2; + image[y*width+x] = i; + } + } + + void clear_overlay() + { + memcpy(image, image_backup, width*height*sizeof(unsigned int)); + } + + //--------------------------------------------------------------------------------------------- + // Load & Save + + void upgrade_drw_header(DRW_Header* hdr, DRW_Command* cmds) + { + if (hdr->version == DRW_Header::ID) // Paying for old bug + hdr->version = 1002; + + if (hdr->version < DRW_VERSION) + { + for(int i = 0; i < hdr->ncommands; i++) + { + DRW_Command* cmd = &cmds[i]; + if (hdr->version < 1001) + { + if (cmd->type == DrawCommand::TYPE_DRAW) + { + cmd->x = int(round(cmd->x * 1024.0f / 2047.0f + 512.0f)); + cmd->x = int(round(cmd->y * 1024.0f / 2047.0f + 512.0f)); + } + } + + if (hdr->version < 1002) + { + if (cmd->type == DrawCommand::TYPE_SIZECHANGE) + { + int type = (cmd->brushtype << 2) | cmd->brushcontrol; + switch(type) + { + case 0: cmd->brushtype = BrushType::BRUSHTYPE_HARD; cmd->brushcontrol = Brush::BRUSHCONTROL_VARIABLEOPACITY; break; + case 2: cmd->brushtype = BrushType::BRUSHTYPE_SOFT; cmd->brushcontrol = Brush::BRUSHCONTROL_VARIABLEOPACITY; break; + case 4: cmd->brushtype = BrushType::BRUSHTYPE_HARD; cmd->brushcontrol = 0; break; + case 6: cmd->brushtype = BrushType::BRUSHTYPE_SOFT; cmd->brushcontrol = 0; break; + } + cmd->size -= (1 << 6); + } + } + } + hdr->version = DRW_VERSION; + } + } + + bool load(const char* filename) + { + FILE* drwfile = fopen(filename, "rb"); + if (!drwfile) + return false; + + int r; + + DRW_Header header; + r = fread(&header, 1, sizeof(DRW_Header), drwfile); + + // Backward compatible code for early versions when there was no header and the filesize is used + // to determine the number of commands. + if (header.id != DRW_Header::ID) + { + header.colorsversion_initial = 0; + fseek(drwfile, 0, SEEK_END); + header.ncommands = ftell(drwfile) / 4; + fseek(drwfile, 0, SEEK_SET); + } + + DRW_Command* cmds = (DRW_Command*)malloc(header.ncommands*sizeof(DRW_Command)); + r = fread(cmds, 1, header.ncommands*sizeof(DRW_Command), drwfile); + + fclose(drwfile); + + upgrade_drw_header(&header, cmds); + + clear(); + convert_from_drw(cmds, 0, header.ncommands); + + free(cmds); + + return true; + } + + bool save(const char* filename) + { + FILE* drwfile = fopen(filename, "wb"); + if (!drwfile) + return false; + + int r; + + DRW_Header header; + header.id = DRW_Header::ID; + header.version = DRW_VERSION; + header.colorsversion_initial = DRW_VERSION; + header.colorsversion_saved = DRW_VERSION; + header.strokes = 0; + header.time = 0; + header.timessaved = 0; + header.ncommands = commands.size(); + r = fwrite(&header, 1, sizeof(DRW_Header), drwfile); + + DRW_Command* cmds; + convert_to_drw(&cmds, 0, commands.size()); + + r = fwrite(cmds, sizeof(DRW_Command), commands.size(), drwfile); + free(cmds); + + fclose(drwfile); + + return true; + } + + void convert_from_drw(DRW_Command* cmds, int start, int ncommands) + { + commands.resize(start+ncommands); + for (int i = 0; i < ncommands; i++) + { + DRW_Command* drw = &cmds[i]; + DrawCommand* cmd = &commands[start+i]; + + cmd->type = drw->type; + cmd->pos.x = (drw->x-512.0f) / 1024.0f; + cmd->pos.y = (drw->y-512.0f) / 1024.0f; + cmd->pressure = drw->alpha; + + cmd->color = Color::create_from_a8r8g8b8(drw->col); + cmd->flipx = drw->flipx; + cmd->flipy = drw->flipy; + + cmd->brush_control = drw->brushcontrol; + cmd->brush_type = drw->brushtype; + cmd->size = drw->size / float(1 << 15); + cmd->opacity = drw->opacity / 255.0f; + } + } + + void convert_to_drw(DRW_Command** cmds, int start, int ncommands) + { + *cmds = (DRW_Command*)malloc(sizeof(DRW_Command) * ncommands); + + for (int i = 0; i < ncommands; i++) + { + DRW_Command* drw = &(*cmds)[i]; + DrawCommand* cmd = &commands[start+i]; + + drw->type = cmd->type; + + if (cmd->type == DrawCommand::TYPE_DRAW) + { + drw->x = int((cmd->pos.x*1024)+512); + drw->y = int((cmd->pos.y*1024)+512); + drw->alpha = cmd->pressure; + } + else if (cmd->type == DrawCommand::TYPE_DRAWEND) + { + drw->alpha = cmd->pressure; + } + else if (cmd->type == DrawCommand::TYPE_COLORCHANGE) + { + drw->flipx = cmd->flipx; + drw->flipy = cmd->flipy; + drw->col = cmd->color.get_a8r8g8b8(); + } + else if (cmd->type == DrawCommand::TYPE_SIZECHANGE) + { + drw->brushcontrol = cmd->brush_control; + drw->brushtype = cmd->brush_type; + drw->size = int(cmd->size * float(1<<15)); + drw->opacity = int(cmd->opacity * 255.0f); + } + } + } + + DrawCommandBuffer send_drw_commands(int start, int ncommands) + { + DrawCommandBuffer buf; + buf.ncommands = ncommands; + convert_to_drw((DRW_Command**)&buf.cmds, start, ncommands); + return buf; + } + + void receive_drw_commands(const DrawCommandBuffer& buf, int start) + { + convert_from_drw((DRW_Command*)buf.cmds, start, buf.ncommands); + } +}; + +#endif + diff --git a/src/colorsc.h b/src/colorsc.h new file mode 100644 index 0000000..555ec2c --- /dev/null +++ b/src/colorsc.h @@ -0,0 +1,204 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +#ifndef _COLORSC_H_ +#define _COLORSC_H_ + +#include + +#include +#include +using namespace std; + +#include + +// todo- Include the real GTK headers when installed. +#include "gtk_types.h" + +static const float PI = 3.14159f; + +inline float sgn(float a) { if (a>0) return 1; if (a<0) return -1; return 0; } + +inline float sqr(float a) { return a*a; } + +inline float clamp(float a, float mn, float mx) { return max(mn, min(mx, a)); } + +inline float to_rad(float degrees) { return degrees * PI/180.0f; } +inline float to_deg(float rads) { return rads * 180.0f/PI; } + +// Maps an incoming value in a given f0-t0 range to a new value in the f1-t1 range, optionally clamping to f1-t1. +inline float map_range(float a, float f0, float t0, float f1, float t1, bool clmp=true) +{ + float r = (a-f0)/(t0-f0); + if (clmp) r = clamp(r, 0.0f, 1.0f); + return f1+r*(t1-f1); +} + +// Scales a value by an 8bit scale factor from 0-255. The MSB of the scale factor is added to it, which means that +// scaling by 255 is an identity. +inline int fixed_scale(int value, int scale) +{ + scale += scale >> 7; + return (value * scale) >> 8; +} + +inline unsigned short endian_swap(unsigned short v) +{ + return (v>>8) | (v<<8); +} + +struct Pos +{ + float x, y; + Pos() : x(0), y(0) {} + Pos(float x, float y) : x(x), y(y) {} + Pos operator+(const Pos& b) const { return Pos(x+b.x, y+b.y); } + Pos operator-(const Pos& b) const { return Pos(x-b.x, y-b.y); } + Pos operator*(const Pos& b) const { return Pos(x*b.x, y*b.y); } + Pos operator/(const Pos& b) const { return Pos(x/b.x, y/b.y); } + Pos operator*(float b) const { return Pos(x*b, y*b); } + Pos operator/(float b) const { return Pos(x/b, y/b); } + static Pos create_from_min(const Pos& a, const Pos& b) { return Pos(min(a.x,b.x), min(a.y,b.y)); } + static Pos create_from_max(const Pos& a, const Pos& b) { return Pos(max(a.x,b.x), max(a.y,b.y)); } + static Pos create_from_angle(float a, float r) { return Pos(cosf(a*PI/180.0f)*r, sinf(a*PI/180.0f)*r); } + static Pos create_from_rotation(const Pos& a, const Pos& center, float t) + { + return Pos( + (a.x-center.x)*cosf(t) - (a.y-center.y)*sinf(t) + center.x, + (a.y-center.y)*cosf(t) + (a.x-center.x)*sinf(t) + center.y); + } +}; + +struct Color +{ + unsigned char r, g, b, a; + Color() : r(0), g(0), b(0), a(0) {} + Color(int r, int g, int b, int a) : r(r), g(g), b(b), a(a) {} + unsigned int get_a8r8g8b8() { return (a<<24) | (r<<16) | (g<<8) | (b<<0); } + static Color create_from_a8r8g8b8(unsigned int v) + { + Color c; + c.a = (v>>24) & 0xff; + c.r = (v>>16) & 0xff; + c.g = (v>> 8) & 0xff; + c.b = (v>> 0) & 0xff; + return c; + } + unsigned int get_a8b8g8r8() { return (a<<24) | (b<<16) | (g<<8) | (r<<0); } + static Color create_from_a8b8g8r8(unsigned int v) + { + Color c; + c.a = (v>>24) & 0xff; + c.b = (v>>16) & 0xff; + c.g = (v>> 8) & 0xff; + c.r = (v>> 0) & 0xff; + return c; + } + unsigned int get_r5g6b5() { return ((r>>3)<<11) | ((g>>2)<<5) | (b>>3); } + static Color create_from_r5g6b5(unsigned short v) + { + Color c; + c.r = ((v>>11)&0x1f)<<3; + c.g = ((v>> 5)&0x1f)<<3; + c.b = ((v>> 0)&0x1f)<<3; + c.a = 255; + return c; + } + unsigned int get_b5g6r5() { return ((b>>3)<<11) | ((g>>2)<<5) | (r>>3); } + static Color create_from_float(float r, float g, float b, float a) + { + Color c; + c.r = int(r*255.0f); + c.g = int(g*255.0f); + c.b = int(b*255.0f); + c.a = int(a*255.0f); + return c; + } + static Color create_from_blend(const Color& a, const Color& b) + { + return create_from_lerp(a, b, a.a); + } + static Color create_from_lerp(const Color& a, const Color& b, unsigned int l) + { + unsigned int il = 255-l; + l += l >> 7; + il += il >> 7; + Color c; + c.r = ((a.r * l) + (b.r * il)) >> 8; + c.g = ((a.g * l) + (b.g * il)) >> 8; + c.b = ((a.b * l) + (b.b * il)) >> 8; + c.a = ((a.a * l) + (b.a * il)) >> 8; + return c; + } + static Color create_from_yuv(unsigned char y, unsigned char u, unsigned char v) + { + Color c; + c.r = (unsigned char)max(0.0f, min(255.0f, 1.164f*(y-16) + 1.596f*(v-128))); + c.g = (unsigned char)max(0.0f, min(255.0f, 1.164f*(y-16) - 0.813f*(v-128) - 0.391f*(u-128))); + c.b = (unsigned char)max(0.0f, min(255.0f, 1.164f*(y-16) + 2.018f*(u-128))); + return c; + } + + static Color yuv_to_hsv(unsigned int yuv) + { + Color c, d; + unsigned char y,u,v,val,delta,vmin; + float hue, sat; + // v4l2src is sending YUYV, meaning, 4 bytes per 2 pixels. + // pixel 1 gets the first 8 bit y and both 8 bit U and V. + // pixel 2 gets the other y and u and v. we are only using pixel 1. + y = ((yuv>>24)&0xFF); + u = ((yuv>>16)&0xFF); + v = (yuv&0xFF); + // for now, yuv->first. TODO: go straight from yuv to hsv + d = create_from_yuv(y, u, v); + + val = max(max(d.r, d.g), d.b); + vmin = min(min(d.r, d.g), d.b); + delta = val-vmin; + if (delta == 0) { + hue = 0.0; + sat = 0.0; + } else if (val == d.r) { + hue = 42.5*(d.g-d.b)/delta; + sat = 255.0*delta/val; + } else if (val == d.g) { + hue = 42.5*(d.b-d.r)/delta + 85.0; + sat = 255.0*delta/val; + } else { + hue = 42.5*(d.r-d.g)/delta + 170.0; + sat = 255.0*delta/val; + } + if (hue < 0.0) hue += 255.0; + if (hue > 255.0) hue -= 255.0; + c.r = (unsigned char)max(0.0f, min(255.0f, hue)); + c.g = (unsigned char)max(0.0f, min(255.0f, sat)); + c.b = (unsigned char)max((unsigned char)0, min((unsigned char)255, val)); + return c; + } + +}; + +// Structure for passing byte data to and from Python. +struct ByteBuffer +{ + int size; + void* data; +}; + +#endif + diff --git a/src/colorsc.i b/src/colorsc.i new file mode 100644 index 0000000..a1e3471 --- /dev/null +++ b/src/colorsc.i @@ -0,0 +1,59 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +%module colorsc + +%{ +#include "canvas.h" +#include "palette.h" +%} + +// Testing facility. +%typemap(in) void* { + $1 = $input; +} + +// Pass a gst.Buffer as a GstBuffer*. +%typemap(in) GstBuffer* { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)$input; + GstBuffer* buf = (GstBuffer*)pygo->obj; + $1 = buf; +} + +// Pass a gtk.gdk.Image as a GdkImage*. +%typemap(in) GdkImage* { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)$input; + GdkImage* img = (GdkImage*)pygo->obj; + $1 = img; +} + +// Return SurfaceA8R8G8B8 as Python string. +%typemap(out) SurfaceA8R8G8B8 { + $result = PyString_FromStringAndSize((const char*)$1.pixels, $1.stride*$1.height); +} + +// Return ByteBuffer as Python string. +%typemap(out) ByteBuffer { + $result = PyString_FromStringAndSize((const char*)$1.data, $1.size); +} + +%include "colorsc.h" +%include "canvas.h" +%include "palette.h" + diff --git a/src/colorsc_wrap.cxx b/src/colorsc_wrap.cxx new file mode 100644 index 0000000..daaefdb --- /dev/null +++ b/src/colorsc_wrap.cxx @@ -0,0 +1,12220 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.33 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGPYTHON +#define SWIG_PYTHON_DIRECTOR_NO_VTABLE + +#ifdef __cplusplus +template class SwigValueWrapper { + T *tt; +public: + SwigValueWrapper() : tt(0) { } + SwigValueWrapper(const SwigValueWrapper& rhs) : tt(new T(*rhs.tt)) { } + SwigValueWrapper(const T& t) : tt(new T(t)) { } + ~SwigValueWrapper() { delete tt; } + SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; } + operator T&() const { return *tt; } + T *operator&() { return tt; } +private: + SwigValueWrapper& operator=(const SwigValueWrapper& rhs); +}; + +template T SwigValueInit() { + return T(); +} +#endif + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +/* Python.h has to appear first */ +#include + +/* ----------------------------------------------------------------------------- + * swigrun.swg + * + * This file contains generic CAPI SWIG runtime support for pointer + * type checking. + * ----------------------------------------------------------------------------- */ + +/* This should only be incremented when either the layout of swig_type_info changes, + or for whatever reason, the runtime changes incompatibly */ +#define SWIG_RUNTIME_VERSION "3" + +/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ +#ifdef SWIG_TYPE_TABLE +# define SWIG_QUOTE_STRING(x) #x +# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) +# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) +#else +# define SWIG_TYPE_TABLE_NAME +#endif + +/* + You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for + creating a static or dynamic library from the swig runtime code. + In 99.9% of the cases, swig just needs to declare them as 'static'. + + But only do this if is strictly necessary, ie, if you have problems + with your compiler or so. +*/ + +#ifndef SWIGRUNTIME +# define SWIGRUNTIME SWIGINTERN +#endif + +#ifndef SWIGRUNTIMEINLINE +# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE +#endif + +/* Generic buffer size */ +#ifndef SWIG_BUFFER_SIZE +# define SWIG_BUFFER_SIZE 1024 +#endif + +/* Flags for pointer conversions */ +#define SWIG_POINTER_DISOWN 0x1 + +/* Flags for new pointer objects */ +#define SWIG_POINTER_OWN 0x1 + + +/* + Flags/methods for returning states. + + The swig conversion methods, as ConvertPtr, return and integer + that tells if the conversion was successful or not. And if not, + an error code can be returned (see swigerrors.swg for the codes). + + Use the following macros/flags to set or process the returning + states. + + In old swig versions, you usually write code as: + + if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { + // success code + } else { + //fail code + } + + Now you can be more explicit as: + + int res = SWIG_ConvertPtr(obj,vptr,ty.flags); + if (SWIG_IsOK(res)) { + // success code + } else { + // fail code + } + + that seems to be the same, but now you can also do + + Type *ptr; + int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags); + if (SWIG_IsOK(res)) { + // success code + if (SWIG_IsNewObj(res) { + ... + delete *ptr; + } else { + ... + } + } else { + // fail code + } + + I.e., now SWIG_ConvertPtr can return new objects and you can + identify the case and take care of the deallocation. Of course that + requires also to SWIG_ConvertPtr to return new result values, as + + int SWIG_ConvertPtr(obj, ptr,...) { + if () { + if () { + *ptr = ; + return SWIG_NEWOBJ; + } else { + *ptr = ; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } + } + + Of course, returning the plain '0(success)/-1(fail)' still works, but you can be + more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the + swig errors code. + + Finally, if the SWIG_CASTRANK_MODE is enabled, the result code + allows to return the 'cast rank', for example, if you have this + + int food(double) + int fooi(int); + + and you call + + food(1) // cast rank '1' (1 -> 1.0) + fooi(1) // cast rank '0' + + just use the SWIG_AddCast()/SWIG_CheckState() + + + */ +#define SWIG_OK (0) +#define SWIG_ERROR (-1) +#define SWIG_IsOK(r) (r >= 0) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) + +/* The CastRankLimit says how many bits are used for the cast rank */ +#define SWIG_CASTRANKLIMIT (1 << 8) +/* The NewMask denotes the object was created (using new/malloc) */ +#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) +/* The TmpMask is for in/out typemaps that use temporal objects */ +#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) +/* Simple returning values */ +#define SWIG_BADOBJ (SWIG_ERROR) +#define SWIG_OLDOBJ (SWIG_OK) +#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) +#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) +/* Check, add and del mask methods */ +#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) +#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) +#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) +#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r) +#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r) +#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK)) + + +/* Cast-Rank Mode */ +#if defined(SWIG_CASTRANK_MODE) +# ifndef SWIG_TypeRank +# define SWIG_TypeRank unsigned long +# endif +# ifndef SWIG_MAXCASTRANK /* Default cast allowed */ +# define SWIG_MAXCASTRANK (2) +# endif +# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) +# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) +SWIGINTERNINLINE int SWIG_AddCast(int r) { + return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; +} +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +} +#else /* no cast-rank mode */ +# define SWIG_AddCast +# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) +#endif + + + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *(*swig_converter_func)(void *); +typedef struct swig_type_info *(*swig_dycast_func)(void **); + +/* Structure to store inforomation on one type */ +typedef struct swig_type_info { + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ + struct swig_cast_info *cast; /* linked list of types that can cast into this type */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ +} swig_type_info; + +/* Structure to store a type and conversion function used for casting */ +typedef struct swig_cast_info { + swig_type_info *type; /* pointer to type that is equivalent to this type */ + swig_converter_func converter; /* function to cast the void pointers */ + struct swig_cast_info *next; /* pointer to next cast in linked list */ + struct swig_cast_info *prev; /* pointer to the previous cast */ +} swig_cast_info; + +/* Structure used to store module information + * Each module generates one structure like this, and the runtime collects + * all of these structures and stores them in a circularly linked list.*/ +typedef struct swig_module_info { + swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ + size_t size; /* Number of types in this module */ + struct swig_module_info *next; /* Pointer to next element in circularly linked list */ + swig_type_info **type_initial; /* Array of initially generated type structures */ + swig_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ +} swig_module_info; + +/* + Compare two type names skipping the space characters, therefore + "char*" == "char *" and "Class" == "Class", etc. + + Return 0 when the two name types are equivalent, as in + strncmp, but skipping ' '. +*/ +SWIGRUNTIME int +SWIG_TypeNameComp(const char *f1, const char *l1, + const char *f2, const char *l2) { + for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { + while ((*f1 == ' ') && (f1 != l1)) ++f1; + while ((*f2 == ' ') && (f2 != l2)) ++f2; + if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; + } + return (int)((l1 - f1) - (l2 - f2)); +} + +/* + Check type equivalence in a name list like ||... + Return 0 if not equal, 1 if equal +*/ +SWIGRUNTIME int +SWIG_TypeEquiv(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + +/* + Check type equivalence in a name list like ||... + Return 0 if equal, -1 if nb < tb, 1 if nb > tb +*/ +SWIGRUNTIME int +SWIG_TypeCompare(const char *nb, const char *tb) { + int equiv = 0; + const char* te = tb + strlen(tb); + const char* ne = nb; + while (!equiv && *ne) { + for (nb = ne; *ne; ++ne) { + if (*ne == '|') break; + } + equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + if (*ne) ++ne; + } + return equiv; +} + + +/* think of this as a c++ template<> or a scheme macro */ +#define SWIG_TypeCheck_Template(comparison, ty) \ + if (ty) { \ + swig_cast_info *iter = ty->cast; \ + while (iter) { \ + if (comparison) { \ + if (iter == ty->cast) return iter; \ + /* Move iter to the top of the linked list */ \ + iter->prev->next = iter->next; \ + if (iter->next) \ + iter->next->prev = iter->prev; \ + iter->next = ty->cast; \ + iter->prev = 0; \ + if (ty->cast) ty->cast->prev = iter; \ + ty->cast = iter; \ + return iter; \ + } \ + iter = iter->next; \ + } \ + } \ + return 0 + +/* + Check the typename +*/ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheck(const char *c, swig_type_info *ty) { + SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty); +} + +/* Same as previous function, except strcmp is replaced with a pointer comparison */ +SWIGRUNTIME swig_cast_info * +SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { + SWIG_TypeCheck_Template(iter->type == from, into); +} + +/* + Cast a pointer up an inheritance hierarchy +*/ +SWIGRUNTIMEINLINE void * +SWIG_TypeCast(swig_cast_info *ty, void *ptr) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +} + +/* + Dynamic pointer casting. Down an inheritance hierarchy +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) { + swig_type_info *lastty = ty; + if (!ty || !ty->dcast) return ty; + while (ty && (ty->dcast)) { + ty = (*ty->dcast)(ptr); + if (ty) lastty = ty; + } + return lastty; +} + +/* + Return the name associated with this type +*/ +SWIGRUNTIMEINLINE const char * +SWIG_TypeName(const swig_type_info *ty) { + return ty->name; +} + +/* + Return the pretty name associated with this type, + that is an unmangled type name in a form presentable to the user. +*/ +SWIGRUNTIME const char * +SWIG_TypePrettyName(const swig_type_info *type) { + /* The "str" field contains the equivalent pretty names of the + type, separated by vertical-bar characters. We choose + to print the last name, as it is often (?) the most + specific. */ + if (!type) return NULL; + if (type->str != NULL) { + const char *last_name = type->str; + const char *s; + for (s = type->str; *s; s++) + if (*s == '|') last_name = s+1; + return last_name; + } + else + return type->name; +} + +/* + Set the clientdata field for a type +*/ +SWIGRUNTIME void +SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { + swig_cast_info *cast = ti->cast; + /* if (ti->clientdata == clientdata) return; */ + ti->clientdata = clientdata; + + while (cast) { + if (!cast->converter) { + swig_type_info *tc = cast->type; + if (!tc->clientdata) { + SWIG_TypeClientData(tc, clientdata); + } + } + cast = cast->next; + } +} +SWIGRUNTIME void +SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { + SWIG_TypeClientData(ti, clientdata); + ti->owndata = 1; +} + +/* + Search for a swig_type_info structure only by mangled name + Search is a O(log #types) + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + swig_module_info *iter = start; + do { + if (iter->size) { + register size_t l = 0; + register size_t r = iter->size - 1; + do { + /* since l+r >= 0, we can (>> 1) instead (/ 2) */ + register size_t i = (l + r) >> 1; + const char *iname = iter->types[i]->name; + if (iname) { + register int compare = strcmp(name, iname); + if (compare == 0) { + return iter->types[i]; + } else if (compare < 0) { + if (i) { + r = i - 1; + } else { + break; + } + } else if (compare > 0) { + l = i + 1; + } + } else { + break; /* should never happen */ + } + } while (l <= r); + } + iter = iter->next; + } while (iter != end); + return 0; +} + +/* + Search for a swig_type_info structure for either a mangled name or a human readable name. + It first searches the mangled names of the types, which is a O(log #types) + If a type is not found it then searches the human readable names, which is O(#types). + + We start searching at module start, and finish searching when start == end. + Note: if start == end at the beginning of the function, we go all the way around + the circular list. +*/ +SWIGRUNTIME swig_type_info * +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, + const char *name) { + /* STEP 1: Search the name field using binary search */ + swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); + if (ret) { + return ret; + } else { + /* STEP 2: If the type hasn't been found, do a complete search + of the str field (the human readable name) */ + swig_module_info *iter = start; + do { + register size_t i = 0; + for (; i < iter->size; ++i) { + if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) + return iter->types[i]; + } + iter = iter->next; + } while (iter != end); + } + + /* neither found a match */ + return 0; +} + +/* + Pack binary data into a string +*/ +SWIGRUNTIME char * +SWIG_PackData(char *c, void *ptr, size_t sz) { + static const char hex[17] = "0123456789abcdef"; + register const unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register unsigned char uu = *u; + *(c++) = hex[(uu & 0xf0) >> 4]; + *(c++) = hex[uu & 0xf]; + } + return c; +} + +/* + Unpack binary data from a string +*/ +SWIGRUNTIME const char * +SWIG_UnpackData(const char *c, void *ptr, size_t sz) { + register unsigned char *u = (unsigned char *) ptr; + register const unsigned char *eu = u + sz; + for (; u != eu; ++u) { + register char d = *(c++); + register unsigned char uu; + if ((d >= '0') && (d <= '9')) + uu = ((d - '0') << 4); + else if ((d >= 'a') && (d <= 'f')) + uu = ((d - ('a'-10)) << 4); + else + return (char *) 0; + d = *(c++); + if ((d >= '0') && (d <= '9')) + uu |= (d - '0'); + else if ((d >= 'a') && (d <= 'f')) + uu |= (d - ('a'-10)); + else + return (char *) 0; + *u = uu; + } + return c; +} + +/* + Pack 'void *' into a string buffer. +*/ +SWIGRUNTIME char * +SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) { + char *r = buff; + if ((2*sizeof(void *) + 2) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,&ptr,sizeof(void *)); + if (strlen(name) + 1 > (bsz - (r - buff))) return 0; + strcpy(r,name); + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + *ptr = (void *) 0; + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sizeof(void *)); +} + +SWIGRUNTIME char * +SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) { + char *r = buff; + size_t lname = (name ? strlen(name) : 0); + if ((2*sz + 2 + lname) > bsz) return 0; + *(r++) = '_'; + r = SWIG_PackData(r,ptr,sz); + if (lname) { + strncpy(r,name,lname+1); + } else { + *r = 0; + } + return buff; +} + +SWIGRUNTIME const char * +SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { + if (*c != '_') { + if (strcmp(c,"NULL") == 0) { + memset(ptr,0,sz); + return name; + } else { + return 0; + } + } + return SWIG_UnpackData(++c,ptr,sz); +} + +#ifdef __cplusplus +} +#endif + +/* Errors in SWIG */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 +#define SWIG_NullReferenceError -13 + + + + +/* Add PyOS_snprintf for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM) +# define PyOS_snprintf _snprintf +# else +# define PyOS_snprintf snprintf +# endif +#endif + +/* A crude PyString_FromFormat implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 + +#ifndef SWIG_PYBUFFER_SIZE +# define SWIG_PYBUFFER_SIZE 1024 +#endif + +static PyObject * +PyString_FromFormat(const char *fmt, ...) { + va_list ap; + char buf[SWIG_PYBUFFER_SIZE * 2]; + int res; + va_start(ap, fmt); + res = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf); +} +#endif + +/* Add PyObject_Del for old Pythons */ +#if PY_VERSION_HEX < 0x01060000 +# define PyObject_Del(op) PyMem_DEL((op)) +#endif +#ifndef PyObject_DEL +# define PyObject_DEL PyObject_Del +#endif + +/* A crude PyExc_StopIteration exception for old Pythons */ +#if PY_VERSION_HEX < 0x02020000 +# ifndef PyExc_StopIteration +# define PyExc_StopIteration PyExc_RuntimeError +# endif +# ifndef PyObject_GenericGetAttr +# define PyObject_GenericGetAttr 0 +# endif +#endif +/* Py_NotImplemented is defined in 2.1 and up. */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef Py_NotImplemented +# define Py_NotImplemented PyExc_RuntimeError +# endif +#endif + + +/* A crude PyString_AsStringAndSize implementation for old Pythons */ +#if PY_VERSION_HEX < 0x02010000 +# ifndef PyString_AsStringAndSize +# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;} +# endif +#endif + +/* PySequence_Size for old Pythons */ +#if PY_VERSION_HEX < 0x02000000 +# ifndef PySequence_Size +# define PySequence_Size PySequence_Length +# endif +#endif + + +/* PyBool_FromLong for old Pythons */ +#if PY_VERSION_HEX < 0x02030000 +static +PyObject *PyBool_FromLong(long ok) +{ + PyObject *result = ok ? Py_True : Py_False; + Py_INCREF(result); + return result; +} +#endif + +/* Py_ssize_t for old Pythons */ +/* This code is as recommended by: */ +/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */ +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) +typedef int Py_ssize_t; +# define PY_SSIZE_T_MAX INT_MAX +# define PY_SSIZE_T_MIN INT_MIN +#endif + +/* ----------------------------------------------------------------------------- + * error manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIME PyObject* +SWIG_Python_ErrorType(int code) { + PyObject* type = 0; + switch(code) { + case SWIG_MemoryError: + type = PyExc_MemoryError; + break; + case SWIG_IOError: + type = PyExc_IOError; + break; + case SWIG_RuntimeError: + type = PyExc_RuntimeError; + break; + case SWIG_IndexError: + type = PyExc_IndexError; + break; + case SWIG_TypeError: + type = PyExc_TypeError; + break; + case SWIG_DivisionByZero: + type = PyExc_ZeroDivisionError; + break; + case SWIG_OverflowError: + type = PyExc_OverflowError; + break; + case SWIG_SyntaxError: + type = PyExc_SyntaxError; + break; + case SWIG_ValueError: + type = PyExc_ValueError; + break; + case SWIG_SystemError: + type = PyExc_SystemError; + break; + case SWIG_AttributeError: + type = PyExc_AttributeError; + break; + default: + type = PyExc_RuntimeError; + } + return type; +} + + +SWIGRUNTIME void +SWIG_Python_AddErrorMsg(const char* mesg) +{ + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + + if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); + if (value) { + PyObject *old_str = PyObject_Str(value); + PyErr_Clear(); + Py_XINCREF(type); + PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); + Py_DECREF(old_str); + Py_DECREF(value); + } else { + PyErr_Format(PyExc_RuntimeError, mesg); + } +} + + + +#if defined(SWIG_PYTHON_NO_THREADS) +# if defined(SWIG_PYTHON_THREADS) +# undef SWIG_PYTHON_THREADS +# endif +#endif +#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */ +# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL) +# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */ +# define SWIG_PYTHON_USE_GIL +# endif +# endif +# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */ +# ifndef SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads() +# endif +# ifdef __cplusplus /* C++ code */ + class SWIG_Python_Thread_Block { + bool status; + PyGILState_STATE state; + public: + void end() { if (status) { PyGILState_Release(state); status = false;} } + SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {} + ~SWIG_Python_Thread_Block() { end(); } + }; + class SWIG_Python_Thread_Allow { + bool status; + PyThreadState *save; + public: + void end() { if (status) { PyEval_RestoreThread(save); status = false; }} + SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {} + ~SWIG_Python_Thread_Allow() { end(); } + }; +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block +# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end() +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow +# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end() +# else /* C code */ +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure() +# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread() +# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow) +# endif +# else /* Old thread way, not implemented, user must provide it */ +# if !defined(SWIG_PYTHON_INITIALIZE_THREADS) +# define SWIG_PYTHON_INITIALIZE_THREADS +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK) +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_END_BLOCK) +# define SWIG_PYTHON_THREAD_END_BLOCK +# endif +# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW) +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# endif +# if !defined(SWIG_PYTHON_THREAD_END_ALLOW) +# define SWIG_PYTHON_THREAD_END_ALLOW +# endif +# endif +#else /* No thread support */ +# define SWIG_PYTHON_INITIALIZE_THREADS +# define SWIG_PYTHON_THREAD_BEGIN_BLOCK +# define SWIG_PYTHON_THREAD_END_BLOCK +# define SWIG_PYTHON_THREAD_BEGIN_ALLOW +# define SWIG_PYTHON_THREAD_END_ALLOW +#endif + +/* ----------------------------------------------------------------------------- + * Python API portion that goes into the runtime + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* cc-mode */ +#endif +#endif + +/* ----------------------------------------------------------------------------- + * Constant declarations + * ----------------------------------------------------------------------------- */ + +/* Constant Types */ +#define SWIG_PY_POINTER 4 +#define SWIG_PY_BINARY 5 + +/* Constant information structure */ +typedef struct swig_const_info { + int type; + char *name; + long lvalue; + double dvalue; + void *pvalue; + swig_type_info **ptype; +} swig_const_info; + +#ifdef __cplusplus +#if 0 +{ /* cc-mode */ +#endif +} +#endif + + +/* ----------------------------------------------------------------------------- + * See the LICENSE file for information on copyright, usage and redistribution + * of SWIG, and the README file for authors - http://www.swig.org/release.html. + * + * pyrun.swg + * + * This file contains the runtime support for Python modules + * and includes code for managing global variables and pointer + * type checking. + * + * ----------------------------------------------------------------------------- */ + +/* Common SWIG API */ + +/* for raw pointers */ +#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0) +#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags) +#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own) +#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags) +#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) +#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) +#define swig_owntype int + +/* for raw packed data */ +#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + +/* for class or struct pointers */ +#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags) +#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags) + +/* for C or C++ function pointers */ +#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type) +#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0) + +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty) +#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type) + + +/* Runtime API */ + +#define SWIG_GetModule(clientdata) SWIG_Python_GetModule() +#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer) +#define SWIG_NewClientData(obj) PySwigClientData_New(obj) + +#define SWIG_SetErrorObj SWIG_Python_SetErrorObj +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail + + +/* Runtime API implementation */ + +/* Error manipulation */ + +SWIGINTERN void +SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetObject(errtype, obj); + Py_DECREF(obj); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +SWIGINTERN void +SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) { + SWIG_PYTHON_THREAD_BEGIN_BLOCK; + PyErr_SetString(errtype, (char *) msg); + SWIG_PYTHON_THREAD_END_BLOCK; +} + +#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj) + +/* Set a constant value */ + +SWIGINTERN void +SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) { + PyDict_SetItemString(d, (char*) name, obj); + Py_DECREF(obj); +} + +/* Append a value to the result obj */ + +SWIGINTERN PyObject* +SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) { +#if !defined(SWIG_PYTHON_OUTPUT_TUPLE) + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyList_Check(result)) { + PyObject *o2 = result; + result = PyList_New(1); + PyList_SetItem(result, 0, o2); + } + PyList_Append(result,obj); + Py_DECREF(obj); + } + return result; +#else + PyObject* o2; + PyObject* o3; + if (!result) { + result = obj; + } else if (result == Py_None) { + Py_DECREF(result); + result = obj; + } else { + if (!PyTuple_Check(result)) { + o2 = result; + result = PyTuple_New(1); + PyTuple_SET_ITEM(result, 0, o2); + } + o3 = PyTuple_New(1); + PyTuple_SET_ITEM(o3, 0, obj); + o2 = result; + result = PySequence_Concat(o2, o3); + Py_DECREF(o2); + Py_DECREF(o3); + } + return result; +#endif +} + +/* Unpack the argument tuple */ + +SWIGINTERN int +SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) +{ + if (!args) { + if (!min && !max) { + return 1; + } else { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", + name, (min == max ? "" : "at least "), (int)min); + return 0; + } + } + if (!PyTuple_Check(args)) { + PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple"); + return 0; + } else { + register Py_ssize_t l = PyTuple_GET_SIZE(args); + if (l < min) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at least "), (int)min, (int)l); + return 0; + } else if (l > max) { + PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", + name, (min == max ? "" : "at most "), (int)max, (int)l); + return 0; + } else { + register int i; + for (i = 0; i < l; ++i) { + objs[i] = PyTuple_GET_ITEM(args, i); + } + for (; l < max; ++l) { + objs[l] = 0; + } + return i + 1; + } + } +} + +/* A functor is a function object with one single object argument */ +#if PY_VERSION_HEX >= 0x02020000 +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); +#else +#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj); +#endif + +/* + Helper for static pointer initialization for both C and C++ code, for example + static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...); +*/ +#ifdef __cplusplus +#define SWIG_STATIC_POINTER(var) var +#else +#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var +#endif + +/* ----------------------------------------------------------------------------- + * Pointer declarations + * ----------------------------------------------------------------------------- */ + +/* Flags for new pointer objects */ +#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1) +#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN) + +#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* cc-mode */ +#endif +#endif + +/* How to access Py_None */ +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# ifndef SWIG_PYTHON_NO_BUILD_NONE +# ifndef SWIG_PYTHON_BUILD_NONE +# define SWIG_PYTHON_BUILD_NONE +# endif +# endif +#endif + +#ifdef SWIG_PYTHON_BUILD_NONE +# ifdef Py_None +# undef Py_None +# define Py_None SWIG_Py_None() +# endif +SWIGRUNTIMEINLINE PyObject * +_SWIG_Py_None(void) +{ + PyObject *none = Py_BuildValue((char*)""); + Py_DECREF(none); + return none; +} +SWIGRUNTIME PyObject * +SWIG_Py_None(void) +{ + static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None(); + return none; +} +#endif + +/* The python void return value */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Py_Void(void) +{ + PyObject *none = Py_None; + Py_INCREF(none); + return none; +} + +/* PySwigClientData */ + +typedef struct { + PyObject *klass; + PyObject *newraw; + PyObject *newargs; + PyObject *destroy; + int delargs; + int implicitconv; +} PySwigClientData; + +SWIGRUNTIMEINLINE int +SWIG_Python_CheckImplicit(swig_type_info *ty) +{ + PySwigClientData *data = (PySwigClientData *)ty->clientdata; + return data ? data->implicitconv : 0; +} + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_ExceptionType(swig_type_info *desc) { + PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0; + PyObject *klass = data ? data->klass : 0; + return (klass ? klass : PyExc_RuntimeError); +} + + +SWIGRUNTIME PySwigClientData * +PySwigClientData_New(PyObject* obj) +{ + if (!obj) { + return 0; + } else { + PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData)); + /* the klass element */ + data->klass = obj; + Py_INCREF(data->klass); + /* the newraw method and newargs arguments used to create a new raw instance */ + if (PyClass_Check(obj)) { + data->newraw = 0; + data->newargs = obj; + Py_INCREF(obj); + } else { +#if (PY_VERSION_HEX < 0x02020000) + data->newraw = 0; +#else + data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__"); +#endif + if (data->newraw) { + Py_INCREF(data->newraw); + data->newargs = PyTuple_New(1); + PyTuple_SetItem(data->newargs, 0, obj); + } else { + data->newargs = obj; + } + Py_INCREF(data->newargs); + } + /* the destroy method, aka as the C++ delete method */ + data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__"); + if (PyErr_Occurred()) { + PyErr_Clear(); + data->destroy = 0; + } + if (data->destroy) { + int flags; + Py_INCREF(data->destroy); + flags = PyCFunction_GET_FLAGS(data->destroy); +#ifdef METH_O + data->delargs = !(flags & (METH_O)); +#else + data->delargs = 0; +#endif + } else { + data->delargs = 0; + } + data->implicitconv = 0; + return data; + } +} + +SWIGRUNTIME void +PySwigClientData_Del(PySwigClientData* data) +{ + Py_XDECREF(data->newraw); + Py_XDECREF(data->newargs); + Py_XDECREF(data->destroy); +} + +/* =============== PySwigObject =====================*/ + +typedef struct { + PyObject_HEAD + void *ptr; + swig_type_info *ty; + int own; + PyObject *next; +} PySwigObject; + +SWIGRUNTIME PyObject * +PySwigObject_long(PySwigObject *v) +{ + return PyLong_FromVoidPtr(v->ptr); +} + +SWIGRUNTIME PyObject * +PySwigObject_format(const char* fmt, PySwigObject *v) +{ + PyObject *res = NULL; + PyObject *args = PyTuple_New(1); + if (args) { + if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) { + PyObject *ofmt = PyString_FromString(fmt); + if (ofmt) { + res = PyString_Format(ofmt,args); + Py_DECREF(ofmt); + } + Py_DECREF(args); + } + } + return res; +} + +SWIGRUNTIME PyObject * +PySwigObject_oct(PySwigObject *v) +{ + return PySwigObject_format("%o",v); +} + +SWIGRUNTIME PyObject * +PySwigObject_hex(PySwigObject *v) +{ + return PySwigObject_format("%x",v); +} + +SWIGRUNTIME PyObject * +#ifdef METH_NOARGS +PySwigObject_repr(PySwigObject *v) +#else +PySwigObject_repr(PySwigObject *v, PyObject *args) +#endif +{ + const char *name = SWIG_TypePrettyName(v->ty); + PyObject *hex = PySwigObject_hex(v); + PyObject *repr = PyString_FromFormat("", name, PyString_AsString(hex)); + Py_DECREF(hex); + if (v->next) { +#ifdef METH_NOARGS + PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next); +#else + PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args); +#endif + PyString_ConcatAndDel(&repr,nrep); + } + return repr; +} + +SWIGRUNTIME int +PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ +#ifdef METH_NOARGS + PyObject *repr = PySwigObject_repr(v); +#else + PyObject *repr = PySwigObject_repr(v, NULL); +#endif + if (repr) { + fputs(PyString_AsString(repr), fp); + Py_DECREF(repr); + return 0; + } else { + return 1; + } +} + +SWIGRUNTIME PyObject * +PySwigObject_str(PySwigObject *v) +{ + char result[SWIG_BUFFER_SIZE]; + return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? + PyString_FromString(result) : 0; +} + +SWIGRUNTIME int +PySwigObject_compare(PySwigObject *v, PySwigObject *w) +{ + void *i = v->ptr; + void *j = w->ptr; + return (i < j) ? -1 : ((i > j) ? 1 : 0); +} + +SWIGRUNTIME PyTypeObject* _PySwigObject_type(void); + +SWIGRUNTIME PyTypeObject* +PySwigObject_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type(); + return type; +} + +SWIGRUNTIMEINLINE int +PySwigObject_Check(PyObject *op) { + return ((op)->ob_type == PySwigObject_type()) + || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0); +} + +SWIGRUNTIME PyObject * +PySwigObject_New(void *ptr, swig_type_info *ty, int own); + +SWIGRUNTIME void +PySwigObject_dealloc(PyObject *v) +{ + PySwigObject *sobj = (PySwigObject *) v; + PyObject *next = sobj->next; + if (sobj->own) { + swig_type_info *ty = sobj->ty; + PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; + PyObject *destroy = data ? data->destroy : 0; + if (destroy) { + /* destroy is always a VARARGS method */ + PyObject *res; + if (data->delargs) { + /* we need to create a temporal object to carry the destroy operation */ + PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0); + res = SWIG_Python_CallFunctor(destroy, tmp); + Py_DECREF(tmp); + } else { + PyCFunction meth = PyCFunction_GET_FUNCTION(destroy); + PyObject *mself = PyCFunction_GET_SELF(destroy); + res = ((*meth)(mself, v)); + } + Py_XDECREF(res); + } else { + const char *name = SWIG_TypePrettyName(ty); +#if !defined(SWIG_PYTHON_SILENT_MEMLEAK) + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); +#endif + } + } + Py_XDECREF(next); + PyObject_DEL(v); +} + +SWIGRUNTIME PyObject* +PySwigObject_append(PyObject* v, PyObject* next) +{ + PySwigObject *sobj = (PySwigObject *) v; +#ifndef METH_O + PyObject *tmp = 0; + if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL; + next = tmp; +#endif + if (!PySwigObject_Check(next)) { + return NULL; + } + sobj->next = next; + Py_INCREF(next); + return SWIG_Py_Void(); +} + +SWIGRUNTIME PyObject* +#ifdef METH_NOARGS +PySwigObject_next(PyObject* v) +#else +PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + PySwigObject *sobj = (PySwigObject *) v; + if (sobj->next) { + Py_INCREF(sobj->next); + return sobj->next; + } else { + return SWIG_Py_Void(); + } +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +PySwigObject_disown(PyObject *v) +#else +PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + PySwigObject *sobj = (PySwigObject *)v; + sobj->own = 0; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +#ifdef METH_NOARGS +PySwigObject_acquire(PyObject *v) +#else +PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args)) +#endif +{ + PySwigObject *sobj = (PySwigObject *)v; + sobj->own = SWIG_POINTER_OWN; + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject* +PySwigObject_own(PyObject *v, PyObject *args) +{ + PyObject *val = 0; +#if (PY_VERSION_HEX < 0x02020000) + if (!PyArg_ParseTuple(args,(char *)"|O:own",&val)) +#else + if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) +#endif + { + return NULL; + } + else + { + PySwigObject *sobj = (PySwigObject *)v; + PyObject *obj = PyBool_FromLong(sobj->own); + if (val) { +#ifdef METH_NOARGS + if (PyObject_IsTrue(val)) { + PySwigObject_acquire(v); + } else { + PySwigObject_disown(v); + } +#else + if (PyObject_IsTrue(val)) { + PySwigObject_acquire(v,args); + } else { + PySwigObject_disown(v,args); + } +#endif + } + return obj; + } +} + +#ifdef METH_O +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#else +static PyMethodDef +swigobject_methods[] = { + {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"}, + {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"}, + {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"}, + {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"}, + {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"}, + {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"}, + {0, 0, 0, 0} +}; +#endif + +#if PY_VERSION_HEX < 0x02020000 +SWIGINTERN PyObject * +PySwigObject_getattr(PySwigObject *sobj,char *name) +{ + return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name); +} +#endif + +SWIGRUNTIME PyTypeObject* +_PySwigObject_type(void) { + static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer"; + + static PyNumberMethods PySwigObject_as_number = { + (binaryfunc)0, /*nb_add*/ + (binaryfunc)0, /*nb_subtract*/ + (binaryfunc)0, /*nb_multiply*/ + (binaryfunc)0, /*nb_divide*/ + (binaryfunc)0, /*nb_remainder*/ + (binaryfunc)0, /*nb_divmod*/ + (ternaryfunc)0,/*nb_power*/ + (unaryfunc)0, /*nb_negative*/ + (unaryfunc)0, /*nb_positive*/ + (unaryfunc)0, /*nb_absolute*/ + (inquiry)0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + (coercion)0, /*nb_coerce*/ + (unaryfunc)PySwigObject_long, /*nb_int*/ + (unaryfunc)PySwigObject_long, /*nb_long*/ + (unaryfunc)0, /*nb_float*/ + (unaryfunc)PySwigObject_oct, /*nb_oct*/ + (unaryfunc)PySwigObject_hex, /*nb_hex*/ +#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */ +#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */ + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ +#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */ + 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */ +#endif + }; + + static PyTypeObject pyswigobject_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp + = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + (char *)"PySwigObject", /* tp_name */ + sizeof(PySwigObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)PySwigObject_dealloc, /* tp_dealloc */ + (printfunc)PySwigObject_print, /* tp_print */ +#if PY_VERSION_HEX < 0x02020000 + (getattrfunc)PySwigObject_getattr, /* tp_getattr */ +#else + (getattrfunc)0, /* tp_getattr */ +#endif + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)PySwigObject_compare, /* tp_compare */ + (reprfunc)PySwigObject_repr, /* tp_repr */ + &PySwigObject_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)PySwigObject_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigobject_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + swigobject_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + pyswigobject_type = tmp; + pyswigobject_type.ob_type = &PyType_Type; + type_init = 1; + } + return &pyswigobject_type; +} + +SWIGRUNTIME PyObject * +PySwigObject_New(void *ptr, swig_type_info *ty, int own) +{ + PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type()); + if (sobj) { + sobj->ptr = ptr; + sobj->ty = ty; + sobj->own = own; + sobj->next = 0; + } + return (PyObject *)sobj; +} + +/* ----------------------------------------------------------------------------- + * Implements a simple Swig Packed type, and use it instead of string + * ----------------------------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + void *pack; + swig_type_info *ty; + size_t size; +} PySwigPacked; + +SWIGRUNTIME int +PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags)) +{ + char result[SWIG_BUFFER_SIZE]; + fputs("pack, v->size, 0, sizeof(result))) { + fputs("at ", fp); + fputs(result, fp); + } + fputs(v->ty->name,fp); + fputs(">", fp); + return 0; +} + +SWIGRUNTIME PyObject * +PySwigPacked_repr(PySwigPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) { + return PyString_FromFormat("", result, v->ty->name); + } else { + return PyString_FromFormat("", v->ty->name); + } +} + +SWIGRUNTIME PyObject * +PySwigPacked_str(PySwigPacked *v) +{ + char result[SWIG_BUFFER_SIZE]; + if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){ + return PyString_FromFormat("%s%s", result, v->ty->name); + } else { + return PyString_FromString(v->ty->name); + } +} + +SWIGRUNTIME int +PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w) +{ + size_t i = v->size; + size_t j = w->size; + int s = (i < j) ? -1 : ((i > j) ? 1 : 0); + return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size); +} + +SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void); + +SWIGRUNTIME PyTypeObject* +PySwigPacked_type(void) { + static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type(); + return type; +} + +SWIGRUNTIMEINLINE int +PySwigPacked_Check(PyObject *op) { + return ((op)->ob_type == _PySwigPacked_type()) + || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0); +} + +SWIGRUNTIME void +PySwigPacked_dealloc(PyObject *v) +{ + if (PySwigPacked_Check(v)) { + PySwigPacked *sobj = (PySwigPacked *) v; + free(sobj->pack); + } + PyObject_DEL(v); +} + +SWIGRUNTIME PyTypeObject* +_PySwigPacked_type(void) { + static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer"; + static PyTypeObject pyswigpacked_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp + = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + (char *)"PySwigPacked", /* tp_name */ + sizeof(PySwigPacked), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)PySwigPacked_dealloc, /* tp_dealloc */ + (printfunc)PySwigPacked_print, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)PySwigPacked_compare, /* tp_compare */ + (reprfunc)PySwigPacked_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)PySwigPacked_str, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + swigpacked_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + pyswigpacked_type = tmp; + pyswigpacked_type.ob_type = &PyType_Type; + type_init = 1; + } + return &pyswigpacked_type; +} + +SWIGRUNTIME PyObject * +PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty) +{ + PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type()); + if (sobj) { + void *pack = malloc(size); + if (pack) { + memcpy(pack, ptr, size); + sobj->pack = pack; + sobj->ty = ty; + sobj->size = size; + } else { + PyObject_DEL((PyObject *) sobj); + sobj = 0; + } + } + return (PyObject *) sobj; +} + +SWIGRUNTIME swig_type_info * +PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size) +{ + if (PySwigPacked_Check(obj)) { + PySwigPacked *sobj = (PySwigPacked *)obj; + if (sobj->size != size) return 0; + memcpy(ptr, sobj->pack, size); + return sobj->ty; + } else { + return 0; + } +} + +/* ----------------------------------------------------------------------------- + * pointers/data manipulation + * ----------------------------------------------------------------------------- */ + +SWIGRUNTIMEINLINE PyObject * +_SWIG_This(void) +{ + return PyString_FromString("this"); +} + +SWIGRUNTIME PyObject * +SWIG_This(void) +{ + static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This(); + return swig_this; +} + +/* #define SWIG_PYTHON_SLOW_GETSET_THIS */ + +SWIGRUNTIME PySwigObject * +SWIG_Python_GetSwigThis(PyObject *pyobj) +{ + if (PySwigObject_Check(pyobj)) { + return (PySwigObject *) pyobj; + } else { + PyObject *obj = 0; +#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000)) + if (PyInstance_Check(pyobj)) { + obj = _PyInstance_Lookup(pyobj, SWIG_This()); + } else { + PyObject **dictptr = _PyObject_GetDictPtr(pyobj); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0; + } else { +#ifdef PyWeakref_CheckProxy + if (PyWeakref_CheckProxy(pyobj)) { + PyObject *wobj = PyWeakref_GET_OBJECT(pyobj); + return wobj ? SWIG_Python_GetSwigThis(wobj) : 0; + } +#endif + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } + } + } +#else + obj = PyObject_GetAttr(pyobj,SWIG_This()); + if (obj) { + Py_DECREF(obj); + } else { + if (PyErr_Occurred()) PyErr_Clear(); + return 0; + } +#endif + if (obj && !PySwigObject_Check(obj)) { + /* a PyObject is called 'this', try to get the 'real this' + PySwigObject from it */ + return SWIG_Python_GetSwigThis(obj); + } + return (PySwigObject *)obj; + } +} + +/* Acquire a pointer value */ + +SWIGRUNTIME int +SWIG_Python_AcquirePtr(PyObject *obj, int own) { + if (own) { + PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (sobj) { + int oldown = sobj->own; + sobj->own = own; + return oldown; + } + } + return 0; +} + +/* Convert a pointer value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) { + if (!obj) return SWIG_ERROR; + if (obj == Py_None) { + if (ptr) *ptr = 0; + return SWIG_OK; + } else { + PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + while (sobj) { + void *vptr = sobj->ptr; + if (ty) { + swig_type_info *to = sobj->ty; + if (to == ty) { + /* no type cast needed */ + if (ptr) *ptr = vptr; + break; + } else { + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) { + sobj = (PySwigObject *)sobj->next; + } else { + if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + break; + } + } + } else { + if (ptr) *ptr = vptr; + break; + } + } + if (sobj) { + if (own) *own = sobj->own; + if (flags & SWIG_POINTER_DISOWN) { + sobj->own = 0; + } + return SWIG_OK; + } else { + int res = SWIG_ERROR; + if (flags & SWIG_POINTER_IMPLICIT_CONV) { + PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; + if (data && !data->implicitconv) { + PyObject *klass = data->klass; + if (klass) { + PyObject *impconv; + data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/ + impconv = SWIG_Python_CallFunctor(klass, obj); + data->implicitconv = 0; + if (PyErr_Occurred()) { + PyErr_Clear(); + impconv = 0; + } + if (impconv) { + PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv); + if (iobj) { + void *vptr; + res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0); + if (SWIG_IsOK(res)) { + if (ptr) { + *ptr = vptr; + /* transfer the ownership to 'ptr' */ + iobj->own = 0; + res = SWIG_AddCast(res); + res = SWIG_AddNewMask(res); + } else { + res = SWIG_AddCast(res); + } + } + } + Py_DECREF(impconv); + } + } + } + } + return res; + } + } +} + +/* Convert a function ptr value */ + +SWIGRUNTIME int +SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { + if (!PyCFunction_Check(obj)) { + return SWIG_ConvertPtr(obj, ptr, ty, 0); + } else { + void *vptr = 0; + + /* here we get the method pointer for callbacks */ + const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); + const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; + if (desc) { + desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; + if (!desc) return SWIG_ERROR; + } + if (ty) { + swig_cast_info *tc = SWIG_TypeCheck(desc,ty); + if (!tc) return SWIG_ERROR; + *ptr = SWIG_TypeCast(tc,vptr); + } else { + *ptr = vptr; + } + return SWIG_OK; + } +} + +/* Convert a packed value value */ + +SWIGRUNTIME int +SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) { + swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz); + if (!to) return SWIG_ERROR; + if (ty) { + if (to != ty) { + /* check type cast? */ + swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); + if (!tc) return SWIG_ERROR; + } + } + return SWIG_OK; +} + +/* ----------------------------------------------------------------------------- + * Create a new pointer object + * ----------------------------------------------------------------------------- */ + +/* + Create a new instance object, whitout calling __init__, and set the + 'this' attribute. +*/ + +SWIGRUNTIME PyObject* +SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this) +{ +#if (PY_VERSION_HEX >= 0x02020000) + PyObject *inst = 0; + PyObject *newraw = data->newraw; + if (newraw) { + inst = PyObject_Call(newraw, data->newargs, NULL); + if (inst) { +#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + PyObject *dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + PyDict_SetItem(dict, SWIG_This(), swig_this); + } + } +#else + PyObject *key = SWIG_This(); + PyObject_SetAttr(inst, key, swig_this); +#endif + } + } else { + PyObject *dict = PyDict_New(); + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + } + return inst; +#else +#if (PY_VERSION_HEX >= 0x02010000) + PyObject *inst; + PyObject *dict = PyDict_New(); + PyDict_SetItem(dict, SWIG_This(), swig_this); + inst = PyInstance_NewRaw(data->newargs, dict); + Py_DECREF(dict); + return (PyObject *) inst; +#else + PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type); + if (inst == NULL) { + return NULL; + } + inst->in_class = (PyClassObject *)data->newargs; + Py_INCREF(inst->in_class); + inst->in_dict = PyDict_New(); + if (inst->in_dict == NULL) { + Py_DECREF(inst); + return NULL; + } +#ifdef Py_TPFLAGS_HAVE_WEAKREFS + inst->in_weakreflist = NULL; +#endif +#ifdef Py_TPFLAGS_GC + PyObject_GC_Init(inst); +#endif + PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this); + return (PyObject *) inst; +#endif +#endif +} + +SWIGRUNTIME void +SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) +{ + PyObject *dict; +#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS) + PyObject **dictptr = _PyObject_GetDictPtr(inst); + if (dictptr != NULL) { + dict = *dictptr; + if (dict == NULL) { + dict = PyDict_New(); + *dictptr = dict; + } + PyDict_SetItem(dict, SWIG_This(), swig_this); + return; + } +#endif + dict = PyObject_GetAttrString(inst, (char*)"__dict__"); + PyDict_SetItem(dict, SWIG_This(), swig_this); + Py_DECREF(dict); +} + + +SWIGINTERN PyObject * +SWIG_Python_InitShadowInstance(PyObject *args) { + PyObject *obj[2]; + if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) { + return NULL; + } else { + PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]); + if (sthis) { + PySwigObject_append((PyObject*) sthis, obj[1]); + } else { + SWIG_Python_SetSwigThis(obj[0], obj[1]); + } + return SWIG_Py_Void(); + } +} + +/* Create a new pointer object */ + +SWIGRUNTIME PyObject * +SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) { + if (!ptr) { + return SWIG_Py_Void(); + } else { + int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0; + PyObject *robj = PySwigObject_New(ptr, type, own); + PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0; + if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) { + PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj); + if (inst) { + Py_DECREF(robj); + robj = inst; + } + } + return robj; + } +} + +/* Create a new packed object */ + +SWIGRUNTIMEINLINE PyObject * +SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) { + return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void(); +} + +/* -----------------------------------------------------------------------------* + * Get type list + * -----------------------------------------------------------------------------*/ + +#ifdef SWIG_LINK_RUNTIME +void *SWIG_ReturnGlobalTypeList(void *); +#endif + +SWIGRUNTIME swig_module_info * +SWIG_Python_GetModule(void) { + static void *type_pointer = (void *)0; + /* first check if module already created */ + if (!type_pointer) { +#ifdef SWIG_LINK_RUNTIME + type_pointer = SWIG_ReturnGlobalTypeList((void *)0); +#else + type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + (char*)"type_pointer" SWIG_TYPE_TABLE_NAME); + if (PyErr_Occurred()) { + PyErr_Clear(); + type_pointer = (void *)0; + } +#endif + } + return (swig_module_info *) type_pointer; +} + +#if PY_MAJOR_VERSION < 2 +/* PyModule_AddObject function was introduced in Python 2.0. The following function + is copied out of Python/modsupport.c in python version 2.3.4 */ +SWIGINTERN int +PyModule_AddObject(PyObject *m, char *name, PyObject *o) +{ + PyObject *dict; + if (!PyModule_Check(m)) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs module as first arg"); + return SWIG_ERROR; + } + if (!o) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs non-NULL value"); + return SWIG_ERROR; + } + + dict = PyModule_GetDict(m); + if (dict == NULL) { + /* Internal error -- modules must have a dict! */ + PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", + PyModule_GetName(m)); + return SWIG_ERROR; + } + if (PyDict_SetItemString(dict, name, o)) + return SWIG_ERROR; + Py_DECREF(o); + return SWIG_OK; +} +#endif + +SWIGRUNTIME void +SWIG_Python_DestroyModule(void *vptr) +{ + swig_module_info *swig_module = (swig_module_info *) vptr; + swig_type_info **types = swig_module->types; + size_t i; + for (i =0; i < swig_module->size; ++i) { + swig_type_info *ty = types[i]; + if (ty->owndata) { + PySwigClientData *data = (PySwigClientData *) ty->clientdata; + if (data) PySwigClientData_Del(data); + } + } + Py_DECREF(SWIG_This()); +} + +SWIGRUNTIME void +SWIG_Python_SetModule(swig_module_info *swig_module) { + static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ + + PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, + swig_empty_runtime_method_table); + PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule); + if (pointer && module) { + PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); + } else { + Py_XDECREF(pointer); + } +} + +/* The python cached type query */ +SWIGRUNTIME PyObject * +SWIG_Python_TypeCache(void) { + static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New(); + return cache; +} + +SWIGRUNTIME swig_type_info * +SWIG_Python_TypeQuery(const char *type) +{ + PyObject *cache = SWIG_Python_TypeCache(); + PyObject *key = PyString_FromString(type); + PyObject *obj = PyDict_GetItem(cache, key); + swig_type_info *descriptor; + if (obj) { + descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj); + } else { + swig_module_info *swig_module = SWIG_Python_GetModule(); + descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type); + if (descriptor) { + obj = PyCObject_FromVoidPtr(descriptor, NULL); + PyDict_SetItem(cache, key, obj); + Py_DECREF(obj); + } + } + Py_DECREF(key); + return descriptor; +} + +/* + For backward compatibility only +*/ +#define SWIG_POINTER_EXCEPTION 0 +#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg) +#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags) + +SWIGRUNTIME int +SWIG_Python_AddErrMesg(const char* mesg, int infront) +{ + if (PyErr_Occurred()) { + PyObject *type = 0; + PyObject *value = 0; + PyObject *traceback = 0; + PyErr_Fetch(&type, &value, &traceback); + if (value) { + PyObject *old_str = PyObject_Str(value); + Py_XINCREF(type); + PyErr_Clear(); + if (infront) { + PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str)); + } else { + PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg); + } + Py_DECREF(old_str); + } + return 1; + } else { + return 0; + } +} + +SWIGRUNTIME int +SWIG_Python_ArgFail(int argnum) +{ + if (PyErr_Occurred()) { + /* add information about failing argument */ + char mesg[256]; + PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum); + return SWIG_Python_AddErrMesg(mesg, 1); + } else { + return 0; + } +} + +SWIGRUNTIMEINLINE const char * +PySwigObject_GetDesc(PyObject *self) +{ + PySwigObject *v = (PySwigObject *)self; + swig_type_info *ty = v ? v->ty : 0; + return ty ? ty->str : (char*)""; +} + +SWIGRUNTIME void +SWIG_Python_TypeError(const char *type, PyObject *obj) +{ + if (type) { +#if defined(SWIG_COBJECT_TYPES) + if (obj && PySwigObject_Check(obj)) { + const char *otype = (const char *) PySwigObject_GetDesc(obj); + if (otype) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", + type, otype); + return; + } + } else +#endif + { + const char *otype = (obj ? obj->ob_type->tp_name : 0); + if (otype) { + PyObject *str = PyObject_Str(obj); + const char *cstr = str ? PyString_AsString(str) : 0; + if (cstr) { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", + type, otype, cstr); + } else { + PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", + type, otype); + } + Py_XDECREF(str); + return; + } + } + PyErr_Format(PyExc_TypeError, "a '%s' is expected", type); + } else { + PyErr_Format(PyExc_TypeError, "unexpected type is received"); + } +} + + +/* Convert a pointer value, signal an exception on a type mismatch */ +SWIGRUNTIME void * +SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) { + void *result; + if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) { + PyErr_Clear(); + if (flags & SWIG_POINTER_EXCEPTION) { + SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj); + SWIG_Python_ArgFail(argnum); + } + } + return result; +} + + +#ifdef __cplusplus +#if 0 +{ /* cc-mode */ +#endif +} +#endif + + + +#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) + +#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else + + + +/* -------- TYPES TABLE (BEGIN) -------- */ + +#define SWIGTYPE_p_Brush swig_types[0] +#define SWIGTYPE_p_BrushPreview swig_types[1] +#define SWIGTYPE_p_BrushType swig_types[2] +#define SWIGTYPE_p_ByteBuffer swig_types[3] +#define SWIGTYPE_p_Canvas swig_types[4] +#define SWIGTYPE_p_Color swig_types[5] +#define SWIGTYPE_p_DRW_Command swig_types[6] +#define SWIGTYPE_p_DRW_Header swig_types[7] +#define SWIGTYPE_p_DrawCommand swig_types[8] +#define SWIGTYPE_p_DrawCommandBuffer swig_types[9] +#define SWIGTYPE_p_GdkImage swig_types[10] +#define SWIGTYPE_p_GstBuffer swig_types[11] +#define SWIGTYPE_p_Palette swig_types[12] +#define SWIGTYPE_p_Pos swig_types[13] +#define SWIGTYPE_p_SurfaceA8R8G8B8 swig_types[14] +#define SWIGTYPE_p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char swig_types[15] +#define SWIGTYPE_p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char swig_types[16] +#define SWIGTYPE_p_char swig_types[17] +#define SWIGTYPE_p_float swig_types[18] +#define SWIGTYPE_p_p_DRW_Command swig_types[19] +#define SWIGTYPE_p_p_unsigned_int swig_types[20] +#define SWIGTYPE_p_uint32_t swig_types[21] +#define SWIGTYPE_p_unsigned_char swig_types[22] +#define SWIGTYPE_p_unsigned_int swig_types[23] +#define SWIGTYPE_p_unsigned_short swig_types[24] +#define SWIGTYPE_p_vectorTDrawCommand_t swig_types[25] +#define SWIGTYPE_p_void swig_types[26] +static swig_type_info *swig_types[28]; +static swig_module_info swig_module = {swig_types, 27, 0, 0, 0, 0}; +#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) +#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) + +/* -------- TYPES TABLE (END) -------- */ + +#if (PY_VERSION_HEX <= 0x02000000) +# if !defined(SWIG_PYTHON_CLASSIC) +# error "This python version requires swig to be run with the '-classic' option" +# endif +#endif + +/*----------------------------------------------- + @(target):= _colorsc.so + ------------------------------------------------*/ +#define SWIG_init init_colorsc + +#define SWIG_name "_colorsc" + +#define SWIGVERSION 0x010333 +#define SWIG_VERSION SWIGVERSION + + +#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) +#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) + + +#include + + +namespace swig { + class PyObject_ptr { + protected: + PyObject *_obj; + + public: + PyObject_ptr() :_obj(0) + { + } + + PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj) + { + Py_XINCREF(_obj); + } + + PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj) + { + if (initial_ref) Py_XINCREF(_obj); + } + + PyObject_ptr & operator=(const PyObject_ptr& item) + { + Py_XINCREF(item._obj); + Py_XDECREF(_obj); + _obj = item._obj; + return *this; + } + + ~PyObject_ptr() + { + Py_XDECREF(_obj); + } + + operator PyObject *() const + { + return _obj; + } + + PyObject *operator->() const + { + return _obj; + } + }; +} + + +namespace swig { + struct PyObject_var : PyObject_ptr { + PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { } + + PyObject_var & operator = (PyObject* obj) + { + Py_XDECREF(_obj); + _obj = obj; + return *this; + } + }; +} + + +#include "canvas.h" +#include "palette.h" + + + #define SWIG_From_double PyFloat_FromDouble + + +SWIGINTERNINLINE PyObject * +SWIG_From_float (float value) +{ + return SWIG_From_double (value); +} + + +#include + + +SWIGINTERN int +SWIG_AsVal_double (PyObject *obj, double *val) +{ + int res = SWIG_TypeError; + if (PyFloat_Check(obj)) { + if (val) *val = PyFloat_AsDouble(obj); + return SWIG_OK; + } else if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + double v = PyLong_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + double d = PyFloat_AsDouble(obj); + if (!PyErr_Occurred()) { + if (val) *val = d; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); + } else { + PyErr_Clear(); + } + } + } +#endif + return res; +} + + +SWIGINTERN int +SWIG_AsVal_float (PyObject * obj, float *val) +{ + double v; + int res = SWIG_AsVal_double (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < -FLT_MAX || v > FLT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< float >(v); + } + } + return res; +} + + +#include + + +SWIGINTERNINLINE int +SWIG_CanCastAsInteger(double *d, double min, double max) { + double x = *d; + if ((min <= x && x <= max)) { + double fx = floor(x); + double cx = ceil(x); + double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ + if ((errno == EDOM) || (errno == ERANGE)) { + errno = 0; + } else { + double summ, reps, diff; + if (rd < x) { + diff = x - rd; + } else if (rd > x) { + diff = rd - x; + } else { + return 1; + } + summ = rd + x; + reps = diff/summ; + if (reps < 8*DBL_EPSILON) { + *d = rd; + return 1; + } + } + } + return 0; +} + + +SWIGINTERN int +SWIG_AsVal_long (PyObject *obj, long* val) +{ + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_bool (PyObject *obj, bool *val) +{ + int r = PyObject_IsTrue(obj); + if (r == -1) + return SWIG_ERROR; + if (val) *val = r ? true : false; + return SWIG_OK; +} + + +#include +#if !defined(SWIG_NO_LLONG_MAX) +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) +# define LLONG_MAX __LONG_LONG_MAX__ +# define LLONG_MIN (-LLONG_MAX - 1LL) +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +# endif +#endif + + +SWIGINTERN int +SWIG_AsVal_int (PyObject * obj, int *val) +{ + long v; + int res = SWIG_AsVal_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v < INT_MIN || v > INT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< int >(v); + } + } + return res; +} + + + #define SWIG_From_long PyInt_FromLong + + +SWIGINTERNINLINE PyObject * +SWIG_From_int (int value) +{ + return SWIG_From_long (value); +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) +{ + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else if (PyLong_Check(obj)) { + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + if (val) *val = (unsigned long)(d); + return res; + } + } + } +#endif + return SWIG_TypeError; +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > USHRT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned short >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject* +SWIG_From_unsigned_SS_long (unsigned long value) +{ + return (value > LONG_MAX) ? + PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value)); +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_short (unsigned short value) +{ + return SWIG_From_unsigned_SS_long (value); +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_char (PyObject * obj, unsigned char *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > UCHAR_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned char >(v); + } + } + return res; +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_char (unsigned char value) +{ + return SWIG_From_unsigned_SS_long (value); +} + + +SWIGINTERNINLINE PyObject * +SWIG_From_unsigned_SS_int (unsigned int value) +{ + return SWIG_From_unsigned_SS_long (value); +} + + +SWIGINTERN int +SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val) +{ + unsigned long v; + int res = SWIG_AsVal_unsigned_SS_long (obj, &v); + if (SWIG_IsOK(res)) { + if ((v > UINT_MAX)) { + return SWIG_OverflowError; + } else { + if (val) *val = static_cast< unsigned int >(v); + } + } + return res; +} + + +SWIGINTERN swig_type_info* +SWIG_pchar_descriptor(void) +{ + static int init = 0; + static swig_type_info* info = 0; + if (!init) { + info = SWIG_TypeQuery("_p_char"); + init = 1; + } + return info; +} + + +SWIGINTERN int +SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) +{ + if (PyString_Check(obj)) { + char *cstr; Py_ssize_t len; + PyString_AsStringAndSize(obj, &cstr, &len); + if (cptr) { + if (alloc) { + /* + In python the user should not be able to modify the inner + string representation. To warranty that, if you define + SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string + buffer is always returned. + + The default behavior is just to return the pointer value, + so, be careful. + */ +#if defined(SWIG_PYTHON_SAFE_CSTRINGS) + if (*alloc != SWIG_OLDOBJ) +#else + if (*alloc == SWIG_NEWOBJ) +#endif + { + *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1))); + *alloc = SWIG_NEWOBJ; + } + else { + *cptr = cstr; + *alloc = SWIG_OLDOBJ; + } + } else { + *cptr = PyString_AsString(obj); + } + } + if (psize) *psize = len + 1; + return SWIG_OK; + } else { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + if (pchar_descriptor) { + void* vptr = 0; + if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { + if (cptr) *cptr = (char *) vptr; + if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; + if (alloc) *alloc = SWIG_OLDOBJ; + return SWIG_OK; + } + } + } + return SWIG_TypeError; +} + + + + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtrAndSize(const char* carray, size_t size) +{ + if (carray) { + if (size > INT_MAX) { + swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); + return pchar_descriptor ? + SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void(); + } else { + return PyString_FromStringAndSize(carray, static_cast< int >(size)); + } + } else { + return SWIG_Py_Void(); + } +} + + +SWIGINTERNINLINE PyObject * +SWIG_FromCharPtr(const char *cptr) +{ + return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0)); +} + + +SWIGINTERNINLINE PyObject* + SWIG_From_bool (bool value) +{ + return PyBool_FromLong(value ? 1 : 0); +} + +#ifdef __cplusplus +extern "C" { +#endif +SWIGINTERN int Swig_var_PI_set(PyObject *) { + SWIG_Error(SWIG_AttributeError,"Variable PI is read-only."); + return 1; +} + + +SWIGINTERN PyObject *Swig_var_PI_get(void) { + PyObject *pyobj = 0; + + pyobj = SWIG_From_float(static_cast< float >(PI)); + return pyobj; +} + + +SWIGINTERN PyObject *_wrap_sgn(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float result; + float val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:sgn",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sgn" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + result = (float)sgn(arg1); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_sqr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float result; + float val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:sqr",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "sqr" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + result = (float)sqr(arg1); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_clamp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float arg2 ; + float arg3 ; + float result; + float val1 ; + int ecode1 = 0 ; + float val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:clamp",&obj0,&obj1,&obj2)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "clamp" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "clamp" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "clamp" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + result = (float)clamp(arg1,arg2,arg3); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_to_rad(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float result; + float val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:to_rad",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "to_rad" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + result = (float)to_rad(arg1); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_to_deg(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float result; + float val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:to_deg",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "to_deg" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + result = (float)to_deg(arg1); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_map_range__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float arg2 ; + float arg3 ; + float arg4 ; + float arg5 ; + bool arg6 ; + float result; + float val1 ; + int ecode1 = 0 ; + float val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + float val4 ; + int ecode4 = 0 ; + float val5 ; + int ecode5 = 0 ; + bool val6 ; + int ecode6 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOO:map_range",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "map_range" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "map_range" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "map_range" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + ecode4 = SWIG_AsVal_float(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "map_range" "', argument " "4"" of type '" "float""'"); + } + arg4 = static_cast< float >(val4); + ecode5 = SWIG_AsVal_float(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "map_range" "', argument " "5"" of type '" "float""'"); + } + arg5 = static_cast< float >(val5); + ecode6 = SWIG_AsVal_bool(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "map_range" "', argument " "6"" of type '" "bool""'"); + } + arg6 = static_cast< bool >(val6); + result = (float)map_range(arg1,arg2,arg3,arg4,arg5,arg6); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_map_range__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float arg2 ; + float arg3 ; + float arg4 ; + float arg5 ; + float result; + float val1 ; + int ecode1 = 0 ; + float val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + float val4 ; + int ecode4 = 0 ; + float val5 ; + int ecode5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO:map_range",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "map_range" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "map_range" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "map_range" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + ecode4 = SWIG_AsVal_float(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "map_range" "', argument " "4"" of type '" "float""'"); + } + arg4 = static_cast< float >(val4); + ecode5 = SWIG_AsVal_float(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "map_range" "', argument " "5"" of type '" "float""'"); + } + arg5 = static_cast< float >(val5); + result = (float)map_range(arg1,arg2,arg3,arg4,arg5); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_map_range(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[7]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 6); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 5) { + int _v; + { + int res = SWIG_AsVal_float(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_map_range__SWIG_1(self, args); + } + } + } + } + } + } + if (argc == 6) { + int _v; + { + int res = SWIG_AsVal_float(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[4], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_bool(argv[5], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_map_range__SWIG_0(self, args); + } + } + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'map_range'.\n Possible C/C++ prototypes are:\n"" map_range(float,float,float,float,float,bool)\n"" map_range(float,float,float,float,float)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_fixed_scale(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int result; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:fixed_scale",&obj0,&obj1)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "fixed_scale" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "fixed_scale" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (int)fixed_scale(arg1,arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_endian_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned short arg1 ; + unsigned short result; + unsigned short val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:endian_swap",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_short(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "endian_swap" "', argument " "1"" of type '" "unsigned short""'"); + } + arg1 = static_cast< unsigned short >(val1); + result = (unsigned short)endian_swap(arg1); + resultobj = SWIG_From_unsigned_SS_short(static_cast< unsigned short >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_x_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos_x_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_x_set" "', argument " "1"" of type '" "Pos *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Pos_x_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->x = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_x_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Pos_x_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_x_get" "', argument " "1"" of type '" "Pos *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + result = (float) ((arg1)->x); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_y_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos_y_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_y_set" "', argument " "1"" of type '" "Pos *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Pos_y_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->y = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_y_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Pos_y_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_y_get" "', argument " "1"" of type '" "Pos *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + result = (float) ((arg1)->y); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Pos__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_Pos")) SWIG_fail; + result = (Pos *)new Pos(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Pos__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float arg2 ; + Pos *result = 0 ; + float val1 ; + int ecode1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:new_Pos",&obj0,&obj1)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Pos" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Pos" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = (Pos *)new Pos(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Pos(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 2); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 0) { + return _wrap_new_Pos__SWIG_0(self, args); + } + if (argc == 2) { + int _v; + { + int res = SWIG_AsVal_float(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_float(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_Pos__SWIG_1(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Pos'.\n Possible C/C++ prototypes are:\n"" Pos()\n"" Pos(float,float)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos___add__",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos___add__" "', argument " "1"" of type '" "Pos const *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos___add__" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos___add__" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = ((Pos const *)arg1)->operator +((Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___sub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos___sub__",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos___sub__" "', argument " "1"" of type '" "Pos const *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos___sub__" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos___sub__" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = ((Pos const *)arg1)->operator -((Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___mul____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos___mul__",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos___mul__" "', argument " "1"" of type '" "Pos const *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos___mul__" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos___mul__" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = ((Pos const *)arg1)->operator *((Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___div____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos___div__",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos___div__" "', argument " "1"" of type '" "Pos const *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos___div__" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos___div__" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = ((Pos const *)arg1)->operator /((Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___mul____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + float arg2 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos___mul__",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos___mul__" "', argument " "1"" of type '" "Pos const *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Pos___mul__" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = ((Pos const *)arg1)->operator *(arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___mul__(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 2); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Pos, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_Pos, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_Pos___mul____SWIG_0(self, args); + } + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Pos, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_float(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_Pos___mul____SWIG_1(self, args); + } + } + } + +fail: + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_Pos___div____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + float arg2 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos___div__",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos___div__" "', argument " "1"" of type '" "Pos const *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Pos___div__" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = ((Pos const *)arg1)->operator /(arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos___div__(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 2); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Pos, 0); + _v = SWIG_CheckState(res); + if (_v) { + int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_Pos, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_Pos___div____SWIG_0(self, args); + } + } + } + if (argc == 2) { + int _v; + void *vptr = 0; + int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Pos, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_float(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_Pos___div____SWIG_1(self, args); + } + } + } + +fail: + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; +} + + +SWIGINTERN PyObject *_wrap_Pos_create_from_min(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos_create_from_min",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_create_from_min" "', argument " "1"" of type '" "Pos const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos_create_from_min" "', argument " "1"" of type '" "Pos const &""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos_create_from_min" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos_create_from_min" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = Pos::create_from_min((Pos const &)*arg1,(Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_create_from_max(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos_create_from_max",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_create_from_max" "', argument " "1"" of type '" "Pos const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos_create_from_max" "', argument " "1"" of type '" "Pos const &""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos_create_from_max" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos_create_from_max" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = Pos::create_from_max((Pos const &)*arg1,(Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_create_from_angle(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float arg2 ; + Pos result; + float val1 ; + int ecode1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Pos_create_from_angle",&obj0,&obj1)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Pos_create_from_angle" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Pos_create_from_angle" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = Pos::create_from_angle(arg1,arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Pos_create_from_rotation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = 0 ; + Pos *arg2 = 0 ; + float arg3 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + float val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Pos_create_from_rotation",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Pos_create_from_rotation" "', argument " "1"" of type '" "Pos const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos_create_from_rotation" "', argument " "1"" of type '" "Pos const &""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Pos_create_from_rotation" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Pos_create_from_rotation" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Pos_create_from_rotation" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + result = Pos::create_from_rotation((Pos const &)*arg1,(Pos const &)*arg2,arg3); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Pos(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Pos",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Pos, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Pos" "', argument " "1"" of type '" "Pos *""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Pos_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Pos, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_Color_r_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Color_r_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_r_set" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Color_r_set" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + if (arg1) (arg1)->r = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_r_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_r_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_r_get" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned char) ((arg1)->r); + resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_g_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Color_g_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_g_set" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Color_g_set" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + if (arg1) (arg1)->g = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_g_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_g_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_g_get" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned char) ((arg1)->g); + resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_b_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Color_b_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_b_set" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Color_b_set" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + if (arg1) (arg1)->b = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_b_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_b_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_b_get" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned char) ((arg1)->b); + resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_a_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Color_a_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_a_set" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Color_a_set" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + if (arg1) (arg1)->a = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_a_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned char result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_a_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_a_get" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned char) ((arg1)->a); + resultobj = SWIG_From_unsigned_SS_char(static_cast< unsigned char >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Color__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_Color")) SWIG_fail; + result = (Color *)new Color(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Color, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Color__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + int arg3 ; + int arg4 ; + Color *result = 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:new_Color",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Color" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Color" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_Color" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_Color" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + result = (Color *)new Color(arg1,arg2,arg3,arg4); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Color, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Color(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[5]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 4); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 0) { + return _wrap_new_Color__SWIG_0(self, args); + } + if (argc == 4) { + int _v; + { + int res = SWIG_AsVal_int(argv[0], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[2], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + { + int res = SWIG_AsVal_int(argv[3], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_Color__SWIG_1(self, args); + } + } + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Color'.\n Possible C/C++ prototypes are:\n"" Color()\n"" Color(int,int,int,int)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_get_a8r8g8b8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_get_a8r8g8b8",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_get_a8r8g8b8" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned int)(arg1)->get_a8r8g8b8(); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_a8r8g8b8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned int arg1 ; + Color result; + unsigned int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_create_from_a8r8g8b8",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Color_create_from_a8r8g8b8" "', argument " "1"" of type '" "unsigned int""'"); + } + arg1 = static_cast< unsigned int >(val1); + result = Color::create_from_a8r8g8b8(arg1); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_get_a8b8g8r8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_get_a8b8g8r8",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_get_a8b8g8r8" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned int)(arg1)->get_a8b8g8r8(); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_a8b8g8r8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned int arg1 ; + Color result; + unsigned int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_create_from_a8b8g8r8",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Color_create_from_a8b8g8r8" "', argument " "1"" of type '" "unsigned int""'"); + } + arg1 = static_cast< unsigned int >(val1); + result = Color::create_from_a8b8g8r8(arg1); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_get_r5g6b5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_get_r5g6b5",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_get_r5g6b5" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned int)(arg1)->get_r5g6b5(); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_r5g6b5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned short arg1 ; + Color result; + unsigned short val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_create_from_r5g6b5",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_short(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Color_create_from_r5g6b5" "', argument " "1"" of type '" "unsigned short""'"); + } + arg1 = static_cast< unsigned short >(val1); + result = Color::create_from_r5g6b5(arg1); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_get_b5g6r5(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + unsigned int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_get_b5g6r5",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_get_b5g6r5" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = (unsigned int)(arg1)->get_b5g6r5(); + resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_float(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + float arg1 ; + float arg2 ; + float arg3 ; + float arg4 ; + Color result; + float val1 ; + int ecode1 = 0 ; + float val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + float val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Color_create_from_float",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + ecode1 = SWIG_AsVal_float(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Color_create_from_float" "', argument " "1"" of type '" "float""'"); + } + arg1 = static_cast< float >(val1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Color_create_from_float" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Color_create_from_float" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + ecode4 = SWIG_AsVal_float(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Color_create_from_float" "', argument " "4"" of type '" "float""'"); + } + arg4 = static_cast< float >(val4); + result = Color::create_from_float(arg1,arg2,arg3,arg4); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_blend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = 0 ; + Color *arg2 = 0 ; + Color result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Color_create_from_blend",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Color, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_create_from_blend" "', argument " "1"" of type '" "Color const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Color_create_from_blend" "', argument " "1"" of type '" "Color const &""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Color, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Color_create_from_blend" "', argument " "2"" of type '" "Color const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Color_create_from_blend" "', argument " "2"" of type '" "Color const &""'"); + } + arg2 = reinterpret_cast< Color * >(argp2); + result = Color::create_from_blend((Color const &)*arg1,(Color const &)*arg2); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_lerp(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = 0 ; + Color *arg2 = 0 ; + unsigned int arg3 ; + Color result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + unsigned int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Color_create_from_lerp",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Color, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Color_create_from_lerp" "', argument " "1"" of type '" "Color const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Color_create_from_lerp" "', argument " "1"" of type '" "Color const &""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Color, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Color_create_from_lerp" "', argument " "2"" of type '" "Color const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Color_create_from_lerp" "', argument " "2"" of type '" "Color const &""'"); + } + arg2 = reinterpret_cast< Color * >(argp2); + ecode3 = SWIG_AsVal_unsigned_SS_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Color_create_from_lerp" "', argument " "3"" of type '" "unsigned int""'"); + } + arg3 = static_cast< unsigned int >(val3); + result = Color::create_from_lerp((Color const &)*arg1,(Color const &)*arg2,arg3); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_create_from_yuv(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned char arg1 ; + unsigned char arg2 ; + unsigned char arg3 ; + Color result; + unsigned char val1 ; + int ecode1 = 0 ; + unsigned char val2 ; + int ecode2 = 0 ; + unsigned char val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Color_create_from_yuv",&obj0,&obj1,&obj2)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_char(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Color_create_from_yuv" "', argument " "1"" of type '" "unsigned char""'"); + } + arg1 = static_cast< unsigned char >(val1); + ecode2 = SWIG_AsVal_unsigned_SS_char(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Color_create_from_yuv" "', argument " "2"" of type '" "unsigned char""'"); + } + arg2 = static_cast< unsigned char >(val2); + ecode3 = SWIG_AsVal_unsigned_SS_char(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Color_create_from_yuv" "', argument " "3"" of type '" "unsigned char""'"); + } + arg3 = static_cast< unsigned char >(val3); + result = Color::create_from_yuv(arg1,arg2,arg3); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Color_yuv_to_hsv(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + unsigned int arg1 ; + Color result; + unsigned int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Color_yuv_to_hsv",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Color_yuv_to_hsv" "', argument " "1"" of type '" "unsigned int""'"); + } + arg1 = static_cast< unsigned int >(val1); + result = Color::yuv_to_hsv(arg1); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Color(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = (Color *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Color",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Color, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Color" "', argument " "1"" of type '" "Color *""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Color_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Color, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_ByteBuffer_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ByteBuffer *arg1 = (ByteBuffer *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ByteBuffer_size_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ByteBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ByteBuffer_size_set" "', argument " "1"" of type '" "ByteBuffer *""'"); + } + arg1 = reinterpret_cast< ByteBuffer * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ByteBuffer_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ByteBuffer_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ByteBuffer *arg1 = (ByteBuffer *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ByteBuffer_size_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ByteBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ByteBuffer_size_get" "', argument " "1"" of type '" "ByteBuffer *""'"); + } + arg1 = reinterpret_cast< ByteBuffer * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ByteBuffer_data_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ByteBuffer *arg1 = (ByteBuffer *) 0 ; + void *arg2 = (void *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:ByteBuffer_data_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ByteBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ByteBuffer_data_set" "', argument " "1"" of type '" "ByteBuffer *""'"); + } + arg1 = reinterpret_cast< ByteBuffer * >(argp1); + { + arg2 = obj1; + } + if (arg1) (arg1)->data = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_ByteBuffer_data_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ByteBuffer *arg1 = (ByteBuffer *) 0 ; + void *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:ByteBuffer_data_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ByteBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ByteBuffer_data_get" "', argument " "1"" of type '" "ByteBuffer *""'"); + } + arg1 = reinterpret_cast< ByteBuffer * >(argp1); + result = (void *) ((arg1)->data); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_ByteBuffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ByteBuffer *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_ByteBuffer")) SWIG_fail; + result = (ByteBuffer *)new ByteBuffer(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ByteBuffer, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_ByteBuffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + ByteBuffer *arg1 = (ByteBuffer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_ByteBuffer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ByteBuffer, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ByteBuffer" "', argument " "1"" of type '" "ByteBuffer *""'"); + } + arg1 = reinterpret_cast< ByteBuffer * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *ByteBuffer_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_ByteBuffer, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_width_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:SurfaceA8R8G8B8_width_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_width_set" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SurfaceA8R8G8B8_width_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->width = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_width_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:SurfaceA8R8G8B8_width_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_width_get" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + result = (int) ((arg1)->width); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_height_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:SurfaceA8R8G8B8_height_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_height_set" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SurfaceA8R8G8B8_height_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->height = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_height_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:SurfaceA8R8G8B8_height_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_height_get" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + result = (int) ((arg1)->height); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_stride_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:SurfaceA8R8G8B8_stride_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_stride_set" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SurfaceA8R8G8B8_stride_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->stride = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_stride_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:SurfaceA8R8G8B8_stride_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_stride_get" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + result = (int) ((arg1)->stride); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_pixels_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + unsigned int *arg2 = (unsigned int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:SurfaceA8R8G8B8_pixels_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_pixels_set" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SurfaceA8R8G8B8_pixels_set" "', argument " "2"" of type '" "unsigned int *""'"); + } + arg2 = reinterpret_cast< unsigned int * >(argp2); + if (arg1) (arg1)->pixels = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_SurfaceA8R8G8B8_pixels_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + unsigned int *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:SurfaceA8R8G8B8_pixels_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SurfaceA8R8G8B8_pixels_get" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + result = (unsigned int *) ((arg1)->pixels); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_SurfaceA8R8G8B8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_SurfaceA8R8G8B8")) SWIG_fail; + result = (SurfaceA8R8G8B8 *)new SurfaceA8R8G8B8(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SurfaceA8R8G8B8, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_SurfaceA8R8G8B8(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + SurfaceA8R8G8B8 *arg1 = (SurfaceA8R8G8B8 *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_SurfaceA8R8G8B8",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_SurfaceA8R8G8B8, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SurfaceA8R8G8B8" "', argument " "1"" of type '" "SurfaceA8R8G8B8 *""'"); + } + arg1 = reinterpret_cast< SurfaceA8R8G8B8 * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *SurfaceA8R8G8B8_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_SurfaceA8R8G8B8, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_new_DrawCommandBuffer__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_DrawCommandBuffer")) SWIG_fail; + result = (DrawCommandBuffer *)new DrawCommandBuffer(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DrawCommandBuffer, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DrawCommandBuffer__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int arg2 ; + DrawCommandBuffer *result = 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:new_DrawCommandBuffer",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DrawCommandBuffer" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_DrawCommandBuffer" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (DrawCommandBuffer *)new DrawCommandBuffer((char const *)arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DrawCommandBuffer, SWIG_POINTER_NEW | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DrawCommandBuffer__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = 0 ; + DrawCommandBuffer *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_DrawCommandBuffer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_DrawCommandBuffer, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_DrawCommandBuffer" "', argument " "1"" of type '" "DrawCommandBuffer const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_DrawCommandBuffer" "', argument " "1"" of type '" "DrawCommandBuffer const &""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + result = (DrawCommandBuffer *)new DrawCommandBuffer((DrawCommandBuffer const &)*arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DrawCommandBuffer, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DrawCommandBuffer(PyObject *self, PyObject *args) { + int argc; + PyObject *argv[3]; + int ii; + + if (!PyTuple_Check(args)) SWIG_fail; + argc = (int)PyObject_Length(args); + for (ii = 0; (ii < argc) && (ii < 2); ii++) { + argv[ii] = PyTuple_GET_ITEM(args,ii); + } + if (argc == 0) { + return _wrap_new_DrawCommandBuffer__SWIG_0(self, args); + } + if (argc == 1) { + int _v; + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_DrawCommandBuffer, 0); + _v = SWIG_CheckState(res); + if (_v) { + return _wrap_new_DrawCommandBuffer__SWIG_2(self, args); + } + } + if (argc == 2) { + int _v; + int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0); + _v = SWIG_CheckState(res); + if (_v) { + { + int res = SWIG_AsVal_int(argv[1], NULL); + _v = SWIG_CheckState(res); + } + if (_v) { + return _wrap_new_DrawCommandBuffer__SWIG_1(self, args); + } + } + } + +fail: + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_DrawCommandBuffer'.\n Possible C/C++ prototypes are:\n"" DrawCommandBuffer()\n"" DrawCommandBuffer(char const *,int)\n"" DrawCommandBuffer(DrawCommandBuffer const &)\n"); + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_DrawCommandBuffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_DrawCommandBuffer",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DrawCommandBuffer" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + DrawCommandBuffer *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommandBuffer_append",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_append" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_DrawCommandBuffer, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DrawCommandBuffer_append" "', argument " "2"" of type '" "DrawCommandBuffer const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DrawCommandBuffer_append" "', argument " "2"" of type '" "DrawCommandBuffer const &""'"); + } + arg2 = reinterpret_cast< DrawCommandBuffer * >(argp2); + (arg1)->append((DrawCommandBuffer const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommandBuffer_clear",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_clear" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_get_bytes(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + ByteBuffer result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommandBuffer_get_bytes",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_get_bytes" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + result = (arg1)->get_bytes(); + { + resultobj = PyString_FromStringAndSize((const char*)(&result)->data, (&result)->size); + } + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_cmds_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + char *arg2 = (char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommandBuffer_cmds_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_cmds_set" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DrawCommandBuffer_cmds_set" "', argument " "2"" of type '" "char *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + if (arg1->cmds) delete[] arg1->cmds; + if (arg2) { + size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1; + arg1->cmds = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size))); + } else { + arg1->cmds = 0; + } + resultobj = SWIG_Py_Void(); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_cmds_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommandBuffer_cmds_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_cmds_get" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + result = (char *) ((arg1)->cmds); + resultobj = SWIG_FromCharPtr((const char *)result); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_ncommands_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommandBuffer_ncommands_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_ncommands_set" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommandBuffer_ncommands_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->ncommands = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_ncommands_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommandBuffer *arg1 = (DrawCommandBuffer *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommandBuffer_ncommands_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommandBuffer, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_ncommands_get" "', argument " "1"" of type '" "DrawCommandBuffer *""'"); + } + arg1 = reinterpret_cast< DrawCommandBuffer * >(argp1); + result = (int) ((arg1)->ncommands); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommandBuffer_create_from_string(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + char *arg1 = (char *) 0 ; + int arg2 ; + DrawCommandBuffer result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommandBuffer_create_from_string",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommandBuffer_create_from_string" "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommandBuffer_create_from_string" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = DrawCommandBuffer::create_from_string((char const *)arg1,arg2); + resultobj = SWIG_NewPointerObj((new DrawCommandBuffer(static_cast< const DrawCommandBuffer& >(result))), SWIGTYPE_p_DrawCommandBuffer, SWIG_POINTER_OWN | 0 ); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + +SWIGINTERN PyObject *DrawCommandBuffer_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_DrawCommandBuffer, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_DrawCommand_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_type_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_type_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_type_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_type_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_type_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (int) ((arg1)->type); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_pos_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_pos_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_pos_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DrawCommand_pos_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->pos = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_pos_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_pos_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_pos_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (Pos *)& ((arg1)->pos); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_color_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + Color *arg2 = (Color *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_color_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_color_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DrawCommand_color_set" "', argument " "2"" of type '" "Color *""'"); + } + arg2 = reinterpret_cast< Color * >(argp2); + if (arg1) (arg1)->color = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_color_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + Color *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_color_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_color_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (Color *)& ((arg1)->color); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Color, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_pressure_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_pressure_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_pressure_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_pressure_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->pressure = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_pressure_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_pressure_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_pressure_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (int) ((arg1)->pressure); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_flipx_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_flipx_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_flipx_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_flipx_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->flipx = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_flipx_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_flipx_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_flipx_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (bool) ((arg1)->flipx); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_flipy_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_flipy_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_flipy_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_flipy_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->flipy = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_flipy_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_flipy_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_flipy_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (bool) ((arg1)->flipy); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_is_text_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_is_text_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_is_text_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_is_text_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->is_text = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_is_text_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_is_text_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_is_text_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (bool) ((arg1)->is_text); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_text_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + uint32_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_text_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_text_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + { + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_uint32_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DrawCommand_text_set" "', argument " "2"" of type '" "uint32_t""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DrawCommand_text_set" "', argument " "2"" of type '" "uint32_t""'"); + } else { + uint32_t * temp = reinterpret_cast< uint32_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; + } + } + if (arg1) (arg1)->text = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_text_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + uint32_t result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_text_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_text_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = ((arg1)->text); + resultobj = SWIG_NewPointerObj((new uint32_t(static_cast< const uint32_t& >(result))), SWIGTYPE_p_uint32_t, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_brush_control_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_brush_control_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_brush_control_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_brush_control_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->brush_control = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_brush_control_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_brush_control_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_brush_control_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (int) ((arg1)->brush_control); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_brush_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_brush_type_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_brush_type_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_brush_type_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->brush_type = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_brush_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_brush_type_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_brush_type_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (int) ((arg1)->brush_type); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_size_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_size_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_size_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->size = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_size_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_size_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (float) ((arg1)->size); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_opacity_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_opacity_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_opacity_set" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_opacity_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->opacity = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_opacity_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_opacity_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_opacity_get" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + result = (float) ((arg1)->opacity); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_DrawCommand(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_DrawCommand")) SWIG_fail; + result = (DrawCommand *)new DrawCommand(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DrawCommand, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_create_color_change(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Color *arg1 = 0 ; + DrawCommand result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_create_color_change",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Color, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_create_color_change" "', argument " "1"" of type '" "Color const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DrawCommand_create_color_change" "', argument " "1"" of type '" "Color const &""'"); + } + arg1 = reinterpret_cast< Color * >(argp1); + result = DrawCommand::create_color_change((Color const &)*arg1); + resultobj = SWIG_NewPointerObj((new DrawCommand(static_cast< const DrawCommand& >(result))), SWIGTYPE_p_DrawCommand, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_create_draw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Pos *arg1 = 0 ; + int arg2 ; + DrawCommand result; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:DrawCommand_create_draw",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DrawCommand_create_draw" "', argument " "1"" of type '" "Pos const &""'"); + } + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "DrawCommand_create_draw" "', argument " "1"" of type '" "Pos const &""'"); + } + arg1 = reinterpret_cast< Pos * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_create_draw" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = DrawCommand::create_draw((Pos const &)*arg1,arg2); + resultobj = SWIG_NewPointerObj((new DrawCommand(static_cast< const DrawCommand& >(result))), SWIGTYPE_p_DrawCommand, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_create_end_draw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + DrawCommand result; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_create_end_draw",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DrawCommand_create_end_draw" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = DrawCommand::create_end_draw(arg1); + resultobj = SWIG_NewPointerObj((new DrawCommand(static_cast< const DrawCommand& >(result))), SWIGTYPE_p_DrawCommand, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_create_size_change(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + float arg3 ; + float arg4 ; + DrawCommand result; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + float val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:DrawCommand_create_size_change",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DrawCommand_create_size_change" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "DrawCommand_create_size_change" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DrawCommand_create_size_change" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + ecode4 = SWIG_AsVal_float(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "DrawCommand_create_size_change" "', argument " "4"" of type '" "float""'"); + } + arg4 = static_cast< float >(val4); + result = DrawCommand::create_size_change(arg1,arg2,arg3,arg4); + resultobj = SWIG_NewPointerObj((new DrawCommand(static_cast< const DrawCommand& >(result))), SWIGTYPE_p_DrawCommand, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_DrawCommand_create_flip(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + bool arg1 ; + DrawCommand result; + bool val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:DrawCommand_create_flip",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_bool(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DrawCommand_create_flip" "', argument " "1"" of type '" "bool""'"); + } + arg1 = static_cast< bool >(val1); + result = DrawCommand::create_flip(arg1); + resultobj = SWIG_NewPointerObj((new DrawCommand(static_cast< const DrawCommand& >(result))), SWIGTYPE_p_DrawCommand, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_DrawCommand(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + DrawCommand *arg1 = (DrawCommand *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_DrawCommand",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_DrawCommand, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_DrawCommand" "', argument " "1"" of type '" "DrawCommand *""'"); + } + arg1 = reinterpret_cast< DrawCommand * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *DrawCommand_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_DrawCommand, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN int Swig_var_BrushType_distance_tbl_set(PyObject *_val) { + { + unsigned char (*inp)[BrushType::DIST_TABLE_WIDTH] = 0; + int res = SWIG_ConvertPtr(_val, SWIG_as_voidptrptr(&inp), SWIGTYPE_p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char, 0 ); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ArgError(res), "in variable '""BrushType::distance_tbl""' of type '""unsigned char [BrushType::DIST_TABLE_WIDTH][BrushType::DIST_TABLE_WIDTH]""'"); + } else if (inp) { + size_t ii = 0; + for (; ii < (size_t)BrushType::DIST_TABLE_WIDTH; ++ii) { + if (inp[ii]) { + size_t jj = 0; + for (; jj < (size_t)BrushType::DIST_TABLE_WIDTH; ++jj) BrushType::distance_tbl[ii][jj] = inp[ii][jj]; + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""BrushType::distance_tbl""' of type '""unsigned char [BrushType::DIST_TABLE_WIDTH][BrushType::DIST_TABLE_WIDTH]""'"); + } + } + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""BrushType::distance_tbl""' of type '""unsigned char [BrushType::DIST_TABLE_WIDTH][BrushType::DIST_TABLE_WIDTH]""'"); + } + } + return 0; +fail: + return 1; +} + + +SWIGINTERN PyObject *Swig_var_BrushType_distance_tbl_get(void) { + PyObject *pyobj = 0; + + pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(BrushType::distance_tbl), SWIGTYPE_p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char, 0 ); + return pyobj; +} + + +SWIGINTERN PyObject *_wrap_BrushType_distance_tbl_get(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(args)) { + return Swig_var_BrushType_distance_tbl_get(); +} + + +SWIGINTERN PyObject *_wrap_BrushType_distance_tbl_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *value; + int res; + + if (!PyArg_ParseTuple(args,(char *)"O:set",&value)) return NULL; + res = Swig_var_BrushType_distance_tbl_set(value); + return !res ? SWIG_Py_Void() : NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_intensity_tbl_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + unsigned char (*arg2)[BrushType::BRUSH_TABLE_HEIGHT] ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:BrushType_intensity_tbl_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_intensity_tbl_set" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "BrushType_intensity_tbl_set" "', argument " "2"" of type '" "unsigned char [BrushType::BRUSH_TABLE_WIDTH][BrushType::BRUSH_TABLE_HEIGHT]""'"); + } + arg2 = reinterpret_cast< unsigned char (*)[BrushType::BRUSH_TABLE_HEIGHT] >(argp2); + { + if (arg2) { + size_t ii = 0; + for (; ii < (size_t)BrushType::BRUSH_TABLE_WIDTH; ++ii) { + if (arg2[ii]) { + size_t jj = 0; + for (; jj < (size_t)BrushType::BRUSH_TABLE_HEIGHT; ++jj) arg1->intensity_tbl[ii][jj] = arg2[ii][jj]; + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""intensity_tbl""' of type '""unsigned char [BrushType::BRUSH_TABLE_WIDTH][BrushType::BRUSH_TABLE_HEIGHT]""'"); + } + } + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""intensity_tbl""' of type '""unsigned char [BrushType::BRUSH_TABLE_WIDTH][BrushType::BRUSH_TABLE_HEIGHT]""'"); + } + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_intensity_tbl_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + unsigned char (*result)[BrushType::BRUSH_TABLE_HEIGHT] = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:BrushType_intensity_tbl_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_intensity_tbl_get" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + result = (unsigned char (*)[BrushType::BRUSH_TABLE_HEIGHT])(unsigned char (*)[BrushType::BRUSH_TABLE_HEIGHT]) ((arg1)->intensity_tbl); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_create_distance_table(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + + if (!PyArg_ParseTuple(args,(char *)":BrushType_create_distance_table")) SWIG_fail; + BrushType::create_distance_table(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_smooth_step(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + float arg2 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:BrushType_smooth_step",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_smooth_step" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "BrushType_smooth_step" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = (float)(arg1)->smooth_step(arg2); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_create_brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + float arg2 ; + float arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:BrushType_create_brush",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_create_brush" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "BrushType_create_brush" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "BrushType_create_brush" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + (arg1)->create_brush(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_create_hard_brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:BrushType_create_hard_brush",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_create_hard_brush" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + (arg1)->create_hard_brush(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_create_soft_brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:BrushType_create_soft_brush",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_create_soft_brush" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + (arg1)->create_soft_brush(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushType_create_cursor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:BrushType_create_cursor",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushType_create_cursor" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + (arg1)->create_cursor(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_BrushType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_BrushType")) SWIG_fail; + result = (BrushType *)new BrushType(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BrushType, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_BrushType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushType *arg1 = (BrushType *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_BrushType",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushType, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_BrushType" "', argument " "1"" of type '" "BrushType *""'"); + } + arg1 = reinterpret_cast< BrushType * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *BrushType_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_BrushType, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN int Swig_var_Brush_brush_type_set(PyObject *_val) { + { + BrushType *inp = 0; + int res = SWIG_ConvertPtr(_val, SWIG_as_voidptrptr(&inp), SWIGTYPE_p_BrushType, 0 ); + if (!SWIG_IsOK(res)) { + SWIG_exception_fail(SWIG_ArgError(res), "in variable '""Brush::brush_type""' of type '""BrushType [BrushType::NUM_BRUSHES]""'"); + } else if (inp) { + size_t ii = 0; + for (; ii < (size_t)BrushType::NUM_BRUSHES; ++ii) Brush::brush_type[ii] = inp[ii]; + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""Brush::brush_type""' of type '""BrushType [BrushType::NUM_BRUSHES]""'"); + } + } + return 0; +fail: + return 1; +} + + +SWIGINTERN PyObject *Swig_var_Brush_brush_type_get(void) { + PyObject *pyobj = 0; + + pyobj = SWIG_NewPointerObj(SWIG_as_voidptr(Brush::brush_type), SWIGTYPE_p_BrushType, 0 ); + return pyobj; +} + + +SWIGINTERN PyObject *_wrap_Brush_brush_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(args)) { + return Swig_var_Brush_brush_type_get(); +} + + +SWIGINTERN PyObject *_wrap_Brush_brush_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *value; + int res; + + if (!PyArg_ParseTuple(args,(char *)"O:set",&value)) return NULL; + res = Swig_var_Brush_brush_type_set(value); + return !res ? SWIG_Py_Void() : NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_color_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + Color *arg2 = (Color *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Brush_color_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_color_set" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Color, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Brush_color_set" "', argument " "2"" of type '" "Color *""'"); + } + arg2 = reinterpret_cast< Color * >(argp2); + if (arg1) (arg1)->color = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_color_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + Color *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Brush_color_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_color_get" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + result = (Color *)& ((arg1)->color); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Color, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_type_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Brush_type_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_type_set" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Brush_type_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->type = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_type_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Brush_type_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_type_get" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + result = (int) ((arg1)->type); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Brush_size_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_size_set" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Brush_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Brush_size_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_size_get" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_control_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Brush_control_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_control_set" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Brush_control_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->control = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_control_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Brush_control_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_control_get" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + result = (int) ((arg1)->control); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_opacity_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Brush_opacity_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_opacity_set" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Brush_opacity_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->opacity = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Brush_opacity_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Brush_opacity_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Brush_opacity_get" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + result = (float) ((arg1)->opacity); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *result = 0 ; + + if (!PyArg_ParseTuple(args,(char *)":new_Brush")) SWIG_fail; + result = (Brush *)new Brush(); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Brush, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Brush *arg1 = (Brush *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Brush",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Brush, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Brush" "', argument " "1"" of type '" "Brush *""'"); + } + arg1 = reinterpret_cast< Brush * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Brush_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Brush, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_Canvas_commands_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + vector *arg2 = (vector *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_commands_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_commands_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_vectorTDrawCommand_t, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_commands_set" "', argument " "2"" of type '" "vector *""'"); + } + arg2 = reinterpret_cast< vector * >(argp2); + if (arg1) (arg1)->commands = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_commands_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + vector *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_commands_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_commands_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (vector *)& ((arg1)->commands); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_vectorTDrawCommand_t, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_width_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_width_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_width_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_width_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->width = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_width_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_width_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_width_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->width); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_height_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_height_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_height_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_height_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->height = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_height_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_height_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_height_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->height); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *arg2 = (unsigned int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_image_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_image_set" "', argument " "2"" of type '" "unsigned int *""'"); + } + arg2 = reinterpret_cast< unsigned int * >(argp2); + if (arg1) (arg1)->image = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_image_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (unsigned int *) ((arg1)->image); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_backup_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *arg2 = (unsigned int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_image_backup_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_backup_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_image_backup_set" "', argument " "2"" of type '" "unsigned int *""'"); + } + arg2 = reinterpret_cast< unsigned int * >(argp2); + if (arg1) (arg1)->image_backup = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_backup_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_image_backup_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_backup_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (unsigned int *) ((arg1)->image_backup); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_alpha_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned char *arg2 = (unsigned char *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_alpha_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_alpha_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_char, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_alpha_set" "', argument " "2"" of type '" "unsigned char *""'"); + } + arg2 = reinterpret_cast< unsigned char * >(argp2); + if (arg1) (arg1)->alpha = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_alpha_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned char *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_alpha_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_alpha_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (unsigned char *) ((arg1)->alpha); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_char, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_shared_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *arg2 = (unsigned int *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_image_shared_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_shared_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_image_shared_set" "', argument " "2"" of type '" "unsigned int *""'"); + } + arg2 = reinterpret_cast< unsigned int * >(argp2); + if (arg1) (arg1)->image_shared = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_shared_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_image_shared_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_shared_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (unsigned int *) ((arg1)->image_shared); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_reference_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned short *arg2 = (unsigned short *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_image_reference_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_reference_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_short, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_image_reference_set" "', argument " "2"" of type '" "unsigned short *""'"); + } + arg2 = reinterpret_cast< unsigned short * >(argp2); + if (arg1) (arg1)->image_reference = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_reference_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned short *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_image_reference_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_reference_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (unsigned short *) ((arg1)->image_reference); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_short, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_video_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int **arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_image_video_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_video_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_unsigned_int, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_image_video_set" "', argument " "2"" of type '" "unsigned int *[2]""'"); + } + arg2 = reinterpret_cast< unsigned int ** >(argp2); + { + if (arg2) { + size_t ii = 0; + for (; ii < (size_t)2; ++ii) arg1->image_video[ii] = arg2[ii]; + } else { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""image_video""' of type '""unsigned int *[2]""'"); + } + } + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_image_video_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int **result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_image_video_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_image_video_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (unsigned int **)(unsigned int **) ((arg1)->image_video); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_unsigned_int, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_video_idx_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_video_idx_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_video_idx_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_video_idx_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->video_idx = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_video_idx_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_video_idx_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_video_idx_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->video_idx); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_videopaint_pos_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_videopaint_pos_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_videopaint_pos_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_videopaint_pos_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->videopaint_pos = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_videopaint_pos_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_videopaint_pos_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_videopaint_pos_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->videopaint_pos); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_videopaint_pressure_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_videopaint_pressure_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_videopaint_pressure_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_videopaint_pressure_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->videopaint_pressure = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_videopaint_pressure_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_videopaint_pressure_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_videopaint_pressure_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (float) ((arg1)->videopaint_pressure); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_brush_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Brush *arg2 = (Brush *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_brush_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_brush_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_brush_set" "', argument " "2"" of type '" "Brush *""'"); + } + arg2 = reinterpret_cast< Brush * >(argp2); + if (arg1) (arg1)->brush = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_brush_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Brush *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_brush_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_brush_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Brush *)& ((arg1)->brush); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Brush, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_lastpos_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_lastpos_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_lastpos_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_lastpos_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->lastpos = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_lastpos_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_lastpos_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_lastpos_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->lastpos); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_lastorgpos_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_lastorgpos_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_lastorgpos_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_lastorgpos_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->lastorgpos = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_lastorgpos_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_lastorgpos_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_lastorgpos_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->lastorgpos); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_lastpressure_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_lastpressure_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_lastpressure_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_lastpressure_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->lastpressure = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_lastpressure_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_lastpressure_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_lastpressure_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (float) ((arg1)->lastpressure); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_dirtymin_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_dirtymin_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_dirtymin_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_dirtymin_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->dirtymin = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_dirtymin_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_dirtymin_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_dirtymin_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->dirtymin); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_dirtymax_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_dirtymax_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_dirtymax_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_dirtymax_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->dirtymax = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_dirtymax_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_dirtymax_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_dirtymax_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->dirtymax); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_strokemin_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_strokemin_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_strokemin_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_strokemin_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->strokemin = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_strokemin_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_strokemin_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_strokemin_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->strokemin); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_strokemax_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_strokemax_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_strokemax_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_strokemax_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->strokemax = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_strokemax_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_strokemax_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_strokemax_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (Pos *)& ((arg1)->strokemax); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_stroke_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_stroke_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_stroke_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_stroke_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->stroke = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_stroke_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_stroke_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_stroke_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (bool) ((arg1)->stroke); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_idle_while_drawing_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_idle_while_drawing_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_idle_while_drawing_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_idle_while_drawing_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->idle_while_drawing = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_idle_while_drawing_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_idle_while_drawing_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_idle_while_drawing_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->idle_while_drawing); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_drawtype_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_drawtype_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_drawtype_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_drawtype_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->drawtype = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_drawtype_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_drawtype_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_drawtype_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->drawtype); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playing_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_playing_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playing_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_playing_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->playing = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playing_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playing_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playing_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (bool) ((arg1)->playing); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_playback_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_playback_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->playback = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playback_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->playback); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_speed_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_playback_speed_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_speed_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_playback_speed_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->playback_speed = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_speed_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playback_speed_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_speed_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int) ((arg1)->playback_speed); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_modified_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_modified_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_modified_set" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_modified_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->modified = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_modified_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_modified_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_modified_get" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (bool) ((arg1)->modified); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Canvas(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + int arg2 ; + Canvas *result = 0 ; + int val1 ; + int ecode1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:new_Canvas",&obj0,&obj1)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Canvas" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Canvas" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + result = (Canvas *)new Canvas(arg1,arg2); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Canvas, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Canvas(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Canvas",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Canvas" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_clear",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_clear" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->clear(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_resize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_resize",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_resize" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_resize" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_resize" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + (arg1)->resize(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_reset_brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_reset_brush",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_reset_brush" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->reset_brush(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_save_shared_image(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_save_shared_image",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_save_shared_image" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->save_shared_image(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_restore_shared_image(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_restore_shared_image",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_restore_shared_image" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->restore_shared_image(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_clear_image(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_clear_image",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_clear_image" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->clear_image(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_get_variable_brush_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + float arg2 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_get_variable_brush_size",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_get_variable_brush_size" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_get_variable_brush_size" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = (float)(arg1)->get_variable_brush_size(arg2); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_command_draw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = 0 ; + int arg3 ; + bool arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + bool val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Canvas_command_draw",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_command_draw" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_command_draw" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Canvas_command_draw" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_command_draw" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_bool(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_command_draw" "', argument " "4"" of type '" "bool""'"); + } + arg4 = static_cast< bool >(val4); + (arg1)->command_draw((Pos const &)*arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_command_enddraw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_command_enddraw",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_command_enddraw" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->command_enddraw(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_reset_dirty_rect(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_reset_dirty_rect",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_reset_dirty_rect" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->reset_dirty_rect(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_draw_brush(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + Pos *arg2 = 0 ; + int arg3 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Canvas_draw_brush",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_draw_brush" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_draw_brush" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Canvas_draw_brush" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_draw_brush" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_draw_brush" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + (arg1)->draw_brush((Pos const &)*arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_add_command(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + DrawCommand *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_add_command",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_add_command" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_DrawCommand, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_add_command" "', argument " "2"" of type '" "DrawCommand const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Canvas_add_command" "', argument " "2"" of type '" "DrawCommand const &""'"); + } + arg2 = reinterpret_cast< DrawCommand * >(argp2); + (arg1)->add_command((DrawCommand const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_play_command(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + DrawCommand *arg2 = 0 ; + bool arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + bool val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_play_command",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_play_command" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_DrawCommand, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_play_command" "', argument " "2"" of type '" "DrawCommand const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Canvas_play_command" "', argument " "2"" of type '" "DrawCommand const &""'"); + } + arg2 = reinterpret_cast< DrawCommand * >(argp2); + ecode3 = SWIG_AsVal_bool(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_play_command" "', argument " "3"" of type '" "bool""'"); + } + arg3 = static_cast< bool >(val3); + (arg1)->play_command((DrawCommand const &)*arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_done(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playback_done",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_done" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (bool)(arg1)->playback_done(); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playback_length",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_length" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int)(arg1)->playback_length(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_pos(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playback_pos",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_pos" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int)(arg1)->playback_pos(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_start_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_start_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_start_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->start_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_pause_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_pause_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_pause_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->pause_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_resume_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_resume_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_resume_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->resume_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_stop_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_stop_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_stop_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->stop_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_finish_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_finish_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_finish_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->finish_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_finish_stroke(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_playback_finish_stroke",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_finish_stroke" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->playback_finish_stroke(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_to(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_playback_to",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_to" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_playback_to" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + (arg1)->playback_to(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_step_to(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_playback_step_to",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_step_to" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_playback_step_to" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + (arg1)->playback_step_to(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_playback_to_timed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + float arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_playback_to_timed",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_playback_to_timed" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_playback_to_timed" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_playback_to_timed" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + (arg1)->playback_to_timed(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_set_playback_speed(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_set_playback_speed",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_set_playback_speed" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_set_playback_speed" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + (arg1)->set_playback_speed(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_truncate_at_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_truncate_at_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_truncate_at_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->truncate_at_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_update_playback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_update_playback",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_update_playback" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->update_playback(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_get_num_commands(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_get_num_commands",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_get_num_commands" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + result = (int)(arg1)->get_num_commands(); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_play_range(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_play_range",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_play_range" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_play_range" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_play_range" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + (arg1)->play_range(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_blit_2x(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + GdkImage *arg2 = (GdkImage *) 0 ; + int arg3 ; + int arg4 ; + int arg5 ; + int arg6 ; + bool arg7 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + int val6 ; + int ecode6 = 0 ; + bool val7 ; + int ecode7 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:Canvas_blit_2x",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_blit_2x" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GdkImage* img = (GdkImage*)pygo->obj; + arg2 = img; + } + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_blit_2x" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_blit_2x" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Canvas_blit_2x" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + ecode6 = SWIG_AsVal_int(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Canvas_blit_2x" "', argument " "6"" of type '" "int""'"); + } + arg6 = static_cast< int >(val6); + ecode7 = SWIG_AsVal_bool(obj6, &val7); + if (!SWIG_IsOK(ecode7)) { + SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "Canvas_blit_2x" "', argument " "7"" of type '" "bool""'"); + } + arg7 = static_cast< bool >(val7); + (arg1)->blit_2x(arg2,arg3,arg4,arg5,arg6,arg7); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_downsize_video(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + unsigned int *arg2 = (unsigned int *) 0 ; + GstBuffer *arg3 = (GstBuffer *) 0 ; + int arg4 ; + int arg5 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val4 ; + int ecode4 = 0 ; + int val5 ; + int ecode5 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOO:Canvas_downsize_video",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_downsize_video" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_unsigned_int, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_downsize_video" "', argument " "2"" of type '" "unsigned int *""'"); + } + arg2 = reinterpret_cast< unsigned int * >(argp2); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj2; + GstBuffer* buf = (GstBuffer*)pygo->obj; + arg3 = buf; + } + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_downsize_video" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + ecode5 = SWIG_AsVal_int(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Canvas_downsize_video" "', argument " "5"" of type '" "int""'"); + } + arg5 = static_cast< int >(val5); + (arg1)->downsize_video(arg2,arg3,arg4,arg5); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_videopaint_motion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + GstBuffer *arg2 = (GstBuffer *) 0 ; + int arg3 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Canvas_videopaint_motion",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_videopaint_motion" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GstBuffer* buf = (GstBuffer*)pygo->obj; + arg2 = buf; + } + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_videopaint_motion" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_videopaint_motion" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + (arg1)->videopaint_motion(arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_blit_videopaint(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + GdkImage *arg2 = (GdkImage *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_blit_videopaint",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_blit_videopaint" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GdkImage* img = (GdkImage*)pygo->obj; + arg2 = img; + } + (arg1)->blit_videopaint(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_set_reference_buffer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + GstBuffer *arg2 = (GstBuffer *) 0 ; + int arg3 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Canvas_set_reference_buffer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_set_reference_buffer" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GstBuffer* buf = (GstBuffer*)pygo->obj; + arg2 = buf; + } + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_set_reference_buffer" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_set_reference_buffer" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + (arg1)->set_reference_buffer(arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_render_reference_overlay(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_render_reference_overlay",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_render_reference_overlay" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->render_reference_overlay(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_render_overlay(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_render_overlay",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_render_overlay" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->render_overlay(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_clear_overlay(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Canvas_clear_overlay",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_clear_overlay" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + (arg1)->clear_overlay(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_upgrade_drw_header(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + DRW_Header *arg2 = (DRW_Header *) 0 ; + DRW_Command *arg3 = (DRW_Command *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_upgrade_drw_header",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_upgrade_drw_header" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_DRW_Header, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_upgrade_drw_header" "', argument " "2"" of type '" "DRW_Header *""'"); + } + arg2 = reinterpret_cast< DRW_Header * >(argp2); + res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_DRW_Command, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Canvas_upgrade_drw_header" "', argument " "3"" of type '" "DRW_Command *""'"); + } + arg3 = reinterpret_cast< DRW_Command * >(argp3); + (arg1)->upgrade_drw_header(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_load(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_load",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_load" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_load" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (bool)(arg1)->load((char const *)arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_save(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Canvas_save",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_save" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_save" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + result = (bool)(arg1)->save((char const *)arg2); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_convert_from_drw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + DRW_Command *arg2 = (DRW_Command *) 0 ; + int arg3 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Canvas_convert_from_drw",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_convert_from_drw" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_DRW_Command, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_convert_from_drw" "', argument " "2"" of type '" "DRW_Command *""'"); + } + arg2 = reinterpret_cast< DRW_Command * >(argp2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_convert_from_drw" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_convert_from_drw" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + (arg1)->convert_from_drw(arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_convert_to_drw(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + DRW_Command **arg2 = (DRW_Command **) 0 ; + int arg3 ; + int arg4 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Canvas_convert_to_drw",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_convert_to_drw" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_DRW_Command, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_convert_to_drw" "', argument " "2"" of type '" "DRW_Command **""'"); + } + arg2 = reinterpret_cast< DRW_Command ** >(argp2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_convert_to_drw" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Canvas_convert_to_drw" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + (arg1)->convert_to_drw(arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_send_drw_commands(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + int arg2 ; + int arg3 ; + DrawCommandBuffer result; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_send_drw_commands",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_send_drw_commands" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Canvas_send_drw_commands" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_send_drw_commands" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + result = (arg1)->send_drw_commands(arg2,arg3); + resultobj = SWIG_NewPointerObj((new DrawCommandBuffer(static_cast< const DrawCommandBuffer& >(result))), SWIGTYPE_p_DrawCommandBuffer, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Canvas_receive_drw_commands(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Canvas *arg1 = (Canvas *) 0 ; + DrawCommandBuffer *arg2 = 0 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Canvas_receive_drw_commands",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Canvas, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Canvas_receive_drw_commands" "', argument " "1"" of type '" "Canvas *""'"); + } + arg1 = reinterpret_cast< Canvas * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_DrawCommandBuffer, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Canvas_receive_drw_commands" "', argument " "2"" of type '" "DrawCommandBuffer const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Canvas_receive_drw_commands" "', argument " "2"" of type '" "DrawCommandBuffer const &""'"); + } + arg2 = reinterpret_cast< DrawCommandBuffer * >(argp2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Canvas_receive_drw_commands" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + (arg1)->receive_drw_commands((DrawCommandBuffer const &)*arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Canvas_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Canvas, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_Palette_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_size_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_size_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_size_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_size_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_palette_h_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_palette_h_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_palette_h_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_palette_h_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->palette_h = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_palette_h_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_palette_h_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_palette_h_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (float) ((arg1)->palette_h); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_palette_s_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_palette_s_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_palette_s_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_palette_s_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->palette_s = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_palette_s_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_palette_s_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_palette_s_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (float) ((arg1)->palette_s); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_palette_v_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_palette_v_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_palette_v_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_palette_v_set" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + if (arg1) (arg1)->palette_v = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_palette_v_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_palette_v_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_palette_v_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (float) ((arg1)->palette_v); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_triangle_cursor_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_triangle_cursor_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_triangle_cursor_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_triangle_cursor_set" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + if (arg1) (arg1)->triangle_cursor = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_triangle_cursor_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_triangle_cursor_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_triangle_cursor_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (Pos *)& ((arg1)->triangle_cursor); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Pos, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_triangle_capture_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_triangle_capture_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_triangle_capture_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_triangle_capture_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->triangle_capture = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_triangle_capture_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_triangle_capture_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_triangle_capture_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (bool) ((arg1)->triangle_capture); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_wheel_capture_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + bool arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + bool val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_wheel_capture_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_wheel_capture_set" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_bool(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_wheel_capture_set" "', argument " "2"" of type '" "bool""'"); + } + arg2 = static_cast< bool >(val2); + if (arg1) (arg1)->wheel_capture = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_wheel_capture_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + bool result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_wheel_capture_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_wheel_capture_get" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (bool) ((arg1)->wheel_capture); + resultobj = SWIG_From_bool(static_cast< bool >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_Palette(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + Palette *result = 0 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_Palette",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Palette" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (Palette *)new Palette(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Palette, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_get_wheel_radius(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_get_wheel_radius",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_get_wheel_radius" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (float)(arg1)->get_wheel_radius(); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_rgb_to_hsv(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float arg2 ; + float arg3 ; + float arg4 ; + float *arg5 = (float *) 0 ; + float *arg6 = (float *) 0 ; + float *arg7 = (float *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + float val3 ; + int ecode3 = 0 ; + float val4 ; + int ecode4 = 0 ; + void *argp5 = 0 ; + int res5 = 0 ; + void *argp6 = 0 ; + int res6 = 0 ; + void *argp7 = 0 ; + int res7 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:Palette_rgb_to_hsv",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_rgb_to_hsv" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_rgb_to_hsv" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + ecode3 = SWIG_AsVal_float(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Palette_rgb_to_hsv" "', argument " "3"" of type '" "float""'"); + } + arg3 = static_cast< float >(val3); + ecode4 = SWIG_AsVal_float(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Palette_rgb_to_hsv" "', argument " "4"" of type '" "float""'"); + } + arg4 = static_cast< float >(val4); + res5 = SWIG_ConvertPtr(obj4, &argp5,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "Palette_rgb_to_hsv" "', argument " "5"" of type '" "float *""'"); + } + arg5 = reinterpret_cast< float * >(argp5); + res6 = SWIG_ConvertPtr(obj5, &argp6,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "Palette_rgb_to_hsv" "', argument " "6"" of type '" "float *""'"); + } + arg6 = reinterpret_cast< float * >(argp6); + res7 = SWIG_ConvertPtr(obj6, &argp7,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res7)) { + SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Palette_rgb_to_hsv" "', argument " "7"" of type '" "float *""'"); + } + arg7 = reinterpret_cast< float * >(argp7); + (arg1)->rgb_to_hsv(arg2,arg3,arg4,arg5,arg6,arg7); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_hsv_to_rgb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float *arg2 = (float *) 0 ; + float *arg3 = (float *) 0 ; + float *arg4 = (float *) 0 ; + float arg5 ; + float arg6 ; + float arg7 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + void *argp4 = 0 ; + int res4 = 0 ; + float val5 ; + int ecode5 = 0 ; + float val6 ; + int ecode6 = 0 ; + float val7 ; + int ecode7 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; + PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:Palette_hsv_to_rgb",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_hsv_to_rgb" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_hsv_to_rgb" "', argument " "2"" of type '" "float *""'"); + } + arg2 = reinterpret_cast< float * >(argp2); + res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Palette_hsv_to_rgb" "', argument " "3"" of type '" "float *""'"); + } + arg3 = reinterpret_cast< float * >(argp3); + res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_float, 0 | 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Palette_hsv_to_rgb" "', argument " "4"" of type '" "float *""'"); + } + arg4 = reinterpret_cast< float * >(argp4); + ecode5 = SWIG_AsVal_float(obj4, &val5); + if (!SWIG_IsOK(ecode5)) { + SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Palette_hsv_to_rgb" "', argument " "5"" of type '" "float""'"); + } + arg5 = static_cast< float >(val5); + ecode6 = SWIG_AsVal_float(obj5, &val6); + if (!SWIG_IsOK(ecode6)) { + SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Palette_hsv_to_rgb" "', argument " "6"" of type '" "float""'"); + } + arg6 = static_cast< float >(val6); + ecode7 = SWIG_AsVal_float(obj6, &val7); + if (!SWIG_IsOK(ecode7)) { + SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "Palette_hsv_to_rgb" "', argument " "7"" of type '" "float""'"); + } + arg7 = static_cast< float >(val7); + (arg1)->hsv_to_rgb(arg2,arg3,arg4,arg5,arg6,arg7); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_set_color(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Color *arg2 = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_set_color",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_set_color" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Color, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_set_color" "', argument " "2"" of type '" "Color const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_set_color" "', argument " "2"" of type '" "Color const &""'"); + } + arg2 = reinterpret_cast< Color * >(argp2); + (arg1)->set_color((Color const &)*arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_get_color(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Color result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_get_color",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_get_color" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (arg1)->get_color(); + resultobj = SWIG_NewPointerObj((new Color(static_cast< const Color& >(result))), SWIGTYPE_p_Color, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_sqr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + float arg2 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + float val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_sqr",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_sqr" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_float(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_sqr" "', argument " "2"" of type '" "float""'"); + } + arg2 = static_cast< float >(val2); + result = (float)(arg1)->sqr(arg2); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_dot(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = 0 ; + Pos *arg3 = 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Palette_dot",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_dot" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_dot" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_dot" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Palette_dot" "', argument " "3"" of type '" "Pos const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_dot" "', argument " "3"" of type '" "Pos const &""'"); + } + arg3 = reinterpret_cast< Pos * >(argp3); + result = (float)(arg1)->dot((Pos const &)*arg2,(Pos const &)*arg3); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_length(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_length",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_length" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_length" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_length" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = (float)(arg1)->length((Pos const &)*arg2); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_length_sqr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_length_sqr",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_length_sqr" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_length_sqr" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_length_sqr" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = (float)(arg1)->length_sqr((Pos const &)*arg2); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = 0 ; + Pos *arg3 = 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Palette_distance",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_distance" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_distance" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_distance" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Palette_distance" "', argument " "3"" of type '" "Pos const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_distance" "', argument " "3"" of type '" "Pos const &""'"); + } + arg3 = reinterpret_cast< Pos * >(argp3); + result = (float)(arg1)->distance((Pos const &)*arg2,(Pos const &)*arg3); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_distance_sqr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = 0 ; + Pos *arg3 = 0 ; + float result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Palette_distance_sqr",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_distance_sqr" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_distance_sqr" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_distance_sqr" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Palette_distance_sqr" "', argument " "3"" of type '" "Pos const &""'"); + } + if (!argp3) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_distance_sqr" "', argument " "3"" of type '" "Pos const &""'"); + } + arg3 = reinterpret_cast< Pos * >(argp3); + result = (float)(arg1)->distance_sqr((Pos const &)*arg2,(Pos const &)*arg3); + resultobj = SWIG_From_float(static_cast< float >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_normalize(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_normalize",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_normalize" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Pos, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_normalize" "', argument " "2"" of type '" "Pos const &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Palette_normalize" "', argument " "2"" of type '" "Pos const &""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + result = (arg1)->normalize((Pos const &)*arg2); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_get_triangle_points(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos *arg2 = (Pos *) 0 ; + Pos *arg3 = (Pos *) 0 ; + Pos *arg4 = (Pos *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + void *argp3 = 0 ; + int res3 = 0 ; + void *argp4 = 0 ; + int res4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:Palette_get_triangle_points",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_get_triangle_points" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Palette_get_triangle_points" "', argument " "2"" of type '" "Pos *""'"); + } + arg2 = reinterpret_cast< Pos * >(argp2); + res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Palette_get_triangle_points" "', argument " "3"" of type '" "Pos *""'"); + } + arg3 = reinterpret_cast< Pos * >(argp3); + res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_Pos, 0 | 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Palette_get_triangle_points" "', argument " "4"" of type '" "Pos *""'"); + } + arg4 = reinterpret_cast< Pos * >(argp4); + (arg1)->get_triangle_points(arg2,arg3,arg4); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_render_wheel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + GdkImage *arg2 = (GdkImage *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_render_wheel",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_render_wheel" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GdkImage* img = (GdkImage*)pygo->obj; + arg2 = img; + } + (arg1)->render_wheel(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_render_triangle(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + GdkImage *arg2 = (GdkImage *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Palette_render_triangle",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_render_triangle" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GdkImage* img = (GdkImage*)pygo->obj; + arg2 = img; + } + (arg1)->render_triangle(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_get_wheel_pos(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_get_wheel_pos",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_get_wheel_pos" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (arg1)->get_wheel_pos(); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_get_triangle_pos(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + Pos result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_get_triangle_pos",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_get_triangle_pos" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + result = (arg1)->get_triangle_pos(); + resultobj = SWIG_NewPointerObj((new Pos(static_cast< const Pos& >(result))), SWIGTYPE_p_Pos, SWIG_POINTER_OWN | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_process_mouse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + int arg2 ; + int arg3 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Palette_process_mouse",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_process_mouse" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Palette_process_mouse" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Palette_process_mouse" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + (arg1)->process_mouse(arg2,arg3); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Palette_process_mouse_release(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Palette_process_mouse_release",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Palette_process_mouse_release" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + (arg1)->process_mouse_release(); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_Palette(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Palette *arg1 = (Palette *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_Palette",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Palette, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Palette" "', argument " "1"" of type '" "Palette *""'"); + } + arg1 = reinterpret_cast< Palette * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *Palette_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_Palette, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +SWIGINTERN PyObject *_wrap_BrushPreview_size_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushPreview *arg1 = (BrushPreview *) 0 ; + int arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + int val2 ; + int ecode2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:BrushPreview_size_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushPreview, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushPreview_size_set" "', argument " "1"" of type '" "BrushPreview *""'"); + } + arg1 = reinterpret_cast< BrushPreview * >(argp1); + ecode2 = SWIG_AsVal_int(obj1, &val2); + if (!SWIG_IsOK(ecode2)) { + SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "BrushPreview_size_set" "', argument " "2"" of type '" "int""'"); + } + arg2 = static_cast< int >(val2); + if (arg1) (arg1)->size = arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushPreview_size_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushPreview *arg1 = (BrushPreview *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:BrushPreview_size_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushPreview, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushPreview_size_get" "', argument " "1"" of type '" "BrushPreview *""'"); + } + arg1 = reinterpret_cast< BrushPreview * >(argp1); + result = (int) ((arg1)->size); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushPreview_brush_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushPreview *arg1 = (BrushPreview *) 0 ; + Brush *arg2 = (Brush *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:BrushPreview_brush_set",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushPreview, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushPreview_brush_set" "', argument " "1"" of type '" "BrushPreview *""'"); + } + arg1 = reinterpret_cast< BrushPreview * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Brush, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "BrushPreview_brush_set" "', argument " "2"" of type '" "Brush *""'"); + } + arg2 = reinterpret_cast< Brush * >(argp2); + if (arg1) (arg1)->brush = *arg2; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushPreview_brush_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushPreview *arg1 = (BrushPreview *) 0 ; + Brush *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:BrushPreview_brush_get",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushPreview, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushPreview_brush_get" "', argument " "1"" of type '" "BrushPreview *""'"); + } + arg1 = reinterpret_cast< BrushPreview * >(argp1); + result = (Brush *)& ((arg1)->brush); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Brush, 0 | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_new_BrushPreview(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + int arg1 ; + BrushPreview *result = 0 ; + int val1 ; + int ecode1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:new_BrushPreview",&obj0)) SWIG_fail; + ecode1 = SWIG_AsVal_int(obj0, &val1); + if (!SWIG_IsOK(ecode1)) { + SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_BrushPreview" "', argument " "1"" of type '" "int""'"); + } + arg1 = static_cast< int >(val1); + result = (BrushPreview *)new BrushPreview(arg1); + resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_BrushPreview, SWIG_POINTER_NEW | 0 ); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_BrushPreview_render(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushPreview *arg1 = (BrushPreview *) 0 ; + GdkImage *arg2 = (GdkImage *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:BrushPreview_render",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushPreview, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BrushPreview_render" "', argument " "1"" of type '" "BrushPreview *""'"); + } + arg1 = reinterpret_cast< BrushPreview * >(argp1); + { + // todo- Error checking would be nice. + PyGObject* pygo = (PyGObject*)obj1; + GdkImage* img = (GdkImage*)pygo->obj; + arg2 = img; + } + (arg1)->render(arg2); + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_delete_BrushPreview(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + BrushPreview *arg1 = (BrushPreview *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:delete_BrushPreview",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_BrushPreview, SWIG_POINTER_DISOWN | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_BrushPreview" "', argument " "1"" of type '" "BrushPreview *""'"); + } + arg1 = reinterpret_cast< BrushPreview * >(argp1); + delete arg1; + + resultobj = SWIG_Py_Void(); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *BrushPreview_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *obj; + if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + SWIG_TypeNewClientData(SWIGTYPE_p_BrushPreview, SWIG_NewClientData(obj)); + return SWIG_Py_Void(); +} + +static PyMethodDef SwigMethods[] = { + { (char *)"sgn", _wrap_sgn, METH_VARARGS, NULL}, + { (char *)"sqr", _wrap_sqr, METH_VARARGS, NULL}, + { (char *)"clamp", _wrap_clamp, METH_VARARGS, NULL}, + { (char *)"to_rad", _wrap_to_rad, METH_VARARGS, NULL}, + { (char *)"to_deg", _wrap_to_deg, METH_VARARGS, NULL}, + { (char *)"map_range", _wrap_map_range, METH_VARARGS, NULL}, + { (char *)"fixed_scale", _wrap_fixed_scale, METH_VARARGS, NULL}, + { (char *)"endian_swap", _wrap_endian_swap, METH_VARARGS, NULL}, + { (char *)"Pos_x_set", _wrap_Pos_x_set, METH_VARARGS, NULL}, + { (char *)"Pos_x_get", _wrap_Pos_x_get, METH_VARARGS, NULL}, + { (char *)"Pos_y_set", _wrap_Pos_y_set, METH_VARARGS, NULL}, + { (char *)"Pos_y_get", _wrap_Pos_y_get, METH_VARARGS, NULL}, + { (char *)"new_Pos", _wrap_new_Pos, METH_VARARGS, NULL}, + { (char *)"Pos___add__", _wrap_Pos___add__, METH_VARARGS, NULL}, + { (char *)"Pos___sub__", _wrap_Pos___sub__, METH_VARARGS, NULL}, + { (char *)"Pos___mul__", _wrap_Pos___mul__, METH_VARARGS, NULL}, + { (char *)"Pos___div__", _wrap_Pos___div__, METH_VARARGS, NULL}, + { (char *)"Pos_create_from_min", _wrap_Pos_create_from_min, METH_VARARGS, NULL}, + { (char *)"Pos_create_from_max", _wrap_Pos_create_from_max, METH_VARARGS, NULL}, + { (char *)"Pos_create_from_angle", _wrap_Pos_create_from_angle, METH_VARARGS, NULL}, + { (char *)"Pos_create_from_rotation", _wrap_Pos_create_from_rotation, METH_VARARGS, NULL}, + { (char *)"delete_Pos", _wrap_delete_Pos, METH_VARARGS, NULL}, + { (char *)"Pos_swigregister", Pos_swigregister, METH_VARARGS, NULL}, + { (char *)"Color_r_set", _wrap_Color_r_set, METH_VARARGS, NULL}, + { (char *)"Color_r_get", _wrap_Color_r_get, METH_VARARGS, NULL}, + { (char *)"Color_g_set", _wrap_Color_g_set, METH_VARARGS, NULL}, + { (char *)"Color_g_get", _wrap_Color_g_get, METH_VARARGS, NULL}, + { (char *)"Color_b_set", _wrap_Color_b_set, METH_VARARGS, NULL}, + { (char *)"Color_b_get", _wrap_Color_b_get, METH_VARARGS, NULL}, + { (char *)"Color_a_set", _wrap_Color_a_set, METH_VARARGS, NULL}, + { (char *)"Color_a_get", _wrap_Color_a_get, METH_VARARGS, NULL}, + { (char *)"new_Color", _wrap_new_Color, METH_VARARGS, NULL}, + { (char *)"Color_get_a8r8g8b8", _wrap_Color_get_a8r8g8b8, METH_VARARGS, NULL}, + { (char *)"Color_create_from_a8r8g8b8", _wrap_Color_create_from_a8r8g8b8, METH_VARARGS, NULL}, + { (char *)"Color_get_a8b8g8r8", _wrap_Color_get_a8b8g8r8, METH_VARARGS, NULL}, + { (char *)"Color_create_from_a8b8g8r8", _wrap_Color_create_from_a8b8g8r8, METH_VARARGS, NULL}, + { (char *)"Color_get_r5g6b5", _wrap_Color_get_r5g6b5, METH_VARARGS, NULL}, + { (char *)"Color_create_from_r5g6b5", _wrap_Color_create_from_r5g6b5, METH_VARARGS, NULL}, + { (char *)"Color_get_b5g6r5", _wrap_Color_get_b5g6r5, METH_VARARGS, NULL}, + { (char *)"Color_create_from_float", _wrap_Color_create_from_float, METH_VARARGS, NULL}, + { (char *)"Color_create_from_blend", _wrap_Color_create_from_blend, METH_VARARGS, NULL}, + { (char *)"Color_create_from_lerp", _wrap_Color_create_from_lerp, METH_VARARGS, NULL}, + { (char *)"Color_create_from_yuv", _wrap_Color_create_from_yuv, METH_VARARGS, NULL}, + { (char *)"Color_yuv_to_hsv", _wrap_Color_yuv_to_hsv, METH_VARARGS, NULL}, + { (char *)"delete_Color", _wrap_delete_Color, METH_VARARGS, NULL}, + { (char *)"Color_swigregister", Color_swigregister, METH_VARARGS, NULL}, + { (char *)"ByteBuffer_size_set", _wrap_ByteBuffer_size_set, METH_VARARGS, NULL}, + { (char *)"ByteBuffer_size_get", _wrap_ByteBuffer_size_get, METH_VARARGS, NULL}, + { (char *)"ByteBuffer_data_set", _wrap_ByteBuffer_data_set, METH_VARARGS, NULL}, + { (char *)"ByteBuffer_data_get", _wrap_ByteBuffer_data_get, METH_VARARGS, NULL}, + { (char *)"new_ByteBuffer", _wrap_new_ByteBuffer, METH_VARARGS, NULL}, + { (char *)"delete_ByteBuffer", _wrap_delete_ByteBuffer, METH_VARARGS, NULL}, + { (char *)"ByteBuffer_swigregister", ByteBuffer_swigregister, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_width_set", _wrap_SurfaceA8R8G8B8_width_set, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_width_get", _wrap_SurfaceA8R8G8B8_width_get, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_height_set", _wrap_SurfaceA8R8G8B8_height_set, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_height_get", _wrap_SurfaceA8R8G8B8_height_get, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_stride_set", _wrap_SurfaceA8R8G8B8_stride_set, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_stride_get", _wrap_SurfaceA8R8G8B8_stride_get, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_pixels_set", _wrap_SurfaceA8R8G8B8_pixels_set, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_pixels_get", _wrap_SurfaceA8R8G8B8_pixels_get, METH_VARARGS, NULL}, + { (char *)"new_SurfaceA8R8G8B8", _wrap_new_SurfaceA8R8G8B8, METH_VARARGS, NULL}, + { (char *)"delete_SurfaceA8R8G8B8", _wrap_delete_SurfaceA8R8G8B8, METH_VARARGS, NULL}, + { (char *)"SurfaceA8R8G8B8_swigregister", SurfaceA8R8G8B8_swigregister, METH_VARARGS, NULL}, + { (char *)"new_DrawCommandBuffer", _wrap_new_DrawCommandBuffer, METH_VARARGS, NULL}, + { (char *)"delete_DrawCommandBuffer", _wrap_delete_DrawCommandBuffer, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_append", _wrap_DrawCommandBuffer_append, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_clear", _wrap_DrawCommandBuffer_clear, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_get_bytes", _wrap_DrawCommandBuffer_get_bytes, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_cmds_set", _wrap_DrawCommandBuffer_cmds_set, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_cmds_get", _wrap_DrawCommandBuffer_cmds_get, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_ncommands_set", _wrap_DrawCommandBuffer_ncommands_set, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_ncommands_get", _wrap_DrawCommandBuffer_ncommands_get, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_create_from_string", _wrap_DrawCommandBuffer_create_from_string, METH_VARARGS, NULL}, + { (char *)"DrawCommandBuffer_swigregister", DrawCommandBuffer_swigregister, METH_VARARGS, NULL}, + { (char *)"DrawCommand_type_set", _wrap_DrawCommand_type_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_type_get", _wrap_DrawCommand_type_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_pos_set", _wrap_DrawCommand_pos_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_pos_get", _wrap_DrawCommand_pos_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_color_set", _wrap_DrawCommand_color_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_color_get", _wrap_DrawCommand_color_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_pressure_set", _wrap_DrawCommand_pressure_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_pressure_get", _wrap_DrawCommand_pressure_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_flipx_set", _wrap_DrawCommand_flipx_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_flipx_get", _wrap_DrawCommand_flipx_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_flipy_set", _wrap_DrawCommand_flipy_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_flipy_get", _wrap_DrawCommand_flipy_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_is_text_set", _wrap_DrawCommand_is_text_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_is_text_get", _wrap_DrawCommand_is_text_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_text_set", _wrap_DrawCommand_text_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_text_get", _wrap_DrawCommand_text_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_brush_control_set", _wrap_DrawCommand_brush_control_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_brush_control_get", _wrap_DrawCommand_brush_control_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_brush_type_set", _wrap_DrawCommand_brush_type_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_brush_type_get", _wrap_DrawCommand_brush_type_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_size_set", _wrap_DrawCommand_size_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_size_get", _wrap_DrawCommand_size_get, METH_VARARGS, NULL}, + { (char *)"DrawCommand_opacity_set", _wrap_DrawCommand_opacity_set, METH_VARARGS, NULL}, + { (char *)"DrawCommand_opacity_get", _wrap_DrawCommand_opacity_get, METH_VARARGS, NULL}, + { (char *)"new_DrawCommand", _wrap_new_DrawCommand, METH_VARARGS, NULL}, + { (char *)"DrawCommand_create_color_change", _wrap_DrawCommand_create_color_change, METH_VARARGS, NULL}, + { (char *)"DrawCommand_create_draw", _wrap_DrawCommand_create_draw, METH_VARARGS, NULL}, + { (char *)"DrawCommand_create_end_draw", _wrap_DrawCommand_create_end_draw, METH_VARARGS, NULL}, + { (char *)"DrawCommand_create_size_change", _wrap_DrawCommand_create_size_change, METH_VARARGS, NULL}, + { (char *)"DrawCommand_create_flip", _wrap_DrawCommand_create_flip, METH_VARARGS, NULL}, + { (char *)"delete_DrawCommand", _wrap_delete_DrawCommand, METH_VARARGS, NULL}, + { (char *)"DrawCommand_swigregister", DrawCommand_swigregister, METH_VARARGS, NULL}, + { (char *)"BrushType_distance_tbl_get", _wrap_BrushType_distance_tbl_get, METH_VARARGS, NULL}, + { (char *)"BrushType_distance_tbl_set", _wrap_BrushType_distance_tbl_set, METH_VARARGS, NULL}, + { (char *)"BrushType_intensity_tbl_set", _wrap_BrushType_intensity_tbl_set, METH_VARARGS, NULL}, + { (char *)"BrushType_intensity_tbl_get", _wrap_BrushType_intensity_tbl_get, METH_VARARGS, NULL}, + { (char *)"BrushType_create_distance_table", _wrap_BrushType_create_distance_table, METH_VARARGS, NULL}, + { (char *)"BrushType_smooth_step", _wrap_BrushType_smooth_step, METH_VARARGS, NULL}, + { (char *)"BrushType_create_brush", _wrap_BrushType_create_brush, METH_VARARGS, NULL}, + { (char *)"BrushType_create_hard_brush", _wrap_BrushType_create_hard_brush, METH_VARARGS, NULL}, + { (char *)"BrushType_create_soft_brush", _wrap_BrushType_create_soft_brush, METH_VARARGS, NULL}, + { (char *)"BrushType_create_cursor", _wrap_BrushType_create_cursor, METH_VARARGS, NULL}, + { (char *)"new_BrushType", _wrap_new_BrushType, METH_VARARGS, NULL}, + { (char *)"delete_BrushType", _wrap_delete_BrushType, METH_VARARGS, NULL}, + { (char *)"BrushType_swigregister", BrushType_swigregister, METH_VARARGS, NULL}, + { (char *)"Brush_brush_type_get", _wrap_Brush_brush_type_get, METH_VARARGS, NULL}, + { (char *)"Brush_brush_type_set", _wrap_Brush_brush_type_set, METH_VARARGS, NULL}, + { (char *)"Brush_color_set", _wrap_Brush_color_set, METH_VARARGS, NULL}, + { (char *)"Brush_color_get", _wrap_Brush_color_get, METH_VARARGS, NULL}, + { (char *)"Brush_type_set", _wrap_Brush_type_set, METH_VARARGS, NULL}, + { (char *)"Brush_type_get", _wrap_Brush_type_get, METH_VARARGS, NULL}, + { (char *)"Brush_size_set", _wrap_Brush_size_set, METH_VARARGS, NULL}, + { (char *)"Brush_size_get", _wrap_Brush_size_get, METH_VARARGS, NULL}, + { (char *)"Brush_control_set", _wrap_Brush_control_set, METH_VARARGS, NULL}, + { (char *)"Brush_control_get", _wrap_Brush_control_get, METH_VARARGS, NULL}, + { (char *)"Brush_opacity_set", _wrap_Brush_opacity_set, METH_VARARGS, NULL}, + { (char *)"Brush_opacity_get", _wrap_Brush_opacity_get, METH_VARARGS, NULL}, + { (char *)"new_Brush", _wrap_new_Brush, METH_VARARGS, NULL}, + { (char *)"delete_Brush", _wrap_delete_Brush, METH_VARARGS, NULL}, + { (char *)"Brush_swigregister", Brush_swigregister, METH_VARARGS, NULL}, + { (char *)"Canvas_commands_set", _wrap_Canvas_commands_set, METH_VARARGS, NULL}, + { (char *)"Canvas_commands_get", _wrap_Canvas_commands_get, METH_VARARGS, NULL}, + { (char *)"Canvas_width_set", _wrap_Canvas_width_set, METH_VARARGS, NULL}, + { (char *)"Canvas_width_get", _wrap_Canvas_width_get, METH_VARARGS, NULL}, + { (char *)"Canvas_height_set", _wrap_Canvas_height_set, METH_VARARGS, NULL}, + { (char *)"Canvas_height_get", _wrap_Canvas_height_get, METH_VARARGS, NULL}, + { (char *)"Canvas_image_set", _wrap_Canvas_image_set, METH_VARARGS, NULL}, + { (char *)"Canvas_image_get", _wrap_Canvas_image_get, METH_VARARGS, NULL}, + { (char *)"Canvas_image_backup_set", _wrap_Canvas_image_backup_set, METH_VARARGS, NULL}, + { (char *)"Canvas_image_backup_get", _wrap_Canvas_image_backup_get, METH_VARARGS, NULL}, + { (char *)"Canvas_alpha_set", _wrap_Canvas_alpha_set, METH_VARARGS, NULL}, + { (char *)"Canvas_alpha_get", _wrap_Canvas_alpha_get, METH_VARARGS, NULL}, + { (char *)"Canvas_image_shared_set", _wrap_Canvas_image_shared_set, METH_VARARGS, NULL}, + { (char *)"Canvas_image_shared_get", _wrap_Canvas_image_shared_get, METH_VARARGS, NULL}, + { (char *)"Canvas_image_reference_set", _wrap_Canvas_image_reference_set, METH_VARARGS, NULL}, + { (char *)"Canvas_image_reference_get", _wrap_Canvas_image_reference_get, METH_VARARGS, NULL}, + { (char *)"Canvas_image_video_set", _wrap_Canvas_image_video_set, METH_VARARGS, NULL}, + { (char *)"Canvas_image_video_get", _wrap_Canvas_image_video_get, METH_VARARGS, NULL}, + { (char *)"Canvas_video_idx_set", _wrap_Canvas_video_idx_set, METH_VARARGS, NULL}, + { (char *)"Canvas_video_idx_get", _wrap_Canvas_video_idx_get, METH_VARARGS, NULL}, + { (char *)"Canvas_videopaint_pos_set", _wrap_Canvas_videopaint_pos_set, METH_VARARGS, NULL}, + { (char *)"Canvas_videopaint_pos_get", _wrap_Canvas_videopaint_pos_get, METH_VARARGS, NULL}, + { (char *)"Canvas_videopaint_pressure_set", _wrap_Canvas_videopaint_pressure_set, METH_VARARGS, NULL}, + { (char *)"Canvas_videopaint_pressure_get", _wrap_Canvas_videopaint_pressure_get, METH_VARARGS, NULL}, + { (char *)"Canvas_brush_set", _wrap_Canvas_brush_set, METH_VARARGS, NULL}, + { (char *)"Canvas_brush_get", _wrap_Canvas_brush_get, METH_VARARGS, NULL}, + { (char *)"Canvas_lastpos_set", _wrap_Canvas_lastpos_set, METH_VARARGS, NULL}, + { (char *)"Canvas_lastpos_get", _wrap_Canvas_lastpos_get, METH_VARARGS, NULL}, + { (char *)"Canvas_lastorgpos_set", _wrap_Canvas_lastorgpos_set, METH_VARARGS, NULL}, + { (char *)"Canvas_lastorgpos_get", _wrap_Canvas_lastorgpos_get, METH_VARARGS, NULL}, + { (char *)"Canvas_lastpressure_set", _wrap_Canvas_lastpressure_set, METH_VARARGS, NULL}, + { (char *)"Canvas_lastpressure_get", _wrap_Canvas_lastpressure_get, METH_VARARGS, NULL}, + { (char *)"Canvas_dirtymin_set", _wrap_Canvas_dirtymin_set, METH_VARARGS, NULL}, + { (char *)"Canvas_dirtymin_get", _wrap_Canvas_dirtymin_get, METH_VARARGS, NULL}, + { (char *)"Canvas_dirtymax_set", _wrap_Canvas_dirtymax_set, METH_VARARGS, NULL}, + { (char *)"Canvas_dirtymax_get", _wrap_Canvas_dirtymax_get, METH_VARARGS, NULL}, + { (char *)"Canvas_strokemin_set", _wrap_Canvas_strokemin_set, METH_VARARGS, NULL}, + { (char *)"Canvas_strokemin_get", _wrap_Canvas_strokemin_get, METH_VARARGS, NULL}, + { (char *)"Canvas_strokemax_set", _wrap_Canvas_strokemax_set, METH_VARARGS, NULL}, + { (char *)"Canvas_strokemax_get", _wrap_Canvas_strokemax_get, METH_VARARGS, NULL}, + { (char *)"Canvas_stroke_set", _wrap_Canvas_stroke_set, METH_VARARGS, NULL}, + { (char *)"Canvas_stroke_get", _wrap_Canvas_stroke_get, METH_VARARGS, NULL}, + { (char *)"Canvas_idle_while_drawing_set", _wrap_Canvas_idle_while_drawing_set, METH_VARARGS, NULL}, + { (char *)"Canvas_idle_while_drawing_get", _wrap_Canvas_idle_while_drawing_get, METH_VARARGS, NULL}, + { (char *)"Canvas_drawtype_set", _wrap_Canvas_drawtype_set, METH_VARARGS, NULL}, + { (char *)"Canvas_drawtype_get", _wrap_Canvas_drawtype_get, METH_VARARGS, NULL}, + { (char *)"Canvas_playing_set", _wrap_Canvas_playing_set, METH_VARARGS, NULL}, + { (char *)"Canvas_playing_get", _wrap_Canvas_playing_get, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_set", _wrap_Canvas_playback_set, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_get", _wrap_Canvas_playback_get, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_speed_set", _wrap_Canvas_playback_speed_set, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_speed_get", _wrap_Canvas_playback_speed_get, METH_VARARGS, NULL}, + { (char *)"Canvas_modified_set", _wrap_Canvas_modified_set, METH_VARARGS, NULL}, + { (char *)"Canvas_modified_get", _wrap_Canvas_modified_get, METH_VARARGS, NULL}, + { (char *)"new_Canvas", _wrap_new_Canvas, METH_VARARGS, NULL}, + { (char *)"delete_Canvas", _wrap_delete_Canvas, METH_VARARGS, NULL}, + { (char *)"Canvas_clear", _wrap_Canvas_clear, METH_VARARGS, NULL}, + { (char *)"Canvas_resize", _wrap_Canvas_resize, METH_VARARGS, NULL}, + { (char *)"Canvas_reset_brush", _wrap_Canvas_reset_brush, METH_VARARGS, NULL}, + { (char *)"Canvas_save_shared_image", _wrap_Canvas_save_shared_image, METH_VARARGS, NULL}, + { (char *)"Canvas_restore_shared_image", _wrap_Canvas_restore_shared_image, METH_VARARGS, NULL}, + { (char *)"Canvas_clear_image", _wrap_Canvas_clear_image, METH_VARARGS, NULL}, + { (char *)"Canvas_get_variable_brush_size", _wrap_Canvas_get_variable_brush_size, METH_VARARGS, NULL}, + { (char *)"Canvas_command_draw", _wrap_Canvas_command_draw, METH_VARARGS, NULL}, + { (char *)"Canvas_command_enddraw", _wrap_Canvas_command_enddraw, METH_VARARGS, NULL}, + { (char *)"Canvas_reset_dirty_rect", _wrap_Canvas_reset_dirty_rect, METH_VARARGS, NULL}, + { (char *)"Canvas_draw_brush", _wrap_Canvas_draw_brush, METH_VARARGS, NULL}, + { (char *)"Canvas_add_command", _wrap_Canvas_add_command, METH_VARARGS, NULL}, + { (char *)"Canvas_play_command", _wrap_Canvas_play_command, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_done", _wrap_Canvas_playback_done, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_length", _wrap_Canvas_playback_length, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_pos", _wrap_Canvas_playback_pos, METH_VARARGS, NULL}, + { (char *)"Canvas_start_playback", _wrap_Canvas_start_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_pause_playback", _wrap_Canvas_pause_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_resume_playback", _wrap_Canvas_resume_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_stop_playback", _wrap_Canvas_stop_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_finish_playback", _wrap_Canvas_finish_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_finish_stroke", _wrap_Canvas_playback_finish_stroke, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_to", _wrap_Canvas_playback_to, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_step_to", _wrap_Canvas_playback_step_to, METH_VARARGS, NULL}, + { (char *)"Canvas_playback_to_timed", _wrap_Canvas_playback_to_timed, METH_VARARGS, NULL}, + { (char *)"Canvas_set_playback_speed", _wrap_Canvas_set_playback_speed, METH_VARARGS, NULL}, + { (char *)"Canvas_truncate_at_playback", _wrap_Canvas_truncate_at_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_update_playback", _wrap_Canvas_update_playback, METH_VARARGS, NULL}, + { (char *)"Canvas_get_num_commands", _wrap_Canvas_get_num_commands, METH_VARARGS, NULL}, + { (char *)"Canvas_play_range", _wrap_Canvas_play_range, METH_VARARGS, NULL}, + { (char *)"Canvas_blit_2x", _wrap_Canvas_blit_2x, METH_VARARGS, NULL}, + { (char *)"Canvas_downsize_video", _wrap_Canvas_downsize_video, METH_VARARGS, NULL}, + { (char *)"Canvas_videopaint_motion", _wrap_Canvas_videopaint_motion, METH_VARARGS, NULL}, + { (char *)"Canvas_blit_videopaint", _wrap_Canvas_blit_videopaint, METH_VARARGS, NULL}, + { (char *)"Canvas_set_reference_buffer", _wrap_Canvas_set_reference_buffer, METH_VARARGS, NULL}, + { (char *)"Canvas_render_reference_overlay", _wrap_Canvas_render_reference_overlay, METH_VARARGS, NULL}, + { (char *)"Canvas_render_overlay", _wrap_Canvas_render_overlay, METH_VARARGS, NULL}, + { (char *)"Canvas_clear_overlay", _wrap_Canvas_clear_overlay, METH_VARARGS, NULL}, + { (char *)"Canvas_upgrade_drw_header", _wrap_Canvas_upgrade_drw_header, METH_VARARGS, NULL}, + { (char *)"Canvas_load", _wrap_Canvas_load, METH_VARARGS, NULL}, + { (char *)"Canvas_save", _wrap_Canvas_save, METH_VARARGS, NULL}, + { (char *)"Canvas_convert_from_drw", _wrap_Canvas_convert_from_drw, METH_VARARGS, NULL}, + { (char *)"Canvas_convert_to_drw", _wrap_Canvas_convert_to_drw, METH_VARARGS, NULL}, + { (char *)"Canvas_send_drw_commands", _wrap_Canvas_send_drw_commands, METH_VARARGS, NULL}, + { (char *)"Canvas_receive_drw_commands", _wrap_Canvas_receive_drw_commands, METH_VARARGS, NULL}, + { (char *)"Canvas_swigregister", Canvas_swigregister, METH_VARARGS, NULL}, + { (char *)"Palette_size_set", _wrap_Palette_size_set, METH_VARARGS, NULL}, + { (char *)"Palette_size_get", _wrap_Palette_size_get, METH_VARARGS, NULL}, + { (char *)"Palette_palette_h_set", _wrap_Palette_palette_h_set, METH_VARARGS, NULL}, + { (char *)"Palette_palette_h_get", _wrap_Palette_palette_h_get, METH_VARARGS, NULL}, + { (char *)"Palette_palette_s_set", _wrap_Palette_palette_s_set, METH_VARARGS, NULL}, + { (char *)"Palette_palette_s_get", _wrap_Palette_palette_s_get, METH_VARARGS, NULL}, + { (char *)"Palette_palette_v_set", _wrap_Palette_palette_v_set, METH_VARARGS, NULL}, + { (char *)"Palette_palette_v_get", _wrap_Palette_palette_v_get, METH_VARARGS, NULL}, + { (char *)"Palette_triangle_cursor_set", _wrap_Palette_triangle_cursor_set, METH_VARARGS, NULL}, + { (char *)"Palette_triangle_cursor_get", _wrap_Palette_triangle_cursor_get, METH_VARARGS, NULL}, + { (char *)"Palette_triangle_capture_set", _wrap_Palette_triangle_capture_set, METH_VARARGS, NULL}, + { (char *)"Palette_triangle_capture_get", _wrap_Palette_triangle_capture_get, METH_VARARGS, NULL}, + { (char *)"Palette_wheel_capture_set", _wrap_Palette_wheel_capture_set, METH_VARARGS, NULL}, + { (char *)"Palette_wheel_capture_get", _wrap_Palette_wheel_capture_get, METH_VARARGS, NULL}, + { (char *)"new_Palette", _wrap_new_Palette, METH_VARARGS, NULL}, + { (char *)"Palette_get_wheel_radius", _wrap_Palette_get_wheel_radius, METH_VARARGS, NULL}, + { (char *)"Palette_rgb_to_hsv", _wrap_Palette_rgb_to_hsv, METH_VARARGS, NULL}, + { (char *)"Palette_hsv_to_rgb", _wrap_Palette_hsv_to_rgb, METH_VARARGS, NULL}, + { (char *)"Palette_set_color", _wrap_Palette_set_color, METH_VARARGS, NULL}, + { (char *)"Palette_get_color", _wrap_Palette_get_color, METH_VARARGS, NULL}, + { (char *)"Palette_sqr", _wrap_Palette_sqr, METH_VARARGS, NULL}, + { (char *)"Palette_dot", _wrap_Palette_dot, METH_VARARGS, NULL}, + { (char *)"Palette_length", _wrap_Palette_length, METH_VARARGS, NULL}, + { (char *)"Palette_length_sqr", _wrap_Palette_length_sqr, METH_VARARGS, NULL}, + { (char *)"Palette_distance", _wrap_Palette_distance, METH_VARARGS, NULL}, + { (char *)"Palette_distance_sqr", _wrap_Palette_distance_sqr, METH_VARARGS, NULL}, + { (char *)"Palette_normalize", _wrap_Palette_normalize, METH_VARARGS, NULL}, + { (char *)"Palette_get_triangle_points", _wrap_Palette_get_triangle_points, METH_VARARGS, NULL}, + { (char *)"Palette_render_wheel", _wrap_Palette_render_wheel, METH_VARARGS, NULL}, + { (char *)"Palette_render_triangle", _wrap_Palette_render_triangle, METH_VARARGS, NULL}, + { (char *)"Palette_get_wheel_pos", _wrap_Palette_get_wheel_pos, METH_VARARGS, NULL}, + { (char *)"Palette_get_triangle_pos", _wrap_Palette_get_triangle_pos, METH_VARARGS, NULL}, + { (char *)"Palette_process_mouse", _wrap_Palette_process_mouse, METH_VARARGS, NULL}, + { (char *)"Palette_process_mouse_release", _wrap_Palette_process_mouse_release, METH_VARARGS, NULL}, + { (char *)"delete_Palette", _wrap_delete_Palette, METH_VARARGS, NULL}, + { (char *)"Palette_swigregister", Palette_swigregister, METH_VARARGS, NULL}, + { (char *)"BrushPreview_size_set", _wrap_BrushPreview_size_set, METH_VARARGS, NULL}, + { (char *)"BrushPreview_size_get", _wrap_BrushPreview_size_get, METH_VARARGS, NULL}, + { (char *)"BrushPreview_brush_set", _wrap_BrushPreview_brush_set, METH_VARARGS, NULL}, + { (char *)"BrushPreview_brush_get", _wrap_BrushPreview_brush_get, METH_VARARGS, NULL}, + { (char *)"new_BrushPreview", _wrap_new_BrushPreview, METH_VARARGS, NULL}, + { (char *)"BrushPreview_render", _wrap_BrushPreview_render, METH_VARARGS, NULL}, + { (char *)"delete_BrushPreview", _wrap_delete_BrushPreview, METH_VARARGS, NULL}, + { (char *)"BrushPreview_swigregister", BrushPreview_swigregister, METH_VARARGS, NULL}, + { NULL, NULL, 0, NULL } +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ + +static swig_type_info _swigt__p_Brush = {"_p_Brush", "Brush *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_BrushPreview = {"_p_BrushPreview", "BrushPreview *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_BrushType = {"_p_BrushType", "BrushType *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_ByteBuffer = {"_p_ByteBuffer", "ByteBuffer *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_Canvas = {"_p_Canvas", "Canvas *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_Color = {"_p_Color", "Color *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_DRW_Command = {"_p_DRW_Command", "DRW_Command *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_DRW_Header = {"_p_DRW_Header", "DRW_Header *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_DrawCommand = {"_p_DrawCommand", "DrawCommand *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_DrawCommandBuffer = {"_p_DrawCommandBuffer", "DrawCommandBuffer *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_GdkImage = {"_p_GdkImage", "GdkImage *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_GstBuffer = {"_p_GstBuffer", "GstBuffer *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_Palette = {"_p_Palette", "Palette *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_Pos = {"_p_Pos", "Pos *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_SurfaceA8R8G8B8 = {"_p_SurfaceA8R8G8B8", "SurfaceA8R8G8B8 *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char = {"_p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char", "unsigned char (*)[BrushType::BRUSH_TABLE_HEIGHT]", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char = {"_p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char", "unsigned char (*)[BrushType::DIST_TABLE_WIDTH]", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_DRW_Command = {"_p_p_DRW_Command", "DRW_Command **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_p_unsigned_int = {"_p_p_unsigned_int", "unsigned int **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_vectorTDrawCommand_t = {"_p_vectorTDrawCommand_t", "vector *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; + +static swig_type_info *swig_type_initial[] = { + &_swigt__p_Brush, + &_swigt__p_BrushPreview, + &_swigt__p_BrushType, + &_swigt__p_ByteBuffer, + &_swigt__p_Canvas, + &_swigt__p_Color, + &_swigt__p_DRW_Command, + &_swigt__p_DRW_Header, + &_swigt__p_DrawCommand, + &_swigt__p_DrawCommandBuffer, + &_swigt__p_GdkImage, + &_swigt__p_GstBuffer, + &_swigt__p_Palette, + &_swigt__p_Pos, + &_swigt__p_SurfaceA8R8G8B8, + &_swigt__p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char, + &_swigt__p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char, + &_swigt__p_char, + &_swigt__p_float, + &_swigt__p_p_DRW_Command, + &_swigt__p_p_unsigned_int, + &_swigt__p_uint32_t, + &_swigt__p_unsigned_char, + &_swigt__p_unsigned_int, + &_swigt__p_unsigned_short, + &_swigt__p_vectorTDrawCommand_t, + &_swigt__p_void, +}; + +static swig_cast_info _swigc__p_Brush[] = { {&_swigt__p_Brush, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_BrushPreview[] = { {&_swigt__p_BrushPreview, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_BrushType[] = { {&_swigt__p_BrushType, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_ByteBuffer[] = { {&_swigt__p_ByteBuffer, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_Canvas[] = { {&_swigt__p_Canvas, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_Color[] = { {&_swigt__p_Color, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_DRW_Command[] = { {&_swigt__p_DRW_Command, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_DRW_Header[] = { {&_swigt__p_DRW_Header, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_DrawCommand[] = { {&_swigt__p_DrawCommand, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_DrawCommandBuffer[] = { {&_swigt__p_DrawCommandBuffer, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_GdkImage[] = { {&_swigt__p_GdkImage, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_GstBuffer[] = { {&_swigt__p_GstBuffer, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_Palette[] = { {&_swigt__p_Palette, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_Pos[] = { {&_swigt__p_Pos, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_SurfaceA8R8G8B8[] = { {&_swigt__p_SurfaceA8R8G8B8, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char[] = { {&_swigt__p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char[] = { {&_swigt__p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_float[] = { {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_DRW_Command[] = { {&_swigt__p_p_DRW_Command, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_p_unsigned_int[] = { {&_swigt__p_p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_vectorTDrawCommand_t[] = { {&_swigt__p_vectorTDrawCommand_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; + +static swig_cast_info *swig_cast_initial[] = { + _swigc__p_Brush, + _swigc__p_BrushPreview, + _swigc__p_BrushType, + _swigc__p_ByteBuffer, + _swigc__p_Canvas, + _swigc__p_Color, + _swigc__p_DRW_Command, + _swigc__p_DRW_Header, + _swigc__p_DrawCommand, + _swigc__p_DrawCommandBuffer, + _swigc__p_GdkImage, + _swigc__p_GstBuffer, + _swigc__p_Palette, + _swigc__p_Pos, + _swigc__p_SurfaceA8R8G8B8, + _swigc__p_a_BrushType__BRUSH_TABLE_HEIGHT__unsigned_char, + _swigc__p_a_BrushType__DIST_TABLE_WIDTH__unsigned_char, + _swigc__p_char, + _swigc__p_float, + _swigc__p_p_DRW_Command, + _swigc__p_p_unsigned_int, + _swigc__p_uint32_t, + _swigc__p_unsigned_char, + _swigc__p_unsigned_int, + _swigc__p_unsigned_short, + _swigc__p_vectorTDrawCommand_t, + _swigc__p_void, +}; + + +/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */ + +static swig_const_info swig_const_table[] = { +{0, 0, 0, 0.0, 0, 0}}; + +#ifdef __cplusplus +} +#endif +/* ----------------------------------------------------------------------------- + * Type initialization: + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to + * swig_cast_info structures and swig_cast_info structures store pointers back + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of + * swig_module, and does all the lookup, filling in the swig_module.types + * array with the correct data and linking the correct swig_cast_info + * structures together. + * + * The generated swig_type_info structures are assigned staticly to an initial + * array. We just loop through that array, and handle each type individually. + * First we lookup if this type has been already loaded, and if so, use the + * loaded structure instead of the generated one. Then we have to fill in the + * cast linked list. The cast data is initially stored in something like a + * two-dimensional array. Each row corresponds to a type (there are the same + * number of rows as there are in the swig_type_initial array). Each entry in + * a column is one of the swig_cast_info structures for that type. + * The cast_initial array is actually an array of arrays, because each row has + * a variable number of columns. So to actually build the cast linked list, + * we find the array of casts associated with the type, and loop through it + * adding the casts to the list. The one last trick we need to do is making + * sure the type pointer in the swig_cast_info struct is correct. + * + * First off, we lookup the cast->type name to see if it is already loaded. + * There are three cases to handle: + * 1) If the cast->type has already been loaded AND the type we are adding + * casting info to has not been loaded (it is in this module), THEN we + * replace the cast->type pointer with the type pointer that has already + * been loaded. + * 2) If BOTH types (the one we are adding casting info to, and the + * cast->type) are loaded, THEN the cast info has already been loaded by + * the previous module so we just ignore it. + * 3) Finally, if cast->type has not already been loaded, then we add that + * swig_cast_info to the linked list (because the cast->type) pointer will + * be correct. + * ----------------------------------------------------------------------------- */ + +#ifdef __cplusplus +extern "C" { +#if 0 +} /* c-mode */ +#endif +#endif + +#if 0 +#define SWIGRUNTIME_DEBUG +#endif + + +SWIGRUNTIME void +SWIG_InitializeModule(void *clientdata) { + size_t i; + swig_module_info *module_head, *iter; + int found; + + clientdata = clientdata; + + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + } + + /* Try and load any already created modules */ + module_head = SWIG_GetModule(clientdata); + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ + swig_module.next = module_head->next; + module_head->next = &swig_module; + } + + /* Now work on filling in swig_module.types */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: size %d\n", swig_module.size); +#endif + for (i = 0; i < swig_module.size; ++i) { + swig_type_info *type = 0; + swig_type_info *ret; + swig_cast_info *cast; + +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); +#endif + + /* if there is another module already loaded */ + if (swig_module.next != &swig_module) { + type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name); + } + if (type) { + /* Overwrite clientdata field */ +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found type %s\n", type->name); +#endif + if (swig_module.type_initial[i]->clientdata) { + type->clientdata = swig_module.type_initial[i]->clientdata; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name); +#endif + } + } else { + type = swig_module.type_initial[i]; + } + + /* Insert casting types */ + cast = swig_module.cast_initial[i]; + while (cast->type) { + /* Don't need to add information already in the list */ + ret = 0; +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: look cast %s\n", cast->type->name); +#endif + if (swig_module.next != &swig_module) { + ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name); +#ifdef SWIGRUNTIME_DEBUG + if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name); +#endif + } + if (ret) { + if (type == swig_module.type_initial[i]) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: skip old type %s\n", ret->name); +#endif + cast->type = ret; + ret = 0; + } else { + /* Check for casting already in the list */ + swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type); +#ifdef SWIGRUNTIME_DEBUG + if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name); +#endif + if (!ocast) ret = 0; + } + } + + if (!ret) { +#ifdef SWIGRUNTIME_DEBUG + printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name); +#endif + if (type->cast) { + type->cast->prev = cast; + cast->next = type->cast; + } + type->cast = cast; + } + cast++; + } + /* Set entry in modules->types array equal to the type */ + swig_module.types[i] = type; + } + swig_module.types[i] = 0; + +#ifdef SWIGRUNTIME_DEBUG + printf("**** SWIG_InitializeModule: Cast List ******\n"); + for (i = 0; i < swig_module.size; ++i) { + int j = 0; + swig_cast_info *cast = swig_module.cast_initial[i]; + printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + while (cast->type) { + printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); + cast++; + ++j; + } + printf("---- Total casts: %d\n",j); + } + printf("**** SWIG_InitializeModule: Cast List ******\n"); +#endif +} + +/* This function will propagate the clientdata field of type to +* any new swig_type_info structures that have been added into the list +* of equivalent types. It is like calling +* SWIG_TypeClientData(type, clientdata) a second time. +*/ +SWIGRUNTIME void +SWIG_PropagateClientData(void) { + size_t i; + swig_cast_info *equiv; + static int init_run = 0; + + if (init_run) return; + init_run = 1; + + for (i = 0; i < swig_module.size; i++) { + if (swig_module.types[i]->clientdata) { + equiv = swig_module.types[i]->cast; + while (equiv) { + if (!equiv->converter) { + if (equiv->type && !equiv->type->clientdata) + SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata); + } + equiv = equiv->next; + } + } + } +} + +#ifdef __cplusplus +#if 0 +{ + /* c-mode */ +#endif +} +#endif + + + +#ifdef __cplusplus +extern "C" { +#endif + + /* Python-specific SWIG API */ +#define SWIG_newvarlink() SWIG_Python_newvarlink() +#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr) +#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants) + + /* ----------------------------------------------------------------------------- + * global variable support code. + * ----------------------------------------------------------------------------- */ + + typedef struct swig_globalvar { + char *name; /* Name of global variable */ + PyObject *(*get_attr)(void); /* Return the current value */ + int (*set_attr)(PyObject *); /* Set the value */ + struct swig_globalvar *next; + } swig_globalvar; + + typedef struct swig_varlinkobject { + PyObject_HEAD + swig_globalvar *vars; + } swig_varlinkobject; + + SWIGINTERN PyObject * + swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) { + return PyString_FromString(""); + } + + SWIGINTERN PyObject * + swig_varlink_str(swig_varlinkobject *v) { + PyObject *str = PyString_FromString("("); + swig_globalvar *var; + for (var = v->vars; var; var=var->next) { + PyString_ConcatAndDel(&str,PyString_FromString(var->name)); + if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", ")); + } + PyString_ConcatAndDel(&str,PyString_FromString(")")); + return str; + } + + SWIGINTERN int + swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) { + PyObject *str = swig_varlink_str(v); + fprintf(fp,"Swig global variables "); + fprintf(fp,"%s\n", PyString_AsString(str)); + Py_DECREF(str); + return 0; + } + + SWIGINTERN void + swig_varlink_dealloc(swig_varlinkobject *v) { + swig_globalvar *var = v->vars; + while (var) { + swig_globalvar *n = var->next; + free(var->name); + free(var); + var = n; + } + } + + SWIGINTERN PyObject * + swig_varlink_getattr(swig_varlinkobject *v, char *n) { + PyObject *res = NULL; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->get_attr)(); + break; + } + var = var->next; + } + if (res == NULL && !PyErr_Occurred()) { + PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + } + return res; + } + + SWIGINTERN int + swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) { + int res = 1; + swig_globalvar *var = v->vars; + while (var) { + if (strcmp(var->name,n) == 0) { + res = (*var->set_attr)(p); + break; + } + var = var->next; + } + if (res == 1 && !PyErr_Occurred()) { + PyErr_SetString(PyExc_NameError,"Unknown C global variable"); + } + return res; + } + + SWIGINTERN PyTypeObject* + swig_varlink_type(void) { + static char varlink__doc__[] = "Swig var link object"; + static PyTypeObject varlink_type; + static int type_init = 0; + if (!type_init) { + const PyTypeObject tmp + = { + PyObject_HEAD_INIT(NULL) + 0, /* Number of items in variable part (ob_size) */ + (char *)"swigvarlink", /* Type name (tp_name) */ + sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */ + 0, /* Itemsize (tp_itemsize) */ + (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */ + (printfunc) swig_varlink_print, /* Print (tp_print) */ + (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */ + (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */ + 0, /* tp_compare */ + (reprfunc) swig_varlink_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + (reprfunc)swig_varlink_str, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + 0, /* tp_flags */ + varlink__doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ +#if PY_VERSION_HEX >= 0x02020000 + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */ +#endif +#if PY_VERSION_HEX >= 0x02030000 + 0, /* tp_del */ +#endif +#ifdef COUNT_ALLOCS + 0,0,0,0 /* tp_alloc -> tp_next */ +#endif + }; + varlink_type = tmp; + varlink_type.ob_type = &PyType_Type; + type_init = 1; + } + return &varlink_type; + } + + /* Create a variable linking object for use later */ + SWIGINTERN PyObject * + SWIG_Python_newvarlink(void) { + swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type()); + if (result) { + result->vars = 0; + } + return ((PyObject*) result); + } + + SWIGINTERN void + SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { + swig_varlinkobject *v = (swig_varlinkobject *) p; + swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); + if (gv) { + size_t size = strlen(name)+1; + gv->name = (char *)malloc(size); + if (gv->name) { + strncpy(gv->name,name,size); + gv->get_attr = get_attr; + gv->set_attr = set_attr; + gv->next = v->vars; + } + } + v->vars = gv; + } + + SWIGINTERN PyObject * + SWIG_globals(void) { + static PyObject *_SWIG_globals = 0; + if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink(); + return _SWIG_globals; + } + + /* ----------------------------------------------------------------------------- + * constants/methods manipulation + * ----------------------------------------------------------------------------- */ + + /* Install Constants */ + SWIGINTERN void + SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) { + PyObject *obj = 0; + size_t i; + for (i = 0; constants[i].type; ++i) { + switch(constants[i].type) { + case SWIG_PY_POINTER: + obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0); + break; + case SWIG_PY_BINARY: + obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); + break; + default: + obj = 0; + break; + } + if (obj) { + PyDict_SetItemString(d, constants[i].name, obj); + Py_DECREF(obj); + } + } + } + + /* -----------------------------------------------------------------------------*/ + /* Fix SwigMethods to carry the callback ptrs when needed */ + /* -----------------------------------------------------------------------------*/ + + SWIGINTERN void + SWIG_Python_FixMethods(PyMethodDef *methods, + swig_const_info *const_table, + swig_type_info **types, + swig_type_info **types_initial) { + size_t i; + for (i = 0; methods[i].ml_name; ++i) { + const char *c = methods[i].ml_doc; + if (c && (c = strstr(c, "swig_ptr: "))) { + int j; + swig_const_info *ci = 0; + const char *name = c + 10; + for (j = 0; const_table[j].type; ++j) { + if (strncmp(const_table[j].name, name, + strlen(const_table[j].name)) == 0) { + ci = &(const_table[j]); + break; + } + } + if (ci) { + size_t shift = (ci->ptype) - types; + swig_type_info *ty = types_initial[shift]; + size_t ldoc = (c - methods[i].ml_doc); + size_t lptr = strlen(ty->name)+2*sizeof(void*)+2; + char *ndoc = (char*)malloc(ldoc + lptr + 10); + if (ndoc) { + char *buff = ndoc; + void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0; + if (ptr) { + strncpy(buff, methods[i].ml_doc, ldoc); + buff += ldoc; + strncpy(buff, "swig_ptr: ", 10); + buff += 10; + SWIG_PackVoidPtr(buff, ptr, ty->name, lptr); + methods[i].ml_doc = ndoc; + } + } + } + } + } + } + +#ifdef __cplusplus +} +#endif + +/* -----------------------------------------------------------------------------* + * Partial Init method + * -----------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif +SWIGEXPORT void SWIG_init(void) { + PyObject *m, *d; + + /* Fix SwigMethods to carry the callback ptrs when needed */ + SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial); + + m = Py_InitModule((char *) SWIG_name, SwigMethods); + d = PyModule_GetDict(m); + + SWIG_InitializeModule(0); + SWIG_InstallConstants(d,swig_const_table); + + + PyDict_SetItemString(d,(char*)"cvar", SWIG_globals()); + SWIG_addvarlink(SWIG_globals(),(char*)"PI",Swig_var_PI_get, Swig_var_PI_set); + SWIG_Python_SetConstant(d, "DrawCommand_TYPE_DRAW",SWIG_From_int(static_cast< int >(DrawCommand::TYPE_DRAW))); + SWIG_Python_SetConstant(d, "DrawCommand_TYPE_DRAWEND",SWIG_From_int(static_cast< int >(DrawCommand::TYPE_DRAWEND))); + SWIG_Python_SetConstant(d, "DrawCommand_TYPE_COLORCHANGE",SWIG_From_int(static_cast< int >(DrawCommand::TYPE_COLORCHANGE))); + SWIG_Python_SetConstant(d, "DrawCommand_TYPE_SIZECHANGE",SWIG_From_int(static_cast< int >(DrawCommand::TYPE_SIZECHANGE))); + SWIG_Python_SetConstant(d, "BrushType_BRUSHTYPE_HARD",SWIG_From_int(static_cast< int >(BrushType::BRUSHTYPE_HARD))); + SWIG_Python_SetConstant(d, "BrushType_BRUSHTYPE_SOFT",SWIG_From_int(static_cast< int >(BrushType::BRUSHTYPE_SOFT))); + SWIG_Python_SetConstant(d, "BrushType_BRUSHTYPE_CURSOR",SWIG_From_int(static_cast< int >(BrushType::BRUSHTYPE_CURSOR))); + SWIG_Python_SetConstant(d, "BrushType_NUM_BRUSHES",SWIG_From_int(static_cast< int >(BrushType::NUM_BRUSHES))); + SWIG_Python_SetConstant(d, "BrushType_DIST_TABLE_WIDTH",SWIG_From_int(static_cast< int >(BrushType::DIST_TABLE_WIDTH))); + SWIG_Python_SetConstant(d, "BrushType_DIST_TABLE_CENTER",SWIG_From_int(static_cast< int >(BrushType::DIST_TABLE_CENTER))); + SWIG_Python_SetConstant(d, "BrushType_BRUSH_TABLE_WIDTH",SWIG_From_int(static_cast< int >(BrushType::BRUSH_TABLE_WIDTH))); + SWIG_Python_SetConstant(d, "BrushType_BRUSH_TABLE_HEIGHT",SWIG_From_int(static_cast< int >(BrushType::BRUSH_TABLE_HEIGHT))); + SWIG_Python_SetConstant(d, "BrushType_EXTRA_BRUSH_SCALE",SWIG_From_float(static_cast< float >(BrushType::EXTRA_BRUSH_SCALE))); + SWIG_addvarlink(SWIG_globals(),(char*)"BrushType_distance_tbl",Swig_var_BrushType_distance_tbl_get, Swig_var_BrushType_distance_tbl_set); + SWIG_Python_SetConstant(d, "Brush_BRUSHCONTROL_VARIABLEOPACITY",SWIG_From_int(static_cast< int >(Brush::BRUSHCONTROL_VARIABLEOPACITY))); + SWIG_Python_SetConstant(d, "Brush_BRUSHCONTROL_VARIABLESIZE",SWIG_From_int(static_cast< int >(Brush::BRUSHCONTROL_VARIABLESIZE))); + SWIG_addvarlink(SWIG_globals(),(char*)"Brush_brush_type",Swig_var_Brush_brush_type_get, Swig_var_Brush_brush_type_set); + SWIG_Python_SetConstant(d, "Canvas_REFERENCE_WIDTH",SWIG_From_int(static_cast< int >(Canvas::REFERENCE_WIDTH))); + SWIG_Python_SetConstant(d, "Canvas_REFERENCE_HEIGHT",SWIG_From_int(static_cast< int >(Canvas::REFERENCE_HEIGHT))); + SWIG_Python_SetConstant(d, "Canvas_VIDEO_WIDTH",SWIG_From_int(static_cast< int >(Canvas::VIDEO_WIDTH))); + SWIG_Python_SetConstant(d, "Canvas_VIDEO_HEIGHT",SWIG_From_int(static_cast< int >(Canvas::VIDEO_HEIGHT))); + SWIG_Python_SetConstant(d, "Canvas_DRAWBRUSH_TYPE_NORMAL",SWIG_From_int(static_cast< int >(Canvas::DRAWBRUSH_TYPE_NORMAL))); + SWIG_Python_SetConstant(d, "Canvas_DRAWBRUSH_TYPE_OLDCURSOR",SWIG_From_int(static_cast< int >(Canvas::DRAWBRUSH_TYPE_OLDCURSOR))); + SWIG_Python_SetConstant(d, "Canvas_DRAWBRUSH_TYPE_DIRECT",SWIG_From_int(static_cast< int >(Canvas::DRAWBRUSH_TYPE_DIRECT))); + SWIG_Python_SetConstant(d, "Canvas_DRAWBRUSH_TYPE_GETCOLOR",SWIG_From_int(static_cast< int >(Canvas::DRAWBRUSH_TYPE_GETCOLOR))); + SWIG_Python_SetConstant(d, "Canvas_DRAWBRUSH_TYPE_CURSOR",SWIG_From_int(static_cast< int >(Canvas::DRAWBRUSH_TYPE_CURSOR))); + SWIG_Python_SetConstant(d, "Palette_WHEEL_WIDTH",SWIG_From_int(static_cast< int >(Palette::WHEEL_WIDTH))); +} + diff --git a/src/deploy.sh b/src/deploy.sh new file mode 100755 index 0000000..0d548de --- /dev/null +++ b/src/deploy.sh @@ -0,0 +1,2 @@ +scp ~/Colors.activity/colors.py ~/Colors.activity/_colorsc.so ~/Colors.activity/colorsc.py olpc@$XOIP:~/Colors.activity/ + diff --git a/src/drwfile.h b/src/drwfile.h new file mode 100644 index 0000000..f581f9b --- /dev/null +++ b/src/drwfile.h @@ -0,0 +1,77 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +#ifndef _DRWFILE_H_ +#define _DRWFILE_H_ + +#define DRW_VERSION 1070 + +struct DRW_Command +{ + union + { + struct + { + unsigned int type0 : 2; + unsigned int alpha : 8; + unsigned int x : 11; + unsigned int y : 11; + }; + + struct + { + unsigned int type1 : 2; + unsigned int col : 24; + unsigned int flipx : 1; + unsigned int flipy : 1; + }; + + struct + { + unsigned int type2 : 2; + unsigned int size : 16; + unsigned int brushcontrol : 2; + unsigned int brushtype : 2; + unsigned int opacity : 8; + }; + + struct + { + unsigned int type : 2; + unsigned int undef : 30; + }; + + int raw; + }; +}; + +struct DRW_Header +{ + static const unsigned int ID = 0x436f6c21; // 'Col!' + + unsigned int id; + unsigned int version; + int colorsversion_initial; + int colorsversion_saved; + int strokes; + int time; + int timessaved; + int dummy[8]; + int ncommands; +}; + +#endif diff --git a/src/gtk_types.h b/src/gtk_types.h new file mode 100644 index 0000000..f3e26bd --- /dev/null +++ b/src/gtk_types.h @@ -0,0 +1,130 @@ +// This file serves to allow access to a limited subset of GTK and GStreamer objects passed from PyGTK, without the full +// GLib + GTK + GST development environment. +// +// Obviously, it is limited to working with a specific version of GTK, PyGTK and GStreamer, but these structures appear +// to be fairly stable. +#ifndef GTK_TYPES_H +#define GTK_TYPES_H + +#include + +typedef uint8_t guint8; +typedef int32_t gint; +typedef uint32_t guint; +typedef uint16_t guint16; +typedef uint64_t guint64; +typedef void* gpointer; + +struct GTypeClass; +struct GData; + +struct _GTypeInstance +{ + /*< private >*/ + GTypeClass *g_class; +}; + +typedef struct _GTypeInstance GTypeInstance; + +struct _GObject +{ + GTypeInstance g_type_instance; + + /*< private >*/ + guint ref_count; + GData *qdata; +}; + +typedef struct _GObject GObject; + +typedef enum +{ + GDK_IMAGE_NORMAL, + GDK_IMAGE_SHARED, + GDK_IMAGE_FASTEST +} GdkImageType; + +typedef enum +{ + GDK_LSB_FIRST, + GDK_MSB_FIRST +} GdkByteOrder; + +struct GdkVisual; +struct GdkColormap; + +typedef struct { + GObject parent_instance; + + + GdkImageType type; /* read only. */ + GdkVisual *visual; /* read only. visual used to create the image */ + GdkByteOrder byte_order; /* read only. */ + gint width; /* read only. */ + gint height; /* read only. */ + guint16 depth; /* read only. */ + guint16 bpp; /* read only. bytes per pixel */ + guint16 bpl; /* read only. bytes per line */ + guint16 bits_per_pixel; /* read only. bits per pixel */ + gpointer mem; + + GdkColormap *colormap; /* read only. */ +} GdkImage; + +struct GSList; + +typedef struct { + PyObject_HEAD + GObject *obj; + PyObject *inst_dict; /* the instance dictionary -- must be last */ + PyObject *weakreflist; /* list of weak references */ + GSList *closures; +} PyGObject; + +struct _GstMiniObject { + GTypeInstance instance; + /*< public >*/ /* with COW */ + gint refcount; + guint flags; + + /*< private >*/ + gpointer _gst_reserved; +}; + +typedef struct _GstMiniObject GstMiniObject; + +struct GstCaps; + +typedef guint64 GstClockTime; + +#define GST_PADDING 4 + +struct _GstBuffer { + GstMiniObject mini_object; + + /*< public >*/ /* with COW */ + /* pointer to data and its size */ + guint8 *data; + guint size; + + /* timestamp */ + GstClockTime timestamp; + GstClockTime duration; + + /* the media type of this buffer */ + GstCaps *caps; + + /* media specific offset */ + guint64 offset; + guint64 offset_end; + + guint8 *malloc_data; + + /*< private >*/ + gpointer _gst_reserved[GST_PADDING]; +}; + +typedef struct _GstBuffer GstBuffer; + +#endif + diff --git a/src/palette.cpp b/src/palette.cpp new file mode 100644 index 0000000..0751983 --- /dev/null +++ b/src/palette.cpp @@ -0,0 +1,19 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +#include "palette.h" + diff --git a/src/palette.h b/src/palette.h new file mode 100644 index 0000000..03d51eb --- /dev/null +++ b/src/palette.h @@ -0,0 +1,458 @@ +/* + Copyright 2008 by Jens Andersson and Wade Brainerd. + This file is part of Colors! XO. + + Colors is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Colors is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Colors. If not, see . +*/ +#ifndef _PALETTE_H_ +#define _PALETTE_H_ + +#include "colorsc.h" +#include "canvas.h" + +// The Palette is the color wheel and triangle that are part of the brush controls dialog. +// This class manages rendering the palette as efficiently as possible into GdkImage objects which are +// then displayed on the screen. +// It also manages responding to mouse inputs that are passed from the Python code. +class Palette +{ +public: + static const int WHEEL_WIDTH = 75; + + int size; + + float palette_h, palette_s, palette_v; + + Pos triangle_cursor; + bool triangle_capture; + bool wheel_capture; + + Palette(int size) : size(size) + { + palette_h = palette_s = palette_v = 0; + triangle_capture = false; + } + + float get_wheel_radius() + { + return size - WHEEL_WIDTH/2; + } + + void rgb_to_hsv(float r, float g, float b, float* h, float* s, float* v) + { + float mn = min(min(r, g), b); + float mx = max(max(r, g), b); + *v = mx; // v + float delta = mx - mn; + if (mx != 0) + *s = delta / mx; // s + else + { + // r = g = b = 0 // s = 0, v is undefined + *s = 0; + *h = -1; + return; + } + if (delta == 0) + *h = 0; + else if (r == mx) + *h = ( g - b ) / delta; // between yellow & magenta + else if (g == mx) + *h = 2 + ( b - r ) / delta; // between cyan & yellow + else + *h = 4 + ( r - g ) / delta; // between magenta & cyan + *h *= 60; // degrees + if (*h < 0) + *h += 360; + } + + void hsv_to_rgb(float* r, float* g, float* b, float h, float s, float v) + { + if (s == 0) + { + // achromatic (grey) + *r = *g = *b = v; + return; + } + h /= 60; // sector 0 to 5 + int i = int(floorf(h)); + float f = h - i; // factorial part of h + float p = v * (1-s); + float q = v * (1-s * f); + float t = v * (1-s * (1 - f)); + switch (i) + { + case 0: *r = v; *g = t; *b = p; break; + case 1: *r = q; *g = v; *b = p; break; + case 2: *r = p; *g = v; *b = t; break; + case 3: *r = p; *g = q; *b = v; break; + case 4: *r = t; *g = p; *b = v; break; + default: + case 5: *r = v; *g = p; *b = q; break; + } + } + + void set_color(const Color& c) + { + rgb_to_hsv(c.r/255.0f, c.g/255.0f, c.b/255.0f, &palette_h, &palette_s, &palette_v); + + // I couldn't work out an exact solution to the blobby triangle position, so I'm using a relaxation algorithm. + // It usually takes less than 10 iterations to converge and only runs when you first open the palette. + Pos p0, p1, p2; + get_triangle_points(&p0, &p1, &p2); + float side = distance(p0, p1); + + Pos p = (p0+p1+p2)*(1.0f/3.0f); + float epsilon = 0.001f; + int max_iterations = 50; + for (int i = 0; i < max_iterations; i++) + { + float d0 = distance(p, p0); + float d0ok = fabsf((side-d0)-palette_s*side); + p = p + ((p0-p)/length(p0-p)) * (d0-(1.0f-palette_s)*side); + + float d2 = distance(p, p2); + float d2ok = fabsf(d2-palette_v*side); + p = p + ((p2-p)/length(p2-p)) * (d2-palette_v*side); + + if (d0ok <= epsilon && d2ok <= epsilon) break; + } + triangle_cursor = p; + } + + Color get_color() + { + float r, g, b; + hsv_to_rgb(&r, &g, &b, palette_h, palette_s, palette_v); + return Color::create_from_float(r, g, b, 1.0f); + } + + float sqr(float a) + { + return a*a; + } + + float dot(const Pos& a, const Pos& b) + { + return a.x*b.x + a.y*b.y; + } + + float length(const Pos& a) + { + return sqrtf(dot(a,a)); + } + + float length_sqr(const Pos& a) + { + return dot(a,a); + } + + float distance(const Pos& a, const Pos& b) + { + return length(a-b); + } + + float distance_sqr(const Pos& a, const Pos& b) + { + return length_sqr(a-b); + } + + Pos normalize(const Pos& a) + { + return a/length(a); + } + + void get_triangle_points(Pos* p0, Pos* p1, Pos* p2) + { + Pos center(size/2, size/2); + *p0 = center + Pos::create_from_angle(palette_h+0.0f, size/2-WHEEL_WIDTH); + *p1 = center + Pos::create_from_angle(palette_h+120.0f, size/2-WHEEL_WIDTH); + *p2 = center + Pos::create_from_angle(palette_h+240.0f, size/2-WHEEL_WIDTH); + } + + // The wheel never changes, so it can be rendered once here. This also clears the image background. + void render_wheel(GdkImage* image) + { + if (image->width != size || image->height != size || image->bits_per_pixel != 16) + { + fprintf(stderr, "Error: Invalid Palette GdkImage.\n"); + return; + } + + Color bkg(64, 64, 64, 0); + + float wheel_radius = size/2; + float ring_min_sqr = sqr(wheel_radius-WHEEL_WIDTH); + float ring_max_sqr = sqr(wheel_radius); + + unsigned short* pixels = (unsigned short*)image->mem; + int stride = image->bpl/sizeof(unsigned short); + + for (int y = 0; y < size; y++) + { + unsigned short* row = &pixels[y*stride]; + for (int x = 0; x < size; x++) + { + // Get radius from center of palette. + float dx = x-wheel_radius; + float dy = y-wheel_radius; + float dist_sqr = dx*dx + dy*dy; + + // Inside color wheel ring? Draw the wheel. + if (dist_sqr >= ring_min_sqr && dist_sqr < ring_max_sqr) + { + // Calculate HSV from wheel angle. + float h = atan2f(dy, dx)*180.0f/PI; + while (h<0) h += 360.0f; + while (h>360.0f) h -= 360.0f; + float r, g, b; + hsv_to_rgb(&r, &g, &b, h, 1.0f, 1.0f); + *row++ = Color::create_from_float(r, g, b, 1).get_r5g6b5(); + } + else + *row++ = bkg.get_r5g6b5(); + } + } + } + + // Clears out the inner circle and redraws the color triangle, as fast as possible. + // Scales up implicitly by 2x to improve performance. + // The appearance was an accident which creates a kind of blobby triangle, like the intersection of three circles. + // But I like the look so I'm keeping it! + void render_triangle(GdkImage* image) + { + if (image->width != size || image->height != size || image->bits_per_pixel != 16 || (size&1)) + { + fprintf(stderr, "Error: Invalid Palette GdkImage.\n"); + return; + } + + Color bkg(64, 64, 64, 0); + unsigned short bkgc = bkg.get_r5g6b5(); + + Pos p0, p1, p2; + get_triangle_points(&p0, &p1, &p2); + float triangle_side = distance(p0, p1); + float triangle_side_sqr = triangle_side*triangle_side; + float inv_triangle_side = 1.0f/triangle_side; + + float wheel_radius = size/2; + float ring_min_sqr = sqr(wheel_radius-WHEEL_WIDTH); + + int x0 = WHEEL_WIDTH; + int x1 = size-WHEEL_WIDTH; + + unsigned short* pixels = (unsigned short*)image->mem; + int stride = image->bpl/sizeof(unsigned short); + + Pos p(x0,x0); + for (int y = x0; y < x1; y+=2, p.y += 2.0f) + { + p.x = x0; + unsigned short* __restrict row0 = &pixels[(y+0)*stride+x0]; + unsigned short* __restrict row1 = &pixels[(y+1)*stride+x0]; + for (int x = x0; x < x1; x+=2, p.x += 2.0f) + { + // Calculate position inside triangle. If inside, then use as HSV. + float d0_sqr = distance_sqr(p, p0); + float d1_sqr = distance_sqr(p, p1); + float d2_sqr = distance_sqr(p, p2); + if (d0_sqr <= triangle_side_sqr && d1_sqr <= triangle_side_sqr && d2_sqr <= triangle_side_sqr) + { + float r, g, b; + hsv_to_rgb(&r, &g, &b, palette_h, 1.0f-sqrtf(d0_sqr)*inv_triangle_side, sqrtf(d2_sqr)*inv_triangle_side); + unsigned short c = Color::create_from_float(r, g, b, 1).get_r5g6b5(); + row0[0] = c; + row0[1] = c; + row1[0] = c; + row1[1] = c; + } + else + { + // Inside ring? Clear to background. + if (distance_sqr(p, Pos(wheel_radius, wheel_radius)) < ring_min_sqr) + { + row0[0] = bkgc; + row0[1] = bkgc; + row1[0] = bkgc; + row1[1] = bkgc; + } + } + row0 += 2; + row1 += 2; + } + } + } + + Pos get_wheel_pos() + { + float a = palette_h*PI/180.0f; + float r = size/2 - WHEEL_WIDTH/2; + return Pos(size/2+r*cosf(a), size/2+r*sinf(a)); + } + + Pos get_triangle_pos() + { + return triangle_cursor; + } + + void process_mouse(int mx, int my) + { + Pos p0, p1, p2; + get_triangle_points(&p0, &p1, &p2); + + // If the triangle has the mouse capture, clip the mouse position to within the blobby triangle. + if (!wheel_capture) + { + if (triangle_capture) + { + Pos p(mx, my); + float d0 = distance(p, p0); + float d1 = distance(p, p1); + float d2 = distance(p, p2); + float side = distance(p0, p1)-1; + if (d0 > side || d1 > side || d2 > side) + { + Pos far_point = p0; + float far_dist = d0; + if (d1 > far_dist) { far_point = p1; far_dist = d1; } + if (d2 > far_dist) { far_point = p2; far_dist = d2; } + p = far_point + normalize(p-far_point) * side; + mx = int(p.x); + my = int(p.y); + } + } + + // Now check to see if it's on the triangle. + float side = 1.0f/distance(p0, p1); + Pos p(mx, my); + float d0 = distance(p, p0)*side; + float d1 = distance(p, p1)*side; + float d2 = distance(p, p2)*side; + if (d0 <= 1.0f && d1 <= 1.0f && d2 <= 1.0f) + { + triangle_capture = true; + triangle_cursor = p; + palette_s = 1.0f-d0; + palette_v = d2; + } + } + + if (!triangle_capture) + { + // Check to see if the mouse is in the wheel ring. + int dx = mx-size/2; + int dy = my-size/2; + float dist = sqrtf(dx*dx + dy*dy); + if (dist >= size/2-WHEEL_WIDTH || wheel_capture) + { + wheel_capture = true; + float h = atan2f(float(dy), float(dx))*180.0f/PI; + while (h<0) h += 360.0f; + while (h>360.0f) h -= 360.0f; + // Rotate the triangle cursor with the wheel. + triangle_cursor = Pos::create_from_rotation(triangle_cursor, (p0+p1+p2)/3.0f, (h-palette_h)*PI/180.0f); + palette_h = h; + } + } + } + + void process_mouse_release() + { + triangle_capture = false; + wheel_capture = false; + } +}; + +// The BrushPreview is a simple preview of the current brush as displayed in the Brush Controls panel. +// This class handles rendering the brush preview to a GdkImage to be displayed on the screen. +class BrushPreview +{ +public: + int size; + + Brush brush; + + BrushPreview(int size) : size(size) + { + } + + void render(GdkImage* image) + { + if (image->width != size || image->height != size || image->bits_per_pixel != 16 || (size&1)) + { + fprintf(stderr, "Error: Invalid BrushPreview GdkImage.\n"); + return; + } + + // Minimum brush size. + if (brush.size<2) brush.size = 2; + + // Calculate interpolation constants + float db = (BrushType::DIST_TABLE_WIDTH-1) / float(brush.size); + + float xb = BrushType::DIST_TABLE_CENTER - (size/2)*db; + float yb = BrushType::DIST_TABLE_CENTER - (size/2)*db; + + // Select which line of the brush-lookup-table to use that most closely matches the current brush width + int brushidx = int(float(BrushType::BRUSH_TABLE_HEIGHT) / brush.size); + + int opacity = int(round(255.0f * brush.opacity)); + + unsigned short* pixels = (unsigned short*)image->mem; + int stride = image->bpl/sizeof(unsigned short); + + // Interpolate the distance table over the area. For each pixel find the distance, and look the + // brush-intensity up in the brush-table + for (int y = 0; y < size; y+=2) + { + float x2b = xb; + unsigned short* __restrict row0 = &pixels[(y+0)*stride]; + unsigned short* __restrict row1 = &pixels[(y+1)*stride]; + for (int x = 0; x < size; x+=2) + { + // Find brush-intensity and mulitply that with incoming opacity + if (x2b >= 0 && x2b < BrushType::DIST_TABLE_WIDTH && yb >= 0 && yb < BrushType::DIST_TABLE_WIDTH) + { + int lookup = BrushType::distance_tbl[int(x2b)][int(yb)]; + int intensity = fixed_scale(Brush::brush_type[brush.type].intensity_tbl[lookup][brushidx], opacity); + Color i = Color::create_from_a8r8g8b8(0xffffffff); + //Color i = Color::create_from_a8r8g8b8(image[y*size+x]); + i = Color::create_from_lerp(brush.color, i, intensity); + unsigned short c = i.get_r5g6b5(); + row0[0] = c; + row0[1] = c; + row1[0] = c; + row1[1] = c; + } + else + { + row0[0] = 0xffff; + row0[1] = 0xffff; + row1[0] = 0xffff; + row1[1] = 0xffff; + } + + row0 += 2; + row1 += 2; + + x2b += db*2; + } + yb += db*2; + } + } +}; + +#endif + diff --git a/src/setup.py b/src/setup.py new file mode 100644 index 0000000..1295652 --- /dev/null +++ b/src/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +""" +setup.py file for colorsc +""" + +from distutils.core import setup, Extension + +colorsc_module = Extension('_colorsc', sources=['canvas.cpp', 'palette.cpp', 'colorsc_wrap.cxx'] ) + +setup (name = 'colorsc', version = '0.1', + author = "Jens Andersson", + description = """Colors C extension library.""", + ext_modules = [colorsc_module], py_modules = ["colorsc"]) + -- cgit v0.9.1