pax_global_header00006660000000000000000000000064137061240010014504gustar00rootroot0000000000000052 comment=b6ddc92dae8a972e3fc6f43934e2ea955f501e8e rcairo-1.16.6/000077500000000000000000000000001370612400100130565ustar00rootroot00000000000000rcairo-1.16.6/.dir-locals.el000066400000000000000000000001641370612400100155100ustar00rootroot00000000000000((sh-mode . ((indent-tabs-mode . nil) (sh-indentation . 2) (sh-basic-offset . 2)))) rcairo-1.16.6/.dockerignore000066400000000000000000000000021370612400100155220ustar00rootroot00000000000000* rcairo-1.16.6/.github/000077500000000000000000000000001370612400100144165ustar00rootroot00000000000000rcairo-1.16.6/.github/workflows/000077500000000000000000000000001370612400100164535ustar00rootroot00000000000000rcairo-1.16.6/.github/workflows/linux.yml000066400000000000000000000011321370612400100203320ustar00rootroot00000000000000name: Linux on: - push - pull_request jobs: test: name: Test strategy: fail-fast: false matrix: service: - arch-linux - centos-8 - debian-10 - fedora-rawhide - ruby-2.5 - ruby-2.6 - ruby-2.7 - ubuntu-18.04 - ubuntu-20.04 runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build Docker image run: | docker-compose build ${{ matrix.service }} - name: Run run: | docker-compose run ${{ matrix.service }} rcairo-1.16.6/.github/workflows/mac-os.yml000066400000000000000000000007531370612400100203620ustar00rootroot00000000000000name: macOS on: - push - pull_request jobs: test: name: Test runs-on: macOS-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-ruby@v1 - name: Install run: | # Need to install cairo gem as a normal gem to find rb_cairo.h by # other gems cairo-gobject gem and so on. gem build cairo.gemspec gem install *.gem bundle install - name: Test run: | bundle exec rake rcairo-1.16.6/.github/workflows/windows.yml000066400000000000000000000020361370612400100206710ustar00rootroot00000000000000name: Windows on: - push - pull_request jobs: test: name: Test strategy: fail-fast: false matrix: ruby-version: - "2.5" - "2.6" - "2.7" runs-on: windows-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - name: Update MSYS2 run: | ridk exec pacman --sync --refresh --sysupgrade --noconfirm - name: Install Bundler run: | gem install bundler bundle config --local force_ruby_platform true - name: Install run: | # Need to install cairo gem as a normal gem to find rb_cairo.h by # other gems cairo-gobject gem and so on. gem build cairo.gemspec gem install *.gem bundle install - name: Build run: | bundle exec ruby -rdevkit extconf.rb ridk exec make - name: Test run: | bundle exec ruby test/run-test.rb rcairo-1.16.6/.gitignore000066400000000000000000000003201370612400100150410ustar00rootroot00000000000000/ext/cairo/Makefile /ext/cairo/libruby-cairo.a /ext/cairo/mkmf.log *.so *.o /doc/ /rcairo-*.tar.gz* /test/.test-result/ /tmp/ /vendor/ /pkg/ /Makefile /Makefile.lib /Gemfile.lock /build/.vagrant/ /build/pkg/ rcairo-1.16.6/.yardopts000066400000000000000000000001111370612400100147150ustar00rootroot00000000000000--output-dir doc/reference/en --use-cache .yardoc lib/**/*.rb ext/**/*.c rcairo-1.16.6/AUTHORS000066400000000000000000000002251370612400100141250ustar00rootroot00000000000000Active: Kouhei Sutou Inactive: Evan Marin Øyvind Kolås MenTaLguY rcairo-1.16.6/COPYING000066400000000000000000000051011370612400100141060ustar00rootroot00000000000000Rcairo is copyrighted free software by the persons listed in AUTHORS distributed under the same conditions as ruby; which follow: Ruby is copyrighted free software by Yukihiro Matsumoto . You can redistribute it and/or modify it under either the terms of the GPL (see the file GPL), or the conditions below: 1. You may make and give away verbatim copies of the source form of the software without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may modify your copy of the software in any way, provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or by allowing the author to include your modifications in the software. b) use the modified software only within your corporation or organization. c) give non-standard binaries non-standard names, with instructions on where to get the original software distribution. d) make other distribution arrangements with the author. 3. You may distribute the software in object code or binary form, provided that you do at least ONE of the following: a) distribute the binaries and library files of the software, together with instructions (in the manual page or equivalent) on where to get the original distribution. b) accompany the distribution with the machine-readable source of the software. c) give non-standard binaries non-standard names, with instructions on where to get the original software distribution. d) make other distribution arrangements with the author. 4. You may modify and include the part of the software into any other software (possibly commercial). But some files in the distribution are not written by the author, so that they are not under these terms. For the list of those files and their copying conditions, see the file LEGAL. 5. The scripts and library files supplied as input to or produced as output from the software do not automatically fall under the copyright of the software, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this software. 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. rcairo-1.16.6/GPL000066400000000000000000000431311370612400100134250ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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. 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 convey 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This 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 Library General Public License instead of this License. rcairo-1.16.6/Gemfile000066400000000000000000000001151370612400100143460ustar00rootroot00000000000000# -*- mode: ruby; coding: utf-8 -*- source "https://rubygems.org/" gemspec rcairo-1.16.6/NEWS000066400000000000000000000500071370612400100135570ustar00rootroot00000000000000Release 1.16.6 (2020-07-23) Sutou Kouhei ============================================================ Improvements ------------ * Specified GPL 2.0 or later explicitly in gemspec. [GitHub#62][Reported by Gabriel Mazetto] * Added more metadata to gem. [GitHub#63][Patch by Gabriel Mazetto] Fixes ----- * Windows: Fixed a link error. [GitHub#ruby-gnome/ruby-gnome#1402][Reported by dsisnero] Thanks ------ * Gabriel Mazetto * dsisnero Release 1.16.5 (2020-02-03) Sutou Kouhei ============================================================ Improvements ------------ * Added Cairo::Context#raw_address for integration with other libraries. [GitHub#59][Reported by kojix2] Fixes ----- * Changed to use only ASCII for color name. [GitHub#57][Reported by spoolkitamura] * Fixed the number of arguments of the following methods: * Cairo::Surface#copy_page * Cairo::Surface#show_page Thanks ------ * spoolkitamura * kojix2 Release 1.16.4 (2019-03-09) Kouhei Sutou ============================================================ Fixes ----- * Removed Skia related code entirely. Release 1.16.3 (2019-03-09) Kouhei Sutou ============================================================ Improvements ------------ * Improved Cairo::Poinst#distance performance. [GitHub#53][Patch by scivola] * Added support for building with cairo and GLib 2.60 installed by Homebrew. * Updated colors. There are some backward incompatibility. Sorry. Fixes ----- * Fixed Cairo::Color::RGB#to_s. [GitHub#55][Patch by spoolkitamura] Thanks ------ * scivola * spoolkitamura. Release 1.16.2 (2018-10-31) Kouhei Sutou ============================================================ Improvements ------------ * Stopped to provide fat gem for Windows. Windows users should use MSYS2 packages. Release 1.16.1 (2018-10-31) Kouhei Sutou ============================================================ Improvements ------------ * Added Cairo::Context#destroyed?. Release 1.16.0 (2018-10-28) Kouhei Sutou ============================================================ Improvements ------------ * Added support for cairo 1.16.0. * Removed Cairo::SkiaSurface. Release 1.15.14 (2018-08-20) Kouhei Sutou ============================================================ Improvements ------------ * Added Cairo::Surface.create {}. Cairo::Surface.new {} is deprecated. * Added Cairo::Context.create {}. Cairo::Context.new {} is deprecated. * Windows: Added support for installing a normal gem (not fat gem) by "gem install --platform ruby". If you use Bundler, use "bundle config --local force_ruby_platform true" and "bundle exec ruby -rdevkit". * Changed to use SPDX license ID in gemspec. Fixes ----- * Fixed a bug that CRFONTOPTIOSN2RVAL() doesn't copy the target options. * Other CR*2RVAL() copy or refer the target objects. So CRFONTOPTIONS2RVAL() must copy for consistency. Release 1.15.13 (2018-05-01) Kouhei Sutou ============================================================ Improvements ------------ * Added cairo 1.15.12 support. * Added Cairo::FontOptions#variations * Added Cairo::FontOptions#variations= Release 1.15.12 (2018-03-14) Kouhei Sutou ============================================================ Improvements ------------ * Re-enabled tests that need Poppler. [GitHub#51][Patch by Mamoru TASAKA] * Windows: Added Ruby 2.5 support. [GitHub#52][Reported by Andy Meneely] Thanks ------ * Mamoru TASAKA * Andy Meneely Release 1.15.11 (2017-12-14) Kouhei Sutou ============================================================ Improvements ------------ * Added cairo 1.15.10 support. * Added Cairo::SVGUnit * Added Cairo::SVGSurface#document_unit * Added Cairo::SVGSurface#document_unit= * Added Cairo::MIMEType::CCITT_FAX * Added Cairo::MIMEType::CCITT_FAX_PARAMS * Added Cairo::MIMEType::EPS * Added Cairo::MIMEType::EPS_PARAMS * test: Updated expected value for cairo 1.15. [GitHub#50][Reported by Mamoru TASAKA] * Windows: Updated bundled libraries: * libpng: 1.6.32 -> 1.6.34 * libxml2: 2.9.6 -> 2.9.7 * cairo: 1.15.8 -> 1.15.10 Thanks ------ * Mamoru TASAKA Release 1.15.10 (2017-10-15) Kouhei Sutou ============================================================ Improvements ------------ * Windows: Ensure setting PATH environment variable. * Added cairo 1.15.8 support. * Windows: Updated bundled libraries: * libpng: 1.6.29 -> 1.6.32 * freetype: 2.9.4 -> 2.9.6 * fontconfig: 2.12.1 -> 2.12.4 * cairo: 1.15.4 -> 1.15.8 Release 1.15.9 (2017-06-03) Kouhei Sutou =========================================================== Improvements ------------ * Supported RubyInstaller2. [GitHub#47][Reported by PLURIX] Thanks ------ * PLURIX Release 1.15.8 (2017-05-29) Kouhei Sutou =========================================================== Improvements ------------ * Added Cairo::FreeTypeFotnFace. [GitHub#45][Patch by Stafford Brunk] * Windows: Supported Ruby 2.4. [ruby-list:50525][Reported by 5.5] * Windows: Supported MSYS2. * Windows: Updated bundled libraries: * zlib: 1.2.8 -> 1.2.11 Thanks ------ * Stafford Brunk * 5.5 Release 1.15.7 (2017-05-01) Kouhei Sutou =========================================================== Fixes ----- * Windows: Fixed zlib version. We should use the same version as Ruby Installer. Ruby Installer uses zlib 1.2.8. [GitHub#47][Reported by jjgh] Thanks ------ * jigh Release 1.15.6 (2017-04-27) Kouhei Sutou =========================================================== Improvements ------------ * Added Cairo::Context#refrence_count. * Windows: Updated bundled libraries: * zlib: 1.2.10 -> 1.2.11 * libpng: 1.6.27 -> 1.6.29 * FreeType: 2.7 -> 2.7.1 * Used native-package-installer gem. Release 1.15.5 (2017-01-14) Kouhei Sutou =========================================================== Improvements ------------ * Windows: Applied the patch at https://bugs.freedesktop.org/show_bug.cgi?id=99054 that fixes unexpected assertion failure in win32 surface. Release 1.15.4 (2017-01-07) Kouhei Sutou =========================================================== Improvements ------------ * Supported cairo 1.15.4: * Added Cairo::PNGError. * Added Cairo::FreeTypeError. * Added Cairo::Win32GDIError. * Added Cairo::TagError. * Added Cairo::Tag::DEST. * Added Cairo::Tag::LINK. * Added Cairo::Context#tag. * Added Cairo::Context#begin_tag. * Added Cairo::Context#end_tag. * Added Cairo::PDFOutlineFlags. * Added Cairo::PDFOutline. * Added Cairo::PDFSurface#add_outline. * Added Cairo::PDFMetadata. * Added Cairo::PDFSurface#set_metadata. * Added Cairo::PDFSurface#page_label=. * Added Cairo::PDFSurface#set_thumbnail_size. Release 1.15.3 (2016-11-15) Kouhei Sutou =========================================================== Improvements ------------ * Changed Cairo::FontOptions#== behavior to value equality check from object equality check. * Windows: Supported Ruby 2.4. * Windows: Updated bundled libpng. * Windows: Updated bundled freetype. * Windows: Updated bundled libxml. * Windows: Updated bundled fontconfig. * Windows: Updated bundled pixman. * Made Cairo::ImageSurface GC friendly with Ruby 2.4. * Cairo::SVGSurface: Accepted nil as filename. [GitHub#43][Reported by Andy Meneely] * Cairo::PSSurface: Accepted nil as filename. * Cairo::PDFSurface: Accepted nil as filename. Release 1.15.2 (2016-04-02) Kouhei Sutou =========================================================== Improvements ------------ * Supported cairo 1.15.2. * Cairo::Win32Surface.new(hdc, format): Added. * Dropped Ruby 2.0 support. * Windows: Supported Ruby 2.3. Release 1.14.3 (2015-09-08) Kouhei Sutou =========================================================== Fixes ----- * Fixed run-time error on OS X. [shocker-ja:1270][Reported by Junichi Oya] Thanks ------ * Junichi Oya Release 1.14.2 (2015-09-06) Kouhei Sutou =========================================================== Improvements ------------ * Supported showing command execution result on failure. [GitHub#36][Reported by Paul McMahon] * Cairo::Region#each_rectangle: Added a convenience method. * Cairo::Region#rectangles: Added a convenience method. * Supported Pathname as output target for surface. [GitHub#37][Reported by scivola] * Exported rb_cairo_surface_check_status(). * Windows: Upgraded bundled libraries. Thanks ------ * Paul McMahon * scivola Release 1.14.1 (2014-12-23) Kouhei Sutou =========================================================== Windows users must upgrade. Non Windows users doesn't need to upgrade. Improvements ------------ * Upgraded bundled libraries for Windows. libpng is upgraded to 1.6.16 from 1.6.14. libpng 1.6.14 has vulnerability. Release 1.14.0 (2014-11-24) Kouhei Sutou =========================================================== Improvements ------------ * Supported integration with ffi gem. [GitHub#20][Patch by Patrick Hanevold] * Supported cairo 1.14.0. [GitHub#24][GitHub#25][GitHub#28][GitHub#30][Patch by Hiroshi Hatake] * Added libstdc++-6.dll into gem for Windows. Fixes ----- * Fixed an build error on Cygwin. [GitHub#19][Reported by Patrick Hanevold][Patch by Masafumi Yokoyama] [ruby-gnome2-devel-en][Reported by Detlef Reichl] Thanks ------ * Patrick Hanevold * Masafumi Yokoyama * Hiroshi Hatake Release 1.12.9 (2014-04-05) Kouhei Sutou =========================================================== Improvements ------------ * Supported cocoa gem. [Patch by Patrick Hanevold] * Made Cairo::Rectangle based on cairo_rectangle_int_t. It improves Ruby/GDK3 integration. * windows: Dropped binary packages support for Ruby 1.9.3. Fixes ----- * Fixed a bug that Cairo::Context isn't GC-ed without explicit Cairo::Context#destroy. [ruby-gnome2-devel-en][Reported by Detlef Reichl] Thanks ------ * Patrick Hanevold * Detlef Reichl Release 1.12.8 (2013-12-23) Kouhei Sutou =========================================================== Fixes ----- * Bundled missing libwinpthread-1.dll into gem for Windows. [Reported by Masafumi Yokoyama] Thanks ------ * Masafumi Yokoyama Release 1.12.7 (2013-12-23) Kouhei Sutou =========================================================== Improvements ------------ * Added paper sizes of ISO B series and JIS B series. [Patch by 5.5] * Added Windows binary for Ruby 2.1.0. * Updated bundled cairo to 1.12.16 from 1.12.14 for Windows. Fixes ----- * Fixed a bug that Cairo::ImageSurface.new(cloned_data, ...) changes both the original data and the cloned data. [Patch by Naoyuki Hirayama] Thanks ------ * 5.5 * Naoyuki Hirayama Release 1.12.6 (2013-05-24) Kouhei Sutou =========================================================== Improvements ------------ * Supported Windows XP again. [ruby-list:49392][Reported by 5.5] [ruby-list:49401][Researched by myokoym] Thanks ------ * 5.5 * myokoym Release 1.12.5 (2013-05-18) Kouhei Sutou =========================================================== Improvements ------------ * Updated bundled cairo binary for Windows to 1.12.14. Release 1.12.4 (2013-03-11) Kouhei Sutou =========================================================== Improvements ------------ * Added Windows binary for Ruby 2.0.0. Release 1.12.3 (2012-12-04) Kouhei Sutou =========================================================== Improvements ------------ * Supported Ruby 2.0.0. [Reported by tmtms] * Supported auto native package install by Homebrew and MacPorts. Thanks ------ * tmtms Release 1.12.2 (2012-06-03) Kouhei Sutou =========================================================== Improvements ------------ * Added Cairo::Device.supported?. [GitHub#11] [Reported by Cédric Boutillier] * Added Cairo::Device.gl_texture_supported?. * Added Cairo::Surface.supported?. * Defined all surfaces even if a surface isn't available. Use Cairo::Surface.XXX_supported? method to check surface availability. * Added Cairo::Pattern.xxx_supported?. [GitHub#12] [Reported by Mamoru Tasaka] * [experimental] Supported auto native package install. Thanks ------ * Cédric Boutillier * Mamoru Tasaka Release 1.12.1 (2012-03-31) Kouhei Sutou =========================================================== Improvements ------------ * Re-supported cairo < 1.10.0. [ruby-gnome2-devel-en] Help me install my own program [Eric C.] Fixes ----- * Fixed a problem that an unresolved symbol is referenced. Thanks ------ * Eric C. Release 1.12.0 (2012-03-25) Kouhei Sutou =========================================================== Improvements ------------ * Supported cairo 1.12.0. * Cairo::Surface#supported_mime_type? * Cairo::Surface#create_similar_image * Cairo::Surface#map_to_image * Cairo::Surface#unmap_to_image * Cairo::RecordingSurface#extents * Cairo::MeshPattern * Cairo::RasterSourcePattern * Cairo::MimeType::UNIQUE_ID * Supported glesv2 surface. Fixes ----- * Fixed a bug that Cairo::HINT_METRICS_ON can't be specified. #8 [Vasily Fedoseyev] Thanks ------ * Vasily Fedoseyev Release 1.10.2 (2011-11-20) Kouhei Sutou =========================================================== Fixes ----- * Added missing pkg-config dependency. #8 [Will Bryant] Thanks ------ * Will Bryant Release 1.10.1 (2011-10-12) Kouhei Sutou =========================================================== Features -------- * Accepted Cairo::EXTEND_PAD as extend value. * Suppressed a warning. [Stefan Salewski] * Bound CAIRO_SURFACE_TYPE_XLIB and CAIRO_SURFACE_TYPE_XCB. * Supported cairo 1.10.2. * Fixed recording surface test. #4 [Mamoru Tasaka] * AcceptedCairo::OPERATOR_HSL_LUMINDSITY as operator value. #6 [Matt Bramlage] * Suppressed warnings on Windows. [Nikolai Weibull] * Added --without-vendor-override options to extconf.rb. [Nikolai Weibull] Thanks ------ * Stefan Salewski * Mamoru Tasaka * Matt Bramlage * Nikolai Weibull Release 1.10.0 (2010-09-12) Kouhei Sutou =========================================================== Features -------- * Support cairo 1.10.0. Release 1.8.5 (2010-08-28) Kouhei Sutou ========================================================== Fixes ----- * Fix build system. (patch by kimura watasu and suggested by OBATA Akio) * Fix Windows gem. (reported by Dominic Sisneros, supported by Masaya TARUI) Thanks ------ * Dominic Sisneros * kimura wataru * OBATA Akio * Masaya TARUI Release 1.8.3 (2010-08-26) Kouhei Sutou ========================================================== Features -------- * Support cairo 1.8.10. * Support Ruby 1.9.2. (reported by Tasuku SUENAGA and kimura wataru) * Fix RGV -> HSV conversion. (patch by Yuta Taniguchi) * Support Cairo::Color as Hash key. Thanks ------ * Yuta Taniguchi * Tasuku SUENAGA * kimura wataru Release 1.8.1 (2009-12-13) Kouhei Sutou ========================================================== Features -------- * Support cairo 1.8.8. * Improve auto .pc detection. Release 1.8.0 (2008-09-26) Kouhei Sutou ========================================================== Features -------- * Support cairo 1.8.0. * Resupport cairo 1.2.x. (reported by Yusuke ENDOH) Release 1.7.0 (2008-08-17) Kouhei Sutou ========================================================== Features -------- * Support cairo 1.7.4. * Add new methods: * Cairo::Context#destroy * Cairo::Surface#destroy * Cairo.satisfied_version? * Resupport ruby 1.9. (suggested by Paul van Tilburg) * Fix README. (suggested by Davide Rambaldi) Release 1.6.3 (2008-07-19) Kouhei Sutou ========================================================== Features -------- * Fix build failure on Debian GNU/Linux. (reported by James Healy) * Fix GC failure with Ruby 1.8.7. (reported by James Healy) * Improve building on MacOS X. (suggested by Carsten Bormann) * Fix install location of cairo.so. (suggested by OBATA Akio) Release 1.6.2 (2008-06-14) Kouhei Sutou ========================================================== Features -------- * Fix build failure on MacOS X. * Fix build failure on 64bit Linux. * Fix build failure with old Ruby. * Fix build failure with Ruby 1.9. Release 1.6.1 (2008-04-24) Kouhei Sutou ========================================================== Features -------- * Fix Quartz related bugs. (thanks to kimura wataru) * Support PKG_CONFIG_LIBDIR. (thanks to OBATA Akio) * Support RubyGems for mswin32. Release 1.6.0 (2008-04-11) Kouhei Sutou ========================================================== Features -------- * Support cairo 1.6.0. * Improve Quartz surface support. (thanks to kimura wataru, OBATA Akio) * Support Cairo::Win32PrintingSurface. * Support Cairo::QuartzImageSurface. * Support ruby 1.9.0. * Add Cairo::Paper. * Improve size specification of Cairo::PSSurface, Cairo::PDFSurface, Cairo::SVGSurface. Release 1.5.1 (2008-01-11) Kouhei Sutou ========================================================== Features -------- * Support Quartz surface. * Fix a wrong type conversion bug. (Binzo) * Fix a memory leak bug. (Binzo) * Support ruby 1.9.0. (Paul van Tilburg) * Fix typos. (NANKI Haruo) * Rename Cairo::WIN32Surface to Cairo::Win32Surface * Cairo::WIN32Surface is still available for backward compatibility but don't use in newly written code. Release 1.5.0 (2007-05-27) Kouhei Sutou ========================================================== Many API improvement. Features -------- * Support Cairo::Surface.new with block. * Support RubyGems. * Add experimental API Cairo::Context#pseudo_blur. (API may be changed.) * Fix strange Cairo::Context#push_group and Cairo::Context#pop_group behaviour. * Fix Cairo::Context::Path#map_path_onto. * Add high-level color interface. (Cairo::Color) * Improve color related API. For example: From: context.set_source_rgb(1, 0, 0) To: context.set_source_color(:red) * Support color type conversion between RGB, CMYK and HSV. * Many default color definitions. * Support path creation using Cairo::Path without Cairo::Context. * Improve constant value specify API. For example: From: Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, 100, 100) To: Cairo::ImageSurface.new(:argb32, 100, 100) * Support win32 surface. (Yoshinao Muramatsu) Release 1.4.1 (2007-03-10 Kouhei Sutou ) ========================================================== Features -------- * Add missing pkg-config.rb. Release 1.4.0 (2007-03-06 Kouhei Sutou ) ========================================================== Features -------- * All cairo 1.4.0 API are implemented. Release 1.2.0 (2006-07-01 Kouhei Sutou ) ========================================================== Features -------- * All cairo 1.2.0 API are implemented. * SVG surface is supported. Release 1.0.0 (2005-10-16 Kouhei Sutou ) ========================================================== Features -------- * All cairo 1.0.0 API are implemented. * PS/PDF surfaces are supported. rcairo-1.16.6/README.rdoc000066400000000000000000000035631370612400100146730ustar00rootroot00000000000000= README == Name rcairo == Description Ruby bindings for cairo // cairo extension for Ruby https://cairographics.org/ == Dependencies * ruby >= 2.2.1 * cairo >= 1.2.0 == Install === Package This way is recommended. # gem install cairo === Self build For experimental users. Add the following to your Gemfile: gem "cairo", github: "rcairo/rcairo" Then run the following command: % bundle install == Documents * Reference manual: https://rcairo.github.io/doc/ * Repository of the reference manual: https://github.com/rcairo/doc * An article for rcairo on Rubyst Magazine a.k.a. RubiMa (in Japanese): https://magazine.rubyist.net/articles/0019/0019-cairo.html == Source There is the rcairo repository at GitHub: https://github.com/rcairo/rcairo == Mailing list If you have trouble with cairo or rcairo, or you have some ideas for how it could be improved, please feel free to send a message to the cairo mailinglist at cairo@cairographics.org , which is archived at http://cairographics.org/cgi-bin/mailman/listinfo/cairo == Thanks * Yoshinao Muramatsu: win32 surface support patch. * NANKI Haruo: some bug fix patches. * Paul van Tilburg: * some patches that support ruby 1.9. * some suggestions. * Binzo: some bug reports and fixed that. * kimura wataru: * some advices for RubyCocoa. * reports a bug. * OBATA Akio: * reports a bug. * some suggestions. * James Healy: reports bugs. * Carsten Bormann: A suggestion. * Davide Rambaldi: A suggestion. * Yusuke ENDOH: reports a bug. * Yuta Taniguchi: a bug fix patch. * kimura wataru: * reports a bug. * some patches. * Masayas TARUI: * Windows support. * Stefan Salewski: reports a bug. * Mamoru Tasaka: reports bugs. * Nikolai Weibull: reports problems. * Will Bryant: reports a bug. * Vasily Fedoseyev: fixes a bug. * Eric C.: reports a bug. * Cédric Boutillier: reports a bug. * tmtms: reports a bug. rcairo-1.16.6/Rakefile000066400000000000000000000053541370612400100145320ustar00rootroot00000000000000# -*- coding: utf-8; mode: ruby -*- require "rubygems" require "bundler/gem_helper" require "packnga" base_dir = File.join(File.dirname(__FILE__)) cairo_ext_dir = File.join(base_dir, "ext", "cairo") cairo_lib_dir = File.join(base_dir, "lib") $LOAD_PATH.unshift(cairo_ext_dir) $LOAD_PATH.unshift(cairo_lib_dir) ENV["RUBYLIB"] = "#{cairo_lib_dir}:#{cairo_ext_dir}:#{ENV['RUBYLIB']}" helper = Bundler::GemHelper.new(base_dir) helper.install spec = helper.gemspec Packnga::DocumentTask.new(spec) do |task| task.original_language = "en" task.translate_languages = ["ja"] end Packnga::ReleaseTask.new(spec) do |task| end # for releasing desc "Release to cairographics.org" task :dist do sh "./dist.sh", spec.version.to_s end # for documentation langs = [ ["en", "English"], ["ja", "日本語"], ] rcairo_doc_dir = File.expand_path(File.join(base_dir, "..", "rcairo-doc")) rcairo_doc_css = File.join(rcairo_doc_dir, "doc.css") rcairo_doc_title_image = File.join(rcairo_doc_dir, "rcairo-title.png") doc_dir = "doc" doc_index = File.join(doc_dir, "index.html") doc_css = File.join(doc_dir, "doc.css") doc_title_image = File.join(doc_dir, "rcairo-title.png") task(doc_index).instance_variable_get("@actions").clear file doc_dir do mkdir_p doc_dir end file doc_title_image => [doc_dir, rcairo_doc_title_image] do cp rcairo_doc_title_image, doc_title_image end file doc_css => [rcairo_doc_css, doc_title_image] do cp rcairo_doc_css, doc_css end file doc_index => doc_css do File.open(doc_index, "w") do |index| index << <<-EOH rcairo reference manual

rcairo reference manual

    EOH langs.each do |lang, native_lang| index << <<-EOH
  • #{native_lang}
  • EOH end index << <<-EOH

    Up

    EOH end end langs.each do |lang,| lang_doc_dir = File.join(doc_dir, lang) directory lang_doc_dir lang_doc_index = File.join(lang_doc_dir, "index.html") file doc_index => lang_doc_index file lang_doc_index => [lang_doc_dir] do lang_doc_dir = File.join(doc_dir, lang) lang_rcairo_doc_dir = File.join(rcairo_doc_dir, lang) cp Dir[File.join(lang_rcairo_doc_dir, "*.rd")], lang_doc_dir ruby File.join(rcairo_doc_dir, "update-html.rb"), lang_doc_dir rm Dir[File.join(lang_doc_dir, "*.{rd,rdc,rbl}")] end end file "Makefile" => ["extconf.rb", "ext/cairo/extconf.rb"] do ruby("extconf.rb") end desc "Configure" task :configure => "Makefile" desc "Run test" task :test => :configure do ruby("test/run-test.rb") end task :default => :test rcairo-1.16.6/cairo.gemspec000066400000000000000000000037321370612400100155250ustar00rootroot00000000000000# -*- mode: ruby; coding: utf-8 -*- base_dir = File.dirname(__FILE__) cairo_ext_dir = File.join(base_dir, "ext", "cairo") guess_rcairo_version = lambda do |cairo_ext_dir| version = {} File.open(File.join(cairo_ext_dir, "rb_cairo.h"), "r:utf-8") do |rb_cairo_h| rb_cairo_h.each_line do |line| case line when /\A#define RB_CAIRO_VERSION_([A-Z]+) (\d+)/ version[$1.downcase] = $2 end end end [version["major"], version["minor"], version["micro"]].join(".") end Gem::Specification.new do |s| s.name = "cairo" s.version = guess_rcairo_version.call(cairo_ext_dir) s.authors = ["Kouhei Sutou"] s.email = ["kou@cozmixng.org"] s.summary = "Ruby bindings for cairo" s.description = "Ruby bindings for cairo" s.homepage = "https://rcairo.github.io/" s.licenses = ["Ruby", "GPL-2.0-or-later"] s.require_paths = ["lib"] s.extensions = ["ext/cairo/extconf.rb"] s.metadata = { "bug_tracker_uri" => "https://github.com/rcairo/rcairo/issues", "changelog_uri" => "https://github.com/rcairo/rcairo/blob/master/NEWS", "documentation_uri" => "https://rcairo.github.io/doc/", "mailing_list_uri" => "https://cairographics.org/cgi-bin/mailman/listinfo/cairo", "source_code_uri" => "https://github.com/rcairo/rcairo", } s.required_ruby_version = ">= 2.2.1" s.requirements << "cairo >= 1.2.0" s.files = ["AUTHORS", "COPYING", "GPL", "Gemfile", "NEWS", "README.rdoc"] s.files += ["Rakefile"] s.files += Dir.glob("{lib,samples}/**/*.rb") s.files += Dir.glob("ext/**/{*.def,depend,*.rb,*.c,*.h}") s.test_files = Dir.glob("test/**/*.rb") s.extra_rdoc_files = ["README.rdoc"] s.add_runtime_dependency("pkg-config", ">= 1.2.2") s.add_runtime_dependency("native-package-installer", ">= 1.0.3") s.add_development_dependency("bundler") s.add_development_dependency("test-unit") s.add_development_dependency("packnga") s.add_development_dependency("poppler", ">= 3.1.1") s.metadata["msys2_mingw_dependencies"] = "cairo" end rcairo-1.16.6/dist.sh000077500000000000000000000007631370612400100143660ustar00rootroot00000000000000#!/bin/sh if [ $# = 0 ]; then echo "usage: $0 VERSION" echo "e.g. $0 1.6.0" exit fi VERSION=$1 TAG="v$VERSION" dest=annarchy.freedesktop.org:/srv/cairo.freedesktop.org/www/releases/ base=rcairo-$VERSION tgz=$base.tar.gz mkdir -p tmp git clone git@github.com:rcairo/rcairo.git tmp/$base cd tmp/$base git checkout $TAG rm -rf .git cd ../.. cp -rp doc tmp/$base/ tar cvfz $tgz -C tmp $base md5sum $tgz > $tgz.md5 sha1sum $tgz > $tgz.sha1 rm -rf tmp scp $tgz $tgz.md5 $tgz.sha1 $dest rcairo-1.16.6/docker-compose.yml000066400000000000000000000037221370612400100165170ustar00rootroot00000000000000version: "3.5" services: arch-linux: build: context: . dockerfile: dockerfiles/arch-linux.dockerfile volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh centos-8: build: context: . dockerfile: dockerfiles/centos.dockerfile args: CENTOS_VERSION: "8" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh debian-10: build: context: . dockerfile: dockerfiles/debian.dockerfile args: DEBIAN_VERSION: "10" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh fedora-rawhide: build: context: . dockerfile: dockerfiles/fedora.dockerfile args: FEDORA_VERSION: rawhide volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh ruby-2.5: build: context: . dockerfile: dockerfiles/ruby.dockerfile args: RUBY_VERSION: "2.5" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh ruby-2.6: build: context: . dockerfile: dockerfiles/ruby.dockerfile args: RUBY_VERSION: "2.6" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh ruby-2.7: build: context: . dockerfile: dockerfiles/ruby.dockerfile args: RUBY_VERSION: "2.7" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh ubuntu-18.04: build: context: . dockerfile: dockerfiles/ubuntu.dockerfile args: UBUNTU_VERSION: "18.04" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh ubuntu-20.04: build: context: . dockerfile: dockerfiles/ubuntu.dockerfile args: UBUNTU_VERSION: "20.04" volumes: - .:/rcairo:delegated command: /rcairo/dockerfiles/run-test.sh rcairo-1.16.6/dockerfiles/000077500000000000000000000000001370612400100153505ustar00rootroot00000000000000rcairo-1.16.6/dockerfiles/arch-linux.dockerfile000066400000000000000000000010211370612400100214450ustar00rootroot00000000000000FROM archlinux/base RUN \ pacman --sync --noconfirm --refresh && \ pacman --sync --noconfirm \ gcc \ make \ ruby \ sudo \ which RUN \ gem install --no-user-install \ bundler \ rake RUN \ useradd --user-group --create-home rcairo RUN \ echo "rcairo ALL=(ALL:ALL) NOPASSWD:ALL" | \ EDITOR=tee visudo -f /etc/sudoers.d/rcairo RUN \ gem install --no-user-install cairo && \ gem install --no-user-install \ packnga \ poppler \ test-unit USER rcairo WORKDIR /home/rcairo rcairo-1.16.6/dockerfiles/centos.dockerfile000066400000000000000000000010271370612400100206740ustar00rootroot00000000000000ARG CENTOS_VERSION FROM centos:${CENTOS_VERSION} RUN \ dnf install -y \ epel-release && \ dnf install -y \ gcc \ gcc-c++ \ make \ redhat-rpm-config \ ruby-devel \ sudo \ which RUN \ gem install \ bundler \ rake RUN \ useradd --user-group --create-home rcairo RUN \ echo "rcairo ALL=(ALL:ALL) NOPASSWD:ALL" | \ EDITOR=tee visudo -f /etc/sudoers.d/rcairo RUN \ gem install cairo && \ gem install \ packnga \ poppler \ test-unit USER rcairo WORKDIR /home/rcairo rcairo-1.16.6/dockerfiles/debian.dockerfile000066400000000000000000000010641370612400100206240ustar00rootroot00000000000000ARG DEBIAN_VERSION FROM debian:${DEBIAN_VERSION} RUN \ echo "debconf debconf/frontend select Noninteractive" | \ debconf-set-selections RUN \ apt update && \ apt install -y \ g++ \ gcc \ make \ ruby-dev \ sudo RUN \ gem install \ bundler \ rake RUN \ useradd --user-group --create-home rcairo RUN \ echo "rcairo ALL=(ALL:ALL) NOPASSWD:ALL" | \ EDITOR=tee visudo -f /etc/sudoers.d/rcairo RUN \ gem install cairo && \ gem install \ packnga \ poppler \ test-unit USER rcairo WORKDIR /home/rcairo rcairo-1.16.6/dockerfiles/fedora.dockerfile000066400000000000000000000007561370612400100206510ustar00rootroot00000000000000ARG FEDORA_VERSION FROM fedora:${FEDORA_VERSION} RUN \ dnf install -y \ gcc \ gcc-c++ \ make \ redhat-rpm-config \ ruby-devel \ sudo \ which RUN \ gem install \ bundler \ rake RUN \ useradd --user-group --create-home rcairo RUN \ echo "rcairo ALL=(ALL:ALL) NOPASSWD:ALL" | \ EDITOR=tee visudo -f /etc/sudoers.d/rcairo RUN \ gem install cairo && \ gem install \ packnga \ poppler \ test-unit USER rcairo WORKDIR /home/rcairo rcairo-1.16.6/dockerfiles/ruby.dockerfile000066400000000000000000000005641370612400100203670ustar00rootroot00000000000000ARG RUBY_VERSION FROM ruby:${RUBY_VERSION} RUN \ apt update && \ apt install -y \ sudo RUN \ useradd --user-group --create-home rcairo RUN \ echo "rcairo ALL=(ALL:ALL) NOPASSWD:ALL" | \ EDITOR=tee visudo -f /etc/sudoers.d/rcairo RUN \ gem install cairo && \ gem install \ packnga \ poppler \ test-unit USER rcairo WORKDIR /home/rcairo rcairo-1.16.6/dockerfiles/run-test.sh000077500000000000000000000003271370612400100174720ustar00rootroot00000000000000#!/bin/bash set -eux cp -a /rcairo/ rcairo.source pushd rcairo.source bundle install popd mkdir -p rcairo.build pushd rcairo.build ruby /rcairo/extconf.rb --enable-debug-build make /rcairo/test/run-test.rb "$@" rcairo-1.16.6/dockerfiles/ubuntu.dockerfile000066400000000000000000000010641370612400100207240ustar00rootroot00000000000000ARG UBUNTU_VERSION FROM ubuntu:${UBUNTU_VERSION} RUN \ echo "debconf debconf/frontend select Noninteractive" | \ debconf-set-selections RUN \ apt update && \ apt install -y \ g++ \ gcc \ make \ ruby-dev \ sudo RUN \ gem install \ bundler \ rake RUN \ useradd --user-group --create-home rcairo RUN \ echo "rcairo ALL=(ALL:ALL) NOPASSWD:ALL" | \ EDITOR=tee visudo -f /etc/sudoers.d/rcairo RUN \ gem install cairo && \ gem install \ packnga \ poppler \ test-unit USER rcairo WORKDIR /home/rcairo rcairo-1.16.6/ext/000077500000000000000000000000001370612400100136565ustar00rootroot00000000000000rcairo-1.16.6/ext/cairo/000077500000000000000000000000001370612400100147535ustar00rootroot00000000000000rcairo-1.16.6/ext/cairo/cairo.def000066400000000000000000000117041370612400100165330ustar00rootroot00000000000000EXPORTS Init_cairo rb_mCairo DATA rb_cCairo_Context DATA rb_cCairo_Rectangle DATA rb_cCairo_Path DATA rb_cCairo_PathData DATA rb_cCairo_PathMoveTo DATA rb_cCairo_PathLineTo DATA rb_cCairo_PathCurveTo DATA rb_cCairo_PathClosePath DATA rb_cCairo_Matrix DATA rb_cCairo_Region DATA rb_cCairo_Pattern DATA rb_cCairo_SolidPattern DATA rb_cCairo_SurfacePattern DATA rb_cCairo_GradientPattern DATA rb_cCairo_LinearPattern DATA rb_cCairo_RadialPattern DATA rb_cCairo_MeshPattern DATA rb_cCairo_RasterSourcePattern DATA rb_cCairo_FontFace DATA rb_cCairo_FreeTypeFontFace DATA rb_cCairo_ToyFontFace DATA rb_cCairo_UserFontFace DATA rb_cCairo_UserFontFace_TextToGlyphsData DATA rb_cCairo_FontExtents DATA rb_cCairo_FontOptions DATA rb_cCairo_ScaledFont DATA rb_cCairo_TextExtents DATA rb_cCairo_Glyph DATA rb_cCairo_TextCluster DATA rb_cCairo_Surface DATA rb_cCairo_ImageSurface DATA rb_cCairo_PDFSurface DATA rb_cCairo_PSSurface DATA rb_cCairo_SVGSurface DATA rb_cCairo_Win32Surface DATA rb_cCairo_Win32PrintingSurface DATA rb_cCairo_QuartzSurface DATA rb_cCairo_QuartzImageSurface DATA rb_cCairo_ScriptSurface DATA rb_cCairo_QtSurface DATA rb_cCairo_RecordingSurface DATA rb_cCairo_VGSurface DATA rb_cCairo_GLSurface DATA rb_cCairo_GLTextureSurface DATA rb_cCairo_DRMSurface DATA rb_cCairo_TeeSurface DATA rb_cCairo_XMLSurface DATA rb_cCairo_SubSurface DATA rb_cCairo_CoglSurface DATA rb_cCairo_Device DATA rb_cCairo_DRMDevice DATA rb_cCairo_GLDevice DATA rb_cCairo_ScriptDevice DATA rb_cCairo_XCBDevice DATA rb_cCairo_XlibDevice DATA rb_cCairo_XMLDevice DATA rb_cCairo_CoglDevice DATA rb_cCairo_Win32Device DATA rb_mCairo_Operator DATA rb_mCairo_Antialias DATA rb_mCairo_FillRule DATA rb_mCairo_LineCap DATA rb_mCairo_LineJoin DATA rb_mCairo_FontSlant DATA rb_mCairo_FontWeight DATA rb_mCairo_SubpixelOrder DATA rb_mCairo_HintStyle DATA rb_mCairo_HintMetrics DATA rb_mCairo_PathDataType DATA rb_mCairo_Content DATA rb_mCairo_Format DATA rb_mCairo_Extend DATA rb_mCairo_Filter DATA rb_mCairo_SVGVersion DATA rb_mCairo_PSLevel DATA rb_mCairo_PDFVersion DATA rb_mCairo_TextClusterFlag DATA rb_mCairo_ScriptMode DATA rb_mCairo_MimeType DATA rb_mCairo_RegionOverlap DATA rb_mCairo_PDFOutlineFlags DATA rb_mCairo_PDFMetadata DATA rb_mCairo_SVGUnit DATA rb_mCairo_Color DATA rb_cCairo_Color_Base DATA rb_cCairo_Paper DATA rb_cairo_context_from_ruby_object rb_cairo_context_to_ruby_object rb_cairo_path_from_ruby_object rb_cairo_path_to_ruby_object rb_cairo_matrix_from_ruby_object rb_cairo_matrix_to_ruby_object rb_cairo_region_from_ruby_object rb_cairo_region_to_ruby_object rb_cairo_pattern_from_ruby_object rb_cairo_pattern_to_ruby_object rb_cairo_font_face_from_ruby_object rb_cairo_font_face_to_ruby_object rb_cairo_font_extents_from_ruby_object rb_cairo_font_extents_to_ruby_object rb_cairo_font_options_to_ruby_object rb_cairo_font_options_from_ruby_object rb_cairo_scaled_font_to_ruby_object rb_cairo_scaled_font_from_ruby_object rb_cairo_text_extents_from_ruby_object rb_cairo_text_extents_to_ruby_object rb_cairo_glyph_from_ruby_object rb_cairo_glyph_to_ruby_object rb_cairo_text_cluster_from_ruby_object rb_cairo_text_cluster_to_ruby_object rb_cairo_surface_from_ruby_object rb_cairo_surface_to_ruby_object rb_cairo_surface_to_ruby_object_with_destroy rb_cairo_device_from_ruby_object rb_cairo_device_to_ruby_object rb_cairo_operator_from_ruby_object rb_cairo_antialias_from_ruby_object rb_cairo_fill_rule_from_ruby_object rb_cairo_line_cap_from_ruby_object rb_cairo_line_join_from_ruby_object rb_cairo_font_slant_from_ruby_object rb_cairo_font_weight_from_ruby_object rb_cairo_subpixel_order_from_ruby_object rb_cairo_hint_style_from_ruby_object rb_cairo_hint_metrics_from_ruby_object rb_cairo_path_data_type_from_ruby_object rb_cairo_content_from_ruby_object rb_cairo_format_from_ruby_object rb_cairo_extend_from_ruby_object rb_cairo_filter_from_ruby_object rb_cairo_svg_version_from_ruby_object rb_cairo_ps_level_from_ruby_object rb_cairo_pdf_version_from_ruby_object rb_cairo_text_cluster_flags_from_ruby_object rb_cairo_check_status rb_cairo_surface_check_status rcairo-1.16.6/ext/cairo/depend000066400000000000000000000001421370612400100161320ustar00rootroot00000000000000install-so: install-headers install-headers: $(INSTALL_DATA) $(srcdir)/rb_cairo.h $(RUBYARCHDIR) rcairo-1.16.6/ext/cairo/extconf.rb000077500000000000000000000045341370612400100167570ustar00rootroot00000000000000#!/usr/bin/env ruby # vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 : require 'pathname' require 'English' require 'mkmf' require 'fileutils' require "pkg-config" require "native-package-installer" checking_for(checking_message("GCC")) do if macro_defined?("__GNUC__", "") $CFLAGS += ' -Wall' true else false end end package = "cairo" module_name = "cairo" major, minor, micro = 1, 2, 0 checking_for(checking_message("Homebrew")) do platform = NativePackageInstaller::Platform.detect if platform.is_a?(NativePackageInstaller::Platform::Homebrew) libffi_prefix = `brew --prefix libffi`.chomp PKGConfig.add_path("#{libffi_prefix}/lib/pkgconfig") true else false end end def required_pkg_config_package(package_info, native_package_info=nil) if package_info.is_a?(Array) required_package_info = package_info else required_package_info = [package_info] end return true if PKGConfig.have_package(*required_package_info) native_package_info ||= {} return false unless NativePackageInstaller.install(native_package_info) PKGConfig.have_package(*required_package_info) end unless required_pkg_config_package([package, major, minor, micro], :arch_linux => "cairo", :debian => "libcairo2-dev", :homebrew => "cairo", :macports => "cairo", :msys2 => "cairo", :redhat => "cairo-devel") exit(false) end PKGConfig.have_package("cairo-ft") checking_for(checking_message("macOS")) do case RUBY_PLATFORM when /darwin/ if have_macro("CAIRO_HAS_QUARTZ_SURFACE", ["cairo.h"]) checking_for("RubyCocoa") do begin require "osx/cocoa" $defs << "-DHAVE_RUBY_COCOA" $DLDFLAGS << " -Wl,-framework,RubyCocoa" true rescue LoadError false end end end true else false end end $defs << "-DRB_CAIRO_COMPILATION" have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h") have_header("ruby/io.h") unless have_macro("HAVE_RUBY_IO_H", "ruby.h") have_func("rb_errinfo", "ruby.h") have_func("rb_gc_adjust_memory_usage", "ruby.h") have_type("enum ruby_value_type", "ruby.h") create_makefile(module_name) rcairo-1.16.6/ext/cairo/rb_cairo.c000066400000000000000000000065021370612400100167020ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2009-12-13 11:27:45 $ * * Copyright 2006-2008 Kouhei Sutou * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_mCairo, rb_mCairo_Color, rb_cCairo_Color_Base, rb_cCairo_Paper; static ID id__add_one_arg_setter; void rb_cairo_def_setters (VALUE klass) { rb_funcall (rb_mCairo, id__add_one_arg_setter, 1, klass); } static VALUE rb_cairo_satisfied_version (int argc, VALUE *argv, VALUE self) { VALUE major, minor, micro; rb_scan_args (argc, argv, "21", &major, &minor, µ); if (NIL_P (micro)) micro = UINT2NUM (0); return CBOOL2RVAL (CAIRO_VERSION_MAJOR > NUM2UINT(major) || (CAIRO_VERSION_MAJOR == NUM2UINT(major) && CAIRO_VERSION_MINOR > NUM2UINT(minor)) || (CAIRO_VERSION_MAJOR == NUM2UINT(major) && CAIRO_VERSION_MINOR == NUM2UINT(minor) && CAIRO_VERSION_MICRO >= NUM2UINT(micro))); } void Init_cairo () { int major, minor, micro; id__add_one_arg_setter = rb_intern("__add_one_arg_setter"); rb_mCairo = rb_define_module ("Cairo"); rb_define_const (rb_mCairo, "BUILD_VERSION", rb_ary_new3 (3, INT2FIX (CAIRO_VERSION_MAJOR), INT2FIX (CAIRO_VERSION_MINOR), INT2FIX (CAIRO_VERSION_MICRO))); major = cairo_version () / 10000; minor = (cairo_version () % 10000) / 100; micro = cairo_version () % 100; rb_define_const (rb_mCairo, "VERSION", rb_ary_new3 (3, INT2FIX (major), INT2FIX (minor), INT2FIX (micro))); rb_define_const (rb_mCairo, "MAJOR_VERSION", INT2FIX (major)); rb_define_const (rb_mCairo, "MINOR_VERSION", INT2FIX (minor)); rb_define_const (rb_mCairo, "MICRO_VERSION", INT2FIX (micro)); rb_define_const (rb_mCairo, "BINDINGS_VERSION", rb_ary_new3 (4, INT2FIX (RB_CAIRO_VERSION_MAJOR), INT2FIX (RB_CAIRO_VERSION_MINOR), INT2FIX (RB_CAIRO_VERSION_MICRO), Qnil)); rb_define_module_function (rb_mCairo, "satisfied_version?", rb_cairo_satisfied_version, -1); rb_mCairo_Color = rb_const_get (rb_mCairo, rb_intern ("Color")); rb_cCairo_Color_Base = rb_const_get (rb_mCairo_Color, rb_intern ("Base")); rb_cCairo_Paper = rb_const_get (rb_mCairo, rb_intern ("Paper")); Init_cairo_private (); Init_cairo_io (); Init_cairo_constants (); Init_cairo_context (); Init_cairo_rectangle (); Init_cairo_path (); Init_cairo_matrix (); Init_cairo_region (); Init_cairo_device (); Init_cairo_surface (); Init_cairo_quartz_surface (); Init_cairo_exception (); Init_cairo_font (); Init_cairo_font_extents (); Init_cairo_font_options (); Init_cairo_scaled_font (); Init_cairo_text_extents (); Init_cairo_pattern (); Init_cairo_glyph (); Init_cairo_text_cluster (); } rcairo-1.16.6/ext/cairo/rb_cairo.h000066400000000000000000000350111370612400100167040ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-09-19 12:56:27 $ * * Copyright 2006-2020 Sutou Kouhei * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #ifndef RB_CAIRO_H #define RB_CAIRO_H #include #ifdef CAIRO_HAS_PS_SURFACE # include #endif #ifdef CAIRO_HAS_PDF_SURFACE # include #endif #ifdef CAIRO_HAS_SVG_SURFACE # include #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE # include #endif #define CAIRO_CHECK_VERSION(major, minor, micro) \ (CAIRO_VERSION_MAJOR > (major) || \ (CAIRO_VERSION_MAJOR == (major) && CAIRO_VERSION_MINOR > (minor)) || \ (CAIRO_VERSION_MAJOR == (major) && CAIRO_VERSION_MINOR == (minor) && \ CAIRO_VERSION_MICRO >= (micro))) #include "ruby.h" #if defined(__cplusplus) # define RB_CAIRO_BEGIN_DECLS extern "C" { # define RB_CAIRO_END_DECLS } #else # define RB_CAIRO_BEGIN_DECLS # define RB_CAIRO_END_DECLS #endif RB_CAIRO_BEGIN_DECLS #ifdef __WIN32__ # ifdef RB_CAIRO_COMPILATION # define RB_CAIRO_VAR extern __declspec(dllexport) # else # define RB_CAIRO_VAR extern __declspec(dllimport) # endif #else # define RB_CAIRO_VAR extern #endif #define RB_CAIRO_VERSION_MAJOR 1 #define RB_CAIRO_VERSION_MINOR 16 #define RB_CAIRO_VERSION_MICRO 6 RB_CAIRO_VAR VALUE rb_mCairo; RB_CAIRO_VAR VALUE rb_cCairo_Context; RB_CAIRO_VAR VALUE rb_cCairo_Rectangle; RB_CAIRO_VAR VALUE rb_cCairo_Point; RB_CAIRO_VAR VALUE rb_cCairo_Path; RB_CAIRO_VAR VALUE rb_cCairo_PathData; RB_CAIRO_VAR VALUE rb_cCairo_PathMoveTo; RB_CAIRO_VAR VALUE rb_cCairo_PathLineTo; RB_CAIRO_VAR VALUE rb_cCairo_PathCurveTo; RB_CAIRO_VAR VALUE rb_cCairo_PathClosePath; RB_CAIRO_VAR VALUE rb_cCairo_Matrix; RB_CAIRO_VAR VALUE rb_cCairo_Region; RB_CAIRO_VAR VALUE rb_cCairo_Pattern; RB_CAIRO_VAR VALUE rb_cCairo_SolidPattern; RB_CAIRO_VAR VALUE rb_cCairo_SurfacePattern; RB_CAIRO_VAR VALUE rb_cCairo_GradientPattern; RB_CAIRO_VAR VALUE rb_cCairo_LinearPattern; RB_CAIRO_VAR VALUE rb_cCairo_RadialPattern; RB_CAIRO_VAR VALUE rb_cCairo_MeshPattern; RB_CAIRO_VAR VALUE rb_cCairo_RasterSourcePattern; RB_CAIRO_VAR VALUE rb_cCairo_FontFace; RB_CAIRO_VAR VALUE rb_cCairo_FreeTypeFontFace; RB_CAIRO_VAR VALUE rb_cCairo_ToyFontFace; RB_CAIRO_VAR VALUE rb_cCairo_UserFontFace; RB_CAIRO_VAR VALUE rb_cCairo_UserFontFace_TextToGlyphsData; RB_CAIRO_VAR VALUE rb_cCairo_FontExtents; RB_CAIRO_VAR VALUE rb_cCairo_FontOptions; RB_CAIRO_VAR VALUE rb_cCairo_ScaledFont; RB_CAIRO_VAR VALUE rb_cCairo_TextExtents; RB_CAIRO_VAR VALUE rb_cCairo_Glyph; RB_CAIRO_VAR VALUE rb_cCairo_Surface; RB_CAIRO_VAR VALUE rb_cCairo_ImageSurface; RB_CAIRO_VAR VALUE rb_cCairo_PDFSurface; RB_CAIRO_VAR VALUE rb_cCairo_PSSurface; RB_CAIRO_VAR VALUE rb_cCairo_SVGSurface; RB_CAIRO_VAR VALUE rb_cCairo_Win32Surface; RB_CAIRO_VAR VALUE rb_cCairo_Win32PrintingSurface; /* For backward compatibility*/ #define rb_cCairo_WIN32Surface rb_cCairo_Win32Surface RB_CAIRO_VAR VALUE rb_cCairo_QuartzSurface; RB_CAIRO_VAR VALUE rb_cCairo_QuartzImageSurface; RB_CAIRO_VAR VALUE rb_cCairo_ScriptSurface; RB_CAIRO_VAR VALUE rb_cCairo_QtSurface; RB_CAIRO_VAR VALUE rb_cCairo_RecordingSurface; RB_CAIRO_VAR VALUE rb_cCairo_VGSurface; RB_CAIRO_VAR VALUE rb_cCairo_GLSurface; RB_CAIRO_VAR VALUE rb_cCairo_GLTextureSurface; RB_CAIRO_VAR VALUE rb_cCairo_DRMSurface; RB_CAIRO_VAR VALUE rb_cCairo_TeeSurface; RB_CAIRO_VAR VALUE rb_cCairo_XMLSurface; RB_CAIRO_VAR VALUE rb_cCairo_SubSurface; RB_CAIRO_VAR VALUE rb_cCairo_Device; RB_CAIRO_VAR VALUE rb_cCairo_DRMDevice; RB_CAIRO_VAR VALUE rb_cCairo_GLDevice; RB_CAIRO_VAR VALUE rb_cCairo_ScriptDevice; RB_CAIRO_VAR VALUE rb_cCairo_XCBDevice; RB_CAIRO_VAR VALUE rb_cCairo_XlibtDevice; RB_CAIRO_VAR VALUE rb_cCairo_XMLDevice; RB_CAIRO_VAR VALUE rb_mCairo_Operator; RB_CAIRO_VAR VALUE rb_mCairo_Antialias; RB_CAIRO_VAR VALUE rb_mCairo_FillRule; RB_CAIRO_VAR VALUE rb_mCairo_LineCap; RB_CAIRO_VAR VALUE rb_mCairo_LineJoin; RB_CAIRO_VAR VALUE rb_mCairo_FontSlant; RB_CAIRO_VAR VALUE rb_mCairo_FontWeight; RB_CAIRO_VAR VALUE rb_mCairo_SubpixelOrder; RB_CAIRO_VAR VALUE rb_mCairo_HintStyle; RB_CAIRO_VAR VALUE rb_mCairo_HintMetrics; RB_CAIRO_VAR VALUE rb_mCairo_FontType; RB_CAIRO_VAR VALUE rb_mCairo_PathDataType; RB_CAIRO_VAR VALUE rb_mCairo_Content; RB_CAIRO_VAR VALUE rb_mCairo_SurfaceType; RB_CAIRO_VAR VALUE rb_mCairo_Format; RB_CAIRO_VAR VALUE rb_mCairo_PatternType; RB_CAIRO_VAR VALUE rb_mCairo_Extend; RB_CAIRO_VAR VALUE rb_mCairo_Filter; RB_CAIRO_VAR VALUE rb_mCairo_SVGVersion; RB_CAIRO_VAR VALUE rb_mCairo_PSLevel; RB_CAIRO_VAR VALUE rb_mCairo_PDFVersion; RB_CAIRO_VAR VALUE rb_mCairo_SVGVersion; RB_CAIRO_VAR VALUE rb_mCairo_TextClusterFlag; RB_CAIRO_VAR VALUE rb_mCairo_ScriptMode; RB_CAIRO_VAR VALUE rb_mCairo_MimeType; RB_CAIRO_VAR VALUE rb_mCairo_RegionOverlap; RB_CAIRO_VAR VALUE rb_mCairo_PDFOutlineFlags; RB_CAIRO_VAR VALUE rb_mCairo_PDFMetadata; RB_CAIRO_VAR VALUE rb_mCairo_SVGUnit; RB_CAIRO_VAR VALUE rb_mCairo_Color; RB_CAIRO_VAR VALUE rb_cCairo_Color_Base; RB_CAIRO_VAR VALUE rb_cCairo_Paper; #define RVAL2POINTER(obj) ((void *)(obj)) #define POINTER2RVAL(pointer) ((VALUE)(pointer)) #define RVAL2CRCONTEXT(obj) (rb_cairo_context_from_ruby_object(obj)) #define CRCONTEXT2RVAL(cr) (rb_cairo_context_to_ruby_object(cr)) #define RVAL2CRPATH(obj) (rb_cairo_path_from_ruby_object(obj)) #define CRPATH2RVAL(path) (rb_cairo_path_to_ruby_object(path)) #define RVAL2CRMATRIX(obj) (rb_cairo_matrix_from_ruby_object(obj)) #define CRMATRIX2RVAL(matrix) (rb_cairo_matrix_to_ruby_object(matrix)) #define RVAL2CRREGION(obj) (rb_cairo_region_from_ruby_object(obj)) #define CRREGION2RVAL(region) (rb_cairo_region_to_ruby_object(region)) #define RVAL2CRPATTERN(obj) (rb_cairo_pattern_from_ruby_object(obj)) #define CRPATTERN2RVAL(pattern) (rb_cairo_pattern_to_ruby_object(pattern)) #define RVAL2CRFONTFACE(obj) (rb_cairo_font_face_from_ruby_object(obj)) #define CRFONTFACE2RVAL(face) (rb_cairo_font_face_to_ruby_object(face)) #define RVAL2CRFONTEXTENTS(obj) (rb_cairo_font_extents_from_ruby_object(obj)) #define CRFONTEXTENTS2RVAL(ext) (rb_cairo_font_extents_to_ruby_object(ext)) #define RVAL2CRFONTOPTIONS(obj) (rb_cairo_font_options_from_ruby_object(obj)) #define CRFONTOPTIONS2RVAL(opt) (rb_cairo_font_options_to_ruby_object(opt)) #define RVAL2CRSCALEDFONT(obj) (rb_cairo_scaled_font_from_ruby_object(obj)) #define CRSCALEDFONT2RVAL(font) (rb_cairo_scaled_font_to_ruby_object(font)) #define RVAL2CRTEXTEXTENTS(obj) (rb_cairo_text_extents_from_ruby_object(obj)) #define CRTEXTEXTENTS2RVAL(ext) (rb_cairo_text_extents_to_ruby_object(ext)) #define RVAL2CRGLYPH(obj) (rb_cairo_glyph_from_ruby_object(obj)) #define CRGLYPH2RVAL(glyph) (rb_cairo_glyph_to_ruby_object(glyph)) #define RVAL2CRTEXTCLUSTER(obj) (rb_cairo_text_cluster_from_ruby_object(obj)) #define CRTEXTCLUSTER2RVAL(cluster) (rb_cairo_text_cluster_to_ruby_object(cluster)) #define RVAL2CRSURFACE(obj) (rb_cairo_surface_from_ruby_object(obj)) #define CRSURFACE2RVAL(surface) (rb_cairo_surface_to_ruby_object(surface)) #define CRSURFACE2RVAL_WITH_DESTROY(surface) \ (rb_cairo_surface_to_ruby_object_with_destroy(surface)) #define RVAL2CRDEVICE(obj) (rb_cairo_device_from_ruby_object(obj)) #define CRDEVICE2RVAL(device) (rb_cairo_device_to_ruby_object(device)) cairo_t *rb_cairo_context_from_ruby_object (VALUE obj); VALUE rb_cairo_context_to_ruby_object (cairo_t *cr); cairo_path_t *rb_cairo_path_from_ruby_object (VALUE obj); VALUE rb_cairo_path_to_ruby_object (cairo_path_t *path); cairo_matrix_t *rb_cairo_matrix_from_ruby_object (VALUE obj); VALUE rb_cairo_matrix_to_ruby_object (cairo_matrix_t *matrix); #if CAIRO_CHECK_VERSION(1, 10, 0) cairo_region_t *rb_cairo_region_from_ruby_object (VALUE obj); VALUE rb_cairo_region_to_ruby_object (cairo_region_t *region); #endif cairo_pattern_t *rb_cairo_pattern_from_ruby_object (VALUE obj); VALUE rb_cairo_pattern_to_ruby_object (cairo_pattern_t *pat); cairo_font_face_t *rb_cairo_font_face_from_ruby_object (VALUE obj); VALUE rb_cairo_font_face_to_ruby_object (cairo_font_face_t *face); cairo_font_extents_t *rb_cairo_font_extents_from_ruby_object (VALUE obj); VALUE rb_cairo_font_extents_to_ruby_object (cairo_font_extents_t *extents); cairo_font_options_t *rb_cairo_font_options_from_ruby_object (VALUE obj); VALUE rb_cairo_font_options_to_ruby_object (cairo_font_options_t *options); cairo_scaled_font_t *rb_cairo_scaled_font_from_ruby_object (VALUE obj); VALUE rb_cairo_scaled_font_to_ruby_object (cairo_scaled_font_t *options); cairo_text_extents_t *rb_cairo_text_extents_from_ruby_object (VALUE obj); VALUE rb_cairo_text_extents_to_ruby_object (cairo_text_extents_t *extents); cairo_glyph_t *rb_cairo_glyph_from_ruby_object (VALUE obj); VALUE rb_cairo_glyph_to_ruby_object (cairo_glyph_t *glyph); #if CAIRO_CHECK_VERSION(1, 7, 2) cairo_text_cluster_t *rb_cairo_text_cluster_from_ruby_object (VALUE obj); VALUE rb_cairo_text_cluster_to_ruby_object (cairo_text_cluster_t *cluster); #endif cairo_surface_t *rb_cairo_surface_from_ruby_object (VALUE obj); VALUE rb_cairo_surface_to_ruby_object (cairo_surface_t *surface); VALUE rb_cairo_surface_to_ruby_object_with_destroy (cairo_surface_t *surface); #if CAIRO_CHECK_VERSION(1, 10, 0) cairo_device_t *rb_cairo_device_from_ruby_object (VALUE obj); VALUE rb_cairo_device_to_ruby_object (cairo_device_t *device); #endif #define RVAL2CROPERATOR(obj) (rb_cairo_operator_from_ruby_object(obj)) #define RVAL2CRANTIALIAS(obj) (rb_cairo_antialias_from_ruby_object(obj)) #define RVAL2CRFILLRULE(obj) (rb_cairo_fill_rule_from_ruby_object(obj)) #define RVAL2CRLINECAP(obj) (rb_cairo_line_cap_from_ruby_object(obj)) #define RVAL2CRLINEJOIN(obj) (rb_cairo_line_join_from_ruby_object(obj)) #define RVAL2CRFONTSLANT(obj) (rb_cairo_font_slant_from_ruby_object(obj)) #define RVAL2CRFONTWEIGHT(obj) (rb_cairo_font_weight_from_ruby_object(obj)) #define RVAL2CRSUBPIXELORDER(obj) (rb_cairo_subpixel_order_from_ruby_object(obj)) #define RVAL2CRHINTSTYLE(obj) (rb_cairo_hint_style_from_ruby_object(obj)) #define RVAL2CRHINTMETRICS(obj) (rb_cairo_hint_metrics_from_ruby_object(obj)) #define RVAL2CRPATHDATATYPE(obj) (rb_cairo_path_data_type_from_ruby_object(obj)) #define RVAL2CRCONTENT(obj) (rb_cairo_content_from_ruby_object(obj)) #define RVAL2CRFORMAT(obj) (rb_cairo_format_from_ruby_object(obj)) #define RVAL2CREXTEND(obj) (rb_cairo_extend_from_ruby_object(obj)) #define RVAL2CRFILTER(obj) (rb_cairo_filter_from_ruby_object(obj)) #ifdef CAIRO_HAS_SVG_SURFACE #define RVAL2CRSVGVERSION(obj) (rb_cairo_svg_version_from_ruby_object(obj)) #endif #ifdef CAIRO_HAS_PS_SURFACE # if CAIRO_CHECK_VERSION(1, 5, 2) #define RVAL2CRPSLEVEL(obj) (rb_cairo_ps_level_from_ruby_object(obj)) # endif #endif #ifdef CAIRO_HAS_PDF_SURFACE # if CAIRO_CHECK_VERSION(1, 10, 0) #define RVAL2CRPDFVERSION(obj) (rb_cairo_pdf_version_from_ruby_object(obj)) # endif #endif #if CAIRO_CHECK_VERSION(1, 7, 6) #define RVAL2CRTEXTCLUSTERFLAGS(obj) (rb_cairo_text_cluster_flags_from_ruby_object(obj)) #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE #define RVAL2CRSCRIPTMODE(obj) (rb_cairo_script_mode_from_ruby_object(obj)) #endif #if CAIRO_CHECK_VERSION(1, 10, 0) #define RVAL2CRREGIONOVERLAP(obj) (rb_cairo_region_overlap_from_ruby_object(obj)) #endif #if CAIRO_CHECK_VERSION(1, 15, 4) #define RVAL2CRPDFOUTLINEFLAGS(obj) (rb_cairo_pdf_outline_flags_from_ruby_object(obj)) #define RVAL2CRPDFMETADATA(obj) (rb_cairo_pdf_metadata_from_ruby_object(obj)) #endif #if CAIRO_CHECK_VERSION(1, 15, 10) #define RVAL2CRSVGUNIT(obj) (rb_cairo_svg_unit_from_ruby_object(obj)) #endif cairo_operator_t rb_cairo_operator_from_ruby_object (VALUE obj); cairo_antialias_t rb_cairo_antialias_from_ruby_object (VALUE obj); cairo_fill_rule_t rb_cairo_fill_rule_from_ruby_object (VALUE obj); cairo_line_cap_t rb_cairo_line_cap_from_ruby_object (VALUE obj); cairo_line_join_t rb_cairo_line_join_from_ruby_object (VALUE obj); cairo_font_slant_t rb_cairo_font_slant_from_ruby_object (VALUE obj); cairo_font_weight_t rb_cairo_font_weight_from_ruby_object (VALUE obj); cairo_subpixel_order_t rb_cairo_subpixel_order_from_ruby_object (VALUE obj); cairo_hint_style_t rb_cairo_hint_style_from_ruby_object (VALUE obj); cairo_hint_metrics_t rb_cairo_hint_metrics_from_ruby_object (VALUE obj); cairo_path_data_type_t rb_cairo_path_data_type_from_ruby_object (VALUE obj); cairo_content_t rb_cairo_content_from_ruby_object (VALUE obj); cairo_format_t rb_cairo_format_from_ruby_object (VALUE obj); cairo_extend_t rb_cairo_extend_from_ruby_object (VALUE obj); cairo_filter_t rb_cairo_filter_from_ruby_object (VALUE obj); #ifdef CAIRO_HAS_SVG_SURFACE cairo_svg_version_t rb_cairo_svg_version_from_ruby_object (VALUE obj); #endif #ifdef CAIRO_HAS_PS_SURFACE # if CAIRO_CHECK_VERSION(1, 5, 2) cairo_ps_level_t rb_cairo_ps_level_from_ruby_object (VALUE obj); # endif #endif #ifdef CAIRO_HAS_PDF_SURFACE # if CAIRO_CHECK_VERSION(1, 10, 0) cairo_pdf_version_t rb_cairo_pdf_version_from_ruby_object (VALUE obj); # endif #endif #if CAIRO_CHECK_VERSION(1, 7, 6) cairo_text_cluster_flags_t rb_cairo_text_cluster_flags_from_ruby_object (VALUE obj); #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE cairo_script_mode_t rb_cairo_script_mode_from_ruby_object (VALUE obj); #endif #if CAIRO_CHECK_VERSION(1, 10, 0) cairo_region_overlap_t rb_cairo_region_overlap_from_ruby_object(VALUE obj); #endif #if CAIRO_CHECK_VERSION(1, 15, 4) cairo_pdf_outline_flags_t rb_cairo_pdf_outline_flags_from_ruby_object(VALUE obj); cairo_pdf_metadata_t rb_cairo_pdf_metadata_from_ruby_object(VALUE obj); #endif #if CAIRO_CHECK_VERSION(1, 15, 10) cairo_svg_unit_t rb_cairo_svg_unit_from_ruby_object(VALUE obj); #endif void rb_cairo_check_status (cairo_status_t status); void rb_cairo_surface_check_status (cairo_surface_t *surface); #define RB_CAIRO_DEF_SETTERS(klass) rb_cairo_def_setters(klass); void rb_cairo_def_setters (VALUE klass); RB_CAIRO_END_DECLS #endif rcairo-1.16.6/ext/cairo/rb_cairo_constants.c000066400000000000000000000676471370612400100210170ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-09-19 12:56:27 $ * * Copyright 2005-2019 Kouhei Sutou * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_mCairo_Operator; VALUE rb_mCairo_Antialias; VALUE rb_mCairo_FillRule; VALUE rb_mCairo_LineCap; VALUE rb_mCairo_LineJoin; VALUE rb_mCairo_FontSlant; VALUE rb_mCairo_FontWeight; VALUE rb_mCairo_SubpixelOrder; VALUE rb_mCairo_HintStyle; VALUE rb_mCairo_HintMetrics; VALUE rb_mCairo_PathDataType; VALUE rb_mCairo_Content; VALUE rb_mCairo_Format; VALUE rb_mCairo_Extend; VALUE rb_mCairo_Filter; VALUE rb_mCairo_SVGVersion = Qnil; VALUE rb_mCairo_PSLevel = Qnil; VALUE rb_mCairo_TextClusterFlag = Qnil; VALUE rb_mCairo_PDFVersion = Qnil; VALUE rb_mCairo_ScriptMode = Qnil; VALUE rb_mCairo_MimeType = Qnil; VALUE rb_mCairo_RegionOverlap = Qnil; VALUE rb_mCairo_PDFOutlineFlags = Qnil; VALUE rb_mCairo_PDFMetadata = Qnil; VALUE rb_mCairo_SVGUnit = Qnil; #define CAIRO_OPERATOR_MIN CAIRO_OPERATOR_CLEAR #if CAIRO_CHECK_VERSION(1, 10, 0) # define CAIRO_OPERATOR_MAX CAIRO_OPERATOR_HSL_LUMINOSITY #else # define CAIRO_OPERATOR_MAX CAIRO_OPERATOR_SATURATE #endif #define CAIRO_ANTIALIAS_MIN CAIRO_ANTIALIAS_DEFAULT #if CAIRO_CHECK_VERSION(1, 11, 4) # define CAIRO_ANTIALIAS_MAX CAIRO_ANTIALIAS_BEST #else # define CAIRO_ANTIALIAS_MAX CAIRO_ANTIALIAS_SUBPIXEL #endif #define CAIRO_FILL_RULE_MIN CAIRO_FILL_RULE_WINDING #define CAIRO_FILL_RULE_MAX CAIRO_FILL_RULE_EVEN_ODD #define CAIRO_LINE_CAP_MIN CAIRO_LINE_CAP_BUTT #define CAIRO_LINE_CAP_MAX CAIRO_LINE_CAP_SQUARE #define CAIRO_LINE_JOIN_MIN CAIRO_LINE_JOIN_MITER #define CAIRO_LINE_JOIN_MAX CAIRO_LINE_JOIN_BEVEL #define CAIRO_FONT_SLANT_MIN CAIRO_FONT_SLANT_NORMAL #define CAIRO_FONT_SLANT_MAX CAIRO_FONT_SLANT_OBLIQUE #define CAIRO_FONT_WEIGHT_MIN CAIRO_FONT_WEIGHT_NORMAL #define CAIRO_FONT_WEIGHT_MAX CAIRO_FONT_WEIGHT_BOLD #define CAIRO_SUBPIXEL_ORDER_MIN CAIRO_SUBPIXEL_ORDER_DEFAULT #define CAIRO_SUBPIXEL_ORDER_MAX CAIRO_SUBPIXEL_ORDER_VBGR #define CAIRO_HINT_STYLE_MIN CAIRO_HINT_STYLE_DEFAULT #define CAIRO_HINT_STYLE_MAX CAIRO_HINT_STYLE_FULL #define CAIRO_HINT_METRICS_MIN CAIRO_HINT_METRICS_DEFAULT #define CAIRO_HINT_METRICS_MAX CAIRO_HINT_METRICS_ON #define CAIRO_PATH_MIN CAIRO_PATH_MOVE_TO #define CAIRO_PATH_MAX CAIRO_PATH_CLOSE_PATH #define CAIRO_CONTENT_MIN CAIRO_CONTENT_COLOR #define CAIRO_CONTENT_MAX CAIRO_CONTENT_COLOR_ALPHA #if CAIRO_CHECK_VERSION(1, 10, 0) # define CAIRO_FORMAT_MIN CAIRO_FORMAT_INVALID #else # define CAIRO_FORMAT_MIN CAIRO_FORMAT_ARGB32 #endif #if CAIRO_CHECK_VERSION(1, 17, 2) # define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGBA128F #elif CAIRO_CHECK_VERSION(1, 11, 4) # define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB30 #else # define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB16_565 #endif #define CAIRO_EXTEND_MIN CAIRO_EXTEND_NONE #define CAIRO_EXTEND_MAX CAIRO_EXTEND_PAD #define CAIRO_FILTER_MIN CAIRO_FILTER_FAST #define CAIRO_FILTER_MAX CAIRO_FILTER_GAUSSIAN #define CAIRO_SVG_VERSION_MIN CAIRO_SVG_VERSION_1_1 #define CAIRO_SVG_VERSION_MAX CAIRO_SVG_VERSION_1_2 #define CAIRO_PS_LEVEL_MIN CAIRO_PS_LEVEL_2 #define CAIRO_PS_LEVEL_MAX CAIRO_PS_LEVEL_3 #define CAIRO_PDF_VERSION_MIN CAIRO_PDF_VERSION_1_4 #define CAIRO_PDF_VERSION_MAX CAIRO_PDF_VERSION_1_5 #define CAIRO_TEXT_CLUSTER_FLAG_MIN 0 #define CAIRO_TEXT_CLUSTER_FLAG_MAX CAIRO_TEXT_CLUSTER_FLAG_BACKWARD #if CAIRO_CHECK_VERSION(1, 11, 4) # define CAIRO_SCRIPT_MODE_MIN CAIRO_SCRIPT_MODE_ASCII # define CAIRO_SCRIPT_MODE_MAX CAIRO_SCRIPT_MODE_BINARY #else # define CAIRO_SCRIPT_MODE_MIN CAIRO_SCRIPT_MODE_BINARY # define CAIRO_SCRIPT_MODE_MAX CAIRO_SCRIPT_MODE_ASCII #endif #define CAIRO_REGION_OVERLAP_MIN CAIRO_REGION_OVERLAP_IN #define CAIRO_REGION_OVERLAP_MAX CAIRO_REGION_OVERLAP_PART #if CAIRO_CHECK_VERSION(1, 15, 5) # define CAIRO_PDF_OUTLINE_FLAGS_MIN CAIRO_PDF_OUTLINE_FLAG_OPEN # define CAIRO_PDF_OUTLINE_FLAGS_MAX CAIRO_PDF_OUTLINE_FLAG_ITALIC #else # define CAIRO_PDF_OUTLINE_FLAGS_MIN CAIRO_BOOKMARK_FLAG_OPEN # define CAIRO_PDF_OUTLINE_FLAGS_MAX CAIRO_BOOKMARK_FLAG_ITALIC #endif #define CAIRO_PDF_METADATA_MIN CAIRO_PDF_METADATA_TITLE #define CAIRO_PDF_METADATA_MAX CAIRO_PDF_METADATA_MOD_DATE #define CAIRO_SVG_UNIT_MIN CAIRO_SVG_UNIT_USER #define CAIRO_SVG_UNIT_MAX CAIRO_SVG_UNIT_PERCENT #define DEFINE_RVAL2ENUM(name, const_name) \ cairo_ ## name ## _t \ rb_cairo_ ## name ## _from_ruby_object (VALUE rb_ ## name) \ { \ cairo_ ## name ## _t name; \ \ if (!rb_cairo__is_kind_of (rb_ ## name, rb_cNumeric)) \ rb_ ## name = rb_cairo__const_get (rb_ ## name, \ # const_name "_"); \ \ name = FIX2INT (rb_ ## name); \ if (name < CAIRO_ ## const_name ## _MIN || \ name > CAIRO_ ## const_name ## _MAX) \ { \ rb_raise (rb_eArgError, \ "invalid %s: %d (expect %d <= %s <= %d)", \ #name, name, \ CAIRO_ ## const_name ## _MIN, \ #name, \ CAIRO_ ## const_name ## _MAX); \ } \ return name; \ } DEFINE_RVAL2ENUM(operator, OPERATOR) DEFINE_RVAL2ENUM(antialias, ANTIALIAS) DEFINE_RVAL2ENUM(fill_rule, FILL_RULE) DEFINE_RVAL2ENUM(line_cap, LINE_CAP) DEFINE_RVAL2ENUM(line_join, LINE_JOIN) DEFINE_RVAL2ENUM(font_slant, FONT_SLANT) DEFINE_RVAL2ENUM(font_weight, FONT_WEIGHT) DEFINE_RVAL2ENUM(subpixel_order, SUBPIXEL_ORDER) DEFINE_RVAL2ENUM(hint_style, HINT_STYLE) DEFINE_RVAL2ENUM(hint_metrics, HINT_METRICS) DEFINE_RVAL2ENUM(path_data_type, PATH) DEFINE_RVAL2ENUM(content, CONTENT) DEFINE_RVAL2ENUM(format, FORMAT) DEFINE_RVAL2ENUM(extend, EXTEND) DEFINE_RVAL2ENUM(filter, FILTER) #ifdef CAIRO_HAS_SVG_SURFACE DEFINE_RVAL2ENUM(svg_version, SVG_VERSION) #endif #ifdef CAIRO_HAS_PS_SURFACE # if CAIRO_CHECK_VERSION(1, 5, 2) DEFINE_RVAL2ENUM(ps_level, PS_LEVEL) #define PS_LEVEL_ENUM_DEFINED 1 # endif #endif #ifdef CAIRO_HAS_PDF_SURFACE # if CAIRO_CHECK_VERSION(1, 10, 0) DEFINE_RVAL2ENUM(pdf_version, PDF_VERSION) #define PDF_VERSION_ENUM_DEFINED 1 # endif #endif #if CAIRO_CHECK_VERSION(1, 7, 6) DEFINE_RVAL2ENUM(text_cluster_flags, TEXT_CLUSTER_FLAG) #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE DEFINE_RVAL2ENUM(script_mode, SCRIPT_MODE) #endif #if CAIRO_CHECK_VERSION(1, 10, 0) DEFINE_RVAL2ENUM(region_overlap, REGION_OVERLAP) #endif #if CAIRO_CHECK_VERSION(1, 15, 4) DEFINE_RVAL2ENUM(pdf_outline_flags, PDF_OUTLINE_FLAGS) DEFINE_RVAL2ENUM(pdf_metadata, PDF_METADATA) #endif #if CAIRO_CHECK_VERSION(1, 15, 10) DEFINE_RVAL2ENUM(svg_unit, SVG_UNIT) #endif #if defined(RB_CAIRO_PLATFORM_WIN32) && !defined(PS_LEVEL_ENUM_DEFINED) void rb_cairo_ps_level_from_ruby_object (VALUE rb_ps_level) { /* dummy */ } #endif #ifdef CAIRO_HAS_SVG_SURFACE static VALUE cr_svg_get_versions (VALUE self) { VALUE rb_versions; int i, num_versions; cairo_svg_version_t const *versions; cairo_svg_get_versions (&versions, &num_versions); rb_versions = rb_ary_new2 (num_versions); for (i = 0; i < num_versions; i++) { rb_ary_push (rb_versions, INT2NUM (versions[i])); } return rb_versions; } static VALUE cr_svg_version_to_string (int argc, VALUE *argv, VALUE self) { if (argc == 0) { return rb_call_super (argc, argv); } else { VALUE version; const char *ver_str; rb_scan_args (argc, argv, "1", &version); ver_str = cairo_svg_version_to_string (RVAL2CRSVGVERSION(version)); return rb_str_new2 (ver_str); } } #endif #if CAIRO_CHECK_VERSION(1, 5, 8) static VALUE cr_format_stride_for_width (VALUE self, VALUE format, VALUE width) { return INT2NUM (cairo_format_stride_for_width (RVAL2CRFORMAT (format), NUM2INT (width))); } #endif #ifdef CAIRO_HAS_PS_SURFACE # if CAIRO_CHECK_VERSION(1, 5, 8) static VALUE cr_ps_get_levels (VALUE self) { VALUE rb_levels; const cairo_ps_level_t *levels; int i, n_levels; cairo_ps_get_levels (&levels, &n_levels); rb_levels = rb_ary_new2 (n_levels); for (i = 0; i < n_levels; i++) { rb_ary_push (rb_levels, INT2NUM (levels[i])); } return rb_levels; } static VALUE cr_ps_level_to_string (int argc, VALUE *argv, VALUE self) { if (argc == 0) { return rb_call_super (argc, argv); } else { VALUE level; rb_scan_args (argc, argv, "1", &level); return rb_str_new2 (cairo_ps_level_to_string (RVAL2CRPSLEVEL (level))); } } # endif #endif #ifdef CAIRO_HAS_PDF_SURFACE # if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE cr_pdf_get_versions (VALUE self) { VALUE rb_versions; const cairo_pdf_version_t *versions; int i, n_versions; cairo_pdf_get_versions (&versions, &n_versions); rb_versions = rb_ary_new2 (n_versions); for (i = 0; i < n_versions; i++) { rb_ary_push (rb_versions, INT2NUM (versions[i])); } return rb_versions; } static VALUE cr_pdf_version_to_string (int argc, VALUE *argv, VALUE self) { if (argc == 0) { return rb_call_super (argc, argv); } else { VALUE version; rb_scan_args (argc, argv, "1", &version); return rb_str_new2 (cairo_pdf_version_to_string (RVAL2CRPDFVERSION (version))); } } # endif #endif void Init_cairo_constants (void) { /* cairo_operator_t */ rb_mCairo_Operator = rb_define_module_under (rb_mCairo, "Operator"); rb_define_const (rb_mCairo_Operator, "CLEAR", INT2FIX (CAIRO_OPERATOR_CLEAR)); rb_define_const (rb_mCairo_Operator, "SOURCE", INT2FIX (CAIRO_OPERATOR_SOURCE)); rb_define_const (rb_mCairo_Operator, "OVER", INT2FIX (CAIRO_OPERATOR_OVER)); rb_define_const (rb_mCairo_Operator, "IN", INT2FIX (CAIRO_OPERATOR_IN)); rb_define_const (rb_mCairo_Operator, "OUT", INT2FIX (CAIRO_OPERATOR_OUT)); rb_define_const (rb_mCairo_Operator, "ATOP", INT2FIX (CAIRO_OPERATOR_ATOP)); rb_define_const (rb_mCairo_Operator, "DEST", INT2FIX (CAIRO_OPERATOR_DEST)); rb_define_const (rb_mCairo_Operator, "DEST_OVER", INT2FIX (CAIRO_OPERATOR_DEST_OVER)); rb_define_const (rb_mCairo_Operator, "DEST_IN", INT2FIX (CAIRO_OPERATOR_DEST_IN)); rb_define_const (rb_mCairo_Operator, "DEST_OUT", INT2FIX (CAIRO_OPERATOR_DEST_OUT)); rb_define_const (rb_mCairo_Operator, "DEST_ATOP", INT2FIX (CAIRO_OPERATOR_DEST_ATOP)); rb_define_const (rb_mCairo_Operator, "XOR", INT2FIX (CAIRO_OPERATOR_XOR)); rb_define_const (rb_mCairo_Operator, "ADD", INT2FIX (CAIRO_OPERATOR_ADD)); rb_define_const (rb_mCairo_Operator, "SATURATE", INT2FIX (CAIRO_OPERATOR_SATURATE)); #if CAIRO_CHECK_VERSION(1, 10, 0) rb_define_const (rb_mCairo_Operator, "MULTIPLY", INT2FIX (CAIRO_OPERATOR_MULTIPLY)); rb_define_const (rb_mCairo_Operator, "SCREEN", INT2FIX (CAIRO_OPERATOR_SCREEN)); rb_define_const (rb_mCairo_Operator, "OVERLAY", INT2FIX (CAIRO_OPERATOR_OVERLAY)); rb_define_const (rb_mCairo_Operator, "DARKEN", INT2FIX (CAIRO_OPERATOR_DARKEN)); rb_define_const (rb_mCairo_Operator, "LIGHTEN", INT2FIX (CAIRO_OPERATOR_LIGHTEN)); rb_define_const (rb_mCairo_Operator, "COLOR_DODGE", INT2FIX (CAIRO_OPERATOR_COLOR_DODGE)); rb_define_const (rb_mCairo_Operator, "COLOR_BURN", INT2FIX (CAIRO_OPERATOR_COLOR_BURN)); rb_define_const (rb_mCairo_Operator, "HARD_LIGHT", INT2FIX (CAIRO_OPERATOR_HARD_LIGHT)); rb_define_const (rb_mCairo_Operator, "SOFT_LIGHT", INT2FIX (CAIRO_OPERATOR_SOFT_LIGHT)); rb_define_const (rb_mCairo_Operator, "DIFFERENCE", INT2FIX (CAIRO_OPERATOR_DIFFERENCE)); rb_define_const (rb_mCairo_Operator, "EXCLUSION", INT2FIX (CAIRO_OPERATOR_EXCLUSION)); rb_define_const (rb_mCairo_Operator, "HSL_HUE", INT2FIX (CAIRO_OPERATOR_HSL_HUE)); rb_define_const (rb_mCairo_Operator, "HSL_SATURATION", INT2FIX (CAIRO_OPERATOR_HSL_SATURATION)); rb_define_const (rb_mCairo_Operator, "HSL_COLOR", INT2FIX (CAIRO_OPERATOR_HSL_COLOR)); rb_define_const (rb_mCairo_Operator, "HSL_LUMINOSITY", INT2FIX (CAIRO_OPERATOR_HSL_LUMINOSITY)); #endif /* cairo_antialias_t */ rb_mCairo_Antialias = rb_define_module_under (rb_mCairo, "Antialias"); rb_define_const (rb_mCairo_Antialias, "DEFAULT", INT2FIX (CAIRO_ANTIALIAS_DEFAULT)); rb_define_const (rb_mCairo_Antialias, "NONE", INT2FIX (CAIRO_ANTIALIAS_NONE)); rb_define_const (rb_mCairo_Antialias, "GRAY", INT2FIX (CAIRO_ANTIALIAS_GRAY)); rb_define_const (rb_mCairo_Antialias, "SUBPIXEL", INT2FIX (CAIRO_ANTIALIAS_SUBPIXEL)); #if CAIRO_CHECK_VERSION(1, 11, 4) rb_define_const (rb_mCairo_Antialias, "FAST", INT2FIX (CAIRO_ANTIALIAS_FAST)); rb_define_const (rb_mCairo_Antialias, "GOOD", INT2FIX (CAIRO_ANTIALIAS_GOOD)); rb_define_const (rb_mCairo_Antialias, "BEST", INT2FIX (CAIRO_ANTIALIAS_BEST)); #endif /* cairo_fill_rule_t */ rb_mCairo_FillRule = rb_define_module_under (rb_mCairo, "FillRule"); rb_define_const (rb_mCairo_FillRule, "WINDING", INT2FIX (CAIRO_FILL_RULE_WINDING)); rb_define_const (rb_mCairo_FillRule, "EVEN_ODD", INT2FIX (CAIRO_FILL_RULE_EVEN_ODD)); /* cairo_line_cap_t */ rb_mCairo_LineCap = rb_define_module_under (rb_mCairo, "LineCap"); rb_define_const (rb_mCairo_LineCap, "BUTT", INT2FIX (CAIRO_LINE_CAP_BUTT)); rb_define_const (rb_mCairo_LineCap, "ROUND", INT2FIX (CAIRO_LINE_CAP_ROUND)); rb_define_const (rb_mCairo_LineCap, "SQUARE", INT2FIX (CAIRO_LINE_CAP_SQUARE)); /* cairo_line_join_t */ rb_mCairo_LineJoin = rb_define_module_under (rb_mCairo, "LineJoin"); rb_define_const (rb_mCairo_LineJoin, "MITER", INT2FIX (CAIRO_LINE_JOIN_MITER)); rb_define_const (rb_mCairo_LineJoin, "ROUND", INT2FIX (CAIRO_LINE_JOIN_ROUND)); rb_define_const (rb_mCairo_LineJoin, "BEVEL", INT2FIX (CAIRO_LINE_JOIN_BEVEL)); /* cairo_font_slant_t */ rb_mCairo_FontSlant = rb_define_module_under (rb_mCairo, "FontSlant"); rb_define_const (rb_mCairo_FontSlant, "NORMAL", INT2FIX (CAIRO_FONT_SLANT_NORMAL)); rb_define_const (rb_mCairo_FontSlant, "ITALIC", INT2FIX (CAIRO_FONT_SLANT_ITALIC)); rb_define_const (rb_mCairo_FontSlant, "OBLIQUE", INT2FIX (CAIRO_FONT_SLANT_OBLIQUE)); /* cairo_font_weight_t */ rb_mCairo_FontWeight = rb_define_module_under (rb_mCairo, "FontWeight"); rb_define_const (rb_mCairo_FontWeight, "NORMAL", INT2FIX (CAIRO_FONT_WEIGHT_NORMAL)); rb_define_const (rb_mCairo_FontWeight, "BOLD", INT2FIX (CAIRO_FONT_WEIGHT_BOLD)); /* cairo_subpixel_order_t */ rb_mCairo_SubpixelOrder = rb_define_module_under (rb_mCairo, "SubpixelOrder"); rb_define_const (rb_mCairo_SubpixelOrder, "DEFAULT", INT2FIX (CAIRO_SUBPIXEL_ORDER_DEFAULT)); rb_define_const (rb_mCairo_SubpixelOrder, "RGB", INT2FIX (CAIRO_SUBPIXEL_ORDER_RGB)); rb_define_const (rb_mCairo_SubpixelOrder, "BGR", INT2FIX (CAIRO_SUBPIXEL_ORDER_BGR)); rb_define_const (rb_mCairo_SubpixelOrder, "VRGB", INT2FIX (CAIRO_SUBPIXEL_ORDER_VRGB)); rb_define_const (rb_mCairo_SubpixelOrder, "VBGR", INT2FIX (CAIRO_SUBPIXEL_ORDER_VBGR)); /* cairo_hint_style_t */ rb_mCairo_HintStyle = rb_define_module_under (rb_mCairo, "HintStyle"); rb_define_const (rb_mCairo_HintStyle, "DEFAULT", INT2FIX (CAIRO_HINT_STYLE_DEFAULT)); rb_define_const (rb_mCairo_HintStyle, "NONE", INT2FIX (CAIRO_HINT_STYLE_NONE)); rb_define_const (rb_mCairo_HintStyle, "SLIGHT", INT2FIX (CAIRO_HINT_STYLE_SLIGHT)); rb_define_const (rb_mCairo_HintStyle, "MEDIUM", INT2FIX (CAIRO_HINT_STYLE_MEDIUM)); rb_define_const (rb_mCairo_HintStyle, "FULL", INT2FIX (CAIRO_HINT_STYLE_FULL)); /* cairo_hint_metrics_t */ rb_mCairo_HintMetrics = rb_define_module_under (rb_mCairo, "HintMetrics"); rb_define_const (rb_mCairo_HintMetrics, "DEFAULT", INT2FIX (CAIRO_HINT_METRICS_DEFAULT)); rb_define_const (rb_mCairo_HintMetrics, "ON", INT2FIX (CAIRO_HINT_METRICS_ON)); rb_define_const (rb_mCairo_HintMetrics, "OFF", INT2FIX (CAIRO_HINT_METRICS_OFF)); /* cairo_path_data_type_t */ rb_mCairo_PathDataType = rb_define_module_under (rb_mCairo, "PathDataType"); rb_define_const (rb_mCairo_PathDataType, "MOVE_TO", INT2FIX (CAIRO_PATH_MOVE_TO)); rb_define_const (rb_mCairo_PathDataType, "LINE_TO", INT2FIX (CAIRO_PATH_LINE_TO)); rb_define_const (rb_mCairo_PathDataType, "CURVE_TO", INT2FIX (CAIRO_PATH_CURVE_TO)); rb_define_const (rb_mCairo_PathDataType, "CLOSE_PATH", INT2FIX (CAIRO_PATH_CLOSE_PATH)); /* cairo_content_t */ rb_mCairo_Content = rb_define_module_under (rb_mCairo, "Content"); rb_define_const (rb_mCairo_Content, "COLOR", INT2FIX (CAIRO_CONTENT_COLOR)); rb_define_const (rb_mCairo_Content, "ALPHA", INT2FIX (CAIRO_CONTENT_ALPHA)); rb_define_const (rb_mCairo_Content, "COLOR_ALPHA", INT2FIX (CAIRO_CONTENT_COLOR_ALPHA)); /* cairo_format_t */ rb_mCairo_Format = rb_define_module_under (rb_mCairo, "Format"); #if CAIRO_CHECK_VERSION(1, 10, 0) rb_define_const (rb_mCairo_Format, "INVALID", INT2FIX (CAIRO_FORMAT_INVALID)); #endif rb_define_const (rb_mCairo_Format, "ARGB32", INT2FIX (CAIRO_FORMAT_ARGB32)); rb_define_const (rb_mCairo_Format, "RGB24", INT2FIX (CAIRO_FORMAT_RGB24)); rb_define_const (rb_mCairo_Format, "A8", INT2FIX (CAIRO_FORMAT_A8)); rb_define_const (rb_mCairo_Format, "A1", INT2FIX (CAIRO_FORMAT_A1)); rb_define_const (rb_mCairo_Format, "RGB16_565", INT2FIX (CAIRO_FORMAT_RGB16_565)); #if CAIRO_CHECK_VERSION(1, 11, 4) rb_define_const (rb_mCairo_Format, "RGB30", INT2FIX (CAIRO_FORMAT_RGB30)); #endif #if CAIRO_CHECK_VERSION(1, 17, 2) rb_define_const (rb_mCairo_Format, "RGB96F", INT2FIX (CAIRO_FORMAT_RGB96F)); rb_define_const (rb_mCairo_Format, "RGBA128F", INT2FIX (CAIRO_FORMAT_RGBA128F)); #endif #if CAIRO_CHECK_VERSION(1, 5, 8) rb_define_singleton_method (rb_mCairo_Format, "stride_for_width", cr_format_stride_for_width, 2); #endif /* cairo_extend_t */ rb_mCairo_Extend = rb_define_module_under (rb_mCairo, "Extend"); rb_define_const (rb_mCairo_Extend, "NONE", INT2FIX (CAIRO_EXTEND_NONE)); rb_define_const (rb_mCairo_Extend, "REPEAT", INT2FIX (CAIRO_EXTEND_REPEAT)); rb_define_const (rb_mCairo_Extend, "REFLECT", INT2FIX (CAIRO_EXTEND_REFLECT)); rb_define_const (rb_mCairo_Extend, "PAD", INT2FIX (CAIRO_EXTEND_PAD)); /* cairo_filter_t */ rb_mCairo_Filter = rb_define_module_under (rb_mCairo, "Filter"); rb_define_const (rb_mCairo_Filter, "FAST", INT2FIX (CAIRO_FILTER_FAST)); rb_define_const (rb_mCairo_Filter, "GOOD", INT2FIX (CAIRO_FILTER_GOOD)); rb_define_const (rb_mCairo_Filter, "BEST", INT2FIX (CAIRO_FILTER_BEST)); rb_define_const (rb_mCairo_Filter, "NEAREST", INT2FIX (CAIRO_FILTER_NEAREST)); rb_define_const (rb_mCairo_Filter, "BILINEAR", INT2FIX (CAIRO_FILTER_BILINEAR)); rb_define_const (rb_mCairo_Filter, "GAUSSIAN", INT2FIX (CAIRO_FILTER_GAUSSIAN)); #ifdef CAIRO_HAS_SVG_SURFACE /* cairo_svg_version_t */ rb_mCairo_SVGVersion = rb_define_module_under (rb_mCairo, "SVGVersion"); rb_define_const (rb_mCairo_SVGVersion, "VERSION_1_1", INT2FIX (CAIRO_SVG_VERSION_1_1)); rb_define_const (rb_mCairo_SVGVersion, "VERSION_1_2", INT2FIX (CAIRO_SVG_VERSION_1_2)); rb_define_singleton_method (rb_mCairo_SVGVersion, "list", cr_svg_get_versions, 0); rb_define_singleton_method (rb_mCairo_SVGVersion, "name", cr_svg_version_to_string, -1); #endif #ifdef CAIRO_HAS_PS_SURFACE # if CAIRO_CHECK_VERSION(1, 5, 2) /* cairo_ps_level_t */ rb_mCairo_PSLevel = rb_define_module_under (rb_mCairo, "PSLevel"); rb_define_const (rb_mCairo_PSLevel, "LEVEL_2", INT2FIX (CAIRO_PS_LEVEL_2)); rb_define_const (rb_mCairo_PSLevel, "LEVEL_3", INT2FIX (CAIRO_PS_LEVEL_3)); rb_define_singleton_method (rb_mCairo_PSLevel, "list", cr_ps_get_levels, 0); rb_define_singleton_method (rb_mCairo_PSLevel, "name", cr_ps_level_to_string, -1); # endif #endif #ifdef CAIRO_HAS_PDF_SURFACE # if CAIRO_CHECK_VERSION(1, 10, 0) /* cairo_pdf_version_t */ rb_mCairo_PDFVersion = rb_define_module_under (rb_mCairo, "PDFVersion"); rb_define_const (rb_mCairo_PDFVersion, "VERSION_1_4", INT2FIX (CAIRO_PDF_VERSION_1_4)); rb_define_const (rb_mCairo_PDFVersion, "VERSION_1_5", INT2FIX (CAIRO_PDF_VERSION_1_5)); rb_define_singleton_method (rb_mCairo_PDFVersion, "list", cr_pdf_get_versions, 0); rb_define_singleton_method (rb_mCairo_PDFVersion, "name", cr_pdf_version_to_string, -1); # endif #endif #if CAIRO_CHECK_VERSION(1, 7, 6) /* cairo_text_cluster_flags_t */ rb_mCairo_TextClusterFlag = rb_define_module_under (rb_mCairo, "TextClusterFlag"); rb_define_const (rb_mCairo_TextClusterFlag, "BACKWARD", INT2FIX (CAIRO_TEXT_CLUSTER_FLAG_BACKWARD)); #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE /* cairo_script_mode_t */ rb_mCairo_ScriptMode = rb_define_module_under (rb_mCairo, "ScriptMode"); rb_define_const (rb_mCairo_ScriptMode, "BINARY", INT2FIX (CAIRO_SCRIPT_MODE_BINARY)); rb_define_const (rb_mCairo_ScriptMode, "ASCII", INT2FIX (CAIRO_SCRIPT_MODE_ASCII)); #endif #if CAIRO_CHECK_VERSION(1, 10, 0) rb_mCairo_MimeType = rb_define_module_under (rb_mCairo, "MimeType"); rb_define_const (rb_mCairo_MimeType, "JPEG", rb_str_new2 (CAIRO_MIME_TYPE_JPEG)); rb_define_const (rb_mCairo_MimeType, "PNG", rb_str_new2 (CAIRO_MIME_TYPE_PNG)); rb_define_const (rb_mCairo_MimeType, "JP2", rb_str_new2 (CAIRO_MIME_TYPE_JP2)); rb_define_const (rb_mCairo_MimeType, "URI", rb_str_new2 (CAIRO_MIME_TYPE_URI)); #endif #if CAIRO_CHECK_VERSION(1, 11, 4) rb_define_const (rb_mCairo_MimeType, "UNIQUE_ID", rb_str_new2 (CAIRO_MIME_TYPE_UNIQUE_ID)); #endif #if CAIRO_CHECK_VERSION(1, 14, 0) rb_define_const (rb_mCairo_MimeType, "JBIG2", rb_str_new2 (CAIRO_MIME_TYPE_JBIG2)); rb_define_const (rb_mCairo_MimeType, "JBIG2_GLOBAL", rb_str_new2 (CAIRO_MIME_TYPE_JBIG2_GLOBAL)); rb_define_const (rb_mCairo_MimeType, "JBIG2_GLOBAL_ID", rb_str_new2 (CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID)); #endif #if CAIRO_CHECK_VERSION(1, 15, 10) rb_define_const (rb_mCairo_MimeType, "CCITT_FAX", rb_str_new_cstr (CAIRO_MIME_TYPE_CCITT_FAX)); rb_define_const (rb_mCairo_MimeType, "CCITT_FAX_PARAMS", rb_str_new_cstr (CAIRO_MIME_TYPE_CCITT_FAX_PARAMS)); rb_define_const (rb_mCairo_MimeType, "EPS", rb_str_new_cstr (CAIRO_MIME_TYPE_EPS)); rb_define_const (rb_mCairo_MimeType, "EPS_PARAMS", rb_str_new_cstr (CAIRO_MIME_TYPE_EPS_PARAMS)); #endif #if CAIRO_CHECK_VERSION(1, 10, 0) rb_mCairo_RegionOverlap = rb_define_module_under (rb_mCairo, "RegionOverlap"); rb_define_const (rb_mCairo_RegionOverlap, "IN", INT2FIX (CAIRO_REGION_OVERLAP_IN)); rb_define_const (rb_mCairo_RegionOverlap, "OUT", INT2FIX (CAIRO_REGION_OVERLAP_OUT)); rb_define_const (rb_mCairo_RegionOverlap, "PART", INT2FIX (CAIRO_REGION_OVERLAP_PART)); #endif #if CAIRO_CHECK_VERSION(1, 15, 4) rb_mCairo_PDFOutlineFlags = rb_define_module_under (rb_mCairo, "PDFOutlineFlags"); # if CAIRO_CHECK_VERSION(1, 15, 5) rb_define_const (rb_mCairo_PDFOutlineFlags, "OPEN", INT2NUM (CAIRO_PDF_OUTLINE_FLAG_OPEN)); rb_define_const (rb_mCairo_PDFOutlineFlags, "BOLD", INT2NUM (CAIRO_PDF_OUTLINE_FLAG_BOLD)); rb_define_const (rb_mCairo_PDFOutlineFlags, "ITALIC", INT2NUM (CAIRO_PDF_OUTLINE_FLAG_ITALIC)); # else rb_define_const (rb_mCairo_PDFOutlineFlags, "OPEN", INT2NUM (CAIRO_BOOKMARK_FLAG_OPEN)); rb_define_const (rb_mCairo_PDFOutlineFlags, "BOLD", INT2NUM (CAIRO_BOOKMARK_FLAG_BOLD)); rb_define_const (rb_mCairo_PDFOutlineFlags, "ITALIC", INT2NUM (CAIRO_BOOKMARK_FLAG_ITALIC)); # endif rb_mCairo_PDFMetadata = rb_define_module_under (rb_mCairo, "PDFMetadata"); rb_define_const (rb_mCairo_PDFMetadata, "TITLE", INT2NUM (CAIRO_PDF_METADATA_TITLE)); rb_define_const (rb_mCairo_PDFMetadata, "AUTHOR", INT2NUM (CAIRO_PDF_METADATA_AUTHOR)); rb_define_const (rb_mCairo_PDFMetadata, "SUBJECT", INT2NUM (CAIRO_PDF_METADATA_SUBJECT)); rb_define_const (rb_mCairo_PDFMetadata, "KEYWORDS", INT2NUM (CAIRO_PDF_METADATA_KEYWORDS)); rb_define_const (rb_mCairo_PDFMetadata, "CREATOR", INT2NUM (CAIRO_PDF_METADATA_CREATOR)); rb_define_const (rb_mCairo_PDFMetadata, "CREATE_DATE", INT2NUM (CAIRO_PDF_METADATA_CREATE_DATE)); rb_define_const (rb_mCairo_PDFMetadata, "MOD_DATE", INT2NUM (CAIRO_PDF_METADATA_MOD_DATE)); #endif #if CAIRO_CHECK_VERSION(1, 15, 10) rb_mCairo_SVGUnit = rb_define_module_under (rb_mCairo, "SVGUnit"); rb_define_const (rb_mCairo_SVGUnit, "USER", INT2NUM (CAIRO_SVG_UNIT_USER)); rb_define_const (rb_mCairo_SVGUnit, "EM", INT2NUM (CAIRO_SVG_UNIT_EM)); rb_define_const (rb_mCairo_SVGUnit, "EX", INT2NUM (CAIRO_SVG_UNIT_EX)); rb_define_const (rb_mCairo_SVGUnit, "PX", INT2NUM (CAIRO_SVG_UNIT_PX)); rb_define_const (rb_mCairo_SVGUnit, "IN", INT2NUM (CAIRO_SVG_UNIT_IN)); rb_define_const (rb_mCairo_SVGUnit, "CM", INT2NUM (CAIRO_SVG_UNIT_CM)); rb_define_const (rb_mCairo_SVGUnit, "MM", INT2NUM (CAIRO_SVG_UNIT_MM)); rb_define_const (rb_mCairo_SVGUnit, "PT", INT2NUM (CAIRO_SVG_UNIT_PT)); rb_define_const (rb_mCairo_SVGUnit, "PC", INT2NUM (CAIRO_SVG_UNIT_PC)); rb_define_const (rb_mCairo_SVGUnit, "PERCENT", INT2NUM (CAIRO_SVG_UNIT_PERCENT)); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_context.c000066400000000000000000001350451370612400100204530ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-09-26 13:52:08 $ * * Copyright 2005-2019 Kouhei Sutou * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #include "rb_cairo_io.h" #ifdef HAVE_RUBY_ST_H # include #else # include #endif VALUE rb_cCairo_Context; static ID cr_id_new; static ID cr_id_surface, cr_id_source; static ID cr_id_plus, cr_id_minus, cr_id_multi, cr_id_div; static cairo_user_data_key_t cr_object_holder_key; #define _SELF (RVAL2CRCONTEXT(self)) static VALUE cr_get_current_point (VALUE self); static inline void cr_check_status (cairo_t *context) { rb_cairo_check_status (cairo_status (context)); } /* Functions for manipulating state objects */ cairo_t * rb_cairo_context_from_ruby_object (VALUE obj) { cairo_t *context; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Context)) { rb_raise (rb_eTypeError, "not a cairo graphics context"); } Data_Get_Struct (obj, cairo_t, context); if (!context) rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER); return context; } static rb_cairo__object_holder_t * cr_object_holder_new (VALUE object) { return rb_cairo__object_holder_new (rb_cCairo_Context, object); } static void cr_object_holder_free (void *ptr) { rb_cairo__object_holder_free (rb_cCairo_Context, ptr); } static void cr_context_free (void *ptr) { if (ptr) { cairo_destroy ((cairo_t *) ptr); } } VALUE rb_cairo_context_to_ruby_object (cairo_t *cr) { if (cr) { cairo_reference (cr); return Data_Wrap_Struct (rb_cCairo_Context, NULL, cr_context_free, cr); } else { return Qnil; } } static VALUE cr_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_context_free, NULL); } static void cr_set_user_data (cairo_t *cr, const cairo_user_data_key_t *key, void *user_data, cairo_destroy_func_t destroy) { #if CAIRO_CHECK_VERSION(1, 4, 0) cairo_set_user_data (cr, key, user_data, destroy); #else cairo_surface_t *surface; surface = cairo_get_target (cr); cairo_surface_set_user_data (surface, key, user_data, destroy); #endif } static VALUE cr_destroy (VALUE self) { cairo_t *cr; cr = _SELF; cr_set_user_data (cr, &cr_object_holder_key, NULL, NULL); cairo_destroy (cr); DATA_PTR (self) = NULL; return Qnil; } static VALUE cr_destroyed (VALUE self) { return CBOOL2RVAL (DATA_PTR (self) == NULL); } static VALUE cr_destroy_with_destroy_check (VALUE self) { if (DATA_PTR (self)) cr_destroy (self); return Qnil; } static VALUE cr_get_reference_count (VALUE self) { cairo_t *cr; unsigned int reference_count; cr = _SELF; reference_count = cairo_get_reference_count (cr); return UINT2NUM (reference_count); } static VALUE cr_s_create (int argc, VALUE *argv, VALUE klass) { VALUE rb_cr; rb_cr = rb_funcallv (klass, cr_id_new, argc, argv); if (rb_block_given_p ()) { return rb_ensure (rb_yield, rb_cr, cr_destroy_with_destroy_check, rb_cr); } else { return rb_cr; } } static VALUE cr_s_wrap (VALUE self, VALUE pointer) { VALUE result; VALUE rb_cr; cairo_t *cr; if (NIL_P (rb_cairo__cFFIPointer)) { rb_raise (rb_eNotImpError, "%s: FFI::Pointer is required", rb_id2name (rb_frame_this_func ())); } if (!RTEST (rb_obj_is_kind_of (pointer, rb_cairo__cFFIPointer))) { rb_raise (rb_eArgError, "must be FFI::Pointer: %s", rb_cairo__inspect (pointer)); } { VALUE rb_cr_address; rb_cr_address = rb_funcall (pointer, rb_intern ("address"), 0); cr = NUM2PTR (rb_cr_address); cr_check_status (cr); } rb_cr = rb_obj_alloc (self); cairo_reference (cr); DATA_PTR (rb_cr) = cr; rb_ivar_set (rb_cr, cr_id_surface, Qnil); if (rb_block_given_p ()) { result = rb_ensure (rb_yield, rb_cr, cr_destroy_with_destroy_check, rb_cr); } else { result = rb_cr; } return result; } static VALUE cr_initialize (VALUE self, VALUE target) { cairo_t *cr; VALUE result = Qnil; cr = cairo_create (RVAL2CRSURFACE (target)); cr_check_status (cr); rb_ivar_set (self, cr_id_surface, target); rb_ivar_set (self, cr_id_source, Qnil); if (rb_ivar_defined (target, rb_cairo__io_id_output)) cr_set_user_data (cr, &cr_object_holder_key, cr_object_holder_new (self), cr_object_holder_free); DATA_PTR (self) = cr; if (rb_block_given_p ()) result = rb_ensure (rb_yield, self, cr_destroy_with_destroy_check, self); return result; } static VALUE cr_to_ptr (VALUE self) { if (NIL_P (rb_cairo__cFFIPointer)) return Qnil; return rb_funcall (rb_cairo__cFFIPointer, rb_intern ("new"), 1, PTR2NUM (_SELF)); } static VALUE cr_raw_address (VALUE self) { return PTR2NUM (_SELF); } static VALUE cr_restore (VALUE self) { cairo_restore (_SELF); cr_check_status (_SELF); return Qnil; } static VALUE cr_save (VALUE self) { VALUE result = Qnil; cairo_save (_SELF); cr_check_status (_SELF); if (rb_block_given_p ()) { result = rb_ensure (rb_yield, self, cr_restore, self); } return result; } static VALUE cr_pop_group (VALUE self) { VALUE rb_pattern; cairo_pattern_t *pattern; pattern = cairo_pop_group (_SELF); cr_check_status (_SELF); rb_pattern = CRPATTERN2RVAL (pattern); cairo_pattern_destroy (pattern); return rb_pattern; } static VALUE cr_pop_group_to_source (VALUE self) { cairo_pop_group_to_source (_SELF); cr_check_status (_SELF); return Qnil; } static VALUE cr_pop_group_generic (int argc, VALUE *argv, VALUE self) { VALUE to_source; rb_scan_args (argc, argv, "01", &to_source); if (RVAL2CBOOL (to_source)) return cr_pop_group_to_source (self); else return cr_pop_group (self); } static VALUE cr_push_group (int argc, VALUE *argv, VALUE self) { VALUE result = Qnil; VALUE content, pop_to_source; rb_scan_args (argc, argv, "02", &content, &pop_to_source); if (NIL_P(content)) cairo_push_group (_SELF); else cairo_push_group_with_content (_SELF, RVAL2CRCONTENT(content)); cr_check_status (_SELF); if (rb_block_given_p ()) { int state = 0; if (NIL_P (pop_to_source)) pop_to_source = Qtrue; result = rb_protect (rb_yield, self, &state); if (cairo_status(_SELF) == CAIRO_STATUS_SUCCESS) { if (RVAL2CBOOL (pop_to_source)) cr_pop_group_to_source (self); else result = cr_pop_group (self); } if (state) rb_jump_tag (state); } return result; } /* Modify state */ static VALUE cr_set_operator (VALUE self, VALUE operator) { cairo_set_operator (_SELF, RVAL2CROPERATOR (operator)); cr_check_status (_SELF); return self; } static VALUE cr_set_source_rgb (int argc, VALUE *argv, VALUE self) { VALUE red, green, blue; int n; n = rb_scan_args (argc, argv, "12", &red, &green, &blue); if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray)) { VALUE ary = red; n = (int) RARRAY_LEN (ary); red = rb_ary_entry (ary, 0); green = rb_ary_entry (ary, 1); blue = rb_ary_entry (ary, 2); } if (n == 3) { cairo_set_source_rgb (_SELF, NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue)); } else { VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv)); rb_raise (rb_eArgError, "invalid RGB: %s (expect " "(red, green, blue) or ([red, green, blue]))", StringValuePtr (inspected_arg)); } cr_check_status (_SELF); rb_ivar_set (self, cr_id_source, Qnil); return self; } static VALUE cr_set_source_rgba (int argc, VALUE *argv, VALUE self) { VALUE red, green, blue, alpha; int n; n = rb_scan_args (argc, argv, "13", &red, &green, &blue, &alpha); if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray)) { VALUE ary = red; n = (int) RARRAY_LEN (ary); red = rb_ary_entry (ary, 0); green = rb_ary_entry (ary, 1); blue = rb_ary_entry (ary, 2); alpha = rb_ary_entry (ary, 3); } if (n == 3) { cairo_set_source_rgb (_SELF, NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue)); } else if (n == 4) { cairo_set_source_rgba (_SELF, NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue), NUM2DBL (alpha)); } else { VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv)); rb_raise (rb_eArgError, "invalid RGB%s: %s (expect " "(red, green, blue), (red, green, blue, alpha), " "([red, green, blue]) or ([red, green, blue, alpha]))", n == 4 ? "A" : "", StringValuePtr (inspected_arg)); } cr_check_status (_SELF); rb_ivar_set (self, cr_id_source, Qnil); return self; } static VALUE cr_set_source_surface (VALUE self, VALUE surface, VALUE width, VALUE height) { cairo_set_source_surface (_SELF, RVAL2CRSURFACE (surface), NUM2DBL (width), NUM2DBL (height)); cr_check_status (_SELF); rb_ivar_set (self, cr_id_source, Qnil); return self; } static VALUE cr_set_source (VALUE self, VALUE pattern) { cairo_set_source (_SELF, RVAL2CRPATTERN (pattern)); cr_check_status (_SELF); rb_ivar_set (self, cr_id_source, pattern); return self; } static VALUE cr_set_source_generic (int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3, arg4; int n; n = rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4); if (n == 1 && rb_cairo__is_kind_of (arg1, rb_cArray)) { return cr_set_source_rgba (argc, argv, self); } else if (n == 1 && rb_cairo__is_kind_of (arg1, rb_cCairo_Surface)) { return cr_set_source_surface (self, arg1, rb_float_new (0), rb_float_new (0)); } else if (n == 1) { return cr_set_source (self, arg1); } else if (n == 3 && rb_cairo__is_kind_of (arg1, rb_cCairo_Surface)) { return cr_set_source_surface (self, arg1, arg2, arg3); } else if (n == 3 || n == 4) { return cr_set_source_rgba (argc, argv, self); } else { rb_raise (rb_eArgError, "invalid argument (expect " "(red, green, blue), (red, green, blue, alpha), " "([red, green, blue]), ([red, green, blue, alpha]), " "(surface), (pattern) or (surface, x, y))"); } } static VALUE cr_set_tolerance (VALUE self, VALUE tolerance) { cairo_set_tolerance (_SELF, NUM2DBL (tolerance)); cr_check_status (_SELF); return self; } static VALUE cr_set_antialias(VALUE self, VALUE antialias) { cairo_set_antialias(_SELF, RVAL2CRANTIALIAS (antialias)); cr_check_status(_SELF); return self; } static VALUE cr_set_fill_rule (VALUE self, VALUE rule) { cairo_set_fill_rule (_SELF, RVAL2CRFILLRULE (rule)); cr_check_status (_SELF); return self; } static VALUE cr_set_line_width (VALUE self, VALUE width) { cairo_set_line_width (_SELF, NUM2DBL (width)); return self; } static VALUE cr_set_line_cap (VALUE self, VALUE cap) { cairo_set_line_cap (_SELF, RVAL2CRLINECAP (cap)); cr_check_status (_SELF); return self; } static VALUE cr_set_line_join (VALUE self, VALUE join) { cairo_set_line_join (_SELF, RVAL2CRLINEJOIN (join)); cr_check_status (_SELF); return self; } static VALUE cr_set_dash (int argc, VALUE *argv, VALUE self) { VALUE dash_array, rb_offset; double offset; cairo_bool_t is_num; rb_scan_args(argc, argv, "11", &dash_array, &rb_offset); is_num = rb_cairo__is_kind_of (dash_array, rb_cNumeric); if (!(NIL_P (dash_array) || is_num)) { Check_Type (dash_array, T_ARRAY); } if (NIL_P (rb_offset)) offset = 0.0; else offset = NUM2DBL (rb_offset); if (is_num) { double values[1]; values[0] = NUM2DBL (dash_array); cairo_set_dash (_SELF, values, 1, offset); } else if (NIL_P (dash_array) || RARRAY_LEN (dash_array) == 0) { cairo_set_dash (_SELF, NULL, 0, offset); } else { int i, length; double *values; length = (int) RARRAY_LEN (dash_array); values = ALLOCA_N (double, length); if (!values) { rb_cairo_check_status (CAIRO_STATUS_NO_MEMORY); } for (i = 0; i < length; i++) { values[i] = NUM2DBL (RARRAY_PTR (dash_array)[i]); } cairo_set_dash (_SELF, values, length, offset); } cr_check_status (_SELF); return self; } static VALUE cr_set_miter_limit (VALUE self, VALUE limit) { cairo_set_miter_limit (_SELF, NUM2DBL (limit)); cr_check_status (_SELF); return self; } static VALUE cr_translate (VALUE self, VALUE tx, VALUE ty) { cairo_translate (_SELF, NUM2DBL (tx), NUM2DBL (ty)); cr_check_status (_SELF); return self; } static VALUE cr_scale (VALUE self, VALUE sx, VALUE sy) { cairo_scale (_SELF, NUM2DBL (sx), NUM2DBL (sy)); cr_check_status (_SELF); return self; } static VALUE cr_rotate (VALUE self, VALUE radians) { cairo_rotate (_SELF, NUM2DBL (radians)); cr_check_status (_SELF); return self; } static VALUE cr_transform (VALUE self, VALUE matrix) { cairo_transform (_SELF, RVAL2CRMATRIX (matrix)); cr_check_status (_SELF); return self; } static VALUE cr_set_matrix (VALUE self, VALUE matrix) { cairo_set_matrix (_SELF, RVAL2CRMATRIX (matrix)); cr_check_status (_SELF); return self; } static VALUE cr_identity_matrix (VALUE self) { cairo_identity_matrix (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_user_to_device (VALUE self, VALUE x, VALUE y) { double pair[2]; pair[0] = NUM2DBL (x); pair[1] = NUM2DBL (y); cairo_user_to_device (_SELF, pair, pair + 1); cr_check_status (_SELF); return rb_cairo__float_array (pair, 2); } static VALUE cr_user_to_device_distance (VALUE self, VALUE dx, VALUE dy) { double pair[2]; pair[0] = NUM2DBL (dx); pair[1] = NUM2DBL (dy); cairo_user_to_device_distance (_SELF, pair, pair + 1); cr_check_status (_SELF); return rb_cairo__float_array (pair, 2); } static VALUE cr_device_to_user (VALUE self, VALUE x, VALUE y) { double pair[2]; pair[0] = NUM2DBL (x); pair[1] = NUM2DBL (y); cairo_device_to_user (_SELF, pair, pair + 1); cr_check_status (_SELF); return rb_cairo__float_array (pair, 2); } static VALUE cr_device_to_user_distance (VALUE self, VALUE dx, VALUE dy) { double pair[2]; pair[0] = NUM2DBL (dx); pair[1] = NUM2DBL (dy); cairo_device_to_user_distance (_SELF, pair, pair + 1); cr_check_status (_SELF); return rb_cairo__float_array (pair, 2); } /* Path creation functions */ static VALUE cr_new_path (VALUE self) { cairo_new_path (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_move_to (VALUE self, VALUE x, VALUE y) { cairo_move_to (_SELF, NUM2DBL (x), NUM2DBL (y)); cr_check_status (_SELF); return self; } static VALUE cr_new_sub_path (VALUE self) { cairo_new_sub_path (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_line_to (VALUE self, VALUE x, VALUE y) { cairo_line_to (_SELF, NUM2DBL (x), NUM2DBL (y)); cr_check_status (_SELF); return self; } static VALUE cr_curve_to (VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3) { cairo_curve_to (_SELF, NUM2DBL (x1), NUM2DBL (y1), NUM2DBL (x2), NUM2DBL (y2), NUM2DBL (x3), NUM2DBL (y3)); cr_check_status (_SELF); return self; } static VALUE cr_quadratic_curve_to (VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2) { VALUE current_point, x0, y0, cx1, cy1, cx2, cy2; current_point = cr_get_current_point (self); x0 = RARRAY_PTR (current_point)[0]; y0 = RARRAY_PTR (current_point)[1]; /* cx1 = x0 + 2 * ((x1 - x0) / 3.0) */ cx1 = rb_funcall (x0, cr_id_plus, 1, rb_funcall (INT2NUM(2), cr_id_multi, 1, rb_funcall (rb_funcall (x1, cr_id_minus, 1, x0), cr_id_div, 1, rb_float_new (3.0)))); /* cy1 = y0 + 2 * ((y1 - y0) / 3.0) */ cy1 = rb_funcall (y0, cr_id_plus, 1, rb_funcall (INT2NUM(2), cr_id_multi, 1, rb_funcall (rb_funcall (y1, cr_id_minus, 1, y0), cr_id_div, 1, rb_float_new (3.0)))); /* cx2 = cx1 + (x2 - x0) / 3.0 */ cx2 = rb_funcall (cx1, cr_id_plus, 1, rb_funcall (rb_funcall (x2, cr_id_minus, 1, x0), cr_id_div, 1, rb_float_new (3.0))); /* cy2 = cy1 + (y2 - y0) / 3.0 */ cy2 = rb_funcall (cy1, cr_id_plus, 1, rb_funcall (rb_funcall (y2, cr_id_minus, 1, y0), cr_id_div, 1, rb_float_new (3.0))); return cr_curve_to (self, cx1, cy1, cx2, cy2, x2, y2); } static VALUE cr_curve_to_generic (int argc, VALUE *argv, VALUE self) { VALUE x1, y1, x2, y2, x3, y3; rb_scan_args (argc, argv, "42", &x1, &y1, &x2, &y2, &x3, &y3); if (!(argc == 4 || argc == 6)) { VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv)); rb_raise (rb_eArgError, "invalid argument: %s (expect " "(x1, y1, x2, y2) (quadratic) or " "(x1, y1, x2, y2, x3, y3) (cubic))", StringValuePtr (inspected_arg)); } if (argc == 4) return cr_quadratic_curve_to (self, x1, y1, x2, y2); else return cr_curve_to (self, x1, y1, x2, y2, x3, y3); } static VALUE cr_arc (VALUE self, VALUE xc, VALUE yc, VALUE radius, VALUE angle1, VALUE angle2) { cairo_arc (_SELF, NUM2DBL (xc), NUM2DBL (yc), NUM2DBL (radius), NUM2DBL (angle1), NUM2DBL (angle2)); cr_check_status (_SELF); return self; } static VALUE cr_arc_negative (VALUE self, VALUE xc, VALUE yc, VALUE radius, VALUE angle1, VALUE angle2) { cairo_arc_negative (_SELF, NUM2DBL (xc), NUM2DBL (yc), NUM2DBL (radius), NUM2DBL (angle1), NUM2DBL (angle2)); cr_check_status (_SELF); return self; } static VALUE cr_rel_move_to (VALUE self, VALUE x, VALUE y) { cairo_rel_move_to (_SELF, NUM2DBL (x), NUM2DBL (y)); cr_check_status (_SELF); return self; } static VALUE cr_rel_line_to (VALUE self, VALUE x, VALUE y) { cairo_rel_line_to (_SELF, NUM2DBL (x), NUM2DBL (y)); cr_check_status (_SELF); return self; } static VALUE cr_rel_curve_to (VALUE self, VALUE dx1, VALUE dy1, VALUE dx2, VALUE dy2, VALUE dx3, VALUE dy3) { cairo_rel_curve_to (_SELF, NUM2DBL (dx1), NUM2DBL (dy1), NUM2DBL (dx2), NUM2DBL (dy2), NUM2DBL (dx3), NUM2DBL (dy3)); cr_check_status (_SELF); return self; } static VALUE cr_rel_quadratic_curve_to (VALUE self, VALUE dx1, VALUE dy1, VALUE dx2, VALUE dy2) { VALUE current_point, x0, y0; current_point = cr_get_current_point (self); x0 = RARRAY_PTR (current_point)[0]; y0 = RARRAY_PTR (current_point)[1]; return cr_quadratic_curve_to (self, rb_funcall (dx1, cr_id_plus, 1, x0), rb_funcall (dy1, cr_id_plus, 1, y0), rb_funcall (dx2, cr_id_plus, 1, x0), rb_funcall (dy2, cr_id_plus, 1, y0)); } static VALUE cr_rel_curve_to_generic (int argc, VALUE *argv, VALUE self) { VALUE dx1, dy1, dx2, dy2, dx3, dy3; rb_scan_args (argc, argv, "42", &dx1, &dy1, &dx2, &dy2, &dx3, &dy3); if (!(argc == 4 || argc == 6)) { VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv)); rb_raise (rb_eArgError, "invalid argument: %s (expect " "(dx1, dy1, dx2, dy2) (quadratic) or " "(dx1, dy1, dx2, dy2, dx3, dy3) (cubic))", StringValuePtr (inspected_arg)); } if (argc == 4) return cr_rel_quadratic_curve_to (self, dx1, dy1, dx2, dy2); else return cr_rel_curve_to (self, dx1, dy1, dx2, dy2, dx3, dy3); } static VALUE cr_rectangle (VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { cairo_rectangle (_SELF, NUM2DBL (x), NUM2DBL (y), NUM2DBL (width), NUM2DBL (height)); cr_check_status (_SELF); return self; } static VALUE cr_close_path (VALUE self) { cairo_close_path (_SELF); cr_check_status (_SELF); return self; } #if CAIRO_CHECK_VERSION(1, 5, 8) static VALUE cr_path_extents (VALUE self) { double x1, y1, x2, y2; cairo_path_extents (_SELF, &x1, &y1, &x2, &y2); cr_check_status (_SELF); return rb_ary_new3 (4, rb_float_new(x1), rb_float_new(y1), rb_float_new(x2), rb_float_new(y2)); } #endif /* Painting functions */ static VALUE cr_paint (VALUE self) { cairo_paint (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_paint_with_alpha (VALUE self, VALUE alpha) { cairo_paint_with_alpha (_SELF, NUM2DBL (alpha)); cr_check_status (_SELF); return self; } static VALUE cr_paint_generic (int argc, VALUE *argv, VALUE self) { VALUE alpha; int n; n = rb_scan_args (argc, argv, "01", &alpha); if (n == 0 || (n == 1 && NIL_P (alpha))) { return cr_paint (self); } if (n == 1) { return cr_paint_with_alpha (self, alpha); } else { rb_raise (rb_eArgError, "invalid argument (expect () or (alpha))"); } } static VALUE cr_mask(VALUE self, VALUE pattern) { cairo_mask (_SELF, RVAL2CRPATTERN (pattern)); cr_check_status (_SELF); return self; } static VALUE cr_mask_surface (VALUE self, VALUE surface, VALUE x, VALUE y) { cairo_mask_surface (_SELF, RVAL2CRSURFACE (surface), NUM2DBL (x), NUM2DBL (y)); cr_check_status (_SELF); return self; } static VALUE cr_mask_generic (int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3; int n; n = rb_scan_args (argc, argv, "12", &arg1, &arg2, &arg3); if (n == 1) { return cr_mask (self, arg1); } else if (n == 3) { return cr_mask_surface (self, arg1, arg2, arg3); } else { rb_raise (rb_eArgError, "invalid argument (expect (pattern) or (surface, x, y))"); } } static VALUE cr_stroke (int argc, VALUE *argv, VALUE self) { VALUE preserve; rb_scan_args (argc, argv, "01", &preserve); if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } if (RVAL2CBOOL (preserve)) cairo_stroke_preserve (_SELF); else cairo_stroke (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_fill (int argc, VALUE *argv, VALUE self) { VALUE preserve; rb_scan_args (argc, argv, "01", &preserve); if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } if (RVAL2CBOOL (preserve)) cairo_fill_preserve (_SELF); else cairo_fill (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_copy_page (VALUE self) { cairo_copy_page (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_show_page (VALUE self) { cairo_show_page (_SELF); cr_check_status (_SELF); return self; } /* Insideness testing */ static VALUE cr_in_stroke (VALUE self, VALUE x, VALUE y) { if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } return CBOOL2RVAL (cairo_in_stroke (_SELF, NUM2DBL (x), NUM2DBL (y))); } static VALUE cr_in_fill (VALUE self, VALUE x, VALUE y) { if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } return CBOOL2RVAL (cairo_in_fill (_SELF, NUM2DBL (x), NUM2DBL (y))); } #if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE cr_in_clip (VALUE self, VALUE x, VALUE y) { if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } return CBOOL2RVAL (cairo_in_clip (_SELF, NUM2DBL (x), NUM2DBL (y))); } #endif /* Rectangular extents */ static VALUE cr_stroke_extents (VALUE self) { double extents[4]; if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } cairo_stroke_extents (_SELF, extents, extents + 1, extents + 2, extents + 3); return rb_cairo__float_array (extents, 4); } static VALUE cr_fill_extents (VALUE self) { double extents[4]; if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } cairo_fill_extents (_SELF, extents, extents + 1, extents + 2, extents + 3); return rb_cairo__float_array (extents, 4); } /* Clipping */ static VALUE cr_reset_clip (VALUE self) { cairo_reset_clip (_SELF); cr_check_status (_SELF); return self; } static VALUE cr_clip (int argc, VALUE *argv, VALUE self) { VALUE preserve; rb_scan_args(argc, argv, "01", &preserve); if (rb_block_given_p ()) { cr_new_path (self); rb_yield (self); } if (RVAL2CBOOL (preserve)) cairo_clip_preserve(_SELF); else cairo_clip (_SELF); cr_check_status (_SELF); return self; } #if CAIRO_CHECK_VERSION(1, 3, 0) static VALUE cr_clip_extents (VALUE self) { double x1, y1, x2, y2; cairo_clip_extents (_SELF, &x1, &y1, &x2, &y2); cr_check_status (_SELF); return rb_ary_new3 (4, rb_float_new (x1), rb_float_new (y1), rb_float_new (x2), rb_float_new (y2)); } static VALUE cr_clip_rectangle_list (VALUE self) { VALUE rb_rectangles; cairo_rectangle_list_t *rectangles; int i; rectangles = cairo_copy_clip_rectangle_list (_SELF); rb_cairo_check_status (rectangles->status); rb_rectangles = rb_ary_new2 (rectangles->num_rectangles); for (i = 0; i < rectangles->num_rectangles; i++) { VALUE argv[4]; cairo_rectangle_t rectangle = rectangles->rectangles[i]; argv[0] = rb_float_new (rectangle.x); argv[1] = rb_float_new (rectangle.y); argv[2] = rb_float_new (rectangle.width); argv[3] = rb_float_new (rectangle.height); rb_ary_push (rb_rectangles, rb_class_new_instance (4, argv, rb_cCairo_Rectangle)); } cairo_rectangle_list_destroy (rectangles); return rb_rectangles; } #endif /* Font/Text functions */ static VALUE cr_select_font_face (int argc, VALUE *argv, VALUE self) { VALUE rb_family, rb_slant, rb_weight; const char *family; cairo_font_slant_t slant; cairo_font_weight_t weight; rb_scan_args(argc, argv, "03", &rb_family, &rb_slant, &rb_weight); if (NIL_P (rb_family)) { family = ""; } else if (rb_cairo__is_kind_of (rb_family, rb_cString)) { family = RSTRING_PTR (rb_family); } else if (rb_cairo__is_kind_of (rb_family, rb_cSymbol)) { family = rb_id2name (SYM2ID (rb_family)); } else { rb_raise (rb_eArgError, "family name should be nil, String or Symbol: %s", rb_cairo__inspect (rb_family)); } if (NIL_P (rb_slant)) slant = CAIRO_FONT_SLANT_NORMAL; else slant = RVAL2CRFONTSLANT (rb_slant); if (NIL_P (rb_weight)) weight = CAIRO_FONT_WEIGHT_NORMAL; else weight = RVAL2CRFONTWEIGHT (rb_weight); cairo_select_font_face (_SELF, family, slant, weight); cr_check_status (_SELF); return self; } static VALUE cr_set_font_size (VALUE self, VALUE scale) { cairo_set_font_size (_SELF, NUM2DBL (scale)); cr_check_status (_SELF); return self; } static VALUE cr_set_font_matrix (VALUE self, VALUE matrix) { cairo_set_font_matrix (_SELF, RVAL2CRMATRIX (matrix)); cr_check_status (_SELF); return self; } static VALUE cr_get_font_matrix (VALUE self) { cairo_matrix_t matrix; cairo_get_font_matrix (_SELF, &matrix); cr_check_status (_SELF); return CRMATRIX2RVAL (&matrix); } static VALUE cr_set_font_options (VALUE self, VALUE options) { cairo_set_font_options (_SELF, RVAL2CRFONTOPTIONS (options)); cr_check_status (_SELF); return self; } static VALUE cr_get_font_options (VALUE self) { cairo_font_options_t *options; VALUE rb_options; options = cairo_font_options_create (); rb_cairo_check_status (cairo_font_options_status (options)); /* TODO: Use rb_ensure() */ rb_options = CRFONTOPTIONS2RVAL (options); cairo_font_options_destroy (options); options = RVAL2CRFONTOPTIONS (rb_options); cairo_get_font_options (_SELF, options); cr_check_status (_SELF); rb_cairo_check_status (cairo_font_options_status (options)); return rb_options; } static VALUE cr_set_scaled_font (VALUE self, VALUE scaled_font) { cairo_set_scaled_font (_SELF, RVAL2CRSCALEDFONT (scaled_font)); cr_check_status (_SELF); return self; } #if CAIRO_CHECK_VERSION(1, 3, 16) static VALUE cr_get_scaled_font (VALUE self) { return CRSCALEDFONT2RVAL (cairo_get_scaled_font (_SELF)); } #endif static VALUE cr_show_text (VALUE self, VALUE utf8) { cairo_show_text (_SELF, RVAL2CSTR (utf8)); cr_check_status (_SELF); return self; } static VALUE cr_show_glyphs (VALUE self, VALUE rb_glyphs) { int count; cairo_glyph_t *glyphs; RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, count); cairo_show_glyphs (_SELF, glyphs, count); cr_check_status (_SELF); return self; } #if CAIRO_CHECK_VERSION(1, 8, 0) static VALUE cr_show_text_glyphs (VALUE self, VALUE rb_utf8, VALUE rb_glyphs, VALUE rb_clusters, VALUE rb_cluster_flags) { cairo_t *cr; const char *utf8; int utf8_len; cairo_glyph_t *glyphs = NULL; int num_glyphs = 0; cairo_text_cluster_t *clusters = NULL; int num_clusters = 0; cairo_text_cluster_flags_t cluster_flags; cr = _SELF; utf8 = RSTRING_PTR (rb_utf8); utf8_len = (int) RSTRING_LEN (rb_utf8); rb_cairo__glyphs_from_ruby_object (rb_glyphs, &glyphs, &num_glyphs); rb_cairo__text_clusters_from_ruby_object (rb_clusters, &clusters, &num_clusters); cluster_flags = RVAL2CRTEXTCLUSTERFLAGS (rb_cluster_flags); cairo_show_text_glyphs (cr, utf8, utf8_len, glyphs, num_glyphs, clusters, num_clusters, cluster_flags); if (glyphs) cairo_glyph_free (glyphs); if (clusters) cairo_text_cluster_free (clusters); return self; } #endif static VALUE cr_get_font_face (VALUE self) { cairo_font_face_t *face; face = cairo_get_font_face (_SELF); rb_cairo_check_status (cairo_font_face_status (face)); return CRFONTFACE2RVAL (face); } static VALUE cr_font_extents (VALUE self) { cairo_font_extents_t extents; cairo_font_extents (_SELF, &extents); cr_check_status (_SELF); return CRFONTEXTENTS2RVAL (&extents); } static VALUE cr_set_font_face (VALUE self, VALUE face) { cairo_set_font_face (_SELF, NIL_P (face) ? NULL : RVAL2CRFONTFACE (face)); cr_check_status (_SELF); return self; } static VALUE cr_text_extents (VALUE self, VALUE utf8) { cairo_text_extents_t extents; cairo_text_extents (_SELF, StringValuePtr (utf8), &extents); cr_check_status (_SELF); return CRTEXTEXTENTS2RVAL (&extents); } static VALUE cr_glyph_extents (VALUE self, VALUE rb_glyphs) { cairo_text_extents_t extents; cairo_glyph_t *glyphs; int length; RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, length); cairo_glyph_extents (_SELF, glyphs, length, &extents); cr_check_status (_SELF); return CRTEXTEXTENTS2RVAL (&extents); } static VALUE cr_text_path (VALUE self, VALUE utf8) { cairo_text_path (_SELF, StringValuePtr (utf8)); cr_check_status (_SELF); return self; } static VALUE cr_glyph_path (VALUE self, VALUE rb_glyphs) { int count; cairo_glyph_t *glyphs; RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, count); cairo_glyph_path (_SELF, glyphs, count); cr_check_status (_SELF); return self; } /* Query functions */ static VALUE cr_get_operator (VALUE self) { return INT2FIX (cairo_get_operator (_SELF)); } static VALUE cr_get_source (VALUE self) { VALUE rb_source = Qnil; cairo_pattern_t *source; source = cairo_get_source (_SELF); if (source) { rb_cairo_check_status (cairo_pattern_status (source)); rb_source = rb_ivar_get (self, cr_id_source); if (NIL_P (rb_source) || RVAL2CRPATTERN (rb_source) != source) { rb_source = CRPATTERN2RVAL (source); rb_ivar_set (self, cr_id_source, rb_source); } } else { rb_source = Qnil; rb_ivar_set (self, cr_id_source, rb_source); } return rb_source; } static VALUE cr_get_tolerance (VALUE self) { return rb_float_new (cairo_get_tolerance (_SELF)); } static VALUE cr_get_antialias(VALUE self) { return INT2NUM (cairo_get_antialias (_SELF)); } #if CAIRO_CHECK_VERSION(1, 5, 10) static VALUE cr_has_current_point(VALUE self) { return RTEST (cairo_has_current_point (_SELF)); } #endif static VALUE cr_get_current_point (VALUE self) { double point[2]; cairo_get_current_point (_SELF, point, point + 1); return rb_cairo__float_array (point, 2); } static VALUE cr_get_fill_rule (VALUE self) { return INT2FIX (cairo_get_fill_rule (_SELF)); } static VALUE cr_get_line_width (VALUE self) { return rb_float_new (cairo_get_line_width (_SELF)); } static VALUE cr_get_line_cap (VALUE self) { return INT2FIX (cairo_get_line_cap (_SELF)); } static VALUE cr_get_line_join (VALUE self) { return INT2FIX (cairo_get_line_join (_SELF)); } static VALUE cr_get_miter_limit (VALUE self) { return rb_float_new (cairo_get_miter_limit (_SELF)); } #if CAIRO_CHECK_VERSION(1, 3, 0) static VALUE cr_get_dash_count (VALUE self) { return INT2NUM (cairo_get_dash_count (_SELF)); } static VALUE cr_get_dash (VALUE self) { int count; double *dashes, offset; count = cairo_get_dash_count (_SELF); dashes = ALLOCA_N (double, count); cairo_get_dash (_SELF, dashes, &offset); return rb_ary_new3 (2, rb_cairo__float_array (dashes, count), rb_float_new (offset)); } #endif static VALUE cr_get_matrix (VALUE self) { cairo_matrix_t matrix; cairo_get_matrix (_SELF, &matrix); cr_check_status (_SELF); return CRMATRIX2RVAL (&matrix); } static VALUE cr_get_target (VALUE self) { cairo_surface_t *surface; VALUE rb_surface = Qnil; surface = cairo_get_target (_SELF); rb_cairo_check_status (cairo_surface_status (surface)); if (RTEST (rb_ivar_defined (self, cr_id_surface))) rb_surface = rb_ivar_get (self, cr_id_surface); if (NIL_P (rb_surface) || RVAL2CRSURFACE (rb_surface) != surface) { rb_surface = CRSURFACE2RVAL (surface); rb_ivar_set (self, cr_id_surface, rb_surface); } return rb_surface; } static VALUE cr_get_group_target (VALUE self) { cairo_surface_t *surface; surface = cairo_get_group_target (_SELF); if (!surface) return Qnil; rb_cairo_check_status (cairo_surface_status (surface)); return CRSURFACE2RVAL (surface); } /* Paths */ static VALUE cr_copy_path (VALUE self) { cairo_path_t *path; path = cairo_copy_path (_SELF); rb_cairo_check_status (path->status); return CRPATH2RVAL (path); } static VALUE cr_copy_path_flat (VALUE self) { cairo_path_t *path; path = cairo_copy_path_flat (_SELF); rb_cairo_check_status (path->status); return CRPATH2RVAL (path); } static VALUE cr_copy_append_path (VALUE self, VALUE path) { cairo_append_path (_SELF, RVAL2CRPATH (path)); cr_check_status (_SELF); return self; } #if CAIRO_CHECK_VERSION(1, 15, 4) /* Logical structure tagging functions */ typedef struct rb_cairo_context_tag_ensure_data { VALUE self; const char *name; } rb_cairo_context_tag_ensure_data_t; static VALUE cr_tag_ensure (VALUE user_data) { rb_cairo_context_tag_ensure_data_t *data = (rb_cairo_context_tag_ensure_data_t *)user_data; VALUE self; self = data->self; cairo_tag_end (_SELF, data->name); cr_check_status (_SELF); return Qnil; } static VALUE cr_tag (int argc, VALUE *argv, VALUE self) { VALUE rb_name; VALUE rb_attributes; const char *name; const char *attributes = NULL; rb_scan_args (argc, argv, "11", &rb_name, &rb_attributes); name = RVAL2CSTR (rb_name); if (!NIL_P (rb_attributes)) attributes = RVAL2CSTR (rb_attributes); cairo_tag_begin (_SELF, name, attributes); cr_check_status (_SELF); if (rb_block_given_p ()) { rb_cairo_context_tag_ensure_data_t data; data.self = self; data.name = name; return rb_ensure (rb_yield, self, cr_tag_ensure, (VALUE)&data); } else { return Qnil; } } static VALUE cr_begin_tag (int argc, VALUE *argv, VALUE self) { VALUE rb_name; VALUE rb_attributes; const char *name; const char *attributes = NULL; rb_scan_args (argc, argv, "11", &rb_name, &rb_attributes); name = RVAL2CSTR (rb_name); if (!NIL_P (rb_attributes)) attributes = RVAL2CSTR (rb_attributes); cairo_tag_begin (_SELF, name, attributes); cr_check_status (_SELF); return Qnil; } static VALUE cr_end_tag (VALUE self, VALUE rb_name) { const char *name; name = RVAL2CSTR (rb_name); cairo_tag_end (_SELF, name); cr_check_status (_SELF); return Qnil; } #endif static int cr_destroy_all_guarded_contexts_at_end_iter (VALUE key, VALUE value, VALUE data) { cr_destroy (key); return ST_CONTINUE; } static void cr_destroy_all_guarded_contexts_at_end (VALUE data) { rb_hash_foreach (rb_cairo__gc_guarded_objects (rb_cCairo_Context), cr_destroy_all_guarded_contexts_at_end_iter, Qnil); } void Init_cairo_context (void) { cr_id_new = rb_intern ("new"); cr_id_surface = rb_intern ("surface"); cr_id_source = rb_intern ("source"); cr_id_plus = rb_intern ("+"); cr_id_minus = rb_intern ("-"); cr_id_multi = rb_intern ("*"); cr_id_div = rb_intern ("/"); rb_cCairo_Context = rb_define_class_under (rb_mCairo, "Context", rb_cObject); rb_define_alloc_func (rb_cCairo_Context, cr_allocate); rb_cairo__initialize_gc_guard_holder_class (rb_cCairo_Context); rb_set_end_proc(cr_destroy_all_guarded_contexts_at_end, Qnil); rb_define_singleton_method (rb_cCairo_Context, "create", cr_s_create, -1); /* For integrate other libraries such as a FFI based library. */ rb_define_singleton_method (rb_cCairo_Context, "wrap", cr_s_wrap, 1); /* Functions for manipulating state objects */ rb_define_method (rb_cCairo_Context, "initialize", cr_initialize, 1); rb_define_method (rb_cCairo_Context, "destroy", cr_destroy, 0); rb_define_method (rb_cCairo_Context, "destroyed?", cr_destroyed, 0); rb_define_method (rb_cCairo_Context, "reference_count", cr_get_reference_count, 0); rb_define_method (rb_cCairo_Context, "save", cr_save, 0); rb_define_method (rb_cCairo_Context, "restore", cr_restore, 0); rb_define_method (rb_cCairo_Context, "push_group", cr_push_group, -1); rb_define_method (rb_cCairo_Context, "pop_group", cr_pop_group_generic, -1); rb_define_method (rb_cCairo_Context, "pop_group_to_source", cr_pop_group_to_source, 0); /* Modify state */ rb_define_method (rb_cCairo_Context, "set_operator", cr_set_operator, 1); rb_define_method (rb_cCairo_Context, "set_source", cr_set_source_generic, -1); rb_define_method (rb_cCairo_Context, "set_source_rgb", cr_set_source_rgb, -1); rb_define_method (rb_cCairo_Context, "set_source_rgba", cr_set_source_rgba, -1); rb_define_method (rb_cCairo_Context, "set_tolerance", cr_set_tolerance, 1); rb_define_method (rb_cCairo_Context, "set_antialias", cr_set_antialias, 1); rb_define_method (rb_cCairo_Context, "set_fill_rule", cr_set_fill_rule, 1); rb_define_method (rb_cCairo_Context, "set_line_width", cr_set_line_width, 1); rb_define_method (rb_cCairo_Context, "set_line_cap", cr_set_line_cap, 1); rb_define_method (rb_cCairo_Context, "set_line_join", cr_set_line_join, 1); rb_define_method (rb_cCairo_Context, "set_dash", cr_set_dash, -1); rb_define_method (rb_cCairo_Context, "set_miter_limit", cr_set_miter_limit, 1); rb_define_method (rb_cCairo_Context, "translate", cr_translate, 2); rb_define_method (rb_cCairo_Context, "scale", cr_scale, 2); rb_define_method (rb_cCairo_Context, "rotate", cr_rotate, 1); rb_define_method (rb_cCairo_Context, "transform", cr_transform, 1); rb_define_method (rb_cCairo_Context, "set_matrix", cr_set_matrix, 1); rb_define_method (rb_cCairo_Context, "identity_matrix", cr_identity_matrix, 0); rb_define_method (rb_cCairo_Context, "user_to_device", cr_user_to_device, 2); rb_define_method (rb_cCairo_Context, "user_to_device_distance", cr_user_to_device_distance, 2); rb_define_method (rb_cCairo_Context, "device_to_user", cr_device_to_user, 2); rb_define_method (rb_cCairo_Context, "device_to_user_distance", cr_device_to_user_distance, 2); /* Path creation functions */ rb_define_method (rb_cCairo_Context, "new_path", cr_new_path, 0); rb_define_method (rb_cCairo_Context, "move_to", cr_move_to, 2); rb_define_method (rb_cCairo_Context, "new_sub_path", cr_new_sub_path, 0); rb_define_method (rb_cCairo_Context, "line_to", cr_line_to, 2); rb_define_method (rb_cCairo_Context, "curve_to", cr_curve_to_generic, -1); rb_define_method (rb_cCairo_Context, "arc", cr_arc, 5); rb_define_method (rb_cCairo_Context, "arc_negative", cr_arc_negative, 5); rb_define_method (rb_cCairo_Context, "rel_move_to", cr_rel_move_to, 2); rb_define_method (rb_cCairo_Context, "rel_line_to", cr_rel_line_to, 2); rb_define_method (rb_cCairo_Context, "rel_curve_to", cr_rel_curve_to_generic, -1); rb_define_method (rb_cCairo_Context, "rectangle", cr_rectangle, 4); rb_define_method (rb_cCairo_Context, "close_path", cr_close_path, 0); #if CAIRO_CHECK_VERSION(1, 5, 8) rb_define_method (rb_cCairo_Context, "path_extents", cr_path_extents, 0); #endif /* Painting functions */ rb_define_method (rb_cCairo_Context, "paint", cr_paint_generic, -1); rb_define_method (rb_cCairo_Context, "mask", cr_mask_generic, -1); rb_define_method (rb_cCairo_Context, "stroke", cr_stroke, -1); rb_define_method (rb_cCairo_Context, "fill", cr_fill, -1); rb_define_method (rb_cCairo_Context, "copy_page", cr_copy_page, 0); rb_define_method (rb_cCairo_Context, "show_page", cr_show_page, 0); /* Insideness testing */ rb_define_method (rb_cCairo_Context, "in_stroke?", cr_in_stroke, 2); rb_define_method (rb_cCairo_Context, "in_fill?", cr_in_fill, 2); #if CAIRO_CHECK_VERSION(1, 10, 0) rb_define_method (rb_cCairo_Context, "in_clip?", cr_in_clip, 2); #endif /* Rectangular extents */ rb_define_method (rb_cCairo_Context, "stroke_extents", cr_stroke_extents, 0); rb_define_method (rb_cCairo_Context, "fill_extents", cr_fill_extents, 0); /* Clipping */ rb_define_method (rb_cCairo_Context, "reset_clip", cr_reset_clip, 0); rb_define_method (rb_cCairo_Context, "clip", cr_clip, -1); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_Context, "clip_extents", cr_clip_extents, 0); rb_define_method (rb_cCairo_Context, "clip_rectangle_list", cr_clip_rectangle_list, 0); #endif /* Font/Text functions */ rb_define_method (rb_cCairo_Context, "select_font_face", cr_select_font_face, -1); rb_define_method (rb_cCairo_Context, "set_font_size", cr_set_font_size, 1); rb_define_method (rb_cCairo_Context, "set_font_matrix", cr_set_font_matrix, 1); rb_define_method (rb_cCairo_Context, "font_matrix", cr_get_font_matrix, 0); rb_define_method (rb_cCairo_Context, "set_font_options", cr_set_font_options, 1); rb_define_method (rb_cCairo_Context, "font_options", cr_get_font_options, 0); rb_define_method (rb_cCairo_Context, "set_font_face", cr_set_font_face, 1); rb_define_method (rb_cCairo_Context, "font_face", cr_get_font_face, 0); rb_define_method (rb_cCairo_Context, "set_scaled_font", cr_set_scaled_font, 1); #if CAIRO_CHECK_VERSION(1, 3, 16) rb_define_method (rb_cCairo_Context, "scaled_font", cr_get_scaled_font, 0); #endif rb_define_method (rb_cCairo_Context, "show_text", cr_show_text, 1); rb_define_method (rb_cCairo_Context, "show_glyphs", cr_show_glyphs, 1); #if CAIRO_CHECK_VERSION(1, 8, 0) rb_define_method (rb_cCairo_Context, "show_text_glyphs", cr_show_text_glyphs, 4); #endif rb_define_method (rb_cCairo_Context, "text_path", cr_text_path, 1); rb_define_method (rb_cCairo_Context, "glyph_path", cr_glyph_path, 1); rb_define_method (rb_cCairo_Context, "text_extents", cr_text_extents, 1); rb_define_method (rb_cCairo_Context, "glyph_extents", cr_glyph_extents, 1); rb_define_method (rb_cCairo_Context, "font_extents", cr_font_extents, 0); /* Query functions */ rb_define_method (rb_cCairo_Context, "operator", cr_get_operator, 0); rb_define_method (rb_cCairo_Context, "source", cr_get_source, 0); rb_define_method (rb_cCairo_Context, "tolerance", cr_get_tolerance, 0); rb_define_method (rb_cCairo_Context, "antialias", cr_get_antialias, 0); #if CAIRO_CHECK_VERSION(1, 5, 10) rb_define_method (rb_cCairo_Context, "have_current_point?", cr_has_current_point, 0); rb_define_alias (rb_cCairo_Context, "has_current_point?", "have_current_point?"); #endif rb_define_method (rb_cCairo_Context, "current_point", cr_get_current_point, 0); rb_define_method (rb_cCairo_Context, "fill_rule", cr_get_fill_rule, 0); rb_define_method (rb_cCairo_Context, "line_width", cr_get_line_width, 0); rb_define_method (rb_cCairo_Context, "line_cap", cr_get_line_cap, 0); rb_define_method (rb_cCairo_Context, "line_join", cr_get_line_join, 0); rb_define_method (rb_cCairo_Context, "miter_limit", cr_get_miter_limit, 0); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_Context, "dash_count", cr_get_dash_count, 0); rb_define_method (rb_cCairo_Context, "dash", cr_get_dash, 0); #endif rb_define_method (rb_cCairo_Context, "matrix", cr_get_matrix, 0); rb_define_method (rb_cCairo_Context, "target", cr_get_target, 0); rb_define_method (rb_cCairo_Context, "group_target", cr_get_group_target, 0); /* Paths */ rb_define_method (rb_cCairo_Context, "copy_path", cr_copy_path, 0); rb_define_method (rb_cCairo_Context, "copy_path_flat", cr_copy_path_flat, 0); rb_define_method (rb_cCairo_Context, "append_path", cr_copy_append_path, 1); rb_define_method (rb_cCairo_Context, "to_ptr", cr_to_ptr, 0); rb_define_method (rb_cCairo_Context, "raw_address", cr_raw_address, 0); #if CAIRO_CHECK_VERSION(1, 15, 4) /* Logical structure tagging functions */ { VALUE rb_mCairo_Tag; rb_mCairo_Tag = rb_define_module_under (rb_mCairo, "Tag"); rb_define_const (rb_mCairo_Tag, "DEST", rb_str_new_cstr (CAIRO_TAG_DEST)); rb_define_const (rb_mCairo_Tag, "LINK", rb_str_new_cstr (CAIRO_TAG_LINK)); rb_define_method (rb_cCairo_Context, "tag", cr_tag, -1); rb_define_method (rb_cCairo_Context, "begin_tag", cr_begin_tag, -1); rb_define_method (rb_cCairo_Context, "end_tag", cr_end_tag, 1); } #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_Context); } rcairo-1.16.6/ext/cairo/rb_cairo_device.c000066400000000000000000000320641370612400100202230ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2010-2019 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #include "rb_cairo_io.h" #ifdef HAVE_RUBY_ST_H # include #else # include #endif #ifdef CAIRO_HAS_XML_SURFACE # include #endif #if defined(CAIRO_HAS_SCRIPT_SURFACE) || defined(CAIRO_HAS_XML_SURFACE) # define NEED_DEFINE_OUTPUT_INITIALIZE 1 #endif VALUE rb_cCairo_Device = Qnil; VALUE rb_cCairo_DRMDevice = Qnil; VALUE rb_cCairo_GLDevice = Qnil; VALUE rb_cCairo_ScriptDevice = Qnil; VALUE rb_cCairo_XCBDevice = Qnil; VALUE rb_cCairo_XlibDevice = Qnil; VALUE rb_cCairo_XMLDevice = Qnil; VALUE rb_cCairo_CoglDevice = Qnil; VALUE rb_cCairo_Win32Device = Qnil; #if CAIRO_CHECK_VERSION(1, 10, 0) static cairo_user_data_key_t cr_closure_key; static cairo_user_data_key_t cr_object_holder_key; static cairo_user_data_key_t cr_finished_key; #define _SELF (RVAL2CRDEVICE(self)) static inline void cr_device_check_status (cairo_device_t *device) { rb_cairo_check_status (cairo_device_status (device)); } static VALUE cr_device_get_klass (cairo_device_t *device) { VALUE klass; cairo_device_type_t type; type = cairo_device_get_type (device); switch (type) { case CAIRO_DEVICE_TYPE_DRM: klass = rb_cCairo_DRMDevice; break; case CAIRO_DEVICE_TYPE_GL: klass = rb_cCairo_GLDevice; break; case CAIRO_DEVICE_TYPE_SCRIPT: klass = rb_cCairo_ScriptDevice; break; case CAIRO_DEVICE_TYPE_XCB: klass = rb_cCairo_XCBDevice; break; case CAIRO_DEVICE_TYPE_XLIB: klass = rb_cCairo_XlibDevice; break; case CAIRO_DEVICE_TYPE_XML: klass = rb_cCairo_XMLDevice; break; # if CAIRO_CHECK_VERSION(1, 11, 4) case CAIRO_DEVICE_TYPE_COGL: klass = rb_cCairo_CoglDevice; break; case CAIRO_DEVICE_TYPE_WIN32: klass = rb_cCairo_Win32Device; break; # endif default: klass = rb_cCairo_Device; break; } if (NIL_P (klass)) rb_raise (rb_eArgError, "unknown device type: %d", type); return klass; } static VALUE cr_device_script_supported_p (VALUE klass) { #ifdef CAIRO_HAS_SCRIPT_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_device_xml_supported_p (VALUE klass) { #ifdef CAIRO_HAS_XML_SURFACE return Qtrue; #else return Qfalse; #endif } /* constructor/de-constructor */ cairo_device_t * rb_cairo_device_from_ruby_object (VALUE obj) { cairo_device_t *device; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Device)) { rb_raise (rb_eTypeError, "not a cairo device"); } Data_Get_Struct (obj, cairo_device_t, device); if (!device) rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER); return device; } #ifdef NEED_DEFINE_OUTPUT_INITIALIZE static rb_cairo__object_holder_t * cr_object_holder_new (VALUE object) { return rb_cairo__object_holder_new (rb_cCairo_Device, object); } static void cr_object_holder_free (void *ptr) { rb_cairo__object_holder_free (rb_cCairo_Device, ptr); } #endif static void cr_device_free (void *ptr) { cairo_device_t *device = ptr; if (device) cairo_device_destroy (device); } VALUE rb_cairo_device_to_ruby_object (cairo_device_t *device) { if (device) { VALUE klass; klass = cr_device_get_klass (device); cairo_device_reference (device); return Data_Wrap_Struct (klass, NULL, cr_device_free, device); } else { return Qnil; } } VALUE rb_cairo_device_to_ruby_object_with_destroy (cairo_device_t *device) { VALUE rb_device; rb_device = rb_cairo_device_to_ruby_object (device); if (device) cairo_device_destroy (device); return rb_device; } static VALUE cr_device_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_device_free, NULL); } static VALUE cr_device_initialize (int argc, VALUE *argv, VALUE self) { rb_raise(rb_eNotImpError, "%s class creation isn't supported on this cairo installation", rb_obj_classname(self)); return Qnil; } /* Backend device manipulation */ static VALUE cr_device_destroy (VALUE self) { cairo_device_t *device; device = _SELF; cairo_device_destroy (device); DATA_PTR (self) = NULL; return self; } static VALUE cr_device_finish (VALUE self) { cairo_device_t *device; rb_cairo__io_callback_closure_t *closure; device = _SELF; closure = cairo_device_get_user_data (device, &cr_closure_key); cairo_device_finish (device); cairo_device_set_user_data (device, &cr_finished_key, (void *)CR_TRUE, NULL); cairo_device_set_user_data (device, &cr_object_holder_key, NULL, NULL); if (closure && !NIL_P (closure->error)) rb_exc_raise (closure->error); cr_device_check_status (device); return self; } static VALUE cr_device_flush (VALUE self) { cairo_device_flush (_SELF); cr_device_check_status (_SELF); return self; } static VALUE cr_device_release (VALUE self) { cairo_device_release (_SELF); cr_device_check_status (_SELF); return self; } static VALUE cr_device_acquire (VALUE self) { cairo_device_acquire (_SELF); cr_device_check_status (_SELF); if (rb_block_given_p ()) return rb_ensure (rb_yield, self, cr_device_release, self); else return self; } static int cr_finish_all_guarded_devices_at_end_iter (VALUE key, VALUE value, VALUE data) { cr_device_finish (key); return ST_CONTINUE; } static void cr_finish_all_guarded_devices_at_end (VALUE data) { rb_hash_foreach (rb_cairo__gc_guarded_objects (rb_cCairo_Device), cr_finish_all_guarded_devices_at_end_iter, Qnil); } #ifdef NEED_DEFINE_OUTPUT_INITIALIZE static void yield_and_finish (VALUE self) { cairo_device_t *device; rb_yield (self); device = _SELF; if (!cairo_device_get_user_data (device, &cr_finished_key)) cr_device_finish (self); } #endif #define DEFINE_OUTPUT_INITIALIZE(type) \ static VALUE \ cr_ ## type ## _device_initialize (VALUE self, \ VALUE file_name_or_output) \ { \ cairo_device_t *device; \ \ if (rb_respond_to (file_name_or_output, rb_cairo__io_id_write)) \ { \ rb_cairo__io_callback_closure_t *closure; \ \ closure = rb_cairo__io_closure_new (file_name_or_output); \ device = \ cairo_ ## type ## _create_for_stream (rb_cairo__io_write_func, \ (void *)closure); \ if (cairo_device_status (device)) \ { \ rb_cairo__io_closure_destroy (closure); \ } \ else \ { \ rb_ivar_set (self, rb_cairo__io_id_output, \ file_name_or_output); \ cairo_device_set_user_data (device, &cr_closure_key, \ closure, \ rb_cairo__io_closure_free); \ cairo_device_set_user_data (device, &cr_object_holder_key, \ cr_object_holder_new (self), \ cr_object_holder_free); \ } \ } \ else \ { \ const char *file_name; \ file_name = StringValueCStr (file_name_or_output); \ device = cairo_ ## type ## _create (file_name); \ } \ \ cr_device_check_status (device); \ DATA_PTR (self) = device; \ if (rb_block_given_p ()) \ yield_and_finish (self); \ return Qnil; \ } # ifdef CAIRO_HAS_SCRIPT_SURFACE DEFINE_OUTPUT_INITIALIZE(script) static VALUE cr_script_device_write_comment (VALUE self, VALUE comment) { cairo_device_t *device; device = _SELF; cairo_script_write_comment (device, StringValuePtr (comment), (int) RSTRING_LEN (comment)); cr_device_check_status (device); return Qnil; } static VALUE cr_script_device_set_mode (VALUE self, VALUE mode) { cairo_device_t *device; device = _SELF; cairo_script_set_mode (device, RVAL2CRSCRIPTMODE (mode)); cr_device_check_status (device); return Qnil; } static VALUE cr_script_device_get_mode (VALUE self) { return INT2NUM (cairo_script_get_mode (_SELF)); } static VALUE cr_script_device_reply (VALUE self, VALUE recording_surface) { cairo_device_t *device; device = _SELF; cairo_script_from_recording_surface (device, RVAL2CRSURFACE (recording_surface)); cr_device_check_status (device); return Qnil; } # endif # ifdef CAIRO_HAS_XML_SURFACE DEFINE_OUTPUT_INITIALIZE(xml) static VALUE cr_xml_device_reply (VALUE self, VALUE recording_surface) { cairo_device_t *device; device = _SELF; cairo_xml_for_recording_surface (device, RVAL2CRSURFACE (recording_surface)); cr_device_check_status (device); return Qnil; } # endif #endif void Init_cairo_device (void) { #if CAIRO_CHECK_VERSION(1, 10, 0) rb_cCairo_Device = rb_define_class_under (rb_mCairo, "Device", rb_cObject); rb_define_alloc_func (rb_cCairo_Device, cr_device_allocate); rb_cairo__initialize_gc_guard_holder_class (rb_cCairo_Device); rb_set_end_proc(cr_finish_all_guarded_devices_at_end, Qnil); rb_define_singleton_method (rb_cCairo_Device, "script_supported?", cr_device_script_supported_p, 0); rb_define_singleton_method (rb_cCairo_Device, "xml_supported?", cr_device_xml_supported_p, 0); rb_define_method (rb_cCairo_Device, "initialize", cr_device_initialize, -1); rb_define_method (rb_cCairo_Device, "destroy", cr_device_destroy, 0); rb_define_method (rb_cCairo_Device, "finish", cr_device_finish, 0); rb_define_method (rb_cCairo_Device, "flush", cr_device_flush, 0); rb_define_method (rb_cCairo_Device, "acquire", cr_device_acquire, 0); rb_define_method (rb_cCairo_Device, "release", cr_device_release, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_Device); rb_cCairo_DRMDevice = rb_define_class_under (rb_mCairo, "DRMDevice", rb_cCairo_Device); rb_cCairo_GLDevice = rb_define_class_under (rb_mCairo, "GLDevice", rb_cCairo_Device); rb_cCairo_ScriptDevice = rb_define_class_under (rb_mCairo, "ScriptDevice", rb_cCairo_Device); # ifdef CAIRO_HAS_SCRIPT_SURFACE rb_define_method (rb_cCairo_ScriptDevice, "initialize", cr_script_device_initialize, 1); rb_define_method (rb_cCairo_ScriptDevice, "write_comment", cr_script_device_write_comment, 1); rb_define_method (rb_cCairo_ScriptDevice, "set_mode", cr_script_device_set_mode, 1); rb_define_method (rb_cCairo_ScriptDevice, "mode", cr_script_device_get_mode, 0); rb_define_method (rb_cCairo_ScriptDevice, "reply", cr_script_device_reply, 1); RB_CAIRO_DEF_SETTERS (rb_cCairo_ScriptDevice); # endif rb_cCairo_XCBDevice = rb_define_class_under (rb_mCairo, "XCBDevice", rb_cCairo_Device); rb_cCairo_XlibDevice = rb_define_class_under (rb_mCairo, "XlibDevice", rb_cCairo_Device); rb_cCairo_XMLDevice = rb_define_class_under (rb_mCairo, "XMLDevice", rb_cCairo_Device); # ifdef CAIRO_HAS_XML_SURFACE rb_define_method (rb_cCairo_XMLDevice, "initialize", cr_xml_device_initialize, 1); rb_define_method (rb_cCairo_XMLDevice, "reply", cr_xml_device_reply, 1); RB_CAIRO_DEF_SETTERS (rb_cCairo_XMLDevice); # endif rb_cCairo_CoglDevice = rb_define_class_under (rb_mCairo, "CoglDevice", rb_cCairo_Device); rb_cCairo_Win32Device = rb_define_class_under (rb_mCairo, "Win32Device", rb_cCairo_Device); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_exception.c000066400000000000000000000442441370612400100207650ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-16 12:52:16 $ * * Copyright 2010-2017 Kouhei Sutou * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" static VALUE rb_eCairo_InvalidRestoreError; static VALUE rb_eCairo_InvalidPopGroupError; static VALUE rb_eCairo_NoCurrentPointError; static VALUE rb_eCairo_InvalidMatrixError; static VALUE rb_eCairo_InvalidStatusError; static VALUE rb_eCairo_NullPointerError; static VALUE rb_eCairo_InvalidStringError; static VALUE rb_eCairo_InvalidPathDataError; static VALUE rb_eCairo_ReadError; static VALUE rb_eCairo_WriteError; static VALUE rb_eCairo_SurfaceFinishedError; static VALUE rb_eCairo_SurfaceTypeMismatchError; static VALUE rb_eCairo_PatternTypeMismatchError; static VALUE rb_eCairo_InvalidContentError; static VALUE rb_eCairo_InvalidFormatError; static VALUE rb_eCairo_InvalidVisualError; static VALUE rb_eCairo_FileNotFoundError; static VALUE rb_eCairo_InvalidDashError; static VALUE rb_eCairo_InvalidDscCommentError; #if CAIRO_CHECK_VERSION(1, 3, 0) static VALUE rb_eCairo_InvalidIndexError; static VALUE rb_eCairo_ClipNotRepresentableError; #endif #if CAIRO_CHECK_VERSION(1, 5, 6) static VALUE rb_eCairo_TempFileError; static VALUE rb_eCairo_InvalidStrideError; #endif #if CAIRO_CHECK_VERSION(1, 7, 2) static VALUE rb_eCairo_FontTypeMismatch; static VALUE rb_eCairo_UserFontImmutable; static VALUE rb_eCairo_UserFontError; static VALUE rb_eCairo_NegativeCount; static VALUE rb_eCairo_InvalidClusters; static VALUE rb_eCairo_InvalidSlant; static VALUE rb_eCairo_InvalidWeight; #endif #if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE rb_eCairo_InvalidSize; static VALUE rb_eCairo_UserFontNotImplemented; static VALUE rb_eCairo_DeviceTypeMismatch; static VALUE rb_eCairo_DeviceError; #endif #if CAIRO_CHECK_VERSION(1, 11, 2) static VALUE rb_eCairo_InvalidMeshConstruction; static VALUE rb_eCairo_DeviceFinished; #endif #if CAIRO_CHECK_VERSION(1, 14, 0) static VALUE rb_eCairo_JBIG2GlobalMissing; #endif #if CAIRO_CHECK_VERSION(1, 15, 4) static VALUE rb_eCairo_PNGError; static VALUE rb_eCairo_FreeTypeError; static VALUE rb_eCairo_Win32GDIError; static VALUE rb_eCairo_TagError; #endif void rb_cairo_check_status (cairo_status_t status) { const char *string = cairo_status_to_string (status); switch (status) { case CAIRO_STATUS_SUCCESS: break; case CAIRO_STATUS_NO_MEMORY: rb_raise (rb_eNoMemError, "%s", string); break; case CAIRO_STATUS_INVALID_RESTORE: rb_raise (rb_eCairo_InvalidRestoreError, "%s", string); break; case CAIRO_STATUS_INVALID_POP_GROUP: rb_raise (rb_eCairo_InvalidPopGroupError, "%s", string); break; case CAIRO_STATUS_NO_CURRENT_POINT: rb_raise (rb_eCairo_NoCurrentPointError, "%s", string); break; case CAIRO_STATUS_INVALID_MATRIX: rb_raise (rb_eCairo_InvalidMatrixError, "%s", string); break; case CAIRO_STATUS_INVALID_STATUS: rb_raise (rb_eCairo_InvalidStatusError, "%s", string); break; case CAIRO_STATUS_NULL_POINTER: rb_raise (rb_eCairo_NullPointerError, "%s", string); break; case CAIRO_STATUS_INVALID_STRING: rb_raise (rb_eCairo_InvalidStringError, "%s", string); break; case CAIRO_STATUS_INVALID_PATH_DATA: rb_raise (rb_eCairo_InvalidPathDataError, "%s", string); break; case CAIRO_STATUS_READ_ERROR: rb_raise (rb_eCairo_ReadError, "%s", string); break; case CAIRO_STATUS_WRITE_ERROR: rb_raise (rb_eCairo_WriteError, "%s", string); break; case CAIRO_STATUS_SURFACE_FINISHED: rb_raise (rb_eCairo_SurfaceFinishedError, "%s", string); break; case CAIRO_STATUS_SURFACE_TYPE_MISMATCH: rb_raise (rb_eCairo_SurfaceTypeMismatchError, "%s", string); break; case CAIRO_STATUS_PATTERN_TYPE_MISMATCH: rb_raise (rb_eCairo_PatternTypeMismatchError, "%s", string); break; case CAIRO_STATUS_INVALID_CONTENT: rb_raise (rb_eCairo_InvalidContentError, "%s", string); break; case CAIRO_STATUS_INVALID_FORMAT: rb_raise (rb_eCairo_InvalidFormatError, "%s", string); break; case CAIRO_STATUS_INVALID_VISUAL: rb_raise (rb_eCairo_InvalidVisualError, "%s", string); break; case CAIRO_STATUS_FILE_NOT_FOUND: rb_raise (rb_eCairo_FileNotFoundError, "%s", string); break; case CAIRO_STATUS_INVALID_DASH: rb_raise (rb_eCairo_InvalidDashError, "%s", string); break; case CAIRO_STATUS_INVALID_DSC_COMMENT: rb_raise (rb_eCairo_InvalidDscCommentError, "%s", string); break; #if CAIRO_CHECK_VERSION(1, 3, 0) case CAIRO_STATUS_INVALID_INDEX: rb_raise (rb_eCairo_InvalidIndexError, "%s", string); break; case CAIRO_STATUS_CLIP_NOT_REPRESENTABLE: rb_raise (rb_eCairo_ClipNotRepresentableError, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 5, 6) case CAIRO_STATUS_TEMP_FILE_ERROR: rb_raise (rb_eCairo_TempFileError, "%s", string); break; case CAIRO_STATUS_INVALID_STRIDE: rb_raise (rb_eCairo_InvalidStringError, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 7, 2) case CAIRO_STATUS_FONT_TYPE_MISMATCH: rb_raise (rb_eCairo_FontTypeMismatch, "%s", string); break; case CAIRO_STATUS_USER_FONT_IMMUTABLE: rb_raise (rb_eCairo_UserFontImmutable, "%s", string); break; case CAIRO_STATUS_USER_FONT_ERROR: rb_raise (rb_eCairo_UserFontError, "%s", string); break; case CAIRO_STATUS_NEGATIVE_COUNT: rb_raise (rb_eCairo_NegativeCount, "%s", string); break; case CAIRO_STATUS_INVALID_CLUSTERS: rb_raise (rb_eCairo_InvalidClusters, "%s", string); break; case CAIRO_STATUS_INVALID_SLANT: rb_raise (rb_eCairo_InvalidSlant, "%s", string); break; case CAIRO_STATUS_INVALID_WEIGHT: rb_raise (rb_eCairo_InvalidWeight, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 10, 0) case CAIRO_STATUS_INVALID_SIZE: rb_raise (rb_eCairo_InvalidSize, "%s", string); break; case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: rb_raise (rb_eCairo_UserFontNotImplemented, "%s", string); break; case CAIRO_STATUS_DEVICE_TYPE_MISMATCH: rb_raise (rb_eCairo_DeviceTypeMismatch, "%s", string); break; case CAIRO_STATUS_DEVICE_ERROR: rb_raise (rb_eCairo_DeviceError, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 11, 2) case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION: rb_raise (rb_eCairo_InvalidMeshConstruction, "%s", string); break; case CAIRO_STATUS_DEVICE_FINISHED: rb_raise (rb_eCairo_DeviceFinished, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 14, 0) case CAIRO_STATUS_JBIG2_GLOBAL_MISSING: rb_raise (rb_eCairo_JBIG2GlobalMissing, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 15, 4) case CAIRO_STATUS_PNG_ERROR: rb_raise (rb_eCairo_PNGError, "%s", string); break; case CAIRO_STATUS_FREETYPE_ERROR: rb_raise (rb_eCairo_FreeTypeError, "%s", string); break; case CAIRO_STATUS_WIN32_GDI_ERROR: rb_raise (rb_eCairo_Win32GDIError, "%s", string); break; case CAIRO_STATUS_TAG_ERROR: rb_raise (rb_eCairo_TagError, "%s", string); break; #endif #if CAIRO_CHECK_VERSION(1, 10, 0) case CAIRO_STATUS_LAST_STATUS: #else default: #endif rb_raise (rb_eArgError, "bug: %s: %d", string, status); break; } } cairo_status_t rb_cairo__exception_to_status (VALUE exception) { if (NIL_P (exception)) return CAIRO_STATUS_SUCCESS; else if (rb_cairo__is_kind_of (exception, rb_eNoMemError)) return CAIRO_STATUS_NO_MEMORY; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidRestoreError)) return CAIRO_STATUS_INVALID_RESTORE; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidPopGroupError)) return CAIRO_STATUS_INVALID_POP_GROUP; else if (rb_cairo__is_kind_of (exception, rb_eCairo_NoCurrentPointError)) return CAIRO_STATUS_NO_CURRENT_POINT; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidMatrixError)) return CAIRO_STATUS_INVALID_MATRIX; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStatusError)) return CAIRO_STATUS_INVALID_STATUS; else if (rb_cairo__is_kind_of (exception, rb_eCairo_NullPointerError)) return CAIRO_STATUS_NULL_POINTER; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStringError)) return CAIRO_STATUS_INVALID_STRING; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidPathDataError)) return CAIRO_STATUS_INVALID_PATH_DATA; else if (rb_cairo__is_kind_of (exception, rb_eCairo_ReadError)) return CAIRO_STATUS_READ_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_WriteError)) return CAIRO_STATUS_WRITE_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_SurfaceFinishedError)) return CAIRO_STATUS_SURFACE_FINISHED; else if (rb_cairo__is_kind_of (exception, rb_eCairo_SurfaceTypeMismatchError)) return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; else if (rb_cairo__is_kind_of (exception, rb_eCairo_PatternTypeMismatchError)) return CAIRO_STATUS_PATTERN_TYPE_MISMATCH; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidContentError)) return CAIRO_STATUS_INVALID_CONTENT; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidFormatError)) return CAIRO_STATUS_INVALID_FORMAT; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidVisualError)) return CAIRO_STATUS_INVALID_VISUAL; else if (rb_cairo__is_kind_of (exception, rb_eCairo_FileNotFoundError)) return CAIRO_STATUS_FILE_NOT_FOUND; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidDashError)) return CAIRO_STATUS_INVALID_DASH; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidDscCommentError)) return CAIRO_STATUS_INVALID_DSC_COMMENT; #if CAIRO_CHECK_VERSION(1, 3, 0) else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidIndexError)) return CAIRO_STATUS_INVALID_INDEX; else if (rb_cairo__is_kind_of (exception, rb_eCairo_ClipNotRepresentableError)) return CAIRO_STATUS_CLIP_NOT_REPRESENTABLE; #endif #if CAIRO_CHECK_VERSION(1, 5, 6) else if (rb_cairo__is_kind_of (exception, rb_eCairo_TempFileError)) return CAIRO_STATUS_TEMP_FILE_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStringError)) return CAIRO_STATUS_INVALID_STRIDE; #endif #if CAIRO_CHECK_VERSION(1, 7, 2) else if (rb_cairo__is_kind_of (exception, rb_eCairo_FontTypeMismatch)) return CAIRO_STATUS_FONT_TYPE_MISMATCH; else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontImmutable)) return CAIRO_STATUS_USER_FONT_IMMUTABLE; else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontError)) return CAIRO_STATUS_USER_FONT_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_NegativeCount)) return CAIRO_STATUS_NEGATIVE_COUNT; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidClusters)) return CAIRO_STATUS_INVALID_CLUSTERS; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidSlant)) return CAIRO_STATUS_INVALID_SLANT; else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidWeight)) return CAIRO_STATUS_INVALID_WEIGHT; #endif #if CAIRO_CHECK_VERSION(1, 10, 0) else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidSize)) return CAIRO_STATUS_INVALID_SIZE; else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontNotImplemented)) return CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED; else if (rb_cairo__is_kind_of (exception, rb_eCairo_DeviceTypeMismatch)) return CAIRO_STATUS_DEVICE_TYPE_MISMATCH; else if (rb_cairo__is_kind_of (exception, rb_eCairo_DeviceError)) return CAIRO_STATUS_DEVICE_ERROR; #endif #if CAIRO_CHECK_VERSION(1, 14, 0) else if (rb_cairo__is_kind_of (exception, rb_eCairo_JBIG2GlobalMissing)) return CAIRO_STATUS_JBIG2_GLOBAL_MISSING; #endif #if CAIRO_CHECK_VERSION(1, 15, 4) else if (rb_cairo__is_kind_of (exception, rb_eCairo_PNGError)) return CAIRO_STATUS_PNG_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_FreeTypeError)) return CAIRO_STATUS_FREETYPE_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_Win32GDIError)) return CAIRO_STATUS_WIN32_GDI_ERROR; else if (rb_cairo__is_kind_of (exception, rb_eCairo_TagError)) return CAIRO_STATUS_TAG_ERROR; #endif return -1; } void Init_cairo_exception () { VALUE rb_eCairo_Error; rb_eCairo_Error = rb_define_class_under (rb_mCairo, "Error", rb_eStandardError); rb_eCairo_InvalidRestoreError = rb_define_class_under (rb_mCairo, "InvalidRestoreError", rb_eCairo_Error); rb_eCairo_InvalidPopGroupError = rb_define_class_under (rb_mCairo, "InvalidPopGroupError", rb_eCairo_Error); rb_eCairo_NoCurrentPointError = rb_define_class_under (rb_mCairo, "NoCurrentPointError", rb_eCairo_Error); rb_eCairo_InvalidMatrixError = rb_define_class_under (rb_mCairo, "InvalidMatrixError", rb_eArgError); rb_eCairo_InvalidStatusError = rb_define_class_under (rb_mCairo, "InvalidStatusError", rb_eArgError); rb_eCairo_NullPointerError = rb_define_class_under (rb_mCairo, "NullPointerError", rb_eTypeError); rb_eCairo_InvalidStringError = rb_define_class_under (rb_mCairo, "InvalidStringError", rb_eArgError); rb_eCairo_InvalidPathDataError = rb_define_class_under (rb_mCairo, "InvalidPathDataError", rb_eArgError); rb_eCairo_ReadError = rb_define_class_under (rb_mCairo, "ReadError", rb_eIOError); rb_eCairo_WriteError = rb_define_class_under (rb_mCairo, "WriteError", rb_eIOError); rb_eCairo_SurfaceFinishedError = rb_define_class_under (rb_mCairo, "SurfaceFinishedError", rb_eCairo_Error); rb_eCairo_SurfaceTypeMismatchError = rb_define_class_under (rb_mCairo, "SurfaceTypeMismatchError", rb_eTypeError); rb_eCairo_PatternTypeMismatchError = rb_define_class_under (rb_mCairo, "PatternTypeMismatchError", rb_eTypeError); rb_eCairo_InvalidContentError = rb_define_class_under (rb_mCairo, "InvalidContentError", rb_eArgError); rb_eCairo_InvalidFormatError = rb_define_class_under (rb_mCairo, "InvalidFormatError", rb_eArgError); rb_eCairo_InvalidVisualError = rb_define_class_under (rb_mCairo, "InvalidVisualError", rb_eArgError); rb_eCairo_FileNotFoundError = rb_define_class_under (rb_mCairo, "FileNotFound", rb_eCairo_Error); rb_eCairo_InvalidDashError = rb_define_class_under (rb_mCairo, "InvalidDashError", rb_eArgError); rb_eCairo_InvalidDscCommentError = rb_define_class_under (rb_mCairo, "InvalidDscCommentError", rb_eArgError); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_eCairo_InvalidIndexError = rb_define_class_under (rb_mCairo, "InvalidIndexError", rb_eArgError); rb_eCairo_ClipNotRepresentableError = rb_define_class_under (rb_mCairo, "ClipNotRepresentableError", rb_eCairo_Error); #endif #if CAIRO_CHECK_VERSION(1, 5, 6) rb_eCairo_TempFileError = rb_define_class_under (rb_mCairo, "TempFileError", rb_eCairo_Error); rb_eCairo_InvalidStrideError = rb_define_class_under (rb_mCairo, "InvalidStrideError", rb_eArgError); #endif #if CAIRO_CHECK_VERSION(1, 7, 2) rb_eCairo_FontTypeMismatch = rb_define_class_under (rb_mCairo, "FontTypeMismatch", rb_eCairo_Error); rb_eCairo_UserFontImmutable = rb_define_class_under (rb_mCairo, "UserFontImmutable", rb_eCairo_Error); rb_eCairo_UserFontError = rb_define_class_under (rb_mCairo, "UserFontError", rb_eCairo_Error); rb_eCairo_NegativeCount = rb_define_class_under (rb_mCairo, "NegativeCount", rb_eCairo_Error); rb_eCairo_InvalidClusters = rb_define_class_under (rb_mCairo, "InvalidClusters", rb_eArgError); rb_eCairo_InvalidSlant = rb_define_class_under (rb_mCairo, "InvalidSlant", rb_eCairo_Error); rb_eCairo_InvalidWeight = rb_define_class_under (rb_mCairo, "InvalidWeight", rb_eArgError); #endif #if CAIRO_CHECK_VERSION(1, 10, 0) rb_eCairo_InvalidSize = rb_define_class_under (rb_mCairo, "InvalidSize", rb_eArgError); rb_eCairo_UserFontNotImplemented = rb_define_class_under (rb_mCairo, "UserFontNotImplemented", rb_eCairo_Error); rb_eCairo_DeviceTypeMismatch = rb_define_class_under (rb_mCairo, "DeviceTypeMismatch", rb_eArgError); rb_eCairo_DeviceError = rb_define_class_under (rb_mCairo, "DeviceError", rb_eCairo_Error); #endif #if CAIRO_CHECK_VERSION(1, 11, 2) rb_eCairo_InvalidMeshConstruction = rb_define_class_under (rb_mCairo, "InvalidMeshConstruction", rb_eArgError); rb_eCairo_DeviceFinished = rb_define_class_under (rb_mCairo, "DeviceFinished", rb_eCairo_Error); #endif #if CAIRO_CHECK_VERSION(1, 14, 0) rb_eCairo_JBIG2GlobalMissing = rb_define_class_under (rb_mCairo, "JBIG2GlobalMissing", rb_eCairo_Error); #endif #if CAIRO_CHECK_VERSION(1, 15, 4) rb_eCairo_PNGError = rb_define_class_under (rb_mCairo, "PNGError", rb_eCairo_Error); rb_eCairo_FreeTypeError = rb_define_class_under (rb_mCairo, "FreeTypeError", rb_eCairo_Error); rb_eCairo_Win32GDIError = rb_define_class_under (rb_mCairo, "Win32GDIError", rb_eCairo_Error); rb_eCairo_TagError = rb_define_class_under (rb_mCairo, "TagError", rb_eCairo_Error); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_font_extents.c000066400000000000000000000120441370612400100215000ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-17 05:12:37 $ * * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_FontExtents; #define _SELF(self) (RVAL2CRFONTEXTENTS(self)) cairo_font_extents_t * rb_cairo_font_extents_from_ruby_object (VALUE obj) { cairo_font_extents_t *extents; if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontExtents)) { rb_raise (rb_eTypeError, "not a cairo font extents"); } Data_Get_Struct (obj, cairo_font_extents_t, extents); return extents; } VALUE rb_cairo_font_extents_to_ruby_object (cairo_font_extents_t *extents) { if (extents) { cairo_font_extents_t *new_extents = ALLOC (cairo_font_extents_t); *new_extents = *extents; return Data_Wrap_Struct (rb_cCairo_FontExtents, NULL, -1, new_extents); } else { return Qnil; } } static VALUE cr_font_extents_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, -1, NULL); } static VALUE cr_font_extents_initialize (VALUE self) { cairo_font_extents_t *extents; extents = ALLOC (cairo_font_extents_t); extents->ascent = 1.0; extents->descent = 0.0; extents->height = 1.0; extents->max_x_advance = 1.0; extents->max_y_advance = 0.0; DATA_PTR (self) = extents; return Qnil; } static VALUE cr_font_extents_ascent (VALUE self) { return rb_float_new (_SELF(self)->ascent); } static VALUE cr_font_extents_set_ascent (VALUE self, VALUE ascent) { _SELF(self)->ascent = NUM2DBL (ascent); return self; } static VALUE cr_font_extents_descent (VALUE self) { return rb_float_new (_SELF(self)->descent); } static VALUE cr_font_extents_set_descent (VALUE self, VALUE descent) { _SELF(self)->descent = NUM2DBL (descent); return self; } static VALUE cr_font_extents_height (VALUE self) { return rb_float_new (_SELF(self)->height); } static VALUE cr_font_extents_set_height (VALUE self, VALUE height) { _SELF(self)->height = NUM2DBL (height); return self; } static VALUE cr_font_extents_max_x_advance (VALUE self) { return rb_float_new (_SELF(self)->max_x_advance); } static VALUE cr_font_extents_set_max_x_advance (VALUE self, VALUE max_x_advance) { _SELF(self)->max_x_advance = NUM2DBL (max_x_advance); return self; } static VALUE cr_font_extents_max_y_advance (VALUE self) { return rb_float_new (_SELF(self)->max_y_advance); } static VALUE cr_font_extents_set_max_y_advance (VALUE self, VALUE max_y_advance) { _SELF(self)->max_y_advance = NUM2DBL (max_y_advance); return self; } static VALUE cr_font_extents_to_s (VALUE self) { VALUE ret; ret = rb_str_new2 ("#<"); rb_str_cat2 (ret, rb_class2name (CLASS_OF (self))); rb_str_cat2 (ret, ": "); rb_str_cat2 (ret, "ascent="); rb_str_concat (ret, rb_inspect (cr_font_extents_ascent (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "descent="); rb_str_concat (ret, rb_inspect (cr_font_extents_descent (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "height="); rb_str_concat (ret, rb_inspect (cr_font_extents_height (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "max_x_advance="); rb_str_concat (ret, rb_inspect (cr_font_extents_max_x_advance (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "max_y_advance="); rb_str_concat (ret, rb_inspect (cr_font_extents_max_y_advance (self))); rb_str_cat2 (ret, ">"); return ret; } void Init_cairo_font_extents (void) { rb_cCairo_FontExtents = rb_define_class_under (rb_mCairo, "FontExtents", rb_cObject); rb_define_alloc_func (rb_cCairo_FontExtents, cr_font_extents_allocate); rb_define_method (rb_cCairo_FontExtents, "initialize", cr_font_extents_initialize, 0); rb_define_method (rb_cCairo_FontExtents, "ascent", cr_font_extents_ascent, 0); rb_define_method (rb_cCairo_FontExtents, "set_ascent", cr_font_extents_set_ascent, 1); rb_define_method (rb_cCairo_FontExtents, "descent", cr_font_extents_descent, 0); rb_define_method (rb_cCairo_FontExtents, "set_descent", cr_font_extents_set_descent, 1); rb_define_method (rb_cCairo_FontExtents, "height", cr_font_extents_height, 0); rb_define_method (rb_cCairo_FontExtents, "set_height", cr_font_extents_set_height, 1); rb_define_method (rb_cCairo_FontExtents, "max_x_advance", cr_font_extents_max_x_advance, 0); rb_define_method (rb_cCairo_FontExtents, "set_max_x_advance", cr_font_extents_set_max_x_advance, 1); rb_define_method (rb_cCairo_FontExtents, "max_y_advance", cr_font_extents_max_y_advance, 0); rb_define_method (rb_cCairo_FontExtents, "set_max_y_advance", cr_font_extents_set_max_y_advance, 1); rb_define_method (rb_cCairo_FontExtents, "to_s", cr_font_extents_to_s, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_FontExtents); } rcairo-1.16.6/ext/cairo/rb_cairo_font_face.c000066400000000000000000000612611370612400100207110ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-09-26 14:13:58 $ * * Copyright 2003-2019 Sutou Kouhei * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_FontFace; VALUE rb_cCairo_FreeTypeFontFace = Qnil; VALUE rb_cCairo_ToyFontFace = Qnil; VALUE rb_cCairo_UserFontFace = Qnil; VALUE rb_cCairo_UserFontFace_TextToGlyphsData = Qnil; #ifdef CAIRO_HAS_FT_FONT # include static cairo_user_data_key_t cr_freetype_face_key; static FT_Library cr_freetype_library; static int cr_freetype_n_faces = 0; static cairo_bool_t cr_freetype_finishing = CR_FALSE; #endif #if CAIRO_CHECK_VERSION(1, 7, 6) static cairo_user_data_key_t ruby_object_key; static ID cr_id_call; static ID cr_id_new; static ID cr_id_init; static ID cr_id_render_glyph; static ID cr_id_text_to_glyphs; static ID cr_id_unicode_to_glyph; static ID cr_id_at_glyphs; static ID cr_id_at_clusters; static ID cr_id_at_cluster_flags; static ID cr_id_at_need_glyphs; static ID cr_id_at_need_clusters; static ID cr_id_at_need_cluster_flags; #endif #define _SELF (RVAL2CRFONTFACE(self)) static inline void cr_font_face_check_status (cairo_font_face_t *face) { rb_cairo_check_status (cairo_font_face_status (face)); } cairo_font_face_t * rb_cairo_font_face_from_ruby_object (VALUE obj) { cairo_font_face_t *face; if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontFace)) { rb_raise (rb_eTypeError, "not a cairo font face: %s", rb_cairo__inspect (obj)); } Data_Get_Struct (obj, cairo_font_face_t, face); if (!face) rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER); cr_font_face_check_status (face); return face; } static void cr_font_face_free (void *ptr) { if (ptr) { cairo_font_face_t *face = ptr; cairo_font_face_destroy (face); } } VALUE rb_cairo_font_face_to_ruby_object (cairo_font_face_t *face) { if (face) { VALUE klass; switch (cairo_font_face_get_type (face)) { #ifdef CAIRO_HAS_FT_FONT case CAIRO_FONT_TYPE_FT: klass = rb_cCairo_FreeTypeFontFace; break; #endif #if CAIRO_CHECK_VERSION(1, 7, 6) case CAIRO_FONT_TYPE_TOY: klass = rb_cCairo_ToyFontFace; break; case CAIRO_FONT_TYPE_USER: klass = rb_cCairo_UserFontFace; break; #endif default: klass = rb_cCairo_FontFace; break; } cairo_font_face_reference (face); return Data_Wrap_Struct (klass, NULL, cr_font_face_free, face); } else { return Qnil; } } static VALUE cr_font_face_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_font_face_free, NULL); } static VALUE cr_font_face_quartz_supported_p (VALUE klass) { #ifdef CAIRO_HAS_QUARTZ_FONT return Qtrue; #else return Qfalse; #endif } static VALUE cr_font_face_freetype_supported_p (VALUE klass) { #ifdef CAIRO_HAS_FT_FONT return Qtrue; #else return Qfalse; #endif } #ifdef CAIRO_HAS_FT_FONT static VALUE cr_freetype_done_library (VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE block_arg) { cr_freetype_finishing = CR_TRUE; if (cr_freetype_n_faces == 0) FT_Done_FreeType (cr_freetype_library); return Qnil; } static void cr_freetype_done_face (void *data) { FT_Face face = data; FT_Done_Face (face); cr_freetype_n_faces--; if (cr_freetype_n_faces == 0 && cr_freetype_finishing) FT_Done_FreeType (cr_freetype_library); } static cairo_bool_t cr_freetype_error_detail (FT_Error error, const char **name, const char **message) { #undef __FTERRORS_H__ #define FT_STRINGIFY(v) #v #define FT_ERRORDEF(e, v, s) {FT_STRINGIFY(e), v, s}, #define FT_ERROR_START_LIST { #define FT_ERROR_END_LIST {NULL, 0, NULL}}; size_t i = 0; static const struct { const char *name; FT_Error code; const char *message; } errors[] = #include FT_ERRORS_H for (i = 0; i < (sizeof (errors) / sizeof (errors[0])); i++) { if (errors[i].code == error) { *name = errors[i].name; *message = errors[i].message; return CR_TRUE; } } return CR_FALSE; } static void cr_freetype_error_check (FT_Error error, const char *message, VALUE related_object) { const char *name = NULL; const char *system_message = NULL; const char *error_class_name; VALUE rb_eCairo_FreeTypeError; if (error == FT_Err_Ok) return; cr_freetype_error_detail (error, &name, &system_message); #if CAIRO_CHECK_VERSION(1, 15, 4) error_class_name = "FreeTypeError"; #else error_class_name = "Error"; #endif rb_eCairo_FreeTypeError = rb_const_get (rb_mCairo, rb_intern (error_class_name)); if (NIL_P (related_object)) { rb_raise (rb_eCairo_FreeTypeError, "%s: %s[%d]: %s", message, name ? name : "unknown", error, system_message ? system_message : "unknown"); } else { rb_raise (rb_eCairo_FreeTypeError, "%s: %s[%d]: %s: %+" PRIsVALUE, message, name ? name : "unknown", error, system_message ? system_message : "unknown", related_object); } } static VALUE cr_freetype_font_face_initialize (VALUE self, VALUE path) { FT_Face freetype_face; FT_Error error; cairo_font_face_t *face; cairo_status_t status; error = FT_New_Face (cr_freetype_library, StringValueCStr(path), 0, &freetype_face); cr_freetype_error_check (error, "failed to open FreeType font", path); cr_freetype_n_faces++; face = cairo_ft_font_face_create_for_ft_face (freetype_face, 0); cr_font_face_check_status (face); status = cairo_font_face_set_user_data (face, &cr_freetype_face_key, freetype_face, (cairo_destroy_func_t) cr_freetype_done_face); if (status != CAIRO_STATUS_SUCCESS) { cairo_font_face_destroy (face); FT_Done_Face (freetype_face); rb_cairo_check_status (status); } DATA_PTR (self) = face; return Qnil; } #endif #if CAIRO_CHECK_VERSION(1, 7, 6) static VALUE cr_toy_font_face_initialize (int argc, VALUE *argv, VALUE self) { cairo_font_face_t *face; VALUE rb_family, rb_slant, rb_weight; const char *family; cairo_font_slant_t slant; cairo_font_weight_t weight; rb_scan_args (argc, argv, "03", &rb_family, &rb_slant, &rb_weight); if (NIL_P (rb_family)) { family = ""; } else if (rb_cairo__is_kind_of (rb_family, rb_cString)) { family = RSTRING_PTR (rb_family); } else if (rb_cairo__is_kind_of (rb_family, rb_cSymbol)) { family = rb_id2name (SYM2ID (rb_family)); } else { rb_raise (rb_eArgError, "family name should be nil, String or Symbol: %s", rb_cairo__inspect (rb_family)); } if (NIL_P (rb_slant)) slant = CAIRO_FONT_SLANT_NORMAL; else slant = RVAL2CRFONTSLANT (rb_slant); if (NIL_P (rb_weight)) weight = CAIRO_FONT_WEIGHT_NORMAL; else weight = RVAL2CRFONTWEIGHT (rb_weight); face = cairo_toy_font_face_create (family, slant, weight); cr_font_face_check_status (face); DATA_PTR (self) = face; return Qnil; } static VALUE cr_toy_font_face_get_family (VALUE self) { return CSTR2RVAL (cairo_toy_font_face_get_family (_SELF)); } static VALUE cr_toy_font_face_get_slant (VALUE self) { return INT2NUM (cairo_toy_font_face_get_slant (_SELF)); } static VALUE cr_toy_font_face_get_weight (VALUE self) { return INT2NUM (cairo_toy_font_face_get_weight (_SELF)); } typedef struct cr_user_font_face_invoke_data { VALUE receiver; ID method; int argc; VALUE *argv; cairo_status_t *status; VALUE result; cr_callback_func_t after_hook; void *after_hook_data; } cr_user_font_face_invoke_data_t; static VALUE cr_user_font_face_invoke_body (VALUE user_data) { cr_user_font_face_invoke_data_t *data; VALUE result; data = (cr_user_font_face_invoke_data_t *)user_data; result = rb_funcall2 (data->receiver, data->method, data->argc, data->argv); data->result = result; if (data->after_hook) result = data->after_hook(user_data); return result; } static VALUE cr_user_font_face_invoke_rescue (VALUE user_data, VALUE exception) { cr_user_font_face_invoke_data_t *data; data = (cr_user_font_face_invoke_data_t *)user_data; *(data->status) = rb_cairo__exception_to_status (exception); if (*(data->status) == (cairo_status_t)-1) rb_exc_raise (exception); return Qnil; } static VALUE cr_user_font_face_invoke_func (VALUE user_data) { return rb_rescue2 (cr_user_font_face_invoke_body, user_data, cr_user_font_face_invoke_rescue, user_data, rb_eException, (VALUE)0); } static VALUE cr_user_font_face_init_func_after (VALUE user_data) { cr_user_font_face_invoke_data_t *data; cairo_font_extents_t *extents; data = (cr_user_font_face_invoke_data_t *)user_data; extents = data->after_hook_data; *extents = *(RVAL2CRFONTEXTENTS (data->argv[2])); return data->result; } static cairo_status_t cr_user_font_face_init_func (cairo_scaled_font_t *scaled_font, cairo_t *cr, cairo_font_extents_t *extents) { cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_font_face_t *face; VALUE self; VALUE receiver = Qnil; ID id_method_name = cr_id_call; face = cairo_scaled_font_get_font_face (scaled_font); self = (VALUE)cairo_font_face_get_user_data (face, &ruby_object_key); receiver = rb_ivar_get (self, cr_id_init); if (NIL_P (receiver) && rb_obj_respond_to (self, cr_id_init, Qtrue)) { receiver = self; id_method_name = cr_id_init; } if (!NIL_P (receiver)) { cr_user_font_face_invoke_data_t data; VALUE argv[3]; argv[0] = CRSCALEDFONT2RVAL (scaled_font); argv[1] = CRCONTEXT2RVAL (cr); argv[2] = CRFONTEXTENTS2RVAL (extents); data.receiver = receiver; data.method = id_method_name; data.argc = 3; data.argv = argv; data.status = &status; data.after_hook = cr_user_font_face_init_func_after; data.after_hook_data = extents; rb_cairo__invoke_callback (cr_user_font_face_invoke_func, (VALUE)&data); } return status; } static VALUE cr_user_font_face_render_glyph_func_after (VALUE user_data) { cr_user_font_face_invoke_data_t *data; cairo_text_extents_t *extents; data = (cr_user_font_face_invoke_data_t *)user_data; extents = data->after_hook_data; *extents = *(RVAL2CRTEXTEXTENTS (data->argv[3])); return data->result; } static cairo_status_t cr_user_font_face_render_glyph_func (cairo_scaled_font_t *scaled_font, unsigned long glyph, cairo_t *cr, cairo_text_extents_t *extents) { cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_font_face_t *face; VALUE self; VALUE receiver = Qnil; ID id_method_name = cr_id_call; face = cairo_scaled_font_get_font_face (scaled_font); self = (VALUE)cairo_font_face_get_user_data (face, &ruby_object_key); receiver = rb_ivar_get (self, cr_id_render_glyph); if (NIL_P (receiver) && rb_obj_respond_to (self, cr_id_render_glyph, Qtrue)) { receiver = self; id_method_name = cr_id_render_glyph; } if (!NIL_P (receiver)) { cr_user_font_face_invoke_data_t data; VALUE argv[4]; argv[0] = CRSCALEDFONT2RVAL (scaled_font); argv[1] = ULONG2NUM (glyph); argv[2] = CRCONTEXT2RVAL (cr); argv[3] = CRTEXTEXTENTS2RVAL (extents); data.receiver = receiver; data.method = id_method_name; data.argc = 4; data.argv = argv; data.status = &status; data.after_hook = cr_user_font_face_render_glyph_func_after; data.after_hook_data = extents; rb_cairo__invoke_callback (cr_user_font_face_invoke_func, (VALUE)&data); } return status; } typedef struct _cr_text_to_glyphs_after_hook_data { VALUE text_to_glyphs_data; cairo_glyph_t **glyphs; int *num_glyphs; cairo_text_cluster_t **clusters; int *num_clusters; cairo_text_cluster_flags_t *cluster_flags; } cr_text_to_glyphs_after_hook_data_t; static VALUE cr_user_font_face_text_to_glyphs_func_after (VALUE user_data) { cr_user_font_face_invoke_data_t *data; cr_text_to_glyphs_after_hook_data_t *after_hook_data; VALUE text_to_glyphs_data; data = (cr_user_font_face_invoke_data_t *)user_data; after_hook_data = data->after_hook_data; text_to_glyphs_data = after_hook_data->text_to_glyphs_data; if (after_hook_data->glyphs) { VALUE rb_glyphs; rb_glyphs = rb_ivar_get (text_to_glyphs_data, cr_id_at_glyphs); rb_cairo__glyphs_from_ruby_object (rb_glyphs, after_hook_data->glyphs, after_hook_data->num_glyphs); } if (after_hook_data->clusters) { VALUE rb_clusters; rb_clusters = rb_ivar_get (text_to_glyphs_data, cr_id_at_clusters); rb_cairo__text_clusters_from_ruby_object (rb_clusters, after_hook_data->clusters, after_hook_data->num_clusters); } if (after_hook_data->cluster_flags) { VALUE rb_cluster_flags; rb_cluster_flags = rb_ivar_get (text_to_glyphs_data, cr_id_at_cluster_flags); *(after_hook_data->cluster_flags) = RVAL2CRTEXTCLUSTERFLAGS (rb_cluster_flags); } return data->result; } static cairo_status_t cr_user_font_face_text_to_glyphs_func (cairo_scaled_font_t *scaled_font, const char *utf8, int utf8_len, cairo_glyph_t **glyphs, int *num_glyphs, cairo_text_cluster_t **clusters, int *num_clusters, cairo_text_cluster_flags_t *cluster_flags) { cairo_status_t status = CAIRO_INT_STATUS_UNSUPPORTED; cairo_font_face_t *face; VALUE self; VALUE receiver = Qnil; ID id_method_name = cr_id_call; face = cairo_scaled_font_get_font_face (scaled_font); self = (VALUE)cairo_font_face_get_user_data (face, &ruby_object_key); receiver = rb_ivar_get (self, cr_id_text_to_glyphs); if (NIL_P (receiver) && rb_obj_respond_to (self, cr_id_text_to_glyphs, Qtrue)) { receiver = self; id_method_name = cr_id_text_to_glyphs; } if (NIL_P (receiver)) { if (num_glyphs) *num_glyphs = -1; } else { cr_user_font_face_invoke_data_t data; cr_text_to_glyphs_after_hook_data_t after_hook_data; VALUE text_to_glyphs_data; VALUE argv[3]; argv[0] = CRSCALEDFONT2RVAL (scaled_font); argv[1] = rb_str_new (utf8, utf8_len); text_to_glyphs_data = rb_funcall (rb_cCairo_UserFontFace_TextToGlyphsData, cr_id_new, 3, CBOOL2RVAL (glyphs != NULL), CBOOL2RVAL (clusters != NULL), CBOOL2RVAL (cluster_flags != NULL)); argv[2] = text_to_glyphs_data; data.receiver = receiver; data.method = id_method_name; data.argc = 3; data.argv = argv; data.status = &status; data.after_hook = cr_user_font_face_text_to_glyphs_func_after; data.after_hook_data = &after_hook_data; after_hook_data.text_to_glyphs_data = text_to_glyphs_data; after_hook_data.glyphs = glyphs; after_hook_data.num_glyphs = num_glyphs; after_hook_data.clusters = clusters; after_hook_data.num_clusters = num_clusters; after_hook_data.cluster_flags = cluster_flags; rb_cairo__invoke_callback (cr_user_font_face_invoke_func, (VALUE)&data); } return status; } static VALUE cr_user_font_face_unicode_to_glyph_func_after (VALUE user_data) { cr_user_font_face_invoke_data_t *data; unsigned long *glyph_index; data = (cr_user_font_face_invoke_data_t *)user_data; glyph_index = data->after_hook_data; *glyph_index = NUM2ULONG (data->result); return data->result; } static cairo_status_t cr_user_font_face_unicode_to_glyph_func (cairo_scaled_font_t *scaled_font, unsigned long unicode, unsigned long *glyph_index) { cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_font_face_t *face; VALUE self; VALUE receiver = Qnil; ID id_method_name = cr_id_call; face = cairo_scaled_font_get_font_face (scaled_font); self = (VALUE)cairo_font_face_get_user_data (face, &ruby_object_key); receiver = rb_ivar_get (self, cr_id_unicode_to_glyph); if (NIL_P (receiver) && rb_obj_respond_to (self, cr_id_unicode_to_glyph, Qtrue)) { receiver = self; id_method_name = cr_id_unicode_to_glyph; } if (NIL_P (receiver)) { *glyph_index = unicode; } else { cr_user_font_face_invoke_data_t data; VALUE argv[2]; argv[0] = CRSCALEDFONT2RVAL (scaled_font); argv[1] = ULONG2NUM (unicode); data.receiver = receiver; data.method = id_method_name; data.argc = 2; data.argv = argv; data.status = &status; data.after_hook = cr_user_font_face_unicode_to_glyph_func_after; data.after_hook_data = glyph_index; rb_cairo__invoke_callback (cr_user_font_face_invoke_func, (VALUE)&data); } return status; } static VALUE cr_user_font_face_initialize (VALUE self) { cairo_font_face_t *face; face = cairo_user_font_face_create (); cr_font_face_check_status (face); cairo_font_face_set_user_data (face, &ruby_object_key, (void *)self, NULL); cairo_user_font_face_set_init_func (face, cr_user_font_face_init_func); cairo_user_font_face_set_render_glyph_func (face, cr_user_font_face_render_glyph_func); cairo_user_font_face_set_text_to_glyphs_func (face, cr_user_font_face_text_to_glyphs_func); cairo_user_font_face_set_unicode_to_glyph_func (face, cr_user_font_face_unicode_to_glyph_func); rb_ivar_set (self, cr_id_init, Qnil); rb_ivar_set (self, cr_id_render_glyph, Qnil); rb_ivar_set (self, cr_id_text_to_glyphs, Qnil); rb_ivar_set (self, cr_id_unicode_to_glyph, Qnil); DATA_PTR (self) = face; return Qnil; } static VALUE cr_user_font_face_on_init (VALUE self) { rb_ivar_set (self, cr_id_init, rb_block_proc ()); return self; } static VALUE cr_user_font_face_on_render_glyph (VALUE self) { rb_ivar_set (self, cr_id_render_glyph, rb_block_proc ()); return self; } static VALUE cr_user_font_face_on_text_to_glyphs (VALUE self) { rb_ivar_set (self, cr_id_text_to_glyphs, rb_block_proc ()); return self; } static VALUE cr_user_font_face_on_unicode_to_glyph (VALUE self) { rb_ivar_set (self, cr_id_unicode_to_glyph, rb_block_proc ()); return self; } static VALUE cr_text_to_glyphs_data_initialize (VALUE self, VALUE need_glyphs, VALUE need_clusters, VALUE need_cluster_flags) { rb_ivar_set (self, cr_id_at_glyphs, Qnil); rb_ivar_set (self, cr_id_at_clusters, Qnil); rb_ivar_set (self, cr_id_at_cluster_flags, INT2NUM (0)); rb_ivar_set (self, cr_id_at_need_glyphs, need_glyphs); rb_ivar_set (self, cr_id_at_need_clusters, need_clusters); rb_ivar_set (self, cr_id_at_need_cluster_flags, need_cluster_flags); return Qnil; } static VALUE cr_text_to_glyphs_data_get_cluster_flags (VALUE self) { return rb_ivar_get (self, cr_id_at_cluster_flags); } static VALUE cr_text_to_glyphs_data_set_cluster_flags (VALUE self, VALUE cluster_flags) { rb_ivar_set (self, cr_id_at_cluster_flags, INT2NUM (RVAL2CRTEXTCLUSTERFLAGS (cluster_flags))); return Qnil; } static VALUE cr_text_to_glyphs_data_need_glyphs (VALUE self) { return rb_ivar_get (self, cr_id_at_need_glyphs); } static VALUE cr_text_to_glyphs_data_need_clusters (VALUE self) { return rb_ivar_get (self, cr_id_at_need_clusters); } static VALUE cr_text_to_glyphs_data_need_cluster_flags (VALUE self) { return rb_ivar_get (self, cr_id_at_need_cluster_flags); } #endif void Init_cairo_font (void) { #if CAIRO_CHECK_VERSION(1, 7, 6) cr_id_call = rb_intern ("call"); cr_id_new = rb_intern ("new"); cr_id_init = rb_intern ("init"); cr_id_render_glyph = rb_intern ("render_glyph"); cr_id_text_to_glyphs = rb_intern ("text_to_glyphs"); cr_id_unicode_to_glyph = rb_intern ("unicode_to_glyph"); cr_id_at_glyphs = rb_intern ("@glyphs"); cr_id_at_clusters = rb_intern ("@clusters"); cr_id_at_cluster_flags = rb_intern ("@cluster_flags"); cr_id_at_need_glyphs = rb_intern ("@need_glyphs"); cr_id_at_need_clusters = rb_intern ("@need_clusters"); cr_id_at_need_cluster_flags = rb_intern ("@need_cluster_flags"); #endif rb_cCairo_FontFace = rb_define_class_under (rb_mCairo, "FontFace", rb_cObject); rb_define_alloc_func (rb_cCairo_FontFace, cr_font_face_allocate); rb_define_singleton_method (rb_cCairo_FontFace, "quartz_supported?", cr_font_face_quartz_supported_p, 0); rb_define_singleton_method (rb_cCairo_FontFace, "freetype_supported?", cr_font_face_freetype_supported_p, 0); #ifdef CAIRO_HAS_FT_FONT rb_cCairo_FreeTypeFontFace = rb_define_class_under (rb_mCairo, "FreeTypeFontFace", rb_cCairo_FontFace); { FT_Error error; error = FT_Init_FreeType (&cr_freetype_library); cr_freetype_error_check (error, "failed to initialize FreeType", Qnil); rb_define_finalizer (rb_cCairo_FreeTypeFontFace, rb_proc_new (cr_freetype_done_library, Qnil)); } rb_define_method (rb_cCairo_FreeTypeFontFace, "initialize", cr_freetype_font_face_initialize, 1); #endif #if CAIRO_CHECK_VERSION(1, 7, 6) rb_cCairo_ToyFontFace = rb_define_class_under (rb_mCairo, "ToyFontFace", rb_cCairo_FontFace); rb_define_method (rb_cCairo_ToyFontFace, "initialize", cr_toy_font_face_initialize, -1); rb_define_method (rb_cCairo_ToyFontFace, "family", cr_toy_font_face_get_family, 0); rb_define_method (rb_cCairo_ToyFontFace, "slant", cr_toy_font_face_get_slant, 0); rb_define_method (rb_cCairo_ToyFontFace, "weight", cr_toy_font_face_get_weight, 0); rb_cCairo_UserFontFace = rb_define_class_under (rb_mCairo, "UserFontFace", rb_cCairo_FontFace); rb_define_method (rb_cCairo_UserFontFace, "initialize", cr_user_font_face_initialize, 0); rb_define_method (rb_cCairo_UserFontFace, "on_init", cr_user_font_face_on_init, 0); rb_define_method (rb_cCairo_UserFontFace, "on_render_glyph", cr_user_font_face_on_render_glyph, 0); rb_define_method (rb_cCairo_UserFontFace, "on_text_to_glyphs", cr_user_font_face_on_text_to_glyphs, 0); rb_define_method (rb_cCairo_UserFontFace, "on_unicode_to_glyph", cr_user_font_face_on_unicode_to_glyph, 0); rb_cCairo_UserFontFace_TextToGlyphsData = rb_define_class_under (rb_cCairo_UserFontFace, "TextToGlyphsData", rb_cObject); rb_attr (rb_cCairo_UserFontFace_TextToGlyphsData, rb_intern ("glyphs"), CR_TRUE, CR_TRUE, CR_TRUE); rb_attr (rb_cCairo_UserFontFace_TextToGlyphsData, rb_intern ("clusters"), CR_TRUE, CR_TRUE, CR_TRUE); rb_define_method (rb_cCairo_UserFontFace_TextToGlyphsData, "initialize", cr_text_to_glyphs_data_initialize, 3); rb_define_method (rb_cCairo_UserFontFace_TextToGlyphsData, "cluster_flags", cr_text_to_glyphs_data_get_cluster_flags, 0); rb_define_method (rb_cCairo_UserFontFace_TextToGlyphsData, "cluster_flags=", cr_text_to_glyphs_data_set_cluster_flags, 1); rb_define_method (rb_cCairo_UserFontFace_TextToGlyphsData, "need_glyphs?", cr_text_to_glyphs_data_need_glyphs, 0); rb_define_method (rb_cCairo_UserFontFace_TextToGlyphsData, "need_clusters?", cr_text_to_glyphs_data_need_clusters, 0); rb_define_method (rb_cCairo_UserFontFace_TextToGlyphsData, "need_cluster_flags?", cr_text_to_glyphs_data_need_cluster_flags, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_UserFontFace_TextToGlyphsData); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_font_options.c000066400000000000000000000135741370612400100215120ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-09-19 12:56:27 $ * * Copyright 2005-2018 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #define _SELF(self) (RVAL2CRFONTOPTIONS(self)) VALUE rb_cCairo_FontOptions; static inline void cr_options_check_status (cairo_font_options_t *options) { rb_cairo_check_status (cairo_font_options_status (options)); } cairo_font_options_t * rb_cairo_font_options_from_ruby_object (VALUE obj) { cairo_font_options_t *options; if (!rb_cairo__is_kind_of (obj, rb_cCairo_FontOptions)) { rb_raise (rb_eTypeError, "not a cairo font options"); } Data_Get_Struct (obj, cairo_font_options_t, options); return options; } static void cr_options_free (void *ptr) { if (ptr) { cairo_font_options_destroy ((cairo_font_options_t *) ptr); } } VALUE rb_cairo_font_options_to_ruby_object (cairo_font_options_t *options) { if (options) { cairo_font_options_t *copied_options; copied_options = cairo_font_options_copy (options); cr_options_check_status (copied_options); return Data_Wrap_Struct (rb_cCairo_FontOptions, NULL, cr_options_free, copied_options); } else { return Qnil; } } static VALUE cr_options_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_options_free, NULL); } static VALUE cr_options_create (VALUE self) { cairo_font_options_t *options; options = cairo_font_options_create (); cr_options_check_status (options); DATA_PTR (self) = options; return Qnil; } static VALUE cr_options_copy (VALUE self) { return CRFONTOPTIONS2RVAL (_SELF (self)); } static VALUE cr_options_merge (VALUE self, VALUE other) { cairo_font_options_merge (_SELF (self), _SELF (other)); return self; } static VALUE cr_options_equal (VALUE self, VALUE other) { if (!rb_cairo__is_kind_of (other, rb_cCairo_FontOptions)) return Qfalse; return CBOOL2RVAL (cairo_font_options_equal (_SELF (self), _SELF (other))); } static VALUE cr_options_hash (VALUE self) { return INT2NUM (cairo_font_options_hash (_SELF (self))); } static VALUE cr_options_set_antialias (VALUE self, VALUE antialias) { cairo_font_options_set_antialias (_SELF (self), RVAL2CRANTIALIAS (antialias)); return self; } static VALUE cr_options_get_antialias (VALUE self) { return INT2NUM (cairo_font_options_get_antialias (_SELF (self))); } static VALUE cr_options_set_subpixel_order (VALUE self, VALUE subpixel_order) { cairo_font_options_set_subpixel_order (_SELF (self), RVAL2CRSUBPIXELORDER (subpixel_order)); return self; } static VALUE cr_options_get_subpixel_order (VALUE self) { return INT2NUM (cairo_font_options_get_subpixel_order (_SELF (self))); } static VALUE cr_options_set_hint_style (VALUE self, VALUE hint_style) { cairo_font_options_set_hint_style (_SELF (self), RVAL2CRHINTSTYLE (hint_style)); return self; } static VALUE cr_options_get_hint_style (VALUE self) { return INT2NUM (cairo_font_options_get_hint_style (_SELF (self))); } static VALUE cr_options_set_hint_metrics (VALUE self, VALUE hint_metrics) { cairo_font_options_set_hint_metrics (_SELF (self), RVAL2CRHINTMETRICS (hint_metrics)); return self; } static VALUE cr_options_get_hint_metrics (VALUE self) { return INT2NUM (cairo_font_options_get_hint_metrics (_SELF (self))); } #if CAIRO_CHECK_VERSION(1, 15, 12) static VALUE cr_options_set_variations (VALUE self, VALUE variations) { cairo_font_options_set_variations (_SELF (self), RVAL2CSTR (variations)); return self; } static VALUE cr_options_get_variations (VALUE self) { const char *variations; variations = cairo_font_options_get_variations (_SELF (self)); if (!variations) return Qnil; return CSTR2RVAL (variations); } #endif void Init_cairo_font_options (void) { rb_cCairo_FontOptions = rb_define_class_under (rb_mCairo, "FontOptions", rb_cObject); rb_define_alloc_func (rb_cCairo_FontOptions, cr_options_allocate); rb_define_method (rb_cCairo_FontOptions, "initialize", cr_options_create, 0); rb_define_method (rb_cCairo_FontOptions, "dup", cr_options_copy, 0); rb_define_method (rb_cCairo_FontOptions, "merge!", cr_options_merge, 1); rb_define_alias (rb_cCairo_FontOptions, "update", "merge!"); rb_define_method (rb_cCairo_FontOptions, "==", cr_options_equal, 1); rb_define_method (rb_cCairo_FontOptions, "eql?", cr_options_equal, 1); rb_define_method (rb_cCairo_FontOptions, "hash", cr_options_hash, 0); rb_define_method (rb_cCairo_FontOptions, "set_antialias", cr_options_set_antialias, 1); rb_define_method (rb_cCairo_FontOptions, "antialias", cr_options_get_antialias, 0); rb_define_method (rb_cCairo_FontOptions, "set_subpixel_order", cr_options_set_subpixel_order, 1); rb_define_method (rb_cCairo_FontOptions, "subpixel_order", cr_options_get_subpixel_order, 0); rb_define_method (rb_cCairo_FontOptions, "set_hint_style", cr_options_set_hint_style, 1); rb_define_method (rb_cCairo_FontOptions, "hint_style", cr_options_get_hint_style, 0); rb_define_method (rb_cCairo_FontOptions, "set_hint_metrics", cr_options_set_hint_metrics, 1); rb_define_method (rb_cCairo_FontOptions, "hint_metrics", cr_options_get_hint_metrics, 0); #if CAIRO_CHECK_VERSION(1, 15, 12) rb_define_method (rb_cCairo_FontOptions, "set_variations", cr_options_set_variations, 1); rb_define_method (rb_cCairo_FontOptions, "variations", cr_options_get_variations, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_FontOptions); } rcairo-1.16.6/ext/cairo/rb_cairo_glyph.c000066400000000000000000000063761370612400100201160ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-16 08:16:39 $ * * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_Glyph; #define _SELF(self) (RVAL2CRGLYPH(self)) cairo_glyph_t * rb_cairo_glyph_from_ruby_object (VALUE obj) { cairo_glyph_t *glyph; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Glyph)) { rb_raise (rb_eTypeError, "not a cairo glyph"); } Data_Get_Struct (obj, cairo_glyph_t, glyph); return glyph; } static void cr_glyph_free (void *ptr) { if (ptr) { xfree (ptr); } } VALUE rb_cairo_glyph_to_ruby_object (cairo_glyph_t *glyph) { if (glyph) { cairo_glyph_t *new_glyph; new_glyph = ALLOC (cairo_glyph_t); *new_glyph = *glyph; return Data_Wrap_Struct (rb_cCairo_Glyph, NULL, cr_glyph_free, new_glyph); } else { return Qnil; } } static VALUE cr_glyph_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_glyph_free, NULL); } static VALUE cr_glyph_initialize (VALUE self, VALUE index, VALUE x, VALUE y) { cairo_glyph_t *glyph; glyph = ALLOC (cairo_glyph_t); glyph->index = NUM2ULONG (index); glyph->x = NUM2DBL (x); glyph->y = NUM2DBL (y); DATA_PTR (self) = glyph; return Qnil; } static VALUE cr_glyph_index (VALUE self) { return ULONG2NUM (_SELF(self)->index); } static VALUE cr_glyph_x (VALUE self) { return rb_float_new (_SELF(self)->x); } static VALUE cr_glyph_y (VALUE self) { return rb_float_new (_SELF(self)->y); } static VALUE cr_glyph_set_index (VALUE self, VALUE index) { _SELF(self)->index = NUM2ULONG (index); return self; } static VALUE cr_glyph_set_x (VALUE self, VALUE x) { _SELF(self)->x = NUM2DBL (x); return self; } static VALUE cr_glyph_set_y (VALUE self, VALUE y) { _SELF(self)->y = NUM2DBL (y); return self; } static VALUE cr_glyph_to_s (VALUE self) { VALUE ret; ret = rb_str_new2 ("#<"); rb_str_cat2 (ret, rb_class2name (CLASS_OF (self))); rb_str_cat2 (ret, ": "); rb_str_cat2 (ret, "index="); rb_str_concat (ret, rb_inspect (cr_glyph_index (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "x="); rb_str_concat (ret, rb_inspect (cr_glyph_x (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "y="); rb_str_concat (ret, rb_inspect (cr_glyph_y (self))); rb_str_cat2 (ret, ">"); return ret; } void Init_cairo_glyph (void) { rb_cCairo_Glyph = rb_define_class_under (rb_mCairo, "Glyph", rb_cObject); rb_define_alloc_func (rb_cCairo_Glyph, cr_glyph_allocate); rb_define_method (rb_cCairo_Glyph, "initialize", cr_glyph_initialize, 3); rb_define_method (rb_cCairo_Glyph, "index", cr_glyph_index, 0); rb_define_method (rb_cCairo_Glyph, "x", cr_glyph_x, 0); rb_define_method (rb_cCairo_Glyph, "y", cr_glyph_y, 0); rb_define_method (rb_cCairo_Glyph, "set_index", cr_glyph_set_index, 1); rb_define_method (rb_cCairo_Glyph, "set_x", cr_glyph_set_x, 1); rb_define_method (rb_cCairo_Glyph, "set_y", cr_glyph_set_y, 1); rb_define_method (rb_cCairo_Glyph, "to_s", cr_glyph_to_s, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_Glyph); } rcairo-1.16.6/ext/cairo/rb_cairo_io.c000066400000000000000000000104141370612400100173660ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2005-2019 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #include "rb_cairo_io.h" ID rb_cairo__io_id_read; ID rb_cairo__io_id_write; ID rb_cairo__io_id_output; ID rb_cairo__io_id_to_io; ID rb_cairo__io_id_to_path; /* read/write callback */ rb_cairo__io_callback_closure_t * rb_cairo__io_closure_new (VALUE target) { rb_cairo__io_callback_closure_t *closure; closure = ALLOC (rb_cairo__io_callback_closure_t); closure->target = target; closure->error = Qnil; return closure; } void rb_cairo__io_closure_destroy (rb_cairo__io_callback_closure_t *closure) { xfree (closure); } void rb_cairo__io_closure_free (void *closure) { rb_cairo__io_closure_destroy ((rb_cairo__io_callback_closure_t *) closure); } static VALUE rb_cairo__io_func_rescue (VALUE io_closure, VALUE error) { rb_cairo__io_callback_closure_t *closure; closure = (rb_cairo__io_callback_closure_t *)io_closure; closure->error = error; return Qnil; } static VALUE rb_cairo__io_func_invoke (VALUE user_data) { rb_cairo__io_invoke_data_t *data; data = (rb_cairo__io_invoke_data_t *)user_data; return rb_rescue2 (data->func, data->data, rb_cairo__io_func_rescue, data->data, rb_eException, (VALUE)0); } /* write callback */ static VALUE rb_cairo__io_write_func_invoke (VALUE write_closure) { VALUE output, data; long written_bytes; rb_cairo__io_callback_closure_t *closure; long length; closure = (rb_cairo__io_callback_closure_t *)write_closure; output = closure->target; data = rb_str_new ((const char *)closure->data, closure->length); length = RSTRING_LEN (data); while (length != 0) { VALUE rb_written_bytes = rb_funcall (output, rb_cairo__io_id_write, 1, data); written_bytes = NUM2LONG (rb_written_bytes); data = rb_str_substr (data, written_bytes, RSTRING_LEN (data) - written_bytes); length -= written_bytes; } return Qnil; } cairo_status_t rb_cairo__io_write_func (void *write_closure, const unsigned char *data, unsigned int length) { rb_cairo__io_callback_closure_t *closure; rb_cairo__io_invoke_data_t invoke_data; closure = (rb_cairo__io_callback_closure_t *)write_closure; closure->data = (unsigned char *)data; closure->length = length; invoke_data.func = rb_cairo__io_write_func_invoke; invoke_data.data = (VALUE)closure; rb_cairo__invoke_callback (rb_cairo__io_func_invoke, (VALUE)&invoke_data); if (NIL_P (closure->error)) return CAIRO_STATUS_SUCCESS; else return CAIRO_STATUS_WRITE_ERROR; } /* read callback */ static VALUE rb_cairo__io_read_func_invoke (VALUE read_closure) { VALUE input, result; rb_cairo__io_callback_closure_t *closure; long length, rest; closure = (rb_cairo__io_callback_closure_t *)read_closure; input = closure->target; length = closure->length; result = rb_str_new2 (""); for (rest = length; rest != 0; rest = length - RSTRING_LEN (result)) { rb_str_concat (result, rb_funcall (input, rb_cairo__io_id_read, 1, INT2NUM (rest))); } memcpy ((void *)closure->data, (const void *) StringValuePtr (result), length); return Qnil; } cairo_status_t rb_cairo__io_read_func (void *read_closure, unsigned char *data, unsigned int length) { rb_cairo__io_callback_closure_t *closure; rb_cairo__io_invoke_data_t invoke_data; closure = (rb_cairo__io_callback_closure_t *)read_closure; closure->data = data; closure->length = length; invoke_data.func = rb_cairo__io_read_func_invoke; invoke_data.data = (VALUE)closure; rb_cairo__invoke_callback (rb_cairo__io_func_invoke, (VALUE)&invoke_data); if (NIL_P (closure->error)) return CAIRO_STATUS_SUCCESS; else return CAIRO_STATUS_READ_ERROR; } void Init_cairo_io (void) { rb_cairo__io_id_read = rb_intern ("read"); rb_cairo__io_id_write = rb_intern ("write"); rb_cairo__io_id_output = rb_intern ("output"); rb_cairo__io_id_to_io = rb_intern ("to_io"); rb_cairo__io_id_to_path = rb_intern ("to_path"); } rcairo-1.16.6/ext/cairo/rb_cairo_io.h000066400000000000000000000027171370612400100174020ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2005-2010 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #ifndef RB_CAIRO_IO_H #define RB_CAIRO_IO_H #include typedef struct rb_cairo__io_callback_closure { VALUE target; VALUE error; unsigned char *data; unsigned int length; } rb_cairo__io_callback_closure_t; typedef struct rb_cairo__io_invoke_data { cr_callback_func_t func; VALUE data; } rb_cairo__io_invoke_data_t; RB_CAIRO_VAR ID rb_cairo__io_id_read; RB_CAIRO_VAR ID rb_cairo__io_id_write; RB_CAIRO_VAR ID rb_cairo__io_id_output; RB_CAIRO_VAR ID rb_cairo__io_id_to_io; RB_CAIRO_VAR ID rb_cairo__io_id_to_path; rb_cairo__io_callback_closure_t * rb_cairo__io_closure_new (VALUE target); void rb_cairo__io_closure_destroy (rb_cairo__io_callback_closure_t *closure); void rb_cairo__io_closure_free (void *closure); cairo_status_t rb_cairo__io_write_func (void *write_closure, const unsigned char *data, unsigned int length); cairo_status_t rb_cairo__io_read_func (void *read_closure, unsigned char *data, unsigned int length); #endif rcairo-1.16.6/ext/cairo/rb_cairo_matrix.c000066400000000000000000000207731370612400100202740ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-14 12:37:50 $ * * Copyright 2006-2008 Kouhei Sutou * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_Matrix; static ID cr_id_equal; #define _SELF (RVAL2CRMATRIX(self)) cairo_matrix_t * rb_cairo_matrix_from_ruby_object (VALUE obj) { cairo_matrix_t *matrix; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Matrix)) { rb_raise (rb_eTypeError, "not a cairo matrix"); } Data_Get_Struct (obj, cairo_matrix_t, matrix); return matrix; } static void cr_matrix_free (void *ptr) { if (ptr) { xfree ((cairo_matrix_t *) ptr); } } VALUE rb_cairo_matrix_to_ruby_object (cairo_matrix_t *matrix) { if (matrix) { cairo_matrix_t *new_matrix = ALLOC (cairo_matrix_t); *new_matrix = *matrix; return Data_Wrap_Struct (rb_cCairo_Matrix, NULL, cr_matrix_free, new_matrix); } else { return Qnil; } } static VALUE cr_matrix_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_matrix_free, NULL); } static VALUE cr_matrix_initialize (VALUE self, VALUE xx, VALUE yx, VALUE xy, VALUE yy, VALUE x0, VALUE y0) { cairo_matrix_t *matrix = ALLOC (cairo_matrix_t); cairo_matrix_init (matrix, NUM2DBL (xx), NUM2DBL (yx), NUM2DBL (xy), NUM2DBL (yy), NUM2DBL (x0), NUM2DBL (y0)); DATA_PTR (self) = matrix; return Qnil; } static VALUE cr_matrix_init_identity (VALUE self) { cairo_matrix_t matrix; cairo_matrix_init_identity (&matrix); return CRMATRIX2RVAL (&matrix); } static VALUE cr_matrix_init_translate (VALUE self, VALUE tx, VALUE ty) { cairo_matrix_t matrix; cairo_matrix_init_translate (&matrix, NUM2DBL (tx), NUM2DBL (ty)); return CRMATRIX2RVAL (&matrix); } static VALUE cr_matrix_init_scale (VALUE self, VALUE sx, VALUE sy) { cairo_matrix_t matrix; cairo_matrix_init_scale (&matrix, NUM2DBL (sx), NUM2DBL (sy)); return CRMATRIX2RVAL (&matrix); } static VALUE cr_matrix_init_rotate (VALUE self, VALUE radius) { cairo_matrix_t matrix; cairo_matrix_init_rotate (&matrix, NUM2DBL (radius)); return CRMATRIX2RVAL (&matrix); } static VALUE cr_matrix_identity (VALUE self) { cairo_matrix_init_identity (_SELF); return self; } static VALUE cr_matrix_translate (VALUE self, VALUE tx, VALUE ty) { cairo_matrix_translate (_SELF, NUM2DBL (tx), NUM2DBL (ty)); return self; } static VALUE cr_matrix_scale (VALUE self, VALUE sx, VALUE sy) { cairo_matrix_scale (_SELF, NUM2DBL (sx), NUM2DBL (sy)); return self; } static VALUE cr_matrix_rotate (VALUE self, VALUE radians) { cairo_matrix_rotate (_SELF, NUM2DBL (radians)); return self; } static VALUE cr_matrix_invert (VALUE self) { rb_cairo_check_status (cairo_matrix_invert (_SELF)); return self; } static VALUE cr_matrix_multiply (VALUE self, VALUE other) { cairo_matrix_multiply (_SELF, _SELF, RVAL2CRMATRIX (other)); return self; } static VALUE cr_matrix_transform_distance (VALUE self, VALUE dx, VALUE dy) { double pair[2]; pair[0] = NUM2DBL (dx); pair[1] = NUM2DBL (dy); cairo_matrix_transform_distance (_SELF, pair, pair + 1); return rb_cairo__float_array (pair, 2); } static VALUE cr_matrix_transform_point (VALUE self, VALUE x, VALUE y) { double pair[2]; pair[0] = NUM2DBL (x); pair[1] = NUM2DBL (y); cairo_matrix_transform_point (_SELF, pair, pair + 1); return rb_cairo__float_array (pair, 2); } /* Accessors */ static VALUE cr_matrix_get_xx (VALUE self) { return rb_float_new (_SELF->xx); } static VALUE cr_matrix_set_xx (VALUE self, VALUE xx) { _SELF->xx = NUM2DBL (xx); return Qnil; } static VALUE cr_matrix_get_yx (VALUE self) { return rb_float_new (_SELF->yx); } static VALUE cr_matrix_set_yx (VALUE self, VALUE yx) { _SELF->yx = NUM2DBL (yx); return Qnil; } static VALUE cr_matrix_get_xy (VALUE self) { return rb_float_new (_SELF->xy); } static VALUE cr_matrix_set_xy (VALUE self, VALUE xy) { _SELF->xy = NUM2DBL (xy); return Qnil; } static VALUE cr_matrix_get_yy (VALUE self) { return rb_float_new (_SELF->yy); } static VALUE cr_matrix_set_yy (VALUE self, VALUE yy) { _SELF->yy = NUM2DBL (yy); return Qnil; } static VALUE cr_matrix_get_x0 (VALUE self) { return rb_float_new (_SELF->x0); } static VALUE cr_matrix_set_x0 (VALUE self, VALUE x0) { _SELF->x0 = NUM2DBL (x0); return Qnil; } static VALUE cr_matrix_get_y0 (VALUE self) { return rb_float_new (_SELF->y0); } static VALUE cr_matrix_set_y0 (VALUE self, VALUE y0) { _SELF->y0 = NUM2DBL (y0); return Qnil; } /* Utilities */ static VALUE cr_matrix_set (VALUE self, VALUE xx, VALUE yx, VALUE xy, VALUE yy, VALUE x0, VALUE y0) { cairo_matrix_init (_SELF, NUM2DBL (xx), NUM2DBL (yx), NUM2DBL (xy), NUM2DBL (yy), NUM2DBL (x0), NUM2DBL (y0)); return self; } static VALUE cr_matrix_to_a (VALUE self) { cairo_matrix_t *matrix = _SELF; double affine[6]; affine[0] = matrix->xx; affine[1] = matrix->yx; affine[2] = matrix->xy; affine[3] = matrix->yy; affine[4] = matrix->x0; affine[5] = matrix->y0; return rb_cairo__float_array (affine, 6); } static VALUE cr_matrix_to_s(VALUE self) { VALUE ret; ret = rb_str_new2 ("#<"); rb_str_cat2 (ret, rb_class2name (CLASS_OF (self))); rb_str_cat2 (ret, ":"); rb_str_concat (ret, rb_inspect (cr_matrix_to_a (self))); rb_str_cat2 (ret, ">"); return ret; } static VALUE cr_matrix_equal (VALUE self, VALUE other) { if (!rb_cairo__is_kind_of (other, rb_cCairo_Matrix)) return Qfalse; return rb_funcall (cr_matrix_to_a (self), cr_id_equal, 1, cr_matrix_to_a (other)); } void Init_cairo_matrix (void) { cr_id_equal = rb_intern ("=="); rb_cCairo_Matrix = rb_define_class_under (rb_mCairo, "Matrix", rb_cObject); rb_define_alloc_func (rb_cCairo_Matrix, cr_matrix_allocate); rb_define_singleton_method (rb_cCairo_Matrix, "identity", cr_matrix_init_identity, 0); rb_define_singleton_method (rb_cCairo_Matrix, "translate", cr_matrix_init_translate, 2); rb_define_singleton_method (rb_cCairo_Matrix, "scale", cr_matrix_init_scale, 2); rb_define_singleton_method (rb_cCairo_Matrix, "rotate", cr_matrix_init_rotate, 1); rb_define_method (rb_cCairo_Matrix, "initialize", cr_matrix_initialize, 6); rb_define_method (rb_cCairo_Matrix, "identity!", cr_matrix_identity, 0); rb_define_method (rb_cCairo_Matrix, "translate!", cr_matrix_translate, 2); rb_define_method (rb_cCairo_Matrix, "scale!", cr_matrix_scale, 2); rb_define_method (rb_cCairo_Matrix, "rotate!", cr_matrix_rotate, 1); rb_define_method (rb_cCairo_Matrix, "invert!", cr_matrix_invert, 0); rb_define_method (rb_cCairo_Matrix, "multiply!", cr_matrix_multiply, 1); rb_define_method (rb_cCairo_Matrix, "transform_distance", cr_matrix_transform_distance, 2); rb_define_method (rb_cCairo_Matrix, "transform_point", cr_matrix_transform_point, 2); /* Accessors */ rb_define_method (rb_cCairo_Matrix, "xx", cr_matrix_get_xx, 0); rb_define_method (rb_cCairo_Matrix, "set_xx", cr_matrix_set_xx, 1); rb_define_method (rb_cCairo_Matrix, "yx", cr_matrix_get_yx, 0); rb_define_method (rb_cCairo_Matrix, "set_yx", cr_matrix_set_yx, 1); rb_define_method (rb_cCairo_Matrix, "xy", cr_matrix_get_xy, 0); rb_define_method (rb_cCairo_Matrix, "set_xy", cr_matrix_set_xy, 1); rb_define_method (rb_cCairo_Matrix, "yy", cr_matrix_get_yy, 0); rb_define_method (rb_cCairo_Matrix, "set_yy", cr_matrix_set_yy, 1); rb_define_method (rb_cCairo_Matrix, "x0", cr_matrix_get_x0, 0); rb_define_method (rb_cCairo_Matrix, "set_x0", cr_matrix_set_x0, 1); rb_define_method (rb_cCairo_Matrix, "y0", cr_matrix_get_y0, 0); rb_define_method (rb_cCairo_Matrix, "set_y0", cr_matrix_set_y0, 1); /* Utilities */ rb_define_method (rb_cCairo_Matrix, "set", cr_matrix_set, 6); rb_define_method (rb_cCairo_Matrix, "to_a", cr_matrix_to_a, 0); rb_define_method (rb_cCairo_Matrix, "to_s", cr_matrix_to_s, 0); rb_define_method (rb_cCairo_Matrix, "==", cr_matrix_equal, 1); RB_CAIRO_DEF_SETTERS (rb_cCairo_Matrix); } rcairo-1.16.6/ext/cairo/rb_cairo_path.c000066400000000000000000000264761370612400100177320ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-04-04 03:52:31 $ * * Copyright 2005 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #define _SELF(self) (RVAL2CRPATH (self)) VALUE rb_cCairo_Point; VALUE rb_cCairo_Path; VALUE rb_cCairo_PathData; VALUE rb_cCairo_PathMoveTo; VALUE rb_cCairo_PathLineTo; VALUE rb_cCairo_PathCurveTo; VALUE rb_cCairo_PathClosePath; static ID id_new, id_current_path; static ID id_at_x, id_at_y, id_at_type, id_at_points, id_at_context; static VALUE cr_point_new (VALUE x, VALUE y) { return rb_funcall (rb_cCairo_Point, id_new, 2, x, y); } static VALUE cr_point_initialize (VALUE self, VALUE x, VALUE y) { rb_ivar_set (self, id_at_x, x); rb_ivar_set (self, id_at_y, y); return Qnil; } static VALUE cr_point_to_a (VALUE self) { return rb_ary_new3 (2, rb_ivar_get (self, id_at_x), rb_ivar_get (self, id_at_y)); } static VALUE cr_path_data_initialize (VALUE self, VALUE type, VALUE points) { rb_ivar_set (self, id_at_type, type); rb_ivar_set (self, id_at_points, points); return Qnil; } static VALUE cr_path_data_move_to_p (VALUE self) { return CBOOL2RVAL (RVAL2CRPATHDATATYPE (rb_ivar_get (self, id_at_type)) == CAIRO_PATH_MOVE_TO); } static VALUE cr_path_data_line_to_p (VALUE self) { return CBOOL2RVAL (RVAL2CRPATHDATATYPE (rb_ivar_get (self, id_at_type)) == CAIRO_PATH_LINE_TO); } static VALUE cr_path_data_curve_to_p (VALUE self) { return CBOOL2RVAL (RVAL2CRPATHDATATYPE (rb_ivar_get (self, id_at_type)) == CAIRO_PATH_CURVE_TO); } static VALUE cr_path_data_close_path_p (VALUE self) { return CBOOL2RVAL (RVAL2CRPATHDATATYPE (rb_ivar_get (self, id_at_type)) == CAIRO_PATH_CLOSE_PATH); } static VALUE cr_path_data_each (VALUE self) { return rb_ary_each (rb_ivar_get (self, id_at_points)); } static VALUE cr_path_data_to_a (VALUE self) { return rb_ary_new3 (2, rb_ivar_get (self, id_at_type), rb_ivar_get (self, id_at_points)); } static VALUE cr_path_data_to_ruby_object (cairo_path_data_t *data) { VALUE rb_data = Qnil; switch (data->header.type) { case CAIRO_PATH_MOVE_TO: rb_data = rb_funcall (rb_cCairo_PathMoveTo, id_new, 2, rb_float_new (data[1].point.x), rb_float_new (data[1].point.y)); break; case CAIRO_PATH_LINE_TO: rb_data = rb_funcall (rb_cCairo_PathLineTo, id_new, 2, rb_float_new (data[1].point.x), rb_float_new (data[1].point.y)); break; case CAIRO_PATH_CURVE_TO: rb_data = rb_funcall (rb_cCairo_PathCurveTo, id_new, 6, rb_float_new (data[1].point.x), rb_float_new (data[1].point.y), rb_float_new (data[2].point.x), rb_float_new (data[2].point.y), rb_float_new (data[3].point.x), rb_float_new (data[3].point.y)); break; case CAIRO_PATH_CLOSE_PATH: rb_data = rb_funcall (rb_cCairo_PathClosePath, id_new, 0); break; } return rb_data; } static VALUE cr_path_move_to_initialize (int argc, VALUE *argv, VALUE self) { VALUE point, x, y; VALUE super_argv[2]; rb_scan_args (argc, argv, "11", &x, &y); if (argc == 1) point = x; else point = cr_point_new (x, y); super_argv[0] = INT2NUM (CAIRO_PATH_MOVE_TO); super_argv[1] = rb_ary_new3 (1, point); rb_call_super (2, super_argv); return Qnil; } static VALUE cr_path_line_to_initialize (int argc, VALUE *argv, VALUE self) { VALUE point, x, y; VALUE super_argv[2]; rb_scan_args (argc, argv, "11", &x, &y); if (argc == 1) point = x; else point = cr_point_new (x, y); super_argv[0] = INT2NUM (CAIRO_PATH_LINE_TO); super_argv[1] = rb_ary_new3 (1, point); rb_call_super (2, super_argv); return Qnil; } static VALUE cr_path_curve_to_initialize (int argc, VALUE *argv, VALUE self) { VALUE point1, point2, point3, x1, y1, x2, y2, x3, y3; VALUE super_argv[2]; rb_scan_args (argc, argv, "33", &x1, &y1, &x2, &y2, &x3, &y3); if (argc == 3) { point1 = x1; point2 = y1; point3 = x2; } else if (argc == 6) { point1 = cr_point_new (x1, y1); point2 = cr_point_new (x2, y2); point3 = cr_point_new (x3, y3); } else { VALUE inspected_arg = rb_inspect (rb_ary_new4 (argc, argv)); rb_raise (rb_eArgError, "invalid argument: %s (expect " "(point1, point2, point3) or " "(x1, y1, x2, y2, x3, y3))", StringValuePtr (inspected_arg)); } super_argv[0] = INT2NUM (CAIRO_PATH_CURVE_TO); super_argv[1] = rb_ary_new3 (3, point1, point2, point3); rb_call_super (2, super_argv); return Qnil; } static VALUE cr_path_close_path_initialize (VALUE self) { VALUE super_argv[2]; super_argv[0] = INT2NUM (CAIRO_PATH_CLOSE_PATH); super_argv[1] = rb_ary_new (); rb_call_super (2, super_argv); return Qnil; } static void cr_path_free (void *ptr) { if (ptr) { cairo_path_destroy ((cairo_path_t *)ptr); } } cairo_path_t * rb_cairo_path_from_ruby_object (VALUE obj) { VALUE context; cairo_t *cr; cairo_path_t *path, *copied_path; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Path)) { rb_raise (rb_eTypeError, "not a cairo path"); } Data_Get_Struct (obj, cairo_path_t, path); context = rb_ivar_get (obj, id_at_context); if (NIL_P (context)) return path; cr = RVAL2CRCONTEXT (context); if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) return path; copied_path = cairo_copy_path (cr); rb_ivar_set (obj, id_current_path, CRPATH2RVAL (copied_path)); return copied_path; } static void cr_path_ensure_internal_context (VALUE rb_path, cairo_path_t *path) { cairo_surface_t *surface; cairo_t *cr; if (!NIL_P (rb_ivar_get (rb_path, id_at_context))) return; surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 1, 1); cr = cairo_create (surface); if (path->num_data > 0) cairo_append_path (cr, path); rb_cairo_check_status (cairo_status (cr)); rb_ivar_set (rb_path, id_at_context, CRCONTEXT2RVAL (cr)); cairo_destroy (cr); } VALUE rb_cairo_path_to_ruby_object (cairo_path_t *path) { if (path) { VALUE rb_path; rb_path = Data_Wrap_Struct (rb_cCairo_Path, NULL, cr_path_free, path); cr_path_ensure_internal_context (rb_path, path); return rb_path; } else { return Qnil; } } static VALUE cr_path_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_path_free, NULL); } static VALUE cr_path_initialize (VALUE self) { cairo_path_t *path; path = ALLOC(cairo_path_t); path->status = CAIRO_STATUS_SUCCESS; path->data = NULL; path->num_data = 0; DATA_PTR (self) = path; cr_path_ensure_internal_context (self, path); return Qnil; } static VALUE cr_path_empty_p (VALUE self) { cairo_path_t *path = _SELF (self); return CBOOL2RVAL (path->num_data == 0); } static int cairo_path_get_size (cairo_path_t *path) { int i, size; for (i = 0, size = 0; i < path->num_data; i += path->data[i].header.length) size++; return size; } static VALUE cr_path_size (VALUE self) { cairo_path_t *path = _SELF (self); return INT2NUM (cairo_path_get_size (path)); } static VALUE cr_path_ref (VALUE self, VALUE index) { cairo_path_t *path = _SELF (self); int i, requested_index, real_index; requested_index = NUM2INT (index); if (requested_index < 0) { requested_index += cairo_path_get_size (path); if (requested_index < 0) return Qnil; } for (i = 0, real_index = 0; i < requested_index; i++) { if (real_index >= path->num_data) return Qnil; real_index += path->data[real_index].header.length; } if (real_index < path->num_data) return cr_path_data_to_ruby_object (&path->data[real_index]); else return Qnil; } static VALUE cr_path_each (VALUE self) { cairo_path_t *path = _SELF(self); int i; for (i = 0; i < path->num_data; i += path->data[i].header.length) { rb_yield (cr_path_data_to_ruby_object (&(path->data[i]))); } return self; } void Init_cairo_path (void) { id_new = rb_intern ("new"); id_current_path = rb_intern ("current_path"); id_at_x = rb_intern ("@x"); id_at_y = rb_intern ("@y"); id_at_type = rb_intern ("@type"); id_at_points = rb_intern ("@points"); id_at_context = rb_intern ("@context"); rb_cCairo_Point = rb_define_class_under (rb_mCairo, "Point", rb_cObject); rb_define_attr (rb_cCairo_Point, "x", CR_TRUE, CR_FALSE); rb_define_attr (rb_cCairo_Point, "y", CR_TRUE, CR_FALSE); rb_define_method (rb_cCairo_Point, "initialize", cr_point_initialize, 2); rb_define_method (rb_cCairo_Point, "to_a", cr_point_to_a, 0); rb_define_alias (rb_cCairo_Point, "to_ary", "to_a"); rb_cCairo_PathData = rb_define_class_under (rb_mCairo, "PathData", rb_cObject); rb_include_module (rb_cCairo_PathData, rb_mEnumerable); rb_define_attr (rb_cCairo_PathData, "type", CR_TRUE, CR_FALSE); rb_define_attr (rb_cCairo_PathData, "points", CR_TRUE, CR_FALSE); rb_define_method (rb_cCairo_PathData, "initialize", cr_path_data_initialize, 2); rb_define_method (rb_cCairo_PathData, "move_to?", cr_path_data_move_to_p, 0); rb_define_method (rb_cCairo_PathData, "line_to?", cr_path_data_line_to_p, 0); rb_define_method (rb_cCairo_PathData, "curve_to?", cr_path_data_curve_to_p, 0); rb_define_method (rb_cCairo_PathData, "close_path?", cr_path_data_close_path_p, 0); rb_define_method (rb_cCairo_PathData, "each", cr_path_data_each, 0); rb_define_method (rb_cCairo_PathData, "to_a", cr_path_data_to_a, 0); rb_define_alias (rb_cCairo_PathData, "to_ary", "to_a"); rb_cCairo_PathMoveTo = rb_define_class_under (rb_mCairo, "PathMoveTo", rb_cCairo_PathData); rb_define_method (rb_cCairo_PathMoveTo, "initialize", cr_path_move_to_initialize, -1); rb_cCairo_PathLineTo = rb_define_class_under (rb_mCairo, "PathLineTo", rb_cCairo_PathData); rb_define_method (rb_cCairo_PathLineTo, "initialize", cr_path_line_to_initialize, -1); rb_cCairo_PathCurveTo = rb_define_class_under (rb_mCairo, "PathCurveTo", rb_cCairo_PathData); rb_define_method (rb_cCairo_PathCurveTo, "initialize", cr_path_curve_to_initialize, -1); rb_cCairo_PathClosePath = rb_define_class_under (rb_mCairo, "PathClosePath", rb_cCairo_PathData); rb_define_method (rb_cCairo_PathClosePath, "initialize", cr_path_close_path_initialize, 0); rb_cCairo_Path = rb_define_class_under (rb_mCairo, "Path", rb_cObject); rb_define_alloc_func (rb_cCairo_Path, cr_path_allocate); rb_include_module (rb_cCairo_Path, rb_mEnumerable); rb_define_method (rb_cCairo_Path, "initialize", cr_path_initialize, 0); rb_define_method (rb_cCairo_Path, "empty?", cr_path_empty_p, 0); rb_define_method (rb_cCairo_Path, "size", cr_path_size, 0); rb_define_alias (rb_cCairo_Path, "length", "size"); rb_define_method (rb_cCairo_Path, "[]", cr_path_ref, 1); rb_define_method (rb_cCairo_Path, "each", cr_path_each, 0); } rcairo-1.16.6/ext/cairo/rb_cairo_pattern.c000066400000000000000000001036601370612400100204420ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-06-12 10:59:54 $ * * Copyright 2012-2019 Kouhei Sutou * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_Pattern; VALUE rb_cCairo_SolidPattern; VALUE rb_cCairo_SurfacePattern; VALUE rb_cCairo_GradientPattern; VALUE rb_cCairo_LinearPattern; VALUE rb_cCairo_RadialPattern; VALUE rb_cCairo_MeshPattern; VALUE rb_cCairo_RasterSourcePattern; static ID id_parse, id_to_rgb, id_to_a, id_inspect, id_new, id_call; #define _SELF(self) (RVAL2CRPATTERN(self)) #if CAIRO_CHECK_VERSION(1, 11, 4) # define RB_CAIRO_HAS_MESH_PATTERN # define RB_CAIRO_HAS_RASTER_SOURCE_PATTERN #endif static VALUE cr_color_parse (VALUE color) { return rb_funcall (rb_mCairo_Color, id_parse, 1, color); } static inline void cr_pattern_check_status (cairo_pattern_t *pattern) { rb_cairo_check_status (cairo_pattern_status (pattern)); } static VALUE cr_pattern_get_klass (cairo_pattern_t *pattern) { VALUE klass; cairo_pattern_type_t type; type = cairo_pattern_get_type (pattern); switch (type) { case CAIRO_PATTERN_TYPE_SOLID: klass = rb_cCairo_SolidPattern; break; case CAIRO_PATTERN_TYPE_SURFACE: klass = rb_cCairo_SurfacePattern; break; case CAIRO_PATTERN_TYPE_LINEAR: klass = rb_cCairo_LinearPattern; break; case CAIRO_PATTERN_TYPE_RADIAL: klass = rb_cCairo_RadialPattern; break; #if CAIRO_CHECK_VERSION(1, 11, 4) case CAIRO_PATTERN_TYPE_MESH: klass = rb_cCairo_MeshPattern; break; case CAIRO_PATTERN_TYPE_RASTER_SOURCE: klass = rb_cCairo_RasterSourcePattern; break; #endif default: rb_raise (rb_eArgError, "unknown pattern type: %d", type); break; } return klass; } static VALUE cr_pattern_solid_supported_p (VALUE klass) { return Qtrue; } static VALUE cr_pattern_surface_supported_p (VALUE klass) { return Qtrue; } static VALUE cr_pattern_gradient_supported_p (VALUE klass) { return Qtrue; } static VALUE cr_pattern_linear_supported_p (VALUE klass) { return Qtrue; } static VALUE cr_pattern_radial_supported_p (VALUE klass) { return Qtrue; } static VALUE cr_pattern_mesh_supported_p (VALUE klass) { #ifdef RB_CAIRO_HAS_MESH_PATTERN return Qtrue; #else return Qfalse; #endif } static VALUE cr_pattern_raster_source_supported_p (VALUE klass) { #ifdef RB_CAIRO_HAS_RASTER_SOURCE_PATTERN return Qtrue; #else return Qfalse; #endif } cairo_pattern_t * rb_cairo_pattern_from_ruby_object (VALUE obj) { cairo_pattern_t *pattern; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Pattern)) { rb_raise (rb_eTypeError, "not a cairo pattern"); } Data_Get_Struct (obj, cairo_pattern_t, pattern); return pattern; } static void cr_pattern_free (void *ptr) { if (ptr) { cairo_pattern_destroy ((cairo_pattern_t *) ptr); } } VALUE rb_cairo_pattern_to_ruby_object (cairo_pattern_t *pattern) { if (pattern) { VALUE klass; klass = cr_pattern_get_klass (pattern); cairo_pattern_reference (pattern); return Data_Wrap_Struct (klass, NULL, cr_pattern_free, pattern); } else { return Qnil; } } static VALUE cr_pattern_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_pattern_free, NULL); } static VALUE cr_pattern_initialize (int argc, VALUE *argv, VALUE self) { rb_raise(rb_eNotImpError, "%s class instantiation isn't supported on this cairo installation", rb_obj_classname(self)); return Qnil; } static VALUE cr_solid_pattern_initialize (int argc, VALUE *argv, VALUE self) { VALUE red, green, blue, alpha; int n; cairo_pattern_t *pattern; n = rb_scan_args (argc, argv, "13", &red, &green, &blue, &alpha); if (n == 1) { VALUE color = red; color = cr_color_parse (color); if (rb_cairo__is_kind_of (color, rb_cCairo_Color_Base)) red = rb_funcall (rb_funcall (color, id_to_rgb, 0), id_to_a, 0); } if (n == 1 && rb_cairo__is_kind_of (red, rb_cArray) && (RARRAY_LEN (red) == 3 || RARRAY_LEN (red) == 4)) { VALUE ary = red; n = (int) RARRAY_LEN (ary); red = rb_ary_entry (ary, 0); green = rb_ary_entry (ary, 1); blue = rb_ary_entry (ary, 2); alpha = rb_ary_entry (ary, 3); } if (n == 3) { pattern = cairo_pattern_create_rgb (NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue)); } else if (n == 4) { pattern = cairo_pattern_create_rgba (NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue), NUM2DBL (alpha)); } else { VALUE inspected; inspected = rb_funcall (argc == 1 ? red : rb_ary_new4 (argc, argv), id_inspect, 0); rb_raise (rb_eArgError, "invalid argument: %s (expect " "(color_name), " "(color_hex_triplet), " "(Cairo::Color::RGB), " "(Cairo::Color::CMYK), " "(Cairo::Color::HSV), " "(red, green, blue), " "([red, green, blue]), " "(red, green, blue, alpha) or " "([red, green, blue, alpha])" ")", RVAL2CSTR (inspected)); } cr_pattern_check_status (pattern); DATA_PTR (self) = pattern; return Qnil; } static VALUE cr_surface_pattern_initialize (VALUE self, VALUE surface) { cairo_pattern_t *pattern; pattern = cairo_pattern_create_for_surface (RVAL2CRSURFACE (surface)); cr_pattern_check_status (pattern); DATA_PTR (self) = pattern; return Qnil; } static VALUE cr_linear_pattern_initialize (VALUE self, VALUE x0, VALUE y0, VALUE x1, VALUE y1) { cairo_pattern_t *pattern; pattern = cairo_pattern_create_linear (NUM2DBL (x0), NUM2DBL (y0), NUM2DBL (x1), NUM2DBL (y1)); cr_pattern_check_status (pattern); DATA_PTR (self) = pattern; return Qnil; } static VALUE cr_radial_pattern_initialize (VALUE self, VALUE cx0, VALUE cy0, VALUE radius0, VALUE cx1, VALUE cy1, VALUE radius1) { cairo_pattern_t *pattern; pattern = cairo_pattern_create_radial (NUM2DBL (cx0), NUM2DBL (cy0), NUM2DBL (radius0), NUM2DBL (cx1), NUM2DBL (cy1), NUM2DBL (radius1)); cr_pattern_check_status (pattern); DATA_PTR (self) = pattern; return Qnil; } /* Cairo::GradientPattern */ static VALUE cr_gradient_pattern_add_color_stop_generic (int argc, VALUE *argv, VALUE self) { VALUE offset, red, green, blue, alpha; int n; n = rb_scan_args (argc, argv, "23", &offset, &red, &green, &blue, &alpha); if (n == 2) { VALUE color = red; color = cr_color_parse (color); if (rb_cairo__is_kind_of (color, rb_cCairo_Color_Base)) red = rb_funcall (rb_funcall (color, id_to_rgb, 0), id_to_a, 0); } if (n == 2 && rb_cairo__is_kind_of (red, rb_cArray)) { VALUE ary = red; n = (int) RARRAY_LEN (ary) + 1; red = rb_ary_entry (ary, 0); green = rb_ary_entry (ary, 1); blue = rb_ary_entry (ary, 2); alpha = rb_ary_entry (ary, 3); } if (n == 4 || (n == 5 && NIL_P (alpha))) { cairo_pattern_add_color_stop_rgb (_SELF (self), NUM2DBL (offset), NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue)); } else if (n == 5) { cairo_pattern_add_color_stop_rgba (_SELF (self), NUM2DBL (offset), NUM2DBL (red), NUM2DBL (green), NUM2DBL (blue), NUM2DBL (alpha)); } else { VALUE inspected; inspected = rb_funcall (rb_ary_new4 (argc, argv), id_inspect, 0); rb_raise (rb_eArgError, "invalid argument: %s (expect " "(offset, color_name), " "(offset, color_hex_triplet), " "(offset, Cairo::Color::RGB), " "(offset, Cairo::Color::CMYK), " "(offset, Cairo::Color::HSV), " "(offset, red, green, blue), " "(offset, [red, green, blue]), " "(offset, red, green, blue, alpha) or " "(offset, [red, green, blue, alpha])" ")", RVAL2CSTR (inspected)); } cr_pattern_check_status (_SELF (self)); return self; } /* Cairo::Pattern */ static VALUE cr_pattern_set_matrix (VALUE self, VALUE matrix) { cairo_pattern_set_matrix (_SELF (self), RVAL2CRMATRIX (matrix)); cr_pattern_check_status (_SELF (self)); return self; } static VALUE cr_pattern_get_matrix (VALUE self) { cairo_matrix_t matrix; cairo_pattern_get_matrix (_SELF (self), &matrix); cr_pattern_check_status (_SELF (self)); return CRMATRIX2RVAL (&matrix); } static VALUE cr_pattern_set_extend (VALUE self, VALUE extend) { cairo_pattern_set_extend (_SELF (self), RVAL2CREXTEND (extend)); cr_pattern_check_status (_SELF (self)); return self; } static VALUE cr_pattern_get_extend (VALUE self) { return INT2NUM (cairo_pattern_get_extend (_SELF (self))); } static VALUE cr_pattern_set_filter (VALUE self, VALUE filter) { cairo_pattern_set_filter (_SELF (self), RVAL2CRFILTER (filter)); cr_pattern_check_status (_SELF (self)); return self; } static VALUE cr_pattern_get_filter (VALUE self) { return INT2NUM (cairo_pattern_get_filter (_SELF (self))); } #if CAIRO_CHECK_VERSION(1, 3, 0) static VALUE cr_solid_pattern_get_rgba (VALUE self) { double red, green, blue, alpha; rb_cairo_check_status (cairo_pattern_get_rgba (_SELF (self), &red, &green, &blue, &alpha)); return rb_ary_new3 (4, rb_float_new (red), rb_float_new (green), rb_float_new (blue), rb_float_new (alpha)); } static VALUE cr_solid_pattern_get_color (VALUE self) { return cr_color_parse (cr_solid_pattern_get_rgba (self)); } static VALUE cr_surface_pattern_get_surface (VALUE self) { cairo_surface_t *surface; rb_cairo_check_status (cairo_pattern_get_surface (_SELF (self), &surface)); return CRSURFACE2RVAL (surface); } static VALUE cr_gradient_pattern_get_color_stop_rgba (VALUE self, VALUE index) { cairo_status_t status; double offset, red, green, blue, alpha; status = cairo_pattern_get_color_stop_rgba (_SELF (self), NUM2INT (index), &offset, &red, &green, &blue, &alpha); rb_cairo_check_status (status); return rb_ary_new3 (5, rb_float_new (offset), rb_float_new (red), rb_float_new (green), rb_float_new (blue), rb_float_new (alpha)); } static VALUE cr_gradient_pattern_get_color_stop_color (VALUE self, VALUE index) { VALUE result, offset, rgba; result = cr_gradient_pattern_get_color_stop_rgba (self, index); offset = rb_ary_shift (result); rgba = result; return rb_ary_new3 (2, offset, cr_color_parse (rgba)); } static VALUE cr_gradient_pattern_get_color_stop_count (VALUE self) { cairo_status_t status; int count; status = cairo_pattern_get_color_stop_count (_SELF (self), &count); rb_cairo_check_status (status); return INT2NUM (count); } static VALUE cr_linear_pattern_get_linear_points (VALUE self) { cairo_status_t status; double x0, y0, x1, y1; status = cairo_pattern_get_linear_points (_SELF (self), &x0, &y0, &x1, &y1); rb_cairo_check_status (status); return rb_ary_new3 (4, rb_float_new (x0), rb_float_new (y0), rb_float_new (x1), rb_float_new (y1)); } static VALUE cr_radial_pattern_get_radial_circles (VALUE self) { cairo_status_t status; double x0, y0, r0, x1, y1, r1; status = cairo_pattern_get_radial_circles (_SELF (self), &x0, &y0, &r0, &x1, &y1, &r1); rb_cairo_check_status (status); return rb_ary_new3 (2, rb_ary_new3 (3, rb_float_new (x0), rb_float_new (y0), rb_float_new (r0)), rb_ary_new3 (3, rb_float_new (x1), rb_float_new (y1), rb_float_new (r1))); } #endif /* Cairo::SurfacePattern */ /* none */ #ifdef RB_CAIRO_HAS_MESH_PATTERN /* Cairo::MeshPattern */ static VALUE cr_mesh_pattern_initialize (VALUE self) { cairo_pattern_t *pattern; pattern = cairo_pattern_create_mesh (); cr_pattern_check_status (pattern); DATA_PTR (self) = pattern; return Qnil; } static VALUE cr_mesh_pattern_end_patch (VALUE self) { cairo_pattern_t *pattern; pattern = _SELF (self); cairo_mesh_pattern_end_patch (pattern); cr_pattern_check_status (pattern); return self; } static VALUE cr_mesh_pattern_begin_patch (VALUE self) { cairo_pattern_t *pattern; pattern = _SELF (self); cairo_mesh_pattern_begin_patch (pattern); cr_pattern_check_status (pattern); if (rb_block_given_p ()) return rb_ensure (rb_yield, self, cr_mesh_pattern_end_patch, self); else return self; } static VALUE cr_mesh_pattern_curve_to (VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3) { cairo_pattern_t *pattern; pattern = _SELF (self); cairo_mesh_pattern_curve_to (pattern, NUM2DBL (x1), NUM2DBL (y1), NUM2DBL (x2), NUM2DBL (y2), NUM2DBL (x3), NUM2DBL (y3)); cr_pattern_check_status (pattern); return self; } static VALUE cr_mesh_pattern_line_to (VALUE self, VALUE x, VALUE y) { cairo_pattern_t *pattern; pattern = _SELF (self); cairo_mesh_pattern_line_to (pattern, NUM2DBL (x), NUM2DBL (y)); cr_pattern_check_status (pattern); return self; } static VALUE cr_mesh_pattern_move_to (VALUE self, VALUE x, VALUE y) { cairo_pattern_t *pattern; pattern = _SELF (self); cairo_mesh_pattern_move_to (pattern, NUM2DBL (x), NUM2DBL (y)); cr_pattern_check_status (pattern); return self; } static VALUE cr_mesh_pattern_set_control_point (VALUE self, VALUE rb_nth_point, VALUE rb_x, VALUE rb_y) { cairo_pattern_t *pattern; unsigned int nth_point; pattern = _SELF (self); nth_point = NUM2UINT (rb_nth_point); if (nth_point <= 3) { cairo_mesh_pattern_set_control_point (pattern, nth_point, NUM2DBL (rb_x), NUM2DBL (rb_y)); } else { VALUE inspected; inspected = rb_funcall (rb_ary_new3 (3, rb_nth_point, rb_x, rb_y), id_inspect, 0); rb_raise (rb_eArgError, "nth_point must be 0, 1, 2 or 3: <%u>: <%s>", nth_point, RVAL2CSTR (inspected)); } cr_pattern_check_status (pattern); return self; } static VALUE cr_mesh_pattern_set_corner_color_generic (int argc, VALUE *argv, VALUE self) { cairo_pattern_t *pattern; VALUE rb_nth_corner, rb_red, rb_green, rb_blue, rb_alpha; unsigned int nth_corner; double red, green, blue, alpha; rb_scan_args (argc, argv, "41", &rb_nth_corner, &rb_red, &rb_green, &rb_blue, &rb_alpha); nth_corner = NUM2UINT (rb_nth_corner); if (nth_corner > 3) { VALUE inspected; inspected = rb_funcall (rb_ary_new4 (argc, argv), id_inspect, 0); rb_raise (rb_eArgError, "nth_corner must be 0, 1, 2 or 3: <%u>: <%s>", nth_corner, RVAL2CSTR (inspected)); } pattern = _SELF (self); red = NUM2DBL (rb_red); green = NUM2DBL (rb_green); blue = NUM2DBL (rb_blue); if (NIL_P (rb_alpha)) { cairo_mesh_pattern_set_corner_color_rgb (pattern, nth_corner, red, green, blue); } else { alpha = NUM2DBL (rb_alpha); cairo_mesh_pattern_set_corner_color_rgba (pattern, nth_corner, red, green, blue, alpha); } cr_pattern_check_status (pattern); return self; } static VALUE cr_mesh_pattern_get_patch_count (VALUE self) { cairo_pattern_t *pattern; unsigned int count; cairo_status_t status; pattern = _SELF (self); status = cairo_mesh_pattern_get_patch_count (pattern, &count); rb_cairo_check_status (status); return UINT2NUM (count); } static VALUE cr_mesh_pattern_get_path (VALUE self, VALUE nth_patch) { cairo_pattern_t *pattern; cairo_path_t *path; pattern = _SELF (self); path = cairo_mesh_pattern_get_path (pattern, NUM2UINT (nth_patch)); rb_cairo_check_status (path->status); return CRPATH2RVAL (path); } static VALUE cr_mesh_pattern_get_corner_color (VALUE self, VALUE rb_nth_patch, VALUE rb_nth_corner) { cairo_pattern_t *pattern; unsigned int nth_patch, nth_corner; double red, green, blue, alpha; cairo_status_t status; nth_patch = NUM2UINT (rb_nth_patch); nth_corner = NUM2UINT (rb_nth_corner); if (nth_corner > 3) { VALUE inspected; inspected = rb_funcall (rb_ary_new3 (2, rb_nth_patch, rb_nth_corner), id_inspect, 0); rb_raise (rb_eArgError, "nth_corner must be 0, 1, 2 or 3: <%u>: <%s>", nth_corner, RVAL2CSTR (inspected)); } pattern = _SELF (self); status = cairo_mesh_pattern_get_corner_color_rgba (pattern, nth_patch, nth_corner, &red, &green, &blue, &alpha); rb_cairo_check_status (status); return rb_ary_new3 (4, rb_float_new (red), rb_float_new (green), rb_float_new (blue), rb_float_new (alpha)); } static VALUE cr_mesh_pattern_get_control_point (VALUE self, VALUE rb_nth_patch, VALUE rb_nth_point) { cairo_pattern_t *pattern; unsigned int nth_patch, nth_point; double x, y; cairo_status_t status; nth_patch = NUM2UINT (rb_nth_patch); nth_point = NUM2UINT (rb_nth_point); if (nth_point > 3) { VALUE inspected; inspected = rb_funcall (rb_ary_new3 (2, rb_nth_patch, rb_nth_point), id_inspect, 0); rb_raise (rb_eArgError, "nth_point must be 0, 1, 2 or 3: <%u>: <%s>", nth_point, RVAL2CSTR (inspected)); } pattern = _SELF (self); status = cairo_mesh_pattern_get_control_point (pattern, nth_patch, nth_point, &x, &y); rb_cairo_check_status (status); return rb_ary_new3 (2, rb_float_new (x), rb_float_new (y)); } #endif #ifdef RB_CAIRO_HAS_RASTER_SOURCE_PATTERN /* Cairo::RasterSourcePattern */ static cairo_surface_t * cr_raster_source_acquire_callback (cairo_pattern_t *pattern, void *callback_data, cairo_surface_t *target, const cairo_rectangle_int_t *extents) { VALUE rb_pattern; VALUE rb_acquire; cairo_surface_t *acquired_surface = NULL; rb_pattern = POINTER2RVAL (callback_data); rb_acquire = rb_iv_get (rb_pattern, "@acquire"); if (!NIL_P (rb_acquire)) { VALUE rb_acquired_surface; VALUE rb_target; VALUE rb_extents; rb_target = CRSURFACE2RVAL (target); rb_extents = rb_funcall (rb_cCairo_Rectangle, id_new, 4, INT2NUM (extents->x), INT2NUM (extents->y), INT2NUM (extents->width), INT2NUM (extents->height)); rb_acquired_surface = rb_funcall (rb_acquire, id_call, 3, rb_pattern, rb_target, rb_extents); if (!NIL_P (rb_acquired_surface)) acquired_surface = RVAL2CRSURFACE (rb_acquired_surface); } return acquired_surface; } static void cr_raster_source_release_callback (cairo_pattern_t *pattern, void *callback_data, cairo_surface_t *surface) { VALUE rb_pattern; VALUE rb_release; VALUE rb_surface; rb_pattern = POINTER2RVAL (callback_data); rb_release = rb_iv_get (rb_pattern, "@release"); if (NIL_P (rb_release)) return; rb_surface = CRSURFACE2RVAL (surface); rb_funcall (rb_release, id_call, 2, rb_pattern, rb_surface); } typedef struct cr_raster_source_notify_callback_data { VALUE pattern; VALUE callback; cairo_status_t status; } cr_raster_source_notify_callback_data_t; static VALUE cr_raster_source_notify_callback_body (VALUE data) { cr_raster_source_notify_callback_data_t* callback_data; callback_data = RVAL2POINTER (data); rb_funcall (callback_data->callback, id_call, 1, callback_data->pattern); return Qnil; } static VALUE cr_raster_source_notify_callback_rescue (VALUE data, VALUE exception) { cr_raster_source_notify_callback_data_t *callback_data; callback_data = RVAL2POINTER (data); callback_data->status = rb_cairo__exception_to_status (exception); if (callback_data->status == (cairo_status_t)-1) rb_exc_raise (exception); return Qnil; } static cairo_status_t cr_raster_source_snapshot_callback (cairo_pattern_t *pattern, void *callback_data) { VALUE rb_pattern; VALUE rb_snapshot; cr_raster_source_notify_callback_data_t data; rb_pattern = POINTER2RVAL (callback_data); rb_snapshot = rb_iv_get (rb_pattern, "@snapshot"); if (NIL_P (rb_snapshot)) return CAIRO_STATUS_SUCCESS; data.pattern = rb_pattern; data.callback = rb_snapshot; data.status = CAIRO_STATUS_SUCCESS; rb_rescue2 (cr_raster_source_notify_callback_body, POINTER2RVAL (&data), cr_raster_source_notify_callback_rescue, POINTER2RVAL (&data), rb_eException); return data.status; } static cairo_status_t cr_raster_source_copy_callback (cairo_pattern_t *pattern, void *callback_data, const cairo_pattern_t *other) { VALUE rb_pattern; VALUE rb_copy; cr_raster_source_notify_callback_data_t data; rb_pattern = POINTER2RVAL (callback_data); rb_copy = rb_iv_get (rb_pattern, "@copy"); if (NIL_P (rb_copy)) return CAIRO_STATUS_SUCCESS; data.pattern = rb_pattern; data.callback = rb_copy; data.status = CAIRO_STATUS_SUCCESS; rb_rescue2 (cr_raster_source_notify_callback_body, POINTER2RVAL (&data), cr_raster_source_notify_callback_rescue, POINTER2RVAL (&data), rb_eException); return data.status; } static void cr_raster_source_finish_callback (cairo_pattern_t *pattern, void *callback_data) { VALUE rb_pattern; VALUE rb_finish; rb_pattern = POINTER2RVAL (callback_data); rb_finish = rb_iv_get (rb_pattern, "@finish"); if (NIL_P (rb_finish)) return; rb_funcall (rb_finish, id_call, 1, rb_pattern); } static VALUE cr_raster_source_pattern_initialize (int argc, VALUE *argv, VALUE self) { cairo_pattern_t *pattern; cairo_content_t content; int width, height; VALUE arg1, arg2, arg3; rb_scan_args (argc, argv, "21", &arg1, &arg2, &arg3); if (argc == 2) { content = CAIRO_CONTENT_COLOR_ALPHA; width = NUM2INT (arg1); height = NUM2INT (arg2); } else { content = RVAL2CRCONTENT (arg1); width = NUM2INT (arg2); height = NUM2INT (arg3); } pattern = cairo_pattern_create_raster_source (RVAL2POINTER (self), content, width, height); cr_pattern_check_status (pattern); DATA_PTR (self) = pattern; rb_iv_set (self, "@acquire", Qnil); rb_iv_set (self, "@release", Qnil); rb_iv_set (self, "@snapshot", Qnil); rb_iv_set (self, "@copy", Qnil); rb_iv_set (self, "@finish", Qnil); cairo_raster_source_pattern_set_acquire (pattern, cr_raster_source_acquire_callback, cr_raster_source_release_callback); cairo_raster_source_pattern_set_snapshot (pattern, cr_raster_source_snapshot_callback); cairo_raster_source_pattern_set_copy (pattern, cr_raster_source_copy_callback); cairo_raster_source_pattern_set_finish (pattern, cr_raster_source_finish_callback); return Qnil; } static VALUE cr_raster_source_pattern_acquire (VALUE self) { if (!rb_block_given_p ()) { VALUE inspected; inspected = rb_funcall (self, id_inspect, 0); rb_raise (rb_eArgError, "acquire block is missing: %s", RVAL2CSTR (inspected)); } rb_iv_set (self, "@acquire", rb_block_proc ()); return self; } static VALUE cr_raster_source_pattern_release (VALUE self) { if (!rb_block_given_p ()) { VALUE inspected; inspected = rb_funcall (self, id_inspect, 0); rb_raise (rb_eArgError, "release block is missing: %s", RVAL2CSTR (inspected)); } rb_iv_set (self, "@release", rb_block_proc ()); return self; } static VALUE cr_raster_source_pattern_snapshot (VALUE self) { if (!rb_block_given_p ()) { VALUE inspected; inspected = rb_funcall (self, id_inspect, 0); rb_raise (rb_eArgError, "snapshot block is missing: %s", RVAL2CSTR (inspected)); } rb_iv_set (self, "@snapshot", rb_block_proc ()); return self; } static VALUE cr_raster_source_pattern_copy (VALUE self) { if (!rb_block_given_p ()) { VALUE inspected; inspected = rb_funcall (self, id_inspect, 0); rb_raise (rb_eArgError, "copy block is missing: %s", RVAL2CSTR (inspected)); } rb_iv_set (self, "@copy", rb_block_proc ()); return self; } static VALUE cr_raster_source_pattern_finish (VALUE self) { if (!rb_block_given_p ()) { VALUE inspected; inspected = rb_funcall (self, id_inspect, 0); rb_raise (rb_eArgError, "finish block is missing: %s", RVAL2CSTR (inspected)); } rb_iv_set (self, "@finish", rb_block_proc ()); return self; } #endif void Init_cairo_pattern (void) { id_parse = rb_intern ("parse"); id_to_rgb = rb_intern ("to_rgb"); id_to_a = rb_intern ("to_a"); id_inspect = rb_intern ("inspect"); id_new = rb_intern ("new"); id_call = rb_intern ("call"); rb_cCairo_Pattern = rb_define_class_under (rb_mCairo, "Pattern", rb_cObject); rb_define_alloc_func (rb_cCairo_Pattern, cr_pattern_allocate); rb_define_singleton_method (rb_cCairo_Pattern, "solid_supported?", cr_pattern_solid_supported_p, 0); rb_define_singleton_method (rb_cCairo_Pattern, "surface_supported?", cr_pattern_surface_supported_p, 0); rb_define_singleton_method (rb_cCairo_Pattern, "gradient_supported?", cr_pattern_gradient_supported_p, 0); rb_define_singleton_method (rb_cCairo_Pattern, "linear_supported?", cr_pattern_linear_supported_p, 0); rb_define_singleton_method (rb_cCairo_Pattern, "radial_supported?", cr_pattern_radial_supported_p, 0); rb_define_singleton_method (rb_cCairo_Pattern, "mesh_supported?", cr_pattern_mesh_supported_p, 0); rb_define_singleton_method (rb_cCairo_Pattern, "raster_source_supported?", cr_pattern_raster_source_supported_p, 0); rb_define_method (rb_cCairo_Pattern, "initialize", cr_pattern_initialize, -1); rb_define_method (rb_cCairo_Pattern, "set_matrix", cr_pattern_set_matrix, 1); rb_define_method (rb_cCairo_Pattern, "matrix", cr_pattern_get_matrix, 0); rb_define_method (rb_cCairo_Pattern, "set_extend", cr_pattern_set_extend, 1); rb_define_alias (rb_cCairo_Pattern, "__extend__", "extend"); rb_define_method (rb_cCairo_Pattern, "extend", cr_pattern_get_extend, 0); rb_define_method (rb_cCairo_Pattern, "set_filter", cr_pattern_set_filter, 1); rb_define_method (rb_cCairo_Pattern, "filter", cr_pattern_get_filter, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_Pattern); rb_cCairo_SolidPattern = rb_define_class_under (rb_mCairo, "SolidPattern", rb_cCairo_Pattern); rb_define_method (rb_cCairo_SolidPattern, "initialize", cr_solid_pattern_initialize, -1); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_SolidPattern, "rgba", cr_solid_pattern_get_rgba, 0); rb_define_method (rb_cCairo_SolidPattern, "color", cr_solid_pattern_get_color, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_SolidPattern); rb_cCairo_SurfacePattern = rb_define_class_under (rb_mCairo, "SurfacePattern", rb_cCairo_Pattern); rb_define_method (rb_cCairo_SurfacePattern, "initialize", cr_surface_pattern_initialize, 1); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_SurfacePattern, "surface", cr_surface_pattern_get_surface, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_SurfacePattern); rb_cCairo_GradientPattern = rb_define_class_under (rb_mCairo, "GradientPattern", rb_cCairo_Pattern); rb_define_method (rb_cCairo_GradientPattern, "add_color_stop", cr_gradient_pattern_add_color_stop_generic, -1); rb_define_alias (rb_cCairo_GradientPattern, "add_color_stop_rgb", "add_color_stop"); rb_define_alias (rb_cCairo_GradientPattern, "add_color_stop_rgba", "add_color_stop"); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_GradientPattern, "get_color_stop_rgba", cr_gradient_pattern_get_color_stop_rgba, 1); rb_define_method (rb_cCairo_GradientPattern, "get_color_stop_color", cr_gradient_pattern_get_color_stop_color, 1); rb_define_method (rb_cCairo_GradientPattern, "color_stop_count", cr_gradient_pattern_get_color_stop_count, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_GradientPattern); rb_cCairo_LinearPattern = rb_define_class_under (rb_mCairo, "LinearPattern", rb_cCairo_GradientPattern); rb_define_method (rb_cCairo_LinearPattern, "initialize", cr_linear_pattern_initialize, 4); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_LinearPattern, "points", cr_linear_pattern_get_linear_points, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_LinearPattern); rb_cCairo_RadialPattern = rb_define_class_under (rb_mCairo, "RadialPattern", rb_cCairo_GradientPattern); rb_define_method (rb_cCairo_RadialPattern, "initialize", cr_radial_pattern_initialize, 6); #if CAIRO_CHECK_VERSION(1, 3, 0) rb_define_method (rb_cCairo_RadialPattern, "circles", cr_radial_pattern_get_radial_circles, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_RadialPattern); rb_cCairo_MeshPattern = rb_define_class_under (rb_mCairo, "MeshPattern", rb_cCairo_Pattern); #ifdef RB_CAIRO_HAS_MESH_PATTERN rb_define_method (rb_cCairo_MeshPattern, "initialize", cr_mesh_pattern_initialize, 0); rb_define_method (rb_cCairo_MeshPattern, "begin_patch", cr_mesh_pattern_begin_patch, 0); rb_define_method (rb_cCairo_MeshPattern, "end_patch", cr_mesh_pattern_end_patch, 0); rb_define_method (rb_cCairo_MeshPattern, "curve_to", cr_mesh_pattern_curve_to, 6); rb_define_method (rb_cCairo_MeshPattern, "line_to", cr_mesh_pattern_line_to, 2); rb_define_method (rb_cCairo_MeshPattern, "move_to", cr_mesh_pattern_move_to, 2); rb_define_method (rb_cCairo_MeshPattern, "set_control_point", cr_mesh_pattern_set_control_point, 3); rb_define_method (rb_cCairo_MeshPattern, "set_corner_color", cr_mesh_pattern_set_corner_color_generic, -1); rb_define_alias (rb_cCairo_MeshPattern, "set_corner_color_rgb", "set_corner_color"); rb_define_alias (rb_cCairo_MeshPattern, "set_corner_color_rgba", "set_corner_color"); rb_define_method (rb_cCairo_MeshPattern, "patch_count", cr_mesh_pattern_get_patch_count, 0); rb_define_method (rb_cCairo_MeshPattern, "get_path", cr_mesh_pattern_get_path, 1); rb_define_method (rb_cCairo_MeshPattern, "get_corner_color", cr_mesh_pattern_get_corner_color, 2); rb_define_method (rb_cCairo_MeshPattern, "get_control_point", cr_mesh_pattern_get_control_point, 2); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_MeshPattern); rb_cCairo_RasterSourcePattern = rb_define_class_under (rb_mCairo, "RasterSourcePattern", rb_cCairo_Pattern); #ifdef RB_CAIRO_HAS_RASTER_SOURCE_PATTERN rb_define_method (rb_cCairo_RasterSourcePattern, "initialize", cr_raster_source_pattern_initialize, -1); rb_define_method (rb_cCairo_RasterSourcePattern, "acquire", cr_raster_source_pattern_acquire, 0); rb_define_method (rb_cCairo_RasterSourcePattern, "release", cr_raster_source_pattern_release, 0); rb_define_method (rb_cCairo_RasterSourcePattern, "snapshot", cr_raster_source_pattern_snapshot, 0); rb_define_method (rb_cCairo_RasterSourcePattern, "copy", cr_raster_source_pattern_copy, 0); rb_define_method (rb_cCairo_RasterSourcePattern, "finish", cr_raster_source_pattern_finish, 0); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_RasterSourcePattern); } rcairo-1.16.6/ext/cairo/rb_cairo_private.c000066400000000000000000000130061370612400100204310ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-17 07:21:42 $ * * Copyright 2005-2019 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cairo__cFFIPointer; static ID cr_id_normalize_const_name; static ID cr_id_objects; static ID cr_id_dup; static ID cr_id_inspect; static ID cr_id_exit_application; VALUE rb_cairo__float_array (double *values, unsigned count) { VALUE result; unsigned i; result = rb_ary_new2 (count); for (i = 0; i < count; i++) { rb_ary_push (result, rb_float_new (values[i])); } return result; } void rb_cairo__glyphs_to_array (VALUE rb_array, cairo_glyph_t *glyphs, int length) { int i; for (i = 0; i < length; i++) { memcpy ((char *) &glyphs[i], (char *) RVAL2CRGLYPH (rb_ary_entry (rb_array, i)), sizeof (cairo_glyph_t)); } } VALUE rb_cairo__const_get (VALUE name, const char *prefix) { VALUE rb_normalized_name; char *const_name, *normalized_name; size_t prefix_len, normalized_name_len; rb_normalized_name = rb_funcall (rb_mCairo, cr_id_normalize_const_name, 1, name); normalized_name = RVAL2CSTR (rb_normalized_name); prefix_len = strlen (prefix); normalized_name_len = strlen (normalized_name); const_name = ALLOCA_N (char, prefix_len + normalized_name_len + 1); strcpy (const_name, prefix); strcpy (const_name + prefix_len, normalized_name); return rb_const_get (rb_mCairo, rb_intern (const_name)); } cairo_bool_t rb_cairo__is_kind_of (VALUE object, VALUE klass) { return RVAL2CBOOL (rb_obj_is_kind_of (object, klass)); } rb_cairo__object_holder_t * rb_cairo__object_holder_new (VALUE klass, VALUE object) { rb_cairo__object_holder_t *holder; holder = ALLOC(rb_cairo__object_holder_t); rb_cairo__gc_guard_add (klass, object); holder->object = object; return holder; } void rb_cairo__object_holder_free (VALUE klass, void *ptr) { rb_cairo__object_holder_t *holder = ptr; if (!NIL_P (holder->object)) rb_cairo__gc_guard_remove (klass, holder->object); xfree (holder); } void rb_cairo__initialize_gc_guard_holder_class (VALUE klass) { rb_ivar_set (klass, cr_id_objects, rb_hash_new ()); } void rb_cairo__gc_guard_add (VALUE klass, VALUE object) { rb_hash_aset (rb_ivar_get (klass, cr_id_objects), object, Qnil); } void rb_cairo__gc_guard_remove (VALUE klass, VALUE object) { rb_hash_delete (rb_ivar_get (klass, cr_id_objects), object); } VALUE rb_cairo__gc_guarded_objects (VALUE klass) { return rb_funcall (rb_ivar_get (klass, cr_id_objects), cr_id_dup, 0); } const char * rb_cairo__inspect (VALUE object) { VALUE inspected; inspected = rb_funcall (object, cr_id_inspect, 0); return RSTRING_PTR (inspected); } #if CAIRO_CHECK_VERSION(1, 7, 2) VALUE rb_cairo__glyphs_to_ruby_object (cairo_glyph_t *glyphs, int num_glyphs) { int i; VALUE rb_glyphs; rb_glyphs = rb_ary_new2 (num_glyphs); for (i = 0; i < num_glyphs; i++) { RARRAY_PTR (rb_glyphs)[i] = CRGLYPH2RVAL (glyphs + i); } return rb_glyphs; } void rb_cairo__glyphs_from_ruby_object (VALUE rb_glyphs, cairo_glyph_t **glyphs, int *num_glyphs) { int i, len; if (NIL_P (rb_glyphs)) { *num_glyphs = -1; return; } len = (int) RARRAY_LEN (rb_glyphs); if (*num_glyphs < len) *glyphs = cairo_glyph_allocate (len); *num_glyphs = len; for (i = 0; i < len; i++) { cairo_glyph_t *glyph; glyph = *glyphs + i; *glyph = *(RVAL2CRGLYPH (RARRAY_PTR (rb_glyphs)[i])); } } VALUE rb_cairo__text_clusters_to_ruby_object (cairo_text_cluster_t *clusters, int num_clusters) { int i; VALUE rb_clusters; rb_clusters = rb_ary_new2 (num_clusters); for (i = 0; i < num_clusters; i++) { RARRAY_PTR (rb_clusters)[i] = CRTEXTCLUSTER2RVAL (clusters + i); } return rb_clusters; } void rb_cairo__text_clusters_from_ruby_object (VALUE rb_clusters, cairo_text_cluster_t **clusters, int *num_clusters) { int i, len; if (NIL_P (rb_clusters)) { *num_clusters = -1; return; } len = (int) RARRAY_LEN (rb_clusters); if (*num_clusters < len) *clusters = cairo_text_cluster_allocate (len); *num_clusters = len; for (i = 0; i < len; i++) { cairo_text_cluster_t *cluster; cluster = *clusters + i; *cluster = *(RVAL2CRTEXTCLUSTER (RARRAY_PTR (rb_clusters)[i])); } } #endif VALUE rb_cairo__invoke_callback (cr_callback_func_t func, VALUE data) { int state = 0; VALUE result, exception; result = rb_protect (func, data, &state); if (state) { exception = RB_ERRINFO; if (exception) rb_funcall (rb_mCairo, cr_id_exit_application, 2, exception, INT2NUM (EXIT_FAILURE)); } return result; } void Init_cairo_private (void) { cr_id_normalize_const_name = rb_intern ("normalize_const_name"); cr_id_objects = rb_intern ("objects"); cr_id_dup = rb_intern ("dup"); cr_id_inspect = rb_intern ("inspect"); cr_id_exit_application = rb_intern ("exit_application"); if (rb_const_defined (rb_cObject, rb_intern ("FFI"))) { rb_cairo__cFFIPointer = rb_const_get (rb_const_get (rb_cObject, rb_intern ("FFI")), rb_intern ("Pointer")); } else { rb_cairo__cFFIPointer = Qnil; } } rcairo-1.16.6/ext/cairo/rb_cairo_private.h000066400000000000000000000105211370612400100204350ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-17 07:21:42 $ * * Copyright 2005-2019 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #ifndef RB_CAIRO_PRIVATE_H #define RB_CAIRO_PRIVATE_H #define CR_TRUE 1 #define CR_FALSE 0 #define CAIRO_INT_STATUS_UNSUPPORTED 100 #define CSTR2RVAL(str) rb_str_new2(str) #define RVAL2CSTR(str) StringValueCStr(str) #define CBOOL2RVAL(bool) (bool ? Qtrue : Qfalse) #define RVAL2CBOOL(bool) RTEST(bool) #ifndef RSTRING_LEN # define RSTRING_LEN(string) (RSTRING(string)->len) #endif #ifndef RARRAY_PTR # define RARRAY_PTR(array) (RARRAY(array)->ptr) #endif #ifndef RARRAY_LEN # define RARRAY_LEN(array) (RARRAY(array)->len) #endif #ifdef HAVE_RB_ERRINFO # define RB_ERRINFO (rb_errinfo()) #else # define RB_ERRINFO (ruby_errinfo) #endif /* from dl/dl.h (ruby 1.9) */ #if SIZEOF_LONG == SIZEOF_VOIDP # define PTR2NUM(x) (ULONG2NUM((unsigned long)(x))) # define NUM2PTR(x) ((void *)(NUM2ULONG(x))) #else # define PTR2NUM(x) (ULL2NUM((unsigned long long)(x))) # define NUM2PTR(x) ((void *)(NUM2ULL(x))) #endif extern void Init_cairo_private (void); extern void Init_cairo_io (void); extern void Init_cairo_constants (void); extern void Init_cairo_context (void); extern void Init_cairo_rectangle (void); extern void Init_cairo_path (void); extern void Init_cairo_matrix (void); extern void Init_cairo_region (void); extern void Init_cairo_device (void); extern void Init_cairo_surface (void); extern void Init_cairo_quartz_surface (void); extern void Init_cairo_exception (void); extern void Init_cairo_font (void); extern void Init_cairo_font_extents (void); extern void Init_cairo_font_options (void); extern void Init_cairo_scaled_font (void); extern void Init_cairo_text_extents (void); extern void Init_cairo_pattern (void); extern void Init_cairo_glyph (void); extern void Init_cairo_text_cluster (void); #define RB_CAIRO__GLYPHS_TO_ARRAY(rb_array, glyphs, length) \ do \ { \ Check_Type (rb_array, T_ARRAY); \ length = (int) RARRAY_LEN (rb_array); \ glyphs = ALLOCA_N (cairo_glyph_t, length); \ \ if (!glyphs) \ rb_cairo_check_status (CAIRO_STATUS_NO_MEMORY); \ \ rb_cairo__glyphs_to_array (rb_array, glyphs, length); \ } while (0) VALUE rb_cairo__float_array (double *values, unsigned count); void rb_cairo__glyphs_to_array (VALUE rb_array, cairo_glyph_t *glyphs, int length); VALUE rb_cairo__const_get (VALUE name, const char *prefix); cairo_bool_t rb_cairo__is_kind_of (VALUE object, VALUE klass); typedef struct rb_cairo__object_holder { VALUE object; } rb_cairo__object_holder_t; rb_cairo__object_holder_t *rb_cairo__object_holder_new (VALUE klass, VALUE object); void rb_cairo__object_holder_free (VALUE klass, void *ptr); void rb_cairo__initialize_gc_guard_holder_class (VALUE klass); void rb_cairo__gc_guard_add (VALUE klass, VALUE object); void rb_cairo__gc_guard_remove (VALUE klass, VALUE object); VALUE rb_cairo__gc_guarded_objects (VALUE klass); const char *rb_cairo__inspect (VALUE object); #if CAIRO_CHECK_VERSION(1, 7, 2) VALUE rb_cairo__glyphs_to_ruby_object (cairo_glyph_t *glyphs, int num_glyphs); void rb_cairo__glyphs_from_ruby_object (VALUE rb_glyphs, cairo_glyph_t **glyphs, int *num_glyphs); VALUE rb_cairo__text_clusters_to_ruby_object (cairo_text_cluster_t *clusters, int num_clusters); void rb_cairo__text_clusters_from_ruby_object (VALUE rb_clusters, cairo_text_cluster_t **clusters, int *num_clusters); #endif cairo_status_t rb_cairo__exception_to_status (VALUE exception); typedef VALUE (*cr_callback_func_t) (VALUE user_data); VALUE rb_cairo__invoke_callback (cr_callback_func_t func, VALUE user_data); extern VALUE rb_cairo__cFFIPointer; VALUE rb_cairo__surface_yield_and_finish (VALUE self); #endif rcairo-1.16.6/ext/cairo/rb_cairo_quartz_surface.c000066400000000000000000000126471370612400100220270ustar00rootroot00000000000000/* -*- mode: objc; c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2008-2015 Kouhei Sutou * Copyright 2014 Patrick Hanevold * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #if CAIRO_CHECK_VERSION(1, 5, 12) # define RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TYPE #endif #ifdef CAIRO_HAS_QUARTZ_SURFACE # ifndef HAVE_TYPE_ENUM_RUBY_VALUE_TYPE enum ruby_value_type { RUBY_T_DATA = T_DATA }; # endif # undef T_DATA # include # define T_DATA RUBY_T_DATA # define RB_CAIRO_HAS_QUARTZ_SURFACE # ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE # include # define RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE # endif #endif #define _SELF (RVAL2CRSURFACE(self)) #ifdef RB_CAIRO_HAS_QUARTZ_SURFACE /* Quartz-surface functions */ #include # ifdef HAVE_RUBY_COCOA BOOL rbobj_to_nsobj (VALUE obj, id* nsobj); VALUE ocid_to_rbobj (VALUE context_obj, id ocid); # endif static VALUE cr_quartz_surface_initialize (int argc, VALUE *argv, VALUE self) { id objc_object = nil; CGContextRef context; unsigned int width, height; cairo_surface_t *surface = NULL; cairo_format_t format = CAIRO_FORMAT_ARGB32; VALUE arg1, arg2, arg3, rb_width, rb_height; # ifdef HAVE_RUBY_COCOA static VALUE rb_cOSXCGContextRef = Qnil; # endif rb_scan_args (argc, argv, "21", &arg1, &arg2, &arg3); if (argc == 2) { rb_width = arg1; rb_height = arg2; } else { switch (TYPE (arg1)) { case T_NIL: break; case T_STRING: case T_SYMBOL: case T_FIXNUM: format = RVAL2CRFORMAT (arg1); break; default: # ifdef HAVE_RUBY_COCOA if (NIL_P (rb_cOSXCGContextRef)) rb_cOSXCGContextRef = rb_const_get (rb_const_get (rb_cObject, rb_intern ("OSX")), rb_intern ("CGContextRef")); # endif # ifdef HAVE_RUBY_COCOA if (RTEST (rb_obj_is_kind_of (arg1, rb_cOSXCGContextRef))) { rbobj_to_nsobj (arg1, &objc_object); } else # endif { if (!NIL_P (rb_cairo__cFFIPointer) && RTEST (rb_obj_is_kind_of (arg1, rb_cairo__cFFIPointer))) { VALUE rb_objc_pointer; rb_objc_pointer = rb_funcall (arg1, rb_intern ("address"), 0); objc_object = (id) NUM2ULONG (rb_objc_pointer); } else { rb_raise (rb_eArgError, "invalid argument (expect " "(width, height), " "(format, width, height), " "(cg_context, width, height) or " "(ffi_pointer, width, height)): %s", rb_cairo__inspect (rb_ary_new3 (3, arg1, arg2, arg3))); } } break; } rb_width = arg2; rb_height = arg3; } width = NUM2UINT (rb_width); height = NUM2UINT (rb_height); if (objc_object == nil) { surface = cairo_quartz_surface_create (format, width, height); } else { context = (CGContextRef)objc_object; surface = cairo_quartz_surface_create_for_cg_context (context, width, height); } rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_quartz_surface_get_cg_context (VALUE self) { # ifdef HAVE_RUBY_COCOA CGContextRef context; id objc_object; context = cairo_quartz_surface_get_cg_context (_SELF); objc_object = (id)context; return ocid_to_rbobj (Qnil, objc_object); # else rb_raise (rb_eNotImpError, "%s#cg_context requires RubyCocoa", rb_obj_classname(self)); return Qnil; # endif } #endif #ifdef RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE /* Quartz image surface functions */ static VALUE cr_quartz_image_surface_initialize (VALUE self, VALUE image_surface) { cairo_surface_t *surface; surface = cairo_quartz_image_surface_create (RVAL2CRSURFACE (image_surface)); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_quartz_image_surface_get_image (VALUE self) { cairo_surface_t *surface; surface = cairo_quartz_image_surface_get_image (_SELF); if (!surface) return Qnil; rb_cairo_surface_check_status (surface); return CRSURFACE2RVAL (surface); } #endif void Init_cairo_quartz_surface (void) { /* Quartz surface */ #ifdef RB_CAIRO_HAS_QUARTZ_SURFACE rb_define_method (rb_cCairo_QuartzSurface, "initialize", cr_quartz_surface_initialize, -1); rb_define_method (rb_cCairo_QuartzSurface, "cg_context", cr_quartz_surface_get_cg_context, 0); #endif /* Quartz image surface */ #ifdef RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE rb_define_method (rb_cCairo_QuartzImageSurface, "initialize", cr_quartz_image_surface_initialize, 1); rb_define_method (rb_cCairo_QuartzImageSurface, "image", cr_quartz_image_surface_get_image, 0); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_rectangle.c000066400000000000000000000051541370612400100207300ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2005-2014 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" VALUE rb_cCairo_Rectangle; #define _SELF ((cairo_rectangle_int_t *)DATA_PTR (self)) #if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE cr_rectangle_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, xfree, NULL); } static VALUE cr_rectangle_initialize (VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { cairo_rectangle_int_t *rectangle; rectangle = ALLOC (cairo_rectangle_int_t); DATA_PTR (self) = rectangle; rectangle->x = NUM2INT (x); rectangle->y = NUM2INT (y); rectangle->width = NUM2INT (width); rectangle->height = NUM2INT (height); return Qnil; } # define DEFINE_RECTANGLE_ACCESSOR(name) \ static VALUE \ cr_rectangle_get_ ## name (VALUE self) \ { \ return INT2NUM (_SELF->name); \ } \ \ static VALUE \ cr_rectangle_set_ ## name (VALUE self, VALUE value) \ { \ _SELF->name = NUM2INT (value); \ return self; \ } DEFINE_RECTANGLE_ACCESSOR(x) DEFINE_RECTANGLE_ACCESSOR(y) DEFINE_RECTANGLE_ACCESSOR(width) DEFINE_RECTANGLE_ACCESSOR(height) # undef DEFINE_RECTANGLE_ACCESSOR #endif void Init_cairo_rectangle (void) { #if CAIRO_CHECK_VERSION(1, 10, 0) rb_cCairo_Rectangle = rb_define_class_under (rb_mCairo, "Rectangle", rb_cObject); rb_define_alloc_func (rb_cCairo_Rectangle, cr_rectangle_allocate); rb_define_method (rb_cCairo_Rectangle, "initialize", cr_rectangle_initialize, 4); rb_define_method (rb_cCairo_Rectangle, "x", cr_rectangle_get_x, 0); rb_define_method (rb_cCairo_Rectangle, "x=", cr_rectangle_set_x, 1); rb_define_method (rb_cCairo_Rectangle, "y", cr_rectangle_get_y, 0); rb_define_method (rb_cCairo_Rectangle, "y=", cr_rectangle_set_y, 1); rb_define_method (rb_cCairo_Rectangle, "width", cr_rectangle_get_width, 0); rb_define_method (rb_cCairo_Rectangle, "width=", cr_rectangle_set_width, 1); rb_define_method (rb_cCairo_Rectangle, "height", cr_rectangle_get_height, 0); rb_define_method (rb_cCairo_Rectangle, "height=", cr_rectangle_set_height, 1); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_region.c000066400000000000000000000305441370612400100202500ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2010 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_Region = Qnil; #if CAIRO_CHECK_VERSION(1, 10, 0) #define _SELF (RVAL2CRREGION(self)) static inline void cr_region_check_status (cairo_region_t *region) { rb_cairo_check_status (cairo_region_status (region)); } cairo_region_t * rb_cairo_region_from_ruby_object (VALUE obj) { cairo_region_t *region; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Region)) { rb_raise (rb_eTypeError, "not a cairo region"); } Data_Get_Struct (obj, cairo_region_t, region); return region; } static void cr_region_free (void *ptr) { if (ptr) { cairo_region_destroy ((cairo_region_t *) ptr); } } VALUE rb_cairo_region_to_ruby_object (cairo_region_t *region) { if (region) { cairo_region_reference (region); return Data_Wrap_Struct (rb_cCairo_Region, NULL, cr_region_free, region); } else { return Qnil; } } static VALUE cr_region_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_region_free, NULL); } static VALUE cr_region_initialize (int argc, VALUE *argv, VALUE self) { cairo_region_t *region; if (argc == 0) { region = cairo_region_create (); } else { int i; cairo_rectangle_int_t *rectangles; rectangles = ALLOCA_N (cairo_rectangle_int_t, argc); for (i = 0; i < argc; i++) { VALUE rb_rectangle; rb_rectangle = rb_check_array_type (argv[i]); if (RARRAY_LEN (rb_rectangle) != 4) rb_raise (rb_eArgError, "invalid argument (expect " "() or ([x, y, width, height], ...): %s", rb_cairo__inspect (rb_ary_new4 (argc, argv))); rectangles[i].x = NUM2INT (RARRAY_PTR (rb_rectangle)[0]); rectangles[i].y = NUM2INT (RARRAY_PTR (rb_rectangle)[1]); rectangles[i].width = NUM2INT (RARRAY_PTR (rb_rectangle)[2]); rectangles[i].height = NUM2INT (RARRAY_PTR (rb_rectangle)[3]); } region = cairo_region_create_rectangles (rectangles, argc); } cr_region_check_status (region); DATA_PTR (self) = region; return Qnil; } static VALUE cr_region_dup (VALUE self) { cairo_region_t *copied_region; VALUE rb_copied_region; copied_region = cairo_region_copy (_SELF); cr_region_check_status (copied_region); rb_copied_region = CRREGION2RVAL (copied_region); cairo_region_destroy (copied_region); return rb_copied_region; } static VALUE cr_region_equal (VALUE self, VALUE other) { cairo_region_t *region, *other_region; if (!rb_cairo__is_kind_of (other, rb_cCairo_Region)) return Qfalse; region = _SELF; other_region = RVAL2CRREGION (other); return CBOOL2RVAL (cairo_region_equal (region, other_region)); } static VALUE cr_region_get_extents (VALUE self) { cairo_region_t *region; cairo_rectangle_int_t extents; region = _SELF; cairo_region_get_extents (region, &extents); cr_region_check_status (region); return rb_ary_new3 (4, INT2NUM (extents.x), INT2NUM (extents.y), INT2NUM (extents.width), INT2NUM (extents.height)); } static VALUE cr_region_num_rectangles (VALUE self) { cairo_region_t *region; int num_rectangles; region = _SELF; num_rectangles = cairo_region_num_rectangles (region); cr_region_check_status (region); return INT2NUM (num_rectangles); } static VALUE cr_region_get_rectangle (VALUE self, VALUE index) { cairo_region_t *region; cairo_rectangle_int_t extents; region = _SELF; cairo_region_get_rectangle (region, NUM2INT (index), &extents); cr_region_check_status (region); return rb_ary_new3 (4, INT2NUM (extents.x), INT2NUM (extents.y), INT2NUM (extents.width), INT2NUM (extents.height)); } static VALUE cr_region_is_empty (VALUE self) { return CBOOL2RVAL (cairo_region_is_empty (_SELF)); } static VALUE cr_region_containts_rectangle (int argc, VALUE *argv, VALUE self) { cairo_region_t *region; cairo_rectangle_int_t rectangle; cairo_region_overlap_t overlap; VALUE arg1, arg2, arg3, arg4; const char *error_message = "invalid argument (expect " "(x, y, width, height) or ([x, y, width, height])): %s"; rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4); region = _SELF; if (argc == 1) { VALUE rb_rectangle; rb_rectangle = rb_check_array_type (arg1); if (RARRAY_LEN (rb_rectangle) != 4) rb_raise (rb_eArgError, error_message, rb_cairo__inspect (rb_ary_new4 (argc, argv))); rectangle.x = NUM2INT (RARRAY_PTR (rb_rectangle)[0]); rectangle.y = NUM2INT (RARRAY_PTR (rb_rectangle)[1]); rectangle.width = NUM2INT (RARRAY_PTR (rb_rectangle)[2]); rectangle.height = NUM2INT (RARRAY_PTR (rb_rectangle)[3]); } else if (argc == 4) { rectangle.x = NUM2INT (arg1); rectangle.y = NUM2INT (arg2); rectangle.width = NUM2INT (arg3); rectangle.height = NUM2INT (arg4); } else { rb_raise (rb_eArgError, error_message, rb_cairo__inspect (rb_ary_new4 (argc, argv))); } overlap = cairo_region_contains_rectangle (region, &rectangle); cr_region_check_status (region); return INT2NUM (overlap); } static VALUE cr_region_containts_point (int argc, VALUE *argv, VALUE self) { cairo_region_t *region; int x, y; VALUE arg1, arg2; const char *error_message = "invalid argument (expect " "(x, y) or ([x, y])): %s"; rb_scan_args (argc, argv, "11", &arg1, &arg2); region = _SELF; if (argc == 1) { VALUE point; point = rb_check_array_type (arg1); if (RARRAY_LEN (point) != 4) rb_raise (rb_eArgError, error_message, rb_cairo__inspect (rb_ary_new4 (argc, argv))); x = NUM2INT (RARRAY_PTR (point)[0]); y = NUM2INT (RARRAY_PTR (point)[1]); } else { x = NUM2INT (arg1); y = NUM2INT (arg2); } return CBOOL2RVAL (cairo_region_contains_point (region, x, y)); } static VALUE cr_region_translate (int argc, VALUE *argv, VALUE self) { cairo_region_t *region; int x, y; VALUE arg1, arg2; const char *error_message = "invalid argument (expect " "(x, y) or ([x, y])): %s"; rb_scan_args (argc, argv, "11", &arg1, &arg2); region = _SELF; if (argc == 1) { VALUE point; point = rb_check_array_type (arg1); if (RARRAY_LEN (point) != 4) rb_raise (rb_eArgError, error_message, rb_cairo__inspect (rb_ary_new4 (argc, argv))); x = NUM2INT (RARRAY_PTR (point)[0]); y = NUM2INT (RARRAY_PTR (point)[1]); } else { x = NUM2INT (arg1); y = NUM2INT (arg2); } cairo_region_translate (region, x, y); cr_region_check_status (region); return Qnil; } #define DEFINE_OPERATOR(type) \ static VALUE \ cr_region_ ## type (int argc, VALUE *argv, VALUE self) \ { \ cairo_status_t status; \ cairo_region_t *region, *other = NULL; \ cairo_rectangle_int_t rectangle; \ VALUE arg1, arg2, arg3, arg4; \ const char *error_message = \ "invalid argument (expect " \ "(region), (x, y, width, height) or ([x, y, width, height])): %s"; \ \ rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4); \ \ region = _SELF; \ if (argc == 1) \ { \ if (rb_cairo__is_kind_of (arg1, rb_cCairo_Region)) \ { \ other = RVAL2CRREGION (arg1); \ } \ else \ { \ VALUE rb_rectangle; \ \ rb_rectangle = rb_check_array_type (arg1); \ if (RARRAY_LEN (rb_rectangle) != 4) \ rb_raise (rb_eArgError, error_message, \ rb_cairo__inspect (rb_ary_new4 (argc, argv))); \ rectangle.x = NUM2INT (RARRAY_PTR (rb_rectangle)[0]); \ rectangle.y = NUM2INT (RARRAY_PTR (rb_rectangle)[1]); \ rectangle.width = NUM2INT (RARRAY_PTR (rb_rectangle)[2]); \ rectangle.height = NUM2INT (RARRAY_PTR (rb_rectangle)[3]); \ } \ } \ else if (argc == 4) \ { \ rectangle.x = NUM2INT (arg1); \ rectangle.y = NUM2INT (arg2); \ rectangle.width = NUM2INT (arg3); \ rectangle.height = NUM2INT (arg4); \ } \ else \ { \ rb_raise (rb_eArgError, error_message, \ rb_cairo__inspect (rb_ary_new4 (argc, argv))); \ } \ \ if (other) \ status = cairo_region_ ## type (region, other); \ else \ status = cairo_region_ ## type ## _rectangle (region, &rectangle); \ rb_cairo_check_status (status); \ cr_region_check_status (region); \ return Qnil; \ } DEFINE_OPERATOR(subtract) DEFINE_OPERATOR(intersect) DEFINE_OPERATOR(union) DEFINE_OPERATOR(xor) #endif void Init_cairo_region (void) { #if CAIRO_CHECK_VERSION(1, 10, 0) rb_cCairo_Region = rb_define_class_under (rb_mCairo, "Region", rb_cObject); rb_define_alloc_func (rb_cCairo_Region, cr_region_allocate); rb_define_method (rb_cCairo_Region, "initialize", cr_region_initialize, -1); rb_define_method (rb_cCairo_Region, "dup", cr_region_dup, 0); rb_define_method (rb_cCairo_Region, "==", cr_region_equal, 1); rb_define_method (rb_cCairo_Region, "extents", cr_region_get_extents, 0); rb_define_method (rb_cCairo_Region, "num_rectangles", cr_region_num_rectangles, 0); rb_define_method (rb_cCairo_Region, "[]", cr_region_get_rectangle, 1); rb_define_method (rb_cCairo_Region, "empty?", cr_region_is_empty, 0); rb_define_method (rb_cCairo_Region, "contains_rectangle", cr_region_containts_rectangle, -1); rb_define_method (rb_cCairo_Region, "contains_point?", cr_region_containts_point, -1); rb_define_method (rb_cCairo_Region, "translate!", cr_region_translate, -1); rb_define_method (rb_cCairo_Region, "subtract!", cr_region_subtract, -1); rb_define_method (rb_cCairo_Region, "intersect!", cr_region_intersect, -1); rb_define_method (rb_cCairo_Region, "union!", cr_region_union, -1); rb_define_method (rb_cCairo_Region, "xor!", cr_region_xor, -1); RB_CAIRO_DEF_SETTERS (rb_cCairo_Region); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_scaled_font.c000066400000000000000000000152351370612400100212460ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-09-19 12:56:27 $ * * Copyright 2005-2019 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_ScaledFont; #define _SELF(self) (RVAL2CRSCALEDFONT(self)) static inline void cr_scaled_font_check_status (cairo_scaled_font_t *font) { rb_cairo_check_status (cairo_scaled_font_status (font)); } cairo_scaled_font_t * rb_cairo_scaled_font_from_ruby_object (VALUE obj) { cairo_scaled_font_t *font; if (!rb_cairo__is_kind_of (obj, rb_cCairo_ScaledFont)) { rb_raise (rb_eTypeError, "not a cairo scaled font"); } Data_Get_Struct (obj, cairo_scaled_font_t, font); return font; } static void cr_scaled_font_free (void *ptr) { if (ptr) { cairo_scaled_font_destroy ((cairo_scaled_font_t *) ptr); } } VALUE rb_cairo_scaled_font_to_ruby_object (cairo_scaled_font_t *font) { if (font) { cairo_scaled_font_reference (font); return Data_Wrap_Struct (rb_cCairo_ScaledFont, NULL, cr_scaled_font_free, font); } else { return Qnil; } } static VALUE cr_scaled_font_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_scaled_font_free, NULL); } static VALUE cr_scaled_font_initialize (VALUE self, VALUE face, VALUE matrix, VALUE ctm, VALUE options) { cairo_scaled_font_t *font; font = cairo_scaled_font_create (RVAL2CRFONTFACE (face), RVAL2CRMATRIX (matrix), RVAL2CRMATRIX (ctm), RVAL2CRFONTOPTIONS (options)); cr_scaled_font_check_status (font); DATA_PTR (self) = font; return Qnil; } static VALUE cr_scaled_font_extents (VALUE self) { cairo_font_extents_t extents; cairo_scaled_font_extents (_SELF (self), &extents); cr_scaled_font_check_status (_SELF (self)); return CRFONTEXTENTS2RVAL (&extents); } static VALUE cr_scaled_font_text_extents (VALUE self, VALUE utf8) { cairo_text_extents_t extents; cairo_scaled_font_text_extents (_SELF (self), StringValueCStr (utf8), &extents); cr_scaled_font_check_status (_SELF (self)); return CRTEXTEXTENTS2RVAL (&extents); } static VALUE cr_scaled_font_glyph_extents (VALUE self, VALUE rb_glyphs) { cairo_text_extents_t extents; cairo_glyph_t *glyphs; int count; RB_CAIRO__GLYPHS_TO_ARRAY (rb_glyphs, glyphs, count); cairo_scaled_font_glyph_extents (_SELF (self), glyphs, count, &extents); cr_scaled_font_check_status (_SELF (self)); return CRTEXTEXTENTS2RVAL (&extents); } #if CAIRO_CHECK_VERSION(1, 7, 6) static VALUE cr_scaled_font_text_to_glyphs (VALUE self, VALUE rb_x, VALUE rb_y, VALUE rb_utf8) { double x, y; const char *utf8; int utf8_len; cairo_glyph_t *glyphs = NULL; int num_glyphs; cairo_text_cluster_t *clusters = NULL; int num_clusters; cairo_text_cluster_flags_t cluster_flags; cairo_status_t status; VALUE rb_glyphs, rb_clusters; x = NUM2DBL (rb_x); y = NUM2DBL (rb_y); utf8 = RSTRING_PTR (rb_utf8); utf8_len = (int) RSTRING_LEN (rb_utf8); status = cairo_scaled_font_text_to_glyphs (_SELF (self), x, y, utf8, utf8_len, &glyphs, &num_glyphs, &clusters, &num_clusters, &cluster_flags); rb_cairo_check_status (status); rb_glyphs = rb_cairo__glyphs_to_ruby_object (glyphs, num_glyphs); cairo_glyph_free (glyphs); rb_clusters = rb_cairo__text_clusters_to_ruby_object (clusters, num_clusters); cairo_text_cluster_free (clusters); return rb_ary_new3 (3, rb_glyphs, rb_clusters, INT2NUM (cluster_flags)); } #endif static VALUE cr_scaled_font_get_font_face (VALUE self) { cairo_font_face_t *face; face = cairo_scaled_font_get_font_face (_SELF (self)); cr_scaled_font_check_status (_SELF (self)); return CRFONTFACE2RVAL (face); } static VALUE cr_scaled_font_get_font_matrix (VALUE self) { cairo_matrix_t font_matrix; cairo_scaled_font_get_font_matrix (_SELF (self), &font_matrix); cr_scaled_font_check_status (_SELF (self)); return CRMATRIX2RVAL (&font_matrix); } static VALUE cr_scaled_font_get_ctm (VALUE self) { cairo_matrix_t ctm; cairo_scaled_font_get_font_matrix (_SELF (self), &ctm); cr_scaled_font_check_status (_SELF (self)); return CRMATRIX2RVAL (&ctm); } static VALUE cr_scaled_font_get_font_options (VALUE self) { cairo_font_options_t *options; VALUE rb_options; options = cairo_font_options_create (); rb_cairo_check_status (cairo_font_options_status (options)); /* TODO: Use rb_ensure() */ rb_options = CRFONTOPTIONS2RVAL (options); cairo_font_options_destroy (options); options = RVAL2CRFONTOPTIONS (rb_options); cairo_scaled_font_get_font_options (_SELF (self), options); cr_scaled_font_check_status (_SELF (self)); rb_cairo_check_status (cairo_font_options_status (options)); return rb_options; } #if CAIRO_CHECK_VERSION(1, 7, 2) static VALUE cr_scaled_font_get_scale_matrix (VALUE self) { cairo_matrix_t matrix; cairo_scaled_font_get_scale_matrix (_SELF (self), &matrix); cr_scaled_font_check_status (_SELF (self)); return CRMATRIX2RVAL (&matrix); } #endif void Init_cairo_scaled_font (void) { rb_cCairo_ScaledFont = rb_define_class_under (rb_mCairo, "ScaledFont", rb_cObject); rb_define_alloc_func (rb_cCairo_ScaledFont, cr_scaled_font_allocate); rb_define_method (rb_cCairo_ScaledFont, "initialize", cr_scaled_font_initialize, 4); rb_define_method (rb_cCairo_ScaledFont, "extents", cr_scaled_font_extents, 0); rb_define_method (rb_cCairo_ScaledFont, "text_extents", cr_scaled_font_text_extents, 1); rb_define_method (rb_cCairo_ScaledFont, "glyph_extents", cr_scaled_font_glyph_extents, 1); #if CAIRO_CHECK_VERSION(1, 7, 2) rb_define_method (rb_cCairo_ScaledFont, "text_to_glyphs", cr_scaled_font_text_to_glyphs, 3); #endif rb_define_method (rb_cCairo_ScaledFont, "font_face", cr_scaled_font_get_font_face, 0); rb_define_method (rb_cCairo_ScaledFont, "font_matrix", cr_scaled_font_get_font_matrix, 0); rb_define_method (rb_cCairo_ScaledFont, "ctm", cr_scaled_font_get_ctm, 0); rb_define_method (rb_cCairo_ScaledFont, "font_options", cr_scaled_font_get_font_options, 0); #if CAIRO_CHECK_VERSION(1, 7, 2) rb_define_method (rb_cCairo_ScaledFont, "scale_matrix", cr_scaled_font_get_scale_matrix, 0); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_surface.c000066400000000000000000002110051370612400100204060ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * Copyright 2005-2019 Kouhei Sutou * Copyright 2014 Patrick Hanevold * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" #include "rb_cairo_io.h" #ifdef HAVE_RUBY_ST_H # include #else # include #endif #if CAIRO_CHECK_VERSION(1, 5, 2) # define RB_CAIRO_HAS_WIN32_PRINTING_SURFACE_TYPE #endif #if CAIRO_CHECK_VERSION(1, 5, 12) # define RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TYPE #endif #ifdef CAIRO_HAS_WIN32_SURFACE # define OpenFile OpenFile_win32 # include # undef OpenFile # ifdef RB_CAIRO_HAS_WIN32_PRINTING_SURFACE_TYPE # define RB_CAIRO_HAS_WIN32_PRINTING_SURFACE # endif #endif #ifdef HAVE_RUBY_IO_H # include #else # include #endif #ifdef CAIRO_HAS_QUARTZ_SURFACE # ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE # define RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE # endif #endif #ifdef CAIRO_HAS_XML_SURFACE # include #endif #ifdef CAIRO_HAS_TEE_SURFACE # include #endif #if defined(CAIRO_HAS_GL_SURFACE) || defined(CAIRO_HAS_GLESV2_SURFACE) # define RB_CAIRO_HAS_GL_SURFACE #endif #ifdef RB_CAIRO_HAS_GL_SURFACE # include #endif VALUE rb_cCairo_Surface; VALUE rb_cCairo_ImageSurface; VALUE rb_cCairo_PDFSurface = Qnil; VALUE rb_cCairo_PSSurface = Qnil; VALUE rb_cCairo_XLibSurface = Qnil; VALUE rb_cCairo_XCBSurface = Qnil; VALUE rb_cCairo_SVGSurface = Qnil; VALUE rb_cCairo_Win32Surface = Qnil; VALUE rb_cCairo_Win32PrintingSurface = Qnil; VALUE rb_cCairo_QuartzSurface = Qnil; VALUE rb_cCairo_QuartzImageSurface = Qnil; VALUE rb_cCairo_ScriptSurface = Qnil; VALUE rb_cCairo_QtSurface = Qnil; VALUE rb_cCairo_RecordingSurface = Qnil; VALUE rb_cCairo_VGSurface = Qnil; VALUE rb_cCairo_GLSurface = Qnil; VALUE rb_cCairo_GLTextureSurface = Qnil; VALUE rb_cCairo_DRMSurface = Qnil; VALUE rb_cCairo_TeeSurface = Qnil; VALUE rb_cCairo_XMLSurface = Qnil; VALUE rb_cCairo_SubSurface = Qnil; VALUE rb_cCairo_CoglSurface = Qnil; static ID cr_id_new; static ID cr_id_parse; static ID cr_id_size; static ID cr_id_set_unit; static ID cr_id_x; static ID cr_id_y; static ID cr_id_width; static ID cr_id_height; static cairo_user_data_key_t cr_closure_key; static cairo_user_data_key_t cr_object_holder_key; static cairo_user_data_key_t cr_finished_key; #define _SELF (RVAL2CRSURFACE(self)) static VALUE cr_paper_parse (VALUE paper_description) { return rb_funcall (rb_cCairo_Paper, cr_id_parse, 2, paper_description, Qtrue); } static void cr_paper_to_size_in_points (VALUE paper_description, VALUE *width, VALUE *height) { VALUE paper, size; paper = cr_paper_parse (paper_description); size = rb_funcall (paper, cr_id_size, 1, rb_str_new2 ("pt")); *width = RARRAY_PTR (size)[0]; *height = RARRAY_PTR (size)[1]; } void rb_cairo_surface_check_status (cairo_surface_t *surface) { rb_cairo_check_status (cairo_surface_status (surface)); } static VALUE cr_surface_get_klass (cairo_surface_t *surface) { VALUE klass; cairo_surface_type_t type; type = cairo_surface_get_type (surface); switch (type) { case CAIRO_SURFACE_TYPE_IMAGE: klass = rb_cCairo_ImageSurface; break; case CAIRO_SURFACE_TYPE_PDF: klass = rb_cCairo_PDFSurface; break; case CAIRO_SURFACE_TYPE_PS: klass = rb_cCairo_PSSurface; break; case CAIRO_SURFACE_TYPE_XLIB: klass = rb_cCairo_XLibSurface; break; case CAIRO_SURFACE_TYPE_XCB: klass = rb_cCairo_XCBSurface; break; case CAIRO_SURFACE_TYPE_QUARTZ: klass = rb_cCairo_QuartzSurface; break; case CAIRO_SURFACE_TYPE_WIN32: klass = rb_cCairo_Win32Surface; break; case CAIRO_SURFACE_TYPE_SVG: klass = rb_cCairo_SVGSurface; break; #ifdef RB_CAIRO_HAS_WIN32_PRINTING_SURFACE_TYPE case CAIRO_SURFACE_TYPE_WIN32_PRINTING: klass = rb_cCairo_Win32PrintingSurface; break; #endif #ifdef RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TYPE case CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: klass = rb_cCairo_QuartzImageSurface; break; #endif #if CAIRO_CHECK_VERSION(1, 10, 0) case CAIRO_SURFACE_TYPE_SCRIPT: klass = rb_cCairo_ScriptSurface; break; case CAIRO_SURFACE_TYPE_QT: klass = rb_cCairo_QtSurface; break; case CAIRO_SURFACE_TYPE_RECORDING: klass = rb_cCairo_RecordingSurface; break; case CAIRO_SURFACE_TYPE_VG: klass = rb_cCairo_VGSurface; break; case CAIRO_SURFACE_TYPE_GL: klass = rb_cCairo_GLSurface; break; case CAIRO_SURFACE_TYPE_DRM: klass = rb_cCairo_DRMSurface; break; case CAIRO_SURFACE_TYPE_TEE: klass = rb_cCairo_TeeSurface; break; case CAIRO_SURFACE_TYPE_XML: klass = rb_cCairo_XMLSurface; break; case CAIRO_SURFACE_TYPE_SUBSURFACE: klass = rb_cCairo_SubSurface; break; #endif #if CAIRO_CHECK_VERSION(1, 11, 4) case CAIRO_SURFACE_TYPE_COGL: klass = rb_cCairo_CoglSurface; break; #endif default: klass = rb_cCairo_Surface; break; } if (NIL_P (klass)) rb_raise (rb_eArgError, "unknown source type: %d", type); return klass; } static void rb_cairo_surface_adjust_memory_usage (cairo_surface_t *surface, cairo_bool_t new) { #ifdef HAVE_RB_GC_ADJUST_MEMORY_USAGE if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE) { ssize_t memory_usage_diff; memory_usage_diff = cairo_image_surface_get_stride (surface) * cairo_image_surface_get_height (surface); if (!new) memory_usage_diff = -memory_usage_diff; rb_gc_adjust_memory_usage (memory_usage_diff); } #endif } static void cr_surface_destroy_raw (cairo_surface_t *surface) { rb_cairo_surface_adjust_memory_usage (surface, CR_FALSE); cairo_surface_destroy (surface); } static VALUE cr_surface_destroy (VALUE self) { cairo_surface_t *surface; surface = _SELF; cr_surface_destroy_raw (surface); DATA_PTR (self) = NULL; return self; } static VALUE cr_surface_destroy_with_destroy_check (VALUE self) { if (_SELF) cr_surface_destroy (self); return Qnil; } static VALUE cr_surface_create (int argc, VALUE *argv, VALUE klass) { VALUE rb_surface; rb_surface = rb_funcallv (klass, cr_id_new, argc, argv); if (rb_block_given_p ()) { return rb_ensure (rb_cairo__surface_yield_and_finish, rb_surface, cr_surface_destroy_with_destroy_check, rb_surface); } else { return rb_surface; } } static VALUE cr_surface_image_supported_p (VALUE klass) { return Qtrue; } static VALUE cr_surface_pdf_supported_p (VALUE klass) { #ifdef CAIRO_HAS_PDF_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_ps_supported_p (VALUE klass) { #ifdef CAIRO_HAS_PS_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_quartz_supported_p (VALUE klass) { #ifdef RB_CAIRO_HAS_QUARTZ_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_win32_supported_p (VALUE klass) { #ifdef CAIRO_HAS_WIN32_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_svg_supported_p (VALUE klass) { #ifdef CAIRO_HAS_SVG_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_win32_printing_supported_p (VALUE klass) { #ifdef RB_CAIRO_HAS_WIN32_PRINTING_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_quartz_image_supported_p (VALUE klass) { #ifdef RB_CAIRO_HAS_QUARTZ_IMAGE_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_script_supported_p (VALUE klass) { #ifdef CAIRO_HAS_SCRIPT_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_recording_supported_p (VALUE klass) { #ifdef CAIRO_HAS_RECORDING_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_gl_supported_p (VALUE klass) { #ifdef RB_CAIRO_HAS_GL_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_gl_texture_supported_p (VALUE klass) { return cr_surface_gl_supported_p(klass); } static VALUE cr_surface_tee_supported_p (VALUE klass) { #ifdef CAIRO_HAS_TEE_SURFACE return Qtrue; #else return Qfalse; #endif } static VALUE cr_surface_xml_supported_p (VALUE klass) { #ifdef CAIRO_HAS_XML_SURFACE return Qtrue; #else return Qfalse; #endif } /* constructor/de-constructor */ cairo_surface_t * rb_cairo_surface_from_ruby_object (VALUE obj) { cairo_surface_t *surface; if (!rb_cairo__is_kind_of (obj, rb_cCairo_Surface)) { rb_raise (rb_eTypeError, "not a cairo surface"); } Data_Get_Struct (obj, cairo_surface_t, surface); if (!surface) rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER); return surface; } static rb_cairo__object_holder_t * cr_object_holder_new (VALUE object) { return rb_cairo__object_holder_new (rb_cCairo_Surface, object); } static void cr_object_holder_free (void *ptr) { rb_cairo__object_holder_free (rb_cCairo_Surface, ptr); } static void cr_surface_free (void *ptr) { cairo_surface_t *surface = ptr; if (!surface) return; cr_surface_destroy_raw (surface); } VALUE rb_cairo_surface_to_ruby_object (cairo_surface_t *surface) { if (surface) { VALUE klass; klass = cr_surface_get_klass (surface); cairo_surface_reference (surface); rb_cairo_surface_adjust_memory_usage (surface, CR_TRUE); return Data_Wrap_Struct (klass, NULL, cr_surface_free, surface); } else { return Qnil; } } VALUE rb_cairo_surface_to_ruby_object_with_destroy (cairo_surface_t *surface) { VALUE rb_surface; rb_surface = rb_cairo_surface_to_ruby_object (surface); if (surface) cairo_surface_destroy (surface); return rb_surface; } static VALUE cr_surface_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_surface_free, NULL); } static VALUE cr_surface_initialize (int argc, VALUE *argv, VALUE self) { rb_raise(rb_eNotImpError, "%s class creation isn't supported on this cairo installation", rb_obj_classname(self)); return Qnil; } /* Surface manipulation */ static VALUE cr_surface_get_reference_count (VALUE self) { cairo_surface_t *surface; unsigned int reference_count; surface = _SELF; reference_count = cairo_surface_get_reference_count (surface); return UINT2NUM (reference_count); } static VALUE cr_surface_finish (VALUE self) { cairo_surface_t *surface; rb_cairo__io_callback_closure_t *closure; surface = _SELF; closure = cairo_surface_get_user_data (surface, &cr_closure_key); cairo_surface_finish (surface); cairo_surface_set_user_data (surface, &cr_finished_key, (void *)CR_TRUE, NULL); cairo_surface_set_user_data (surface, &cr_object_holder_key, NULL, NULL); if (closure && !NIL_P (closure->error)) rb_exc_raise (closure->error); rb_cairo_surface_check_status (surface); return self; } VALUE rb_cairo__surface_yield_and_finish (VALUE self) { VALUE rb_result; cairo_surface_t *surface; rb_result = rb_yield (self); surface = _SELF; if (!surface) return rb_result; if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) return rb_result; if (cairo_surface_get_user_data (surface, &cr_finished_key)) return rb_result; cr_surface_finish (self); return rb_result; } static VALUE cr_surface_create_similar (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface, *similar_surface; cairo_content_t content; int width, height; VALUE arg1, arg2, arg3; rb_scan_args (argc, argv, "21", &arg1, &arg2, &arg3); surface = _SELF; if (argc == 2) { content = cairo_surface_get_content (surface); width = NUM2INT (arg1); height = NUM2INT (arg2); } else { content = RVAL2CRCONTENT (arg1); width = NUM2INT (arg2); height = NUM2INT (arg3); } similar_surface = cairo_surface_create_similar (surface, content, width, height); rb_cairo_surface_check_status (similar_surface); return CRSURFACE2RVAL_WITH_DESTROY (similar_surface); } #if CAIRO_CHECK_VERSION(1, 11, 4) static VALUE cr_surface_create_similar_image (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface, *similar_image; cairo_format_t format; int width, height; VALUE arg1, arg2, arg3; rb_scan_args (argc, argv, "21", &arg1, &arg2, &arg3); surface = _SELF; if (argc == 2) { if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE) { format = cairo_image_surface_get_format (surface); } else { format = CAIRO_FORMAT_ARGB32; } width = NUM2INT (arg1); height = NUM2INT (arg2); } else { format = RVAL2CRFORMAT (arg1); width = NUM2INT (arg2); height = NUM2INT (arg3); } similar_image = cairo_surface_create_similar_image (surface, format, width, height); rb_cairo_surface_check_status (similar_image); return CRSURFACE2RVAL_WITH_DESTROY (similar_image); } static VALUE cr_surface_map_to_image (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface, *mapped_image; cairo_rectangle_int_t extents_value; cairo_rectangle_int_t *extents = NULL; VALUE rb_extents; rb_scan_args (argc, argv, "01", &rb_extents); surface = _SELF; if (!NIL_P (rb_extents)) { extents = &extents_value; if (rb_cairo__is_kind_of (rb_extents, rb_cCairo_Rectangle)) { extents->x = NUM2INT (rb_funcall (rb_extents, cr_id_x, 0)); extents->y = NUM2INT (rb_funcall (rb_extents, cr_id_y, 0)); extents->width = NUM2INT (rb_funcall (rb_extents, cr_id_width, 0)); extents->height = NUM2INT (rb_funcall (rb_extents, cr_id_height, 0)); } else { VALUE *values; rb_extents = rb_convert_type (rb_extents, T_ARRAY, "Array", "to_ary"); values = RARRAY_PTR (rb_extents); extents->x = NUM2INT (values[0]); extents->y = NUM2INT (values[1]); extents->height = NUM2INT (values[2]); extents->width = NUM2INT (values[3]); } } mapped_image = cairo_surface_map_to_image (surface, extents); rb_cairo_surface_check_status (mapped_image); return CRSURFACE2RVAL_WITH_DESTROY (mapped_image); } static VALUE cr_surface_unmap_image (VALUE self, VALUE rb_mapped_image) { cairo_surface_t *surface, *mapped_image; surface = _SELF; mapped_image = RVAL2CRSURFACE (rb_mapped_image); cairo_surface_unmap_image (surface, mapped_image); return Qnil; } #endif #if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE cr_surface_create_sub_rectangle_surface (VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) { VALUE rb_surface; cairo_surface_t *surface; surface = cairo_surface_create_for_rectangle (RVAL2CRSURFACE (self), NUM2DBL (x), NUM2DBL (y), NUM2DBL (width), NUM2INT (height)); rb_cairo_surface_check_status (surface); rb_surface = CRSURFACE2RVAL_WITH_DESTROY (surface); if (rb_block_given_p ()) return rb_ensure (rb_yield, rb_surface, cr_surface_destroy_with_destroy_check, rb_surface); else return rb_surface; } static VALUE cr_surface_get_device (VALUE self) { return CRDEVICE2RVAL (cairo_surface_get_device (_SELF)); } #endif static VALUE cr_surface_get_content (VALUE self) { return INT2NUM (cairo_surface_get_content (_SELF)); } #ifdef CAIRO_HAS_PNG_FUNCTIONS static VALUE cr_surface_write_to_png_stream (VALUE self, VALUE target) { cairo_status_t status; rb_cairo__io_callback_closure_t closure; closure.target = target; closure.error = Qnil; status = cairo_surface_write_to_png_stream (_SELF, rb_cairo__io_write_func, (void *)&closure); if (!NIL_P (closure.error)) rb_exc_raise (closure.error); rb_cairo_check_status (status); return self; } static VALUE cr_surface_write_to_png (VALUE self, VALUE filename) { cairo_status_t status; status = cairo_surface_write_to_png (_SELF, StringValueCStr (filename)); rb_cairo_check_status (status); return self; } static VALUE cr_surface_write_to_png_generic (VALUE self, VALUE target) { if (rb_respond_to (target, rb_cairo__io_id_write)) return cr_surface_write_to_png_stream (self, target); else return cr_surface_write_to_png (self, target); } #endif #if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE cr_surface_get_mime_data (VALUE self, VALUE mime_type) { cairo_surface_t *surface; const unsigned char *data; unsigned long length; surface = _SELF; cairo_surface_get_mime_data (surface, StringValueCStr (mime_type), &data, &length); if (data) return rb_str_new ((const char *)data, length); else return Qnil; } static VALUE cr_surface_set_mime_data (VALUE self, VALUE rb_mime_type, VALUE rb_data) { cairo_status_t status; cairo_surface_t *surface; const char *mime_type; surface = _SELF; mime_type = StringValueCStr (rb_mime_type); if (NIL_P (rb_data)) { status = cairo_surface_set_mime_data (surface, mime_type, NULL, 0, NULL, NULL); } else { const char *raw_data; unsigned char *data; unsigned long length; raw_data = StringValuePtr (rb_data); length = RSTRING_LEN (rb_data); data = xmalloc (length); memcpy (data, raw_data, length); status = cairo_surface_set_mime_data (surface, mime_type, data, length, xfree, data); } rb_cairo_check_status (status); return Qnil; } #endif #if CAIRO_CHECK_VERSION(1, 11, 4) static VALUE cr_surface_supported_mime_type_p (VALUE self, VALUE rb_mime_type) { cairo_surface_t *surface; const char *mime_type; cairo_bool_t supported_p; surface = _SELF; mime_type = StringValueCStr (rb_mime_type); supported_p = cairo_surface_supports_mime_type (surface, mime_type); return CBOOL2RVAL (supported_p); } #endif static VALUE cr_surface_get_font_options (VALUE self) { cairo_font_options_t *options; VALUE rb_options; options = cairo_font_options_create (); rb_cairo_check_status (cairo_font_options_status (options)); /* TODO: Use rb_ensure() */ rb_options = CRFONTOPTIONS2RVAL (options); cairo_font_options_destroy (options); options = RVAL2CRFONTOPTIONS (rb_options); cairo_surface_get_font_options (_SELF, options); rb_cairo_surface_check_status (_SELF); rb_cairo_check_status (cairo_font_options_status (options)); return rb_options; } static VALUE cr_surface_flush (VALUE self) { cairo_surface_flush (_SELF); rb_cairo_surface_check_status (_SELF); return self; } static VALUE cr_surface_mark_dirty (int argc, VALUE *argv, VALUE self) { VALUE x, y, width, height; int n; n = rb_scan_args (argc, argv, "04", &x, &y, &width, &height); if (n == 0) { cairo_surface_mark_dirty (_SELF); } else if (n == 4) { cairo_surface_mark_dirty_rectangle (_SELF, NUM2INT (x), NUM2INT (y), NUM2INT (width), NUM2INT (height)); } else { int i; VALUE args; args = rb_ary_new2 (n); for (i = 0; i < n; i++) { rb_ary_push (args, argv[i]); } rb_raise (rb_eArgError, "invalid argument (expect () or (x, y, width, height)): %s", rb_cairo__inspect (args)); } rb_cairo_surface_check_status (_SELF); return self; } static VALUE cr_surface_set_device_offset (VALUE self, VALUE x_offset, VALUE y_offset) { cairo_surface_set_device_offset (_SELF, NUM2DBL (x_offset), NUM2DBL (y_offset)); rb_cairo_surface_check_status (_SELF); return self; } static VALUE cr_surface_get_device_offset (VALUE self) { double x_offset, y_offset; cairo_surface_get_device_offset (_SELF, &x_offset, &y_offset); rb_cairo_surface_check_status (_SELF); return rb_ary_new3 (2, rb_float_new (x_offset), rb_float_new (y_offset)); } #if CAIRO_CHECK_VERSION(1, 14, 0) static VALUE cr_surface_set_device_scale (VALUE self, VALUE x_scale, VALUE y_scale) { cairo_surface_set_device_scale (_SELF, NUM2DBL (x_scale), NUM2DBL (y_scale)); rb_cairo_surface_check_status (_SELF); return self; } static VALUE cr_surface_get_device_scale (VALUE self) { double x_scale, y_scale; cairo_surface_get_device_scale (_SELF, &x_scale, &y_scale); return rb_ary_new3 (2, rb_float_new (x_scale), rb_float_new (y_scale)); } #endif static VALUE cr_surface_set_fallback_resolution (VALUE self, VALUE x_pixels_per_inch, VALUE y_pixels_per_inch) { cairo_surface_set_fallback_resolution (_SELF, NUM2DBL (x_pixels_per_inch), NUM2DBL (y_pixels_per_inch)); rb_cairo_surface_check_status (_SELF); return self; } #if CAIRO_CHECK_VERSION(1, 7, 2) static VALUE cr_surface_get_fallback_resolution (VALUE self) { double x_pixels_per_inch, y_pixels_per_inch; cairo_surface_get_fallback_resolution (_SELF, &x_pixels_per_inch, &y_pixels_per_inch); rb_cairo_surface_check_status (_SELF); return rb_ary_new3 (2, rb_float_new (x_pixels_per_inch), rb_float_new (y_pixels_per_inch)); } #endif #if CAIRO_CHECK_VERSION(1, 5, 2) static VALUE cr_surface_copy_page (VALUE self) { cairo_surface_copy_page (_SELF); rb_cairo_surface_check_status (_SELF); return self; } static VALUE cr_surface_show_page (VALUE self) { cairo_surface_show_page (_SELF); rb_cairo_surface_check_status (_SELF); return self; } #endif /* image surface functions */ #ifdef CAIRO_HAS_PNG_FUNCTIONS static cairo_surface_t * cr_image_surface_create_from_png_stream (VALUE target) { rb_cairo__io_callback_closure_t closure; cairo_surface_t *surface; closure.target = target; closure.error = Qnil; surface = cairo_image_surface_create_from_png_stream (rb_cairo__io_read_func, (void *)&closure); if (!NIL_P (closure.error)) rb_exc_raise (closure.error); return surface; } static cairo_surface_t * cr_image_surface_create_from_png (VALUE filename) { return cairo_image_surface_create_from_png (StringValueCStr (filename)); } static VALUE cr_image_surface_create_from_png_generic (VALUE klass, VALUE target) { VALUE rb_surface; cairo_surface_t *surface; if (rb_respond_to (target, rb_cairo__io_id_read)) surface = cr_image_surface_create_from_png_stream (target); else surface = cr_image_surface_create_from_png (target); rb_cairo_surface_check_status (surface); rb_surface = cr_surface_allocate (klass); DATA_PTR (rb_surface) = surface; return rb_surface; } #endif static cairo_surface_t * cr_image_surface_create (VALUE self, VALUE format, VALUE width, VALUE height) { cairo_format_t cr_format; cr_format = NIL_P (format) ? CAIRO_FORMAT_ARGB32 : RVAL2CRFORMAT (format); return cairo_image_surface_create (cr_format, NUM2INT (width), NUM2INT (height)); } static cairo_surface_t * cr_image_surface_create_for_data (VALUE self, VALUE rb_data, VALUE format, VALUE width, VALUE height, VALUE stride) { unsigned char *data; rb_data = StringValue (rb_data); rb_str_modify (rb_data); data = (unsigned char *)StringValuePtr (rb_data); return cairo_image_surface_create_for_data (data, RVAL2CRFORMAT (format), NUM2INT (width), NUM2INT (height), NUM2INT (stride)); } static VALUE cr_image_surface_initialize (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface; VALUE arg1, arg2, arg3, arg4, arg5; int n; n = rb_scan_args (argc, argv, "23", &arg1, &arg2, &arg3, &arg4, &arg5); if (n == 2) surface = cr_image_surface_create (self, Qnil, arg1, arg2); else if (n == 3) surface = cr_image_surface_create (self, arg1, arg2, arg3); else if (n == 5) surface = cr_image_surface_create_for_data (self, arg1, arg2, arg3, arg4, arg5); else rb_raise (rb_eArgError, "invalid argument (expect " "(width, height) or " "(format, width, height) or " "(data, format, width, height, stride)): %s", rb_cairo__inspect (rb_ary_new3 (4, arg1, arg2, arg3, arg4))); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; rb_cairo_surface_adjust_memory_usage (surface, CR_TRUE); if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_image_surface_get_data (VALUE self) { unsigned char *data; cairo_surface_t *surface; surface = _SELF; data = cairo_image_surface_get_data (surface); if (data) return rb_str_new ((const char *)data, cairo_image_surface_get_stride (surface) * cairo_image_surface_get_height (surface)); else return Qnil; } static VALUE cr_image_surface_get_format (VALUE self) { return INT2NUM (cairo_image_surface_get_format (_SELF)); } static VALUE cr_image_surface_get_width (VALUE self) { return INT2NUM (cairo_image_surface_get_width (_SELF)); } static VALUE cr_image_surface_get_height (VALUE self) { return INT2NUM (cairo_image_surface_get_height (_SELF)); } static VALUE cr_image_surface_get_stride (VALUE self) { return INT2NUM (cairo_image_surface_get_stride (_SELF)); } /* printing surfaces */ #define DEFINE_SURFACE(type) \ static VALUE \ cr_ ## type ## _surface_initialize (int argc, VALUE *argv, VALUE self) \ { \ VALUE target, rb_width_in_points, rb_height_in_points; \ VALUE arg2, arg3; \ cairo_surface_t *surface; \ double width_in_points, height_in_points; \ \ rb_scan_args (argc, argv, "21", &target, &arg2, &arg3); \ if (argc == 2) \ { \ VALUE paper; \ \ paper = arg2; \ cr_paper_to_size_in_points (paper, \ &rb_width_in_points, \ &rb_height_in_points); \ } \ else \ { \ rb_width_in_points = arg2; \ rb_height_in_points = arg3; \ } \ \ width_in_points = NUM2DBL (rb_width_in_points); \ height_in_points = NUM2DBL (rb_height_in_points); \ \ if (rb_respond_to (target, rb_cairo__io_id_to_path) && \ !rb_respond_to (target, rb_cairo__io_id_to_io)) \ { \ target = rb_funcall (target, rb_cairo__io_id_to_path, 0); \ } \ \ if (rb_respond_to (target, rb_cairo__io_id_write)) \ { \ rb_cairo__io_callback_closure_t *closure; \ \ closure = rb_cairo__io_closure_new (target); \ surface = \ cairo_ ## type ## _surface_create_for_stream ( \ rb_cairo__io_write_func, \ (void *) closure, \ width_in_points, \ height_in_points); \ \ if (cairo_surface_status (surface)) \ { \ rb_cairo__io_closure_destroy (closure); \ } \ else \ { \ rb_ivar_set (self, rb_cairo__io_id_output, target); \ cairo_surface_set_user_data (surface, &cr_closure_key, \ closure, \ rb_cairo__io_closure_free); \ cairo_surface_set_user_data (surface, &cr_object_holder_key, \ cr_object_holder_new (self), \ cr_object_holder_free); \ } \ } \ else \ { \ const char *filename = NULL; \ if (!NIL_P (target)) \ filename = StringValueCStr (target); \ surface = cairo_ ## type ## _surface_create (filename, \ width_in_points, \ height_in_points); \ } \ \ rb_cairo_surface_check_status (surface); \ DATA_PTR (self) = surface; \ if (rb_block_given_p ()) \ rb_cairo__surface_yield_and_finish (self); \ return Qnil; \ } #define DEFINE_SURFACE_SET_SIZE(type) \ static VALUE \ cr_ ## type ## _surface_set_size (int argc, VALUE *argv, VALUE self) \ { \ VALUE arg1, arg2; \ VALUE width_in_points, height_in_points; \ \ rb_scan_args(argc, argv, "11", &arg1, &arg2); \ if (argc == 1) \ { \ VALUE paper; \ \ paper = arg1; \ cr_paper_to_size_in_points (paper, \ &width_in_points, \ &height_in_points); \ } \ else \ { \ width_in_points = arg1; \ height_in_points = arg2; \ } \ \ cairo_ ## type ## _surface_set_size (_SELF, \ NUM2DBL (width_in_points), \ NUM2DBL (height_in_points)); \ rb_cairo_surface_check_status (_SELF); \ return Qnil; \ } #ifdef CAIRO_HAS_PDF_SURFACE /* PDF-surface functions */ DEFINE_SURFACE(pdf) DEFINE_SURFACE_SET_SIZE(pdf) # if CAIRO_CHECK_VERSION(1, 10, 0) static VALUE cr_pdf_surface_restrict_to_version (VALUE self, VALUE version) { cairo_pdf_surface_restrict_to_version (_SELF, RVAL2CRPDFVERSION (version)); rb_cairo_surface_check_status (_SELF); return Qnil; } # endif # if CAIRO_CHECK_VERSION(1, 15, 4) static VALUE cr_pdf_surface_add_outline (VALUE self, VALUE rb_parent_id, VALUE rb_name, VALUE rb_destination, VALUE rb_flags) { cairo_surface_t *surface; int parent_id; const char *name; const char *destination; cairo_pdf_outline_flags_t flags; int id; surface = _SELF; if (NIL_P (rb_parent_id)) parent_id = 0; else parent_id = NUM2INT (rb_parent_id); name = RVAL2CSTR (rb_name); destination = RVAL2CSTR (rb_destination); if (NIL_P (rb_flags)) flags = 0; else flags = RVAL2CRPDFOUTLINEFLAGS (rb_flags); id = cairo_pdf_surface_add_outline (surface, parent_id, name, destination, flags); rb_cairo_surface_check_status (surface); if (id == 0) return Qnil; else return INT2NUM (id); } static VALUE cr_pdf_surface_set_metadata (VALUE self, VALUE rb_metadata, VALUE rb_value) { cairo_surface_t *surface; cairo_pdf_metadata_t metadata; const char *value; surface = _SELF; metadata = RVAL2CRPDFMETADATA (rb_metadata); switch (metadata) { case CAIRO_PDF_METADATA_CREATE_DATE: case CAIRO_PDF_METADATA_MOD_DATE: if (rb_cairo__is_kind_of (rb_value, rb_cTime)) { ID id_iso8601; CONST_ID(id_iso8601, "iso8601"); rb_value = rb_funcall (rb_value, id_iso8601, 0); } break; default: break; } value = RVAL2CSTR (rb_value); cairo_pdf_surface_set_metadata (surface, metadata, value); rb_cairo_surface_check_status (surface); return Qnil; } static VALUE cr_pdf_surface_set_page_label (VALUE self, VALUE rb_label) { cairo_surface_t *surface; const char *label; surface = _SELF; label = RVAL2CSTR (rb_label); cairo_pdf_surface_set_page_label (surface, label); rb_cairo_surface_check_status (surface); return Qnil; } static VALUE cr_pdf_surface_set_thumbnail_size (VALUE self, VALUE rb_width, VALUE rb_height) { cairo_surface_t *surface; int width; int height; surface = _SELF; width = NUM2INT (rb_width); height = NUM2INT (rb_height); cairo_pdf_surface_set_thumbnail_size (surface, width, height); rb_cairo_surface_check_status (surface); return Qnil; } # endif #endif #ifdef CAIRO_HAS_PS_SURFACE /* PS-surface functions */ DEFINE_SURFACE(ps) DEFINE_SURFACE_SET_SIZE(ps) static VALUE cr_ps_surface_dsc_comment (VALUE self, VALUE comment) { cairo_ps_surface_dsc_comment (_SELF, StringValueCStr (comment)); rb_cairo_surface_check_status (_SELF); return Qnil; } static VALUE cr_ps_surface_dsc_begin_setup (VALUE self) { cairo_ps_surface_dsc_begin_setup (_SELF); rb_cairo_surface_check_status (_SELF); if (rb_block_given_p ()) return rb_yield (self); else return Qnil; } static VALUE cr_ps_surface_dsc_begin_page_setup (VALUE self) { cairo_ps_surface_dsc_begin_page_setup (_SELF); rb_cairo_surface_check_status (_SELF); if (rb_block_given_p ()) return rb_yield (self); else return Qnil; } # if CAIRO_CHECK_VERSION(1, 5, 2) static VALUE cr_ps_surface_restrict_to_level (VALUE self, VALUE level) { cairo_ps_surface_restrict_to_level (_SELF, RVAL2CRPSLEVEL (level)); rb_cairo_surface_check_status (_SELF); return Qnil; } static VALUE cr_ps_surface_get_eps (VALUE self) { return cairo_ps_surface_get_eps (_SELF) ? Qtrue : Qfalse; } static VALUE cr_ps_surface_set_eps (VALUE self, VALUE eps) { cairo_ps_surface_set_eps (_SELF, RTEST (eps)); rb_cairo_surface_check_status (_SELF); return Qnil; } # endif #endif #ifdef CAIRO_HAS_WIN32_SURFACE /* Win32 surface functions */ static VALUE cr_win32_surface_initialize (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface = NULL; VALUE arg1, arg2, arg3, arg4; VALUE hdc, format, width, height; rb_scan_args (argc, argv, "13", &arg1, &arg2, &arg3, &arg4); switch (argc) { case 1: hdc = arg1; surface = cairo_win32_surface_create (NUM2PTR (hdc)); break; case 2: # if CAIRO_CHECK_VERSION(1, 11, 4) # define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB30 # else # define CAIRO_FORMAT_MAX CAIRO_FORMAT_RGB16_565 # endif if (CAIRO_FORMAT_ARGB32 <= NUM2INT (arg2) && NUM2INT (arg2) <= CAIRO_FORMAT_MAX) { # if CAIRO_CHECK_VERSION(1, 15, 2) hdc = arg1; format = arg2; surface = cairo_win32_surface_create_with_format (NUM2PTR (hdc), RVAL2CRFORMAT (format)); # else rb_raise (rb_eArgError, "Cairo::Win32Surface.new(hdc, format) " "is available since cairo >= 1.15.2"); # endif } else { width = arg1; height = arg2; surface = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_ARGB32, NUM2INT (width), NUM2INT (height)); } break; case 3: if (NIL_P (arg1) || (rb_cairo__is_kind_of (arg1, rb_cNumeric) && NUM2INT (arg1) != CAIRO_FORMAT_RGB24)) { # if CAIRO_CHECK_VERSION(1, 4, 0) HDC win32_hdc; hdc = arg1; width = arg2; height = arg3; win32_hdc = NIL_P (hdc) ? NULL : NUM2PTR (hdc); surface = cairo_win32_surface_create_with_ddb (win32_hdc, CAIRO_FORMAT_RGB24, NUM2INT (width), NUM2INT (height)); # else rb_raise (rb_eArgError, "Cairo::Win32Surface.new(hdc, width, height) " "is available since cairo >= 1.4.0"); # endif } else { format = arg1; width = arg2; height = arg3; surface = cairo_win32_surface_create_with_dib (RVAL2CRFORMAT (format), NUM2INT (width), NUM2INT (height)); } break; case 4: { # if CAIRO_CHECK_VERSION(1, 4, 0) HDC win32_hdc; hdc = arg1; format = arg2; width = arg3; height = arg4; win32_hdc = NIL_P (hdc) ? NULL : (HDC) (UINT_PTR) NUM2UINT (hdc); surface = cairo_win32_surface_create_with_ddb (win32_hdc, RVAL2CRFORMAT (format), NUM2INT (width), NUM2INT (height)); # else rb_raise (rb_eArgError, "Cairo::Win32Surface.new(hdc, format, width, height) " "is available since cairo >= 1.4.0"); # endif } break; } if (!surface) rb_cairo_check_status (CAIRO_STATUS_INVALID_FORMAT); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_win32_surface_get_hdc (VALUE self) { HDC hdc; hdc = cairo_win32_surface_get_dc (_SELF); if (!hdc) return Qnil; else return PTR2NUM (hdc); } # if CAIRO_CHECK_VERSION(1, 4, 0) static VALUE cr_win32_surface_get_image (VALUE self) { cairo_surface_t *surface; surface = cairo_win32_surface_get_image (_SELF); if (!surface) return Qnil; rb_cairo_surface_check_status (surface); return CRSURFACE2RVAL (surface); } # endif #endif #ifdef CAIRO_HAS_SVG_SURFACE /* SVG-surface functions */ DEFINE_SURFACE(svg) static VALUE cr_svg_surface_restrict_to_version (VALUE self, VALUE version) { cairo_svg_surface_restrict_to_version (_SELF, RVAL2CRSVGVERSION (version)); rb_cairo_surface_check_status (_SELF); return Qnil; } # if CAIRO_CHECK_VERSION(1, 15, 10) static VALUE cr_svg_surface_get_document_unit (VALUE self) { cairo_svg_unit_t unit; unit = cairo_svg_surface_get_document_unit (_SELF); rb_cairo_surface_check_status (_SELF); return INT2NUM (unit); } static VALUE cr_svg_surface_set_document_unit (VALUE self, VALUE rb_unit) { cairo_svg_unit_t unit; unit = RVAL2CRSVGUNIT (rb_unit); cairo_svg_surface_set_document_unit (_SELF, unit); rb_cairo_surface_check_status (_SELF); return Qnil; } # endif #endif #ifdef RB_CAIRO_HAS_WIN32_PRINTING_SURFACE /* Win32 printing surface functions */ static VALUE cr_win32_printing_surface_initialize (VALUE self, VALUE hdc) { cairo_surface_t *surface = NULL; surface = cairo_win32_printing_surface_create (NUM2PTR (hdc)); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } #endif #ifdef CAIRO_HAS_SCRIPT_SURFACE /* script surface functions */ static VALUE cr_script_surface_initialize (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface = NULL, *target = NULL; cairo_device_t *device; double width = 0.0, height = 0.0; cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA; VALUE arg1, arg2, arg3, arg4; rb_scan_args (argc, argv, "22", &arg1, &arg2, &arg3, &arg4); device = RVAL2CRDEVICE (arg1); if (argc == 2) { target = RVAL2CRSURFACE (arg2); } else { width = NUM2DBL (arg2); height = NUM2DBL (arg3); switch (TYPE (arg4)) { case T_NIL: break; case T_STRING: case T_SYMBOL: case T_FIXNUM: content = RVAL2CRCONTENT (arg4); break; default: rb_raise (rb_eArgError, "invalid argument (expect " "(device, width, height), " "(device, width, height, content) or " "(device, surface)): %s", rb_cairo__inspect (rb_ary_new4 (argc, argv))); break; } } if (target) surface = cairo_script_surface_create_for_target (device, target); else surface = cairo_script_surface_create (device, content, width, height); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } #endif #ifdef CAIRO_HAS_RECORDING_SURFACE /* recording surface functions */ static VALUE cr_recording_surface_initialize (int argc, VALUE *argv, VALUE self) { VALUE arg1, arg2, arg3, arg4, arg5; cairo_surface_t *surface; cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA; cairo_rectangle_t extents; const char *error_message = "invalid argument (expect " "(x, y, width, height), " "([x, y, width, height])," "(x, y, width, height, content) or " "([x, y, width, height], content)): %s"; rb_scan_args (argc, argv, "14", &arg1, &arg2, &arg3, &arg4, &arg5); if (argc == 1 || argc == 2) { VALUE rb_extents; rb_extents = rb_check_array_type (arg1); if (RARRAY_LEN (rb_extents) != 4) rb_raise (rb_eArgError, error_message, rb_cairo__inspect (arg1)); extents.x = NUM2DBL (RARRAY_PTR (rb_extents)[0]); extents.y = NUM2DBL (RARRAY_PTR (rb_extents)[1]); extents.width = NUM2DBL (RARRAY_PTR (rb_extents)[2]); extents.height = NUM2DBL (RARRAY_PTR (rb_extents)[3]); if (!NIL_P (arg2)) content = RVAL2CRCONTENT (arg2); } else if (argc == 4 || argc == 5) { extents.x = NUM2DBL (arg1); extents.y = NUM2DBL (arg2); extents.width = NUM2DBL (arg3); extents.height = NUM2DBL (arg4); if (!NIL_P (arg5)) content = RVAL2CRCONTENT (arg5); } else { rb_raise (rb_eArgError, error_message, rb_cairo__inspect (rb_ary_new4 (argc, argv))); } surface = cairo_recording_surface_create (content, &extents); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_recording_surface_get_ink_extents (VALUE self) { cairo_surface_t *surface; double x, y, width, height; surface = _SELF; cairo_recording_surface_ink_extents (surface, &x, &y, &width, &height); rb_cairo_surface_check_status (surface); return rb_ary_new3 (4, rb_float_new (x), rb_float_new (y), rb_float_new (width), rb_float_new (height)); } # if CAIRO_CHECK_VERSION(1, 11, 4) static VALUE cr_recording_surface_get_extents (VALUE self) { cairo_surface_t *surface; cairo_rectangle_t extents; surface = _SELF; cairo_recording_surface_get_extents (surface, &extents); rb_cairo_surface_check_status (surface); return rb_ary_new3 (4, rb_float_new (extents.x), rb_float_new (extents.y), rb_float_new (extents.width), rb_float_new (extents.height)); } # endif #endif #ifdef RB_CAIRO_HAS_GL_SURFACE /* GL surface functions */ static VALUE cr_gl_surface_initialize (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface; cairo_device_t *device; int width, height; cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA; VALUE rb_device, rb_width, rb_height, rb_content; rb_scan_args (argc, argv, "31", &rb_device, &rb_width, &rb_height, &rb_content); device = RVAL2CRDEVICE (rb_device); width = NUM2INT (rb_width); height = NUM2INT (rb_height); switch (TYPE (rb_content)) { case T_NIL: break; case T_STRING: case T_SYMBOL: case T_FIXNUM: content = RVAL2CRCONTENT (rb_content); break; default: rb_raise (rb_eArgError, "invalid argument (expect " "(device, width, height) or " "(device, width, height, content)): %s", rb_cairo__inspect (rb_ary_new4 (argc, argv))); break; } surface = cairo_gl_surface_create (device, content, width, height); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_gl_texture_surface_initialize (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface; cairo_device_t *device; unsigned int texture; int width, height; cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA; VALUE rb_device, rb_texture, rb_width, rb_height, rb_content; rb_scan_args (argc, argv, "41", &rb_device, &rb_texture, &rb_width, &rb_height, &rb_content); device = RVAL2CRDEVICE (rb_device); texture = NUM2UINT (rb_texture); width = NUM2INT (rb_width); height = NUM2INT (rb_height); switch (TYPE (rb_content)) { case T_NIL: break; case T_STRING: case T_SYMBOL: case T_FIXNUM: content = RVAL2CRCONTENT (rb_content); break; default: rb_raise (rb_eArgError, "invalid argument (expect " "(device, texture, width, height) or " "(device, texture, width, height, content)): %s", rb_cairo__inspect (rb_ary_new4 (argc, argv))); break; } surface = cairo_gl_surface_create_for_texture (device, content, texture, width, height); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_gl_surface_set_size (VALUE self, VALUE width, VALUE height) { cairo_surface_t *surface = NULL; surface = _SELF; cairo_gl_surface_set_size (surface, NUM2INT (width), NUM2INT (height)); rb_cairo_surface_check_status (surface); return Qnil; } static VALUE cr_gl_surface_get_width (VALUE self) { return INT2NUM (cairo_gl_surface_get_width (_SELF)); } static VALUE cr_gl_surface_get_height (VALUE self) { return INT2NUM (cairo_gl_surface_get_height (_SELF)); } static VALUE cr_gl_surface_swap_buffers (VALUE self) { cairo_surface_t *surface = NULL; surface = _SELF; cairo_gl_surface_swapbuffers (surface); rb_cairo_surface_check_status (surface); return Qnil; } #endif #ifdef CAIRO_HAS_TEE_SURFACE /* tee surface functions */ static VALUE cr_tee_surface_initialize (VALUE self, VALUE master) { cairo_surface_t *surface = NULL; surface = cairo_tee_surface_create (RVAL2CRSURFACE (master)); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; rb_iv_set (self, "surfaces", rb_ary_new3 (1, master)); if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } static VALUE cr_tee_surface_add (VALUE self, VALUE target) { cairo_surface_t *surface = NULL; surface = _SELF; cairo_tee_surface_add (surface, RVAL2CRSURFACE (target)); rb_cairo_surface_check_status (surface); rb_ary_push (rb_iv_get (self, "surfaces"), target); return Qnil; } static VALUE cr_tee_surface_shift_operator (VALUE self, VALUE target) { cr_tee_surface_add (self, target); return self; } static VALUE cr_tee_surface_remove (VALUE self, VALUE target_or_index) { cairo_surface_t *surface = NULL, *target; VALUE rb_surfaces; int i; surface = _SELF; if (rb_cairo__is_kind_of (target_or_index, rb_cCairo_Surface)) { target = RVAL2CRSURFACE (target_or_index); } else { VALUE index; index = rb_check_to_integer (target_or_index, "to_int"); if (NIL_P (index)) rb_raise (rb_eArgError, "invalid argument (expect (surface) or (index)): %s", rb_cairo__inspect (target_or_index)); target = cairo_tee_surface_index (surface, NUM2INT (index)); } cairo_tee_surface_remove (surface, target); rb_cairo_surface_check_status (surface); rb_surfaces = rb_iv_get (self, "surfaces"); for (i = 0; i < RARRAY_LEN (rb_surfaces); i++) { VALUE rb_marked_surface; cairo_surface_t *marked_surface; rb_marked_surface = RARRAY_PTR (rb_surfaces)[i]; marked_surface = RVAL2CRSURFACE (rb_marked_surface); if (marked_surface == target) { rb_ary_delete (rb_surfaces, rb_marked_surface); break; } } return Qnil; } static VALUE cr_tee_surface_array_reference (VALUE self, VALUE index) { cairo_surface_t *surface = NULL, *target; surface = _SELF; index = rb_Integer (index); target = cairo_tee_surface_index (surface, NUM2UINT (index)); rb_cairo_surface_check_status (surface); rb_cairo_surface_check_status (target); return CRSURFACE2RVAL (target); } #endif #ifdef CAIRO_HAS_XML_SURFACE /* XML surface functions */ static VALUE cr_xml_surface_initialize (int argc, VALUE *argv, VALUE self) { cairo_surface_t *surface; cairo_device_t *device; double width, height; cairo_content_t content = CAIRO_CONTENT_COLOR_ALPHA; VALUE rb_device, rb_width, rb_height, rb_content; rb_scan_args (argc, argv, "31", &rb_device, &rb_width, &rb_height, &rb_content); device = RVAL2CRDEVICE (rb_device); width = NUM2DBL (rb_width); height = NUM2DBL (rb_height); switch (TYPE (rb_content)) { case T_NIL: break; case T_STRING: case T_SYMBOL: case T_FIXNUM: content = RVAL2CRCONTENT (rb_content); break; default: rb_raise (rb_eArgError, "invalid argument (expect " "(device, width, height) or " "(device, width, height, content)): %s", rb_cairo__inspect (rb_ary_new4 (argc, argv))); break; } surface = cairo_xml_surface_create (device, content, width, height); rb_cairo_surface_check_status (surface); DATA_PTR (self) = surface; if (rb_block_given_p ()) rb_cairo__surface_yield_and_finish (self); return Qnil; } #endif static int cr_finish_all_guarded_surfaces_at_end_iter (VALUE key, VALUE value, VALUE data) { cr_surface_finish (key); return ST_CONTINUE; } static void cr_finish_all_guarded_surfaces_at_end (VALUE data) { rb_hash_foreach (rb_cairo__gc_guarded_objects (rb_cCairo_Surface), cr_finish_all_guarded_surfaces_at_end_iter, Qnil); } void Init_cairo_surface (void) { cr_id_new = rb_intern ("new"); cr_id_parse = rb_intern ("parse"); cr_id_size = rb_intern ("size"); cr_id_set_unit = rb_intern ("unit="); cr_id_x = rb_intern ("x"); cr_id_y = rb_intern ("y"); cr_id_width = rb_intern ("width"); cr_id_height = rb_intern ("height"); rb_cCairo_Surface = rb_define_class_under (rb_mCairo, "Surface", rb_cObject); rb_define_alloc_func (rb_cCairo_Surface, cr_surface_allocate); rb_cairo__initialize_gc_guard_holder_class (rb_cCairo_Surface); rb_set_end_proc(cr_finish_all_guarded_surfaces_at_end, Qnil); rb_define_singleton_method (rb_cCairo_Surface, "create", cr_surface_create, -1); rb_define_singleton_method (rb_cCairo_Surface, "image_supported?", cr_surface_image_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "pdf_supported?", cr_surface_pdf_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "ps_supported?", cr_surface_ps_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "quartz_supported?", cr_surface_quartz_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "win32_supported?", cr_surface_win32_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "svg_supported?", cr_surface_svg_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "win32_printing_supported?", cr_surface_win32_printing_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "quartz_image_supported?", cr_surface_quartz_image_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "script_supported?", cr_surface_script_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "recording_supported?", cr_surface_recording_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "gl_supported?", cr_surface_gl_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "gl_texture_supported?", cr_surface_gl_texture_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "tee_supported?", cr_surface_tee_supported_p, 0); rb_define_singleton_method (rb_cCairo_Surface, "xml_supported?", cr_surface_xml_supported_p, 0); rb_define_method (rb_cCairo_Surface, "initialize", cr_surface_initialize, -1); rb_define_method (rb_cCairo_Surface, "create_similar", cr_surface_create_similar, -1); #if CAIRO_CHECK_VERSION(1, 11, 4) rb_define_method (rb_cCairo_Surface, "create_similar_image", cr_surface_create_similar_image, -1); rb_define_method (rb_cCairo_Surface, "map_to_image", cr_surface_map_to_image, -1); rb_define_method (rb_cCairo_Surface, "unmap_image", cr_surface_unmap_image, 1); #endif #if CAIRO_CHECK_VERSION(1, 10, 0) rb_define_method (rb_cCairo_Surface, "sub_rectangle_surface", cr_surface_create_sub_rectangle_surface, 4); rb_define_method (rb_cCairo_Surface, "device", cr_surface_get_device, 0); #endif rb_define_method (rb_cCairo_Surface, "destroy", cr_surface_destroy, 0); rb_define_method (rb_cCairo_Surface, "reference_count", cr_surface_get_reference_count, 0); rb_define_method (rb_cCairo_Surface, "finish", cr_surface_finish, 0); rb_define_method (rb_cCairo_Surface, "content", cr_surface_get_content, 0); #if CAIRO_CHECK_VERSION(1, 10, 0) rb_define_method (rb_cCairo_Surface, "get_mime_data", cr_surface_get_mime_data, 1); rb_define_method (rb_cCairo_Surface, "set_mime_data", cr_surface_set_mime_data, 2); #endif #if CAIRO_CHECK_VERSION(1, 11, 4) rb_define_method (rb_cCairo_Surface, "supported_mime_type?", cr_surface_supported_mime_type_p, 1); #endif rb_define_method (rb_cCairo_Surface, "font_options", cr_surface_get_font_options, 0); rb_define_method (rb_cCairo_Surface, "flush", cr_surface_flush, 0); rb_define_method (rb_cCairo_Surface, "mark_dirty", cr_surface_mark_dirty, -1); rb_define_method (rb_cCairo_Surface, "set_device_offset", cr_surface_set_device_offset, 2); rb_define_method (rb_cCairo_Surface, "device_offset", cr_surface_get_device_offset, 0); #if CAIRO_CHECK_VERSION(1, 14, 0) rb_define_method (rb_cCairo_Surface, "set_device_scale", cr_surface_set_device_scale, 2); rb_define_method (rb_cCairo_Surface, "device_scale", cr_surface_get_device_scale, 0); #endif rb_define_method (rb_cCairo_Surface, "set_fallback_resolution", cr_surface_set_fallback_resolution, 2); #if CAIRO_CHECK_VERSION(1, 7, 2) rb_define_method (rb_cCairo_Surface, "fallback_resolution", cr_surface_get_fallback_resolution, 0); #endif #if CAIRO_CHECK_VERSION(1, 5, 2) rb_define_method (rb_cCairo_Surface, "copy_page", cr_surface_copy_page, 0); rb_define_method (rb_cCairo_Surface, "show_page", cr_surface_show_page, 0); #endif #ifdef CAIRO_HAS_PNG_FUNCTIONS rb_define_method (rb_cCairo_Surface, "write_to_png", cr_surface_write_to_png_generic, 1); #endif RB_CAIRO_DEF_SETTERS (rb_cCairo_Surface); /* image surface */ rb_cCairo_ImageSurface = rb_define_class_under (rb_mCairo, "ImageSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_PNG_FUNCTIONS rb_define_singleton_method (rb_cCairo_ImageSurface, "from_png", cr_image_surface_create_from_png_generic, 1); #endif rb_define_method (rb_cCairo_ImageSurface, "initialize", cr_image_surface_initialize, -1); rb_define_method (rb_cCairo_ImageSurface, "data", cr_image_surface_get_data, 0); rb_define_method (rb_cCairo_ImageSurface, "format", cr_image_surface_get_format, 0); rb_define_method (rb_cCairo_ImageSurface, "width", cr_image_surface_get_width, 0); rb_define_method (rb_cCairo_ImageSurface, "height", cr_image_surface_get_height, 0); rb_define_method (rb_cCairo_ImageSurface, "stride", cr_image_surface_get_stride, 0); /* PDF surface */ rb_cCairo_PDFSurface = rb_define_class_under (rb_mCairo, "PDFSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_PDF_SURFACE rb_define_method (rb_cCairo_PDFSurface, "initialize", cr_pdf_surface_initialize, -1); rb_define_method (rb_cCairo_PDFSurface, "set_size", cr_pdf_surface_set_size, -1); # if CAIRO_CHECK_VERSION(1, 10, 0) rb_define_method (rb_cCairo_PDFSurface, "restrict_to_version", cr_pdf_surface_restrict_to_version, 1); # endif # if CAIRO_CHECK_VERSION(1, 15, 4) { VALUE rb_mCairo_PDFOutline; rb_mCairo_PDFOutline = rb_define_module_under (rb_mCairo, "PDFOutline"); rb_define_const (rb_mCairo_PDFOutline, "ROOT", INT2NUM (CAIRO_PDF_OUTLINE_ROOT)); rb_define_method (rb_cCairo_PDFSurface, "add_outline", cr_pdf_surface_add_outline, 4); rb_define_method (rb_cCairo_PDFSurface, "set_metadata", cr_pdf_surface_set_metadata, 2); rb_define_method (rb_cCairo_PDFSurface, "set_page_label", cr_pdf_surface_set_page_label, 1); rb_define_method (rb_cCairo_PDFSurface, "set_thumbnail_size", cr_pdf_surface_set_thumbnail_size, 2); } # endif RB_CAIRO_DEF_SETTERS (rb_cCairo_PDFSurface); #endif /* PS surface */ rb_cCairo_PSSurface = rb_define_class_under (rb_mCairo, "PSSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_PS_SURFACE rb_define_method (rb_cCairo_PSSurface, "initialize", cr_ps_surface_initialize, -1); rb_define_method (rb_cCairo_PSSurface, "set_size", cr_ps_surface_set_size, -1); rb_define_method (rb_cCairo_PSSurface, "dsc_comment", cr_ps_surface_dsc_comment, 1); rb_define_method (rb_cCairo_PSSurface, "dsc_begin_setup", cr_ps_surface_dsc_begin_setup, 0); rb_define_method (rb_cCairo_PSSurface, "dsc_begin_page_setup", cr_ps_surface_dsc_begin_page_setup, 0); # if CAIRO_CHECK_VERSION(1, 5, 2) rb_define_method (rb_cCairo_PSSurface, "restrict_to_level", cr_ps_surface_restrict_to_level, 1); rb_define_method (rb_cCairo_PSSurface, "eps?", cr_ps_surface_get_eps, 0); rb_define_method (rb_cCairo_PSSurface, "set_eps", cr_ps_surface_set_eps, 1); # endif RB_CAIRO_DEF_SETTERS (rb_cCairo_PSSurface); #endif /* XLib surface */ rb_cCairo_XLibSurface = rb_define_class_under (rb_mCairo, "XLibSurface", rb_cCairo_Surface); /* XCB surface */ rb_cCairo_XCBSurface = rb_define_class_under (rb_mCairo, "XCBSurface", rb_cCairo_Surface); /* Quartz surface */ rb_cCairo_QuartzSurface = rb_define_class_under (rb_mCairo, "QuartzSurface", rb_cCairo_Surface); /* Win32 surface */ rb_cCairo_Win32Surface = rb_define_class_under (rb_mCairo, "Win32Surface", rb_cCairo_Surface); #ifdef CAIRO_HAS_WIN32_SURFACE rb_define_method (rb_cCairo_Win32Surface, "initialize", cr_win32_surface_initialize, -1); rb_define_method (rb_cCairo_Win32Surface, "hdc", cr_win32_surface_get_hdc, 0); # if CAIRO_CHECK_VERSION(1, 4, 0) rb_define_method (rb_cCairo_Win32Surface, "image", cr_win32_surface_get_image, 0); # endif #endif /* SVG surface */ rb_cCairo_SVGSurface = rb_define_class_under (rb_mCairo, "SVGSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_SVG_SURFACE rb_define_method (rb_cCairo_SVGSurface, "initialize", cr_svg_surface_initialize, -1); rb_define_method (rb_cCairo_SVGSurface, "restrict_to_version", cr_svg_surface_restrict_to_version, 1); # if CAIRO_CHECK_VERSION(1, 15, 10) rb_define_method (rb_cCairo_SVGSurface, "document_unit", cr_svg_surface_get_document_unit, 0); rb_define_method (rb_cCairo_SVGSurface, "set_document_unit", cr_svg_surface_set_document_unit, 1); # endif RB_CAIRO_DEF_SETTERS (rb_cCairo_SVGSurface); #endif /* Win32 printing surface */ rb_cCairo_Win32PrintingSurface = rb_define_class_under (rb_mCairo, "Win32PrintingSurface", rb_cCairo_Surface); #ifdef RB_CAIRO_HAS_WIN32_PRINTING_SURFACE rb_define_method (rb_cCairo_Win32PrintingSurface, "initialize", cr_win32_printing_surface_initialize, -1); rb_define_method (rb_cCairo_Win32PrintingSurface, "hdc", cr_win32_surface_get_hdc, 0); #endif /* Quartz image surface */ rb_cCairo_QuartzImageSurface = rb_define_class_under (rb_mCairo, "QuartzImageSurface", rb_cCairo_Surface); /* script surface */ rb_cCairo_ScriptSurface = rb_define_class_under (rb_mCairo, "ScriptSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_SCRIPT_SURFACE rb_define_method (rb_cCairo_ScriptSurface, "initialize", cr_script_surface_initialize, -1); RB_CAIRO_DEF_SETTERS (rb_cCairo_ScriptSurface); #endif /* Qt surface */ rb_cCairo_QtSurface = rb_define_class_under (rb_mCairo, "QtSurface", rb_cCairo_Surface); /* recording surface */ rb_cCairo_RecordingSurface = rb_define_class_under (rb_mCairo, "RecordingSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_RECORDING_SURFACE rb_define_method (rb_cCairo_RecordingSurface, "initialize", cr_recording_surface_initialize, -1); rb_define_method (rb_cCairo_RecordingSurface, "ink_extents", cr_recording_surface_get_ink_extents, 0); # if CAIRO_CHECK_VERSION(1, 11, 4) rb_define_method (rb_cCairo_RecordingSurface, "extents", cr_recording_surface_get_extents, 0); # endif #endif /* VG surface */ rb_cCairo_VGSurface = rb_define_class_under (rb_mCairo, "VGSurface", rb_cCairo_Surface); /* GL surface */ rb_cCairo_GLSurface = rb_define_class_under (rb_mCairo, "GLSurface", rb_cCairo_Surface); rb_cCairo_GLTextureSurface = rb_define_class_under (rb_mCairo, "GLTextureSurface", rb_cCairo_GLSurface); #ifdef RB_CAIRO_HAS_GL_SURFACE rb_define_method (rb_cCairo_GLSurface, "initialize", cr_gl_surface_initialize, 1); rb_define_method (rb_cCairo_GLSurface, "set_size", cr_gl_surface_set_size, 2); rb_define_method (rb_cCairo_GLSurface, "width", cr_gl_surface_get_width, 0); rb_define_method (rb_cCairo_GLSurface, "height", cr_gl_surface_get_height, 0); rb_define_method (rb_cCairo_GLSurface, "swap_buffers", cr_gl_surface_swap_buffers, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_GLSurface); rb_define_method (rb_cCairo_GLTextureSurface, "initialize", cr_gl_texture_surface_initialize, 1); RB_CAIRO_DEF_SETTERS (rb_cCairo_GLTextureSurface); #endif /* DRM surface */ rb_cCairo_DRMSurface = rb_define_class_under (rb_mCairo, "DRMSurface", rb_cCairo_Surface); /* tee surface */ rb_cCairo_TeeSurface = rb_define_class_under (rb_mCairo, "TeeSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_TEE_SURFACE rb_define_method (rb_cCairo_TeeSurface, "initialize", cr_tee_surface_initialize, 1); rb_define_method (rb_cCairo_TeeSurface, "add", cr_tee_surface_add, 1); rb_define_method (rb_cCairo_TeeSurface, "<<", cr_tee_surface_shift_operator, 1); rb_define_method (rb_cCairo_TeeSurface, "remove", cr_tee_surface_remove, 1); rb_define_method (rb_cCairo_TeeSurface, "[]", cr_tee_surface_array_reference, 1); RB_CAIRO_DEF_SETTERS (rb_cCairo_TeeSurface); #endif /* XML surface */ rb_cCairo_XMLSurface = rb_define_class_under (rb_mCairo, "XMLSurface", rb_cCairo_Surface); #ifdef CAIRO_HAS_XML_SURFACE rb_define_method (rb_cCairo_XMLSurface, "initialize", cr_xml_surface_initialize, -1); RB_CAIRO_DEF_SETTERS (rb_cCairo_XMLSurface); #endif /* sub surface */ rb_cCairo_SubSurface = rb_define_class_under (rb_mCairo, "SubSurface", rb_cCairo_Surface); /* Cogl surface */ rb_cCairo_CoglSurface = rb_define_class_under (rb_mCairo, "CoglSurface", rb_cCairo_Surface); } rcairo-1.16.6/ext/cairo/rb_cairo_text_cluster.c000066400000000000000000000070001370612400100215010ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-16 08:16:40 $ * * Copyright 2008 Kouhei Sutou * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_TextCluster = Qnil; #if CAIRO_CHECK_VERSION(1, 7, 2) #define _SELF(self) (RVAL2CRTEXTCLUSTER(self)) cairo_text_cluster_t * rb_cairo_text_cluster_from_ruby_object (VALUE obj) { cairo_text_cluster_t *cluster; if (!rb_cairo__is_kind_of (obj, rb_cCairo_TextCluster)) { rb_raise (rb_eTypeError, "not a cairo cluster: %s", rb_cairo__inspect (obj)); } Data_Get_Struct (obj, cairo_text_cluster_t, cluster); return cluster; } static void cr_text_cluster_free (void *ptr) { if (ptr) { xfree (ptr); } } VALUE rb_cairo_text_cluster_to_ruby_object (cairo_text_cluster_t *cluster) { if (cluster) { cairo_text_cluster_t *new_cluster; new_cluster = ALLOC (cairo_text_cluster_t); *new_cluster = *cluster; return Data_Wrap_Struct (rb_cCairo_TextCluster, NULL, cr_text_cluster_free, new_cluster); } else { return Qnil; } } static VALUE cr_text_cluster_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, cr_text_cluster_free, NULL); } static VALUE cr_text_cluster_initialize (VALUE self, VALUE num_bytes, VALUE num_glyphs) { cairo_text_cluster_t *cluster; cluster = ALLOC (cairo_text_cluster_t); cluster->num_bytes = NUM2INT (num_bytes); cluster->num_glyphs = NUM2INT (num_glyphs); DATA_PTR (self) = cluster; return Qnil; } static VALUE cr_text_cluster_num_bytes (VALUE self) { return INT2NUM (_SELF(self)->num_bytes); } static VALUE cr_text_cluster_num_glyphs (VALUE self) { return INT2NUM (_SELF(self)->num_glyphs); } static VALUE cr_text_cluster_set_num_bytes (VALUE self, VALUE num_bytes) { _SELF(self)->num_bytes = NUM2INT (num_bytes); return self; } static VALUE cr_text_cluster_set_num_glyphs (VALUE self, VALUE num_glyphs) { _SELF(self)->num_glyphs = NUM2INT (num_glyphs); return self; } static VALUE cr_text_cluster_to_s (VALUE self) { VALUE ret; ret = rb_str_new2 ("#<"); rb_str_cat2 (ret, rb_class2name (CLASS_OF (self))); rb_str_cat2 (ret, ": "); rb_str_cat2 (ret, "num_bytes="); rb_str_concat (ret, rb_inspect (cr_text_cluster_num_bytes (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "num_glyphs="); rb_str_concat (ret, rb_inspect (cr_text_cluster_num_glyphs (self))); rb_str_cat2 (ret, ">"); return ret; } #endif void Init_cairo_text_cluster (void) { #if CAIRO_CHECK_VERSION(1, 7, 2) rb_cCairo_TextCluster = rb_define_class_under (rb_mCairo, "TextCluster", rb_cObject); rb_define_alloc_func (rb_cCairo_TextCluster, cr_text_cluster_allocate); rb_define_method (rb_cCairo_TextCluster, "initialize", cr_text_cluster_initialize, 2); rb_define_method (rb_cCairo_TextCluster, "num_bytes", cr_text_cluster_num_bytes, 0); rb_define_method (rb_cCairo_TextCluster, "num_glyphs", cr_text_cluster_num_glyphs, 0); rb_define_method (rb_cCairo_TextCluster, "set_num_bytes", cr_text_cluster_set_num_bytes, 1); rb_define_method (rb_cCairo_TextCluster, "set_num_glyphs", cr_text_cluster_set_num_glyphs, 1); rb_define_method (rb_cCairo_TextCluster, "to_s", cr_text_cluster_to_s, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_TextCluster); #endif } rcairo-1.16.6/ext/cairo/rb_cairo_text_extents.c000066400000000000000000000131211370612400100215130ustar00rootroot00000000000000/* -*- c-file-style: "gnu"; indent-tabs-mode: nil -*- */ /* * Ruby Cairo Binding * * $Author: kou $ * $Date: 2008-08-17 05:41:28 $ * * Copyright 2005 Øyvind Kolås * Copyright 2004-2005 MenTaLguY * * This file is made available under the same terms as Ruby * */ #include "rb_cairo.h" #include "rb_cairo_private.h" VALUE rb_cCairo_TextExtents; #define _SELF(self) (RVAL2CRTEXTEXTENTS(self)) cairo_text_extents_t * rb_cairo_text_extents_from_ruby_object (VALUE obj) { cairo_text_extents_t *extents; if (!rb_cairo__is_kind_of (obj, rb_cCairo_TextExtents)) { rb_raise (rb_eTypeError, "not a cairo text_extents"); } Data_Get_Struct (obj, cairo_text_extents_t, extents); return extents; } VALUE rb_cairo_text_extents_to_ruby_object (cairo_text_extents_t *extents) { if (extents) { cairo_text_extents_t *new_extents = ALLOC (cairo_text_extents_t); *new_extents = *extents; return Data_Wrap_Struct (rb_cCairo_TextExtents, NULL, -1, new_extents); } else { return Qnil; } } static VALUE cr_text_extents_allocate (VALUE klass) { return Data_Wrap_Struct (klass, NULL, -1, NULL); } static VALUE cr_text_extents_initialize (VALUE self) { cairo_text_extents_t *extents; extents = ALLOC (cairo_text_extents_t); extents->x_bearing = 0.0; extents->y_bearing = -1.0; extents->width = 0.0; extents->height = 1.0; extents->x_advance = 1.0; extents->y_advance = 0.0; DATA_PTR (self) = extents; return Qnil; } static VALUE cr_text_extents_x_bearing (VALUE self) { return rb_float_new (_SELF(self)->x_bearing); } static VALUE cr_text_extents_set_x_bearing (VALUE self, VALUE x_bearing) { _SELF(self)->x_bearing = NUM2DBL (x_bearing); return Qnil; } static VALUE cr_text_extents_y_bearing (VALUE self) { return rb_float_new (_SELF(self)->y_bearing); } static VALUE cr_text_extents_set_y_bearing (VALUE self, VALUE y_bearing) { _SELF(self)->y_bearing = NUM2DBL (y_bearing); return Qnil; } static VALUE cr_text_extents_width (VALUE self) { return rb_float_new (_SELF(self)->width); } static VALUE cr_text_extents_set_width (VALUE self, VALUE width) { _SELF(self)->width = NUM2DBL (width); return Qnil; } static VALUE cr_text_extents_height (VALUE self) { return rb_float_new (_SELF(self)->height); } static VALUE cr_text_extents_set_height (VALUE self, VALUE height) { _SELF(self)->height = NUM2DBL (height); return Qnil; } static VALUE cr_text_extents_x_advance (VALUE self) { return rb_float_new (_SELF(self)->x_advance); } static VALUE cr_text_extents_set_x_advance (VALUE self, VALUE x_advance) { _SELF(self)->x_advance = NUM2DBL (x_advance); return Qnil; } static VALUE cr_text_extents_y_advance (VALUE self) { return rb_float_new (_SELF(self)->y_advance); } static VALUE cr_text_extents_set_y_advance (VALUE self, VALUE y_advance) { _SELF(self)->y_advance = NUM2DBL (y_advance); return Qnil; } static VALUE cr_text_extents_to_s (VALUE self) { VALUE ret; ret = rb_str_new2 ("#<"); rb_str_cat2 (ret, rb_class2name (CLASS_OF (self))); rb_str_cat2 (ret, ": "); rb_str_cat2 (ret, "x_bearing="); rb_str_concat (ret, rb_inspect (cr_text_extents_x_bearing (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "y_bearing="); rb_str_concat (ret, rb_inspect (cr_text_extents_y_bearing (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "width="); rb_str_concat (ret, rb_inspect (cr_text_extents_width (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "height="); rb_str_concat (ret, rb_inspect (cr_text_extents_height (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "x_advance="); rb_str_concat (ret, rb_inspect (cr_text_extents_x_advance (self))); rb_str_cat2 (ret, ", "); rb_str_cat2 (ret, "y_advance="); rb_str_concat (ret, rb_inspect (cr_text_extents_y_advance (self))); rb_str_cat2 (ret, ">"); return ret; } void Init_cairo_text_extents (void) { rb_cCairo_TextExtents = rb_define_class_under (rb_mCairo, "TextExtents", rb_cObject); rb_define_alloc_func (rb_cCairo_TextExtents, cr_text_extents_allocate); rb_define_method (rb_cCairo_TextExtents, "initialize", cr_text_extents_initialize, 0); rb_define_method (rb_cCairo_TextExtents, "x_bearing", cr_text_extents_x_bearing, 0); rb_define_method (rb_cCairo_TextExtents, "set_x_bearing", cr_text_extents_set_x_bearing, 1); rb_define_method (rb_cCairo_TextExtents, "y_bearing", cr_text_extents_y_bearing, 0); rb_define_method (rb_cCairo_TextExtents, "set_y_bearing", cr_text_extents_set_y_bearing, 1); rb_define_method (rb_cCairo_TextExtents, "width", cr_text_extents_width, 0); rb_define_method (rb_cCairo_TextExtents, "set_width", cr_text_extents_set_width, 1); rb_define_method (rb_cCairo_TextExtents, "height", cr_text_extents_height, 0); rb_define_method (rb_cCairo_TextExtents, "set_height", cr_text_extents_set_height, 1); rb_define_method (rb_cCairo_TextExtents, "x_advance", cr_text_extents_x_advance, 0); rb_define_method (rb_cCairo_TextExtents, "set_x_advance", cr_text_extents_set_x_advance, 1); rb_define_method (rb_cCairo_TextExtents, "y_advance", cr_text_extents_y_advance, 0); rb_define_method (rb_cCairo_TextExtents, "set_y_advance", cr_text_extents_set_y_advance, 1); rb_define_method (rb_cCairo_TextExtents, "to_s", cr_text_extents_to_s, 0); RB_CAIRO_DEF_SETTERS (rb_cCairo_TextExtents); } rcairo-1.16.6/extconf.rb000077500000000000000000000020541370612400100150550ustar00rootroot00000000000000#!/usr/bin/env ruby require 'pathname' require 'mkmf' require 'rbconfig' require 'fileutils' base_dir = Pathname(__FILE__).dirname.expand_path ext_dir = base_dir + "ext" + "cairo" ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG["EXEEXT"]) build_ext_dir = Pathname(".") + "ext" + "cairo" FileUtils.mkdir_p(build_ext_dir.to_s) Dir.chdir(build_ext_dir.to_s) do system(ruby, (ext_dir + "extconf.rb").to_s, *ARGV) || exit(false) end create_makefile("cairo") FileUtils.mv("Makefile", "Makefile.lib") File.open("Makefile", "w") do |makefile| makefile.puts(<<-EOM) all: (cd ext/cairo && $(MAKE)) $(MAKE) -f Makefile.lib install: (cd ext/cairo && $(MAKE) install) $(MAKE) -f Makefile.lib install site-install: (cd ext/cairo && $(MAKE) site-install) $(MAKE) -f Makefile.lib site-install clean: (cd ext/cairo && $(MAKE) clean) $(MAKE) -f Makefile.lib clean distclean: (cd ext/cairo && $(MAKE) distclean) $(MAKE) -f Makefile.lib distclean @rm -f Makefile.lib EOM end rcairo-1.16.6/lib/000077500000000000000000000000001370612400100136245ustar00rootroot00000000000000rcairo-1.16.6/lib/cairo.rb000066400000000000000000000065751370612400100152630ustar00rootroot00000000000000# vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 : if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM require "pathname" base_dir = Pathname(File.dirname(__FILE__)) base_dir = base_dir.parent + "vendor" + "local" if base_dir.exist? base_dir = base_dir.to_s.gsub(/\//, "\\") begin require "ruby_installer/runtime" rescue LoadError else RubyInstaller::Runtime.add_dll_directory("#{base_dir}\\bin") end ENV["PATH"] = %w(bin lib).collect do |dir| "#{base_dir}\\#{dir};" end.join("") + ENV["PATH"] else require "rbconfig" ENV["PATH"] = %w(bin lib).collect do |dir| "#{RbConfig::CONFIG["prefix"]}\\lib\\GTK\\#{dir};" end.join("") + ENV["PATH"] end end require "time" module Cairo class << self def __add_one_arg_setter(klass) names = klass.instance_methods(false) names.each do |name| if /^set_(.*)/ =~ name and not names.include? "#{$1}=" and klass.instance_method(name).arity == 1 klass.module_eval("def #{$1}=(val); set_#{$1}(val); val; end") end end end def normalize_const_name(name) name.to_s.upcase.gsub(/[\s\-_.]+/, "_") end end end require "cairo/color" require "cairo/paper" begin major, minor, _ = RUBY_VERSION.split(/\./) require "#{major}.#{minor}/cairo.so" rescue LoadError require "cairo.so" end require "cairo/constants" module Cairo class << self undef __add_one_arg_setter def bindings_version major, minor, micro, tag = BINDINGS_VERSION version = [major, minor, micro].join(".") version << "-#{tag}" if tag version end def exit_application(exception, status) puts("#{exception.class}: #{exception}") puts(exception.backtrace) exit(status) end end class Surface def dup raise NotImplementedError end def clone raise NotImplementedError end end if const_defined?("PSLevel") module PSLevel class << self def names list.collect {|version| name(version)} end end end end if const_defined?("SVGVersion") module SVGVersion class << self def names list.collect {|version| name(version)} end end end end if const_defined?("SVGSurface") class SVGSurface class << self def versions_as_string SVGVersion.names end def versions SVGVersion.list end def version_to_string(version) SVGVersion.name(version) end end end end class Matrix def dup Matrix.new(*to_a) end def clone copy = dup copy.freeze if self.frozen? copy end def translate(tx, ty); dup.translate!(tx, ty); end def scale(sx, sy); dup.scale!(sx, sy); end def rotate(radians); dup.rotate!(radians); end def invert; dup.invert!; end def multiply(other); dup.multiply!(other); end alias_method :*, :multiply end class FontOptions def merge(other) dup.merge!(other) end end end require "cairo/point" require "cairo/colors" require "cairo/papers" require "cairo/context" require "cairo/device" require "cairo/surface" require "cairo/pattern" require "cairo/path" require "cairo/region" module Cairo if const_defined?(:Win32Surface) WIN32Surface = Win32Surface # For backward compatibility end end rcairo-1.16.6/lib/cairo/000077500000000000000000000000001370612400100147215ustar00rootroot00000000000000rcairo-1.16.6/lib/cairo/color.rb000066400000000000000000000144141370612400100163700ustar00rootroot00000000000000module Cairo module Color module_function def parse(value, robust=false) return value.dup if value.is_a?(Base) case value when Array case value.first when :cmyk, :cmyka CMYK.new(*value[1..-1]) when :hsv, :hsva HSV.new(*value[1..-1]) else _, *value = value if [:rgb, :rgba].include?(value.first) RGB.new(*value) end when /\A\#/ parse_hex_color(value) when String, Symbol name = Cairo.normalize_const_name(value) begin const_get(name).dup rescue NameError raise ArgumentError, "unknown color name: #{value}" end else if robust raise ArgumentError, "can't parse as color name: #{value.inspect}" end value end end HEX_RE = "(?i:[a-f\\d])" def parse_hex_color(value) case value when /\A\#((?:#{HEX_RE}){3,4})\z/ RGB.new(*$1.scan(/./).collect {|part| part.hex / 15.0}) when /\A\#((?:#{HEX_RE}{2,2}){3,4})\z/ RGB.new(*$1.scan(/.{2,2}/).collect {|part| part.hex / 255.0}) when /\A\#((?:#{HEX_RE}{4,4}){3,4})\z/ RGB.new(*$1.scan(/.{4,4}/).collect {|part| part.hex / 65535.0}) else message = "invalid hex color format: #{value} should be " message << "\#RGB, \#RGBA, \#RRGGBB, \#RRGGBBAA, \#RRRRGGGGBBBB " message << "or \#RRRRGGGGBBBBAAAA" raise ArgumentError, message end end class Base attr_accessor :alpha alias_method :a, :alpha alias_method :a=, :alpha= def initialize(a) assert_in_range(a, "alpha channel") @alpha = a end private def assert_in_range(value, description) unless (0.0..1.0).include?(value) raise ArgumentError, "#{description} value should be in [0.0, 1.0]: #{value.inspect}" end end end class RGB < Base attr_accessor :red, :green, :blue alias_method :r, :red alias_method :r=, :red= alias_method :g, :green alias_method :g=, :green= alias_method :b, :blue alias_method :b=, :blue= def initialize(r, g, b, a=1.0) super(a) assert_in_range(r, "red") assert_in_range(g, "green") assert_in_range(b, "blue") @red = r @green = g @blue = b end def hash to_s.hash end def eql?(other) self == other end def ==(other) other.is_a?(self.class) and other.to_s == to_s end def to_a [@red, @green, @blue, @alpha] end alias_method :to_ary, :to_a def to_s "#%02X%02X%02X%02X" % to_a.collect {|v| (v * 255).round(1)} end def to_rgb clone end def to_cmyk cmy = [1.0 - @red, 1.0 - @green, 1.0 - @blue] key_plate = cmy.min if key_plate < 1.0 one_k = 1.0 - key_plate cmyk = cmy.collect {|value| (value - key_plate) / one_k} + [key_plate] else cmyk = [0, 0, 0, key_plate] end cmyka = cmyk + [@alpha] CMYK.new(*cmyka) end def to_hsv max = [@red, @blue, @green].max if max > 0 min = [@red, @blue, @green].min max_min = max - min case max when @red numerator = @green - @blue angle = 0 when @green numerator = @blue - @red angle = 120 when @blue numerator = @red - @green angle = 240 end h = max_min > 0 ? 60 * numerator / max_min + angle : 0.0 s = max_min / max else h = 0.0 s = 0.0 end v = max HSV.new(h, s, v, @alpha) end end class CMYK < Base attr_accessor :cyan, :magenta, :yellow, :key_plate alias_method :c, :cyan alias_method :c=, :cyan= alias_method :m, :magenta alias_method :m=, :magenta= alias_method :y, :yellow alias_method :y=, :yellow= alias_method :k, :key_plate alias_method :k=, :key_plate= def initialize(c, m, y, k, a=1.0) super(a) assert_in_range(c, "cyan") assert_in_range(m, "magenta") assert_in_range(y, "yellow") assert_in_range(k, "key plate") @cyan = c @magenta = m @yellow = y @key_plate = k end def to_a [@cyan, @magenta, @yellow, @key_plate, @alpha] end alias_method :to_ary, :to_a def to_rgb one_k = 1.0 - @key_plate rgba = [ (1.0 - @cyan) * one_k, (1.0 - @magenta) * one_k, (1.0 - @yellow) * one_k, @alpha, ] RGB.new(*rgba) end def to_cmyk clone end def to_hsv to_rgb.to_hsv end end class HSV < Base attr_accessor :hue, :saturation, :value alias_method :h, :hue alias_method :h=, :hue= alias_method :s, :saturation alias_method :s=, :saturation= alias_method :v, :value alias_method :v=, :value= def initialize(h, s, v, a=1.0) super(a) assert_in_range(s, "saturation") assert_in_range(v, "value") @hue = h.modulo(360.0) @saturation = s @value = v end def to_a [@hue, @saturation, @value, @alpha] end alias_method :to_ary, :to_a def to_rgb if s > 0 h_60 = @hue / 60.0 hi = h_60.floor.modulo(6) f = h_60 - hi p = @value * (1 - @saturation) q = @value * (1 - f * @saturation) t = @value * (1 - (1 - f) * @saturation) case hi when 0 rgb = [@value, t, p] when 1 rgb = [q, @value, p] when 2 rgb = [p, @value, t] when 3 rgb = [p, q, @value] when 4 rgb = [t, p, @value] when 5 rgb = [@value, p, q] end rgba = rgb + [@alpha] RGB.new(*rgba) else RGB.new(@value, @value, @value, @alpha) end end def to_cmyk to_rgb.to_cmyk end def to_hsv clone end end end end rcairo-1.16.6/lib/cairo/colors.rb000066400000000000000000006204021370612400100165530ustar00rootroot00000000000000require "cairo/color" module Cairo module Color # Absolute Zero: #0048BA: (0, 72, 186) ABSOLUTE_ZERO = RGB.new(0.0, 0.2823529411764706, 0.7294117647058823) # Acid green: #B0BF1A: (176, 191, 26) ACID_GREEN = RGB.new(0.6901960784313725, 0.7490196078431373, 0.10196078431372549) # Aero: #7CB9E8: (124, 185, 232) AERO = RGB.new(0.48627450980392156, 0.7254901960784313, 0.9098039215686274) # Aero blue: #C9FFE5: (201, 255, 229) AERO_BLUE = RGB.new(0.788235294117647, 1.0, 0.8980392156862745) # African violet: #B284BE: (178, 132, 190) AFRICAN_VIOLET = RGB.new(0.6980392156862745, 0.5176470588235295, 0.7450980392156863) # Alabama crimson: #AF002A: (175, 0, 42) ALABAMA_CRIMSON = RGB.new(0.6862745098039216, 0.0, 0.16470588235294117) # Alabaster: #F2F0E6: (242, 240, 230) ALABASTER = RGB.new(0.9490196078431372, 0.9411764705882353, 0.9019607843137255) # Alice blue: #F0F8FF: (240, 248, 255) ALICE_BLUE = RGB.new(0.9411764705882353, 0.9725490196078431, 1.0) # Alien Armpit: #84DE02: (132, 222, 2) ALIEN_ARMPIT = RGB.new(0.5176470588235295, 0.8705882352941177, 0.00784313725490196) # Alloy orange: #C46210: (196, 98, 16) ALLOY_ORANGE = RGB.new(0.7686274509803922, 0.3843137254901961, 0.06274509803921569) # Almond: #EFDECD: (239, 222, 205) ALMOND = RGB.new(0.9372549019607843, 0.8705882352941177, 0.803921568627451) # Amaranth: #E52B50: (229, 43, 80) AMARANTH = RGB.new(0.8980392156862745, 0.16862745098039217, 0.3137254901960784) # Amaranth deep purple: #9F2B68: (159, 43, 104) AMARANTH_DEEP_PURPLE = RGB.new(0.6235294117647059, 0.16862745098039217, 0.40784313725490196) # Amaranth pink: #F19CBB: (241, 156, 187) AMARANTH_PINK = RGB.new(0.9450980392156862, 0.611764705882353, 0.7333333333333333) # Amaranth purple: #AB274F: (171, 39, 79) AMARANTH_PURPLE = RGB.new(0.6705882352941176, 0.15294117647058825, 0.30980392156862746) # Amaranth red: #D3212D: (211, 33, 45) AMARANTH_RED = RGB.new(0.8274509803921568, 0.12941176470588237, 0.17647058823529413) # Amazon: #3B7A57: (59, 122, 87) AMAZON = RGB.new(0.23137254901960785, 0.47843137254901963, 0.3411764705882353) # Amber: #FFBF00: (255, 191, 0) AMBER = RGB.new(1.0, 0.7490196078431373, 0.0) # Amber (SAE/ECE): #FF7E00: (255, 126, 0) AMBER_SAE_ECE = RGB.new(1.0, 0.49411764705882355, 0.0) # Amethyst: #9966CC: (153, 102, 204) AMETHYST = RGB.new(0.6, 0.4, 0.8) # Android green: #A4C639: (164, 198, 57) ANDROID_GREEN = RGB.new(0.6431372549019608, 0.7764705882352941, 0.2235294117647059) # Anti-flash white: #F2F3F4: (242, 243, 244) ANTI_FLASH_WHITE = RGB.new(0.9490196078431372, 0.9529411764705882, 0.9568627450980393) # Antique brass: #CD9575: (205, 149, 117) ANTIQUE_BRASS = RGB.new(0.803921568627451, 0.5843137254901961, 0.4588235294117647) # Antique bronze: #665D1E: (102, 93, 30) ANTIQUE_BRONZE = RGB.new(0.4, 0.36470588235294116, 0.11764705882352941) # Antique fuchsia: #915C83: (145, 92, 131) ANTIQUE_FUCHSIA = RGB.new(0.5686274509803921, 0.3607843137254902, 0.5137254901960784) # Antique ruby: #841B2D: (132, 27, 45) ANTIQUE_RUBY = RGB.new(0.5176470588235295, 0.10588235294117647, 0.17647058823529413) # Antique white: #FAEBD7: (250, 235, 215) ANTIQUE_WHITE = RGB.new(0.9803921568627451, 0.9215686274509803, 0.8431372549019608) # Ao (English): #008000: (0, 128, 0) AO_ENGLISH = RGB.new(0.0, 0.5019607843137255, 0.0) # Apple: #66B447: (102, 180, 71) APPLE = RGB.new(0.4, 0.7058823529411765, 0.2784313725490196) # Apple green: #8DB600: (141, 182, 0) APPLE_GREEN = RGB.new(0.5529411764705883, 0.7137254901960784, 0.0) # Apricot: #FBCEB1: (251, 206, 177) APRICOT = RGB.new(0.984313725490196, 0.807843137254902, 0.6941176470588235) # Aqua: #00FFFF: (0, 255, 255) AQUA = RGB.new(0.0, 1.0, 1.0) # Aquamarine: #7FFFD4: (127, 255, 212) AQUAMARINE = RGB.new(0.4980392156862745, 1.0, 0.8313725490196079) # Arctic lime: #D0FF14: (208, 255, 20) ARCTIC_LIME = RGB.new(0.8156862745098039, 1.0, 0.0784313725490196) # Army green: #4B5320: (75, 83, 32) ARMY_GREEN = RGB.new(0.29411764705882354, 0.3254901960784314, 0.12549019607843137) # Artichoke: #8F9779: (143, 151, 121) ARTICHOKE = RGB.new(0.5607843137254902, 0.592156862745098, 0.4745098039215686) # Arylide yellow: #E9D66B: (233, 214, 107) ARYLIDE_YELLOW = RGB.new(0.9137254901960784, 0.8392156862745098, 0.4196078431372549) # Ash grey: #B2BEB5: (178, 190, 181) ASH_GREY = RGB.new(0.6980392156862745, 0.7450980392156863, 0.7098039215686275) # Asparagus: #87A96B: (135, 169, 107) ASPARAGUS = RGB.new(0.5294117647058824, 0.6627450980392157, 0.4196078431372549) # Atomic tangerine: #FF9966: (255, 153, 102) ATOMIC_TANGERINE = RGB.new(1.0, 0.6, 0.4) # Auburn: #A52A2A: (165, 42, 42) AUBURN = RGB.new(0.6470588235294118, 0.16470588235294117, 0.16470588235294117) # Aureolin: #FDEE00: (253, 238, 0) AUREOLIN = RGB.new(0.9921568627450981, 0.9333333333333333, 0.0) # AuroMetalSaurus: #6E7F80: (110, 127, 128) AUROMETALSAURUS = RGB.new(0.43137254901960786, 0.4980392156862745, 0.5019607843137255) # Avocado: #568203: (86, 130, 3) AVOCADO = RGB.new(0.33725490196078434, 0.5098039215686274, 0.011764705882352941) # Axolotl: #63775B: (99, 119, 91) AXOLOTL = RGB.new(0.38823529411764707, 0.4666666666666667, 0.3568627450980392) # Azure: #007FFF: (0, 127, 255) AZURE = RGB.new(0.0, 0.4980392156862745, 1.0) # Azure mist: #F0FFFF: (240, 255, 255) AZURE_MIST = RGB.new(0.9411764705882353, 1.0, 1.0) # B'dazzled blue: #2E5894: (46, 88, 149) BDAZZLED_BLUE = RGB.new(0.1803921568627451, 0.34509803921568627, 0.5843137254901961) # Baby blue: #89CFF0: (137, 207, 240) BABY_BLUE = RGB.new(0.5372549019607843, 0.8117647058823529, 0.9411764705882353) # Baby blue eyes: #A1CAF1: (161, 202, 241) BABY_BLUE_EYES = RGB.new(0.6313725490196078, 0.792156862745098, 0.9450980392156862) # Baby pink: #F4C2C2: (244, 194, 194) BABY_PINK = RGB.new(0.9568627450980393, 0.7607843137254902, 0.7607843137254902) # Baby powder: #FEFEFA: (254, 254, 250) BABY_POWDER = RGB.new(0.996078431372549, 0.996078431372549, 0.9803921568627451) # Baker-Miller pink: #FF91AF: (255, 145, 175) BAKER_MILLER_PINK = RGB.new(1.0, 0.5686274509803921, 0.6862745098039216) # Ball blue: #21ABCD: (33, 171, 205) BALL_BLUE = RGB.new(0.12941176470588237, 0.6705882352941176, 0.803921568627451) # Banana Mania: #FAE7B5: (250, 231, 181) BANANA_MANIA = RGB.new(0.9803921568627451, 0.9058823529411765, 0.7098039215686275) # Banana yellow: #FFE135: (255, 225, 53) BANANA_YELLOW = RGB.new(1.0, 0.8823529411764706, 0.20784313725490197) # Bangladesh green: #006A4E: (0, 106, 78) BANGLADESH_GREEN = RGB.new(0.0, 0.41568627450980394, 0.3058823529411765) # Barbie pink: #E0218A: (224, 33, 138) BARBIE_PINK = RGB.new(0.8784313725490196, 0.12941176470588237, 0.5411764705882353) # Barn red: #7C0A02: (124, 10, 2) BARN_RED = RGB.new(0.48627450980392156, 0.0392156862745098, 0.00784313725490196) # Battery charged blue: #1DACD6: (29, 172, 214) BATTERY_CHARGED_BLUE = RGB.new(0.11372549019607843, 0.6745098039215687, 0.8392156862745098) # Battleship grey: #848482: (132, 132, 130) BATTLESHIP_GREY = RGB.new(0.5176470588235295, 0.5176470588235295, 0.5098039215686274) # Bayside: #5FC9BF: (95, 201, 191) BAYSIDE = RGB.new(0.37254901960784315, 0.788235294117647, 0.7490196078431373) # Bazaar: #98777B: (152, 119, 123) BAZAAR = RGB.new(0.596078431372549, 0.4666666666666667, 0.4823529411764706) # Beau blue: #BCD4E6: (188, 212, 230) BEAU_BLUE = RGB.new(0.7372549019607844, 0.8313725490196079, 0.9019607843137255) # Begonia: #FA6E79: (250, 110, 121) BEGONIA = RGB.new(0.9803921568627451, 0.43137254901960786, 0.4745098039215686) # Beaver: #9F8170: (159, 129, 112) BEAVER = RGB.new(0.6235294117647059, 0.5058823529411764, 0.4392156862745098) # Beer: #F28E1C: (242, 142, 28) BEER = RGB.new(0.9490196078431372, 0.5568627450980392, 0.10980392156862745) # Beige: #F5F5DC: (245, 245, 220) BEIGE = RGB.new(0.9607843137254902, 0.9607843137254902, 0.8627450980392157) # Big dip o’ruby: #9C2542: (156, 37, 66) BIG_DIP_ORUBY = RGB.new(0.611764705882353, 0.1450980392156863, 0.25882352941176473) # Big Foot Feet: #E88E5A: (232, 142, 90) BIG_FOOT_FEET = RGB.new(0.9098039215686274, 0.5568627450980392, 0.35294117647058826) # Bisque: #FFE4C4: (255, 228, 196) BISQUE = RGB.new(1.0, 0.8941176470588236, 0.7686274509803922) # Bistre: #3D2B1F: (61, 43, 31) BISTRE = RGB.new(0.23921568627450981, 0.16862745098039217, 0.12156862745098039) # Bistre brown: #967117: (150, 113, 23) BISTRE_BROWN = RGB.new(0.5882352941176471, 0.44313725490196076, 0.09019607843137255) # Bitter lemon: #CAE00D: (202, 224, 13) BITTER_LEMON = RGB.new(0.792156862745098, 0.8784313725490196, 0.050980392156862744) # Bitter lime: #BFFF00: (191, 255, 0) BITTER_LIME = RGB.new(0.7490196078431373, 1.0, 0.0) # Bittersweet: #FE6F5E: (254, 111, 94) BITTERSWEET = RGB.new(0.996078431372549, 0.43529411764705883, 0.3686274509803922) # Bittersweet shimmer: #BF4F51: (191, 79, 81) BITTERSWEET_SHIMMER = RGB.new(0.7490196078431373, 0.30980392156862746, 0.3176470588235294) # Black: #000000: (0, 0, 0) BLACK = RGB.new(0.0, 0.0, 0.0) # Black bean: #3D0C02: (61, 12, 2) BLACK_BEAN = RGB.new(0.23921568627450981, 0.047058823529411764, 0.00784313725490196) # Black chocolate: #1B1811: (27, 24, 17) BLACK_CHOCOLATE = RGB.new(0.10588235294117647, 0.09411764705882353, 0.06666666666666667) # Black coffee: #3B2F2F: (59, 47, 47) BLACK_COFFEE = RGB.new(0.23137254901960785, 0.1843137254901961, 0.1843137254901961) # Black coral: #54626F: (84, 98, 111) BLACK_CORAL = RGB.new(0.32941176470588235, 0.3843137254901961, 0.43529411764705883) # Black leather jacket: #253529: (37, 53, 41) BLACK_LEATHER_JACKET = RGB.new(0.1450980392156863, 0.20784313725490197, 0.1607843137254902) # Black olive: #3B3C36: (59, 60, 54) BLACK_OLIVE = RGB.new(0.23137254901960785, 0.23529411764705882, 0.21176470588235294) # Blackberry: #8F5973: (143, 89, 115) BLACKBERRY = RGB.new(0.5607843137254902, 0.34901960784313724, 0.45098039215686275) # Black Shadows: #BFAFB2: (191, 175, 178) BLACK_SHADOWS = RGB.new(0.7490196078431373, 0.6862745098039216, 0.6980392156862745) # Blanched almond: #FFEBCD: (255, 235, 205) BLANCHED_ALMOND = RGB.new(1.0, 0.9215686274509803, 0.803921568627451) # Blast-off bronze: #A57164: (165, 113, 100) BLAST_OFF_BRONZE = RGB.new(0.6470588235294118, 0.44313725490196076, 0.39215686274509803) # Bleu de France: #318CE7: (49, 140, 231) BLEU_DE_FRANCE = RGB.new(0.19215686274509805, 0.5490196078431373, 0.9058823529411765) # Blizzard blue: #ACE5EE: (172, 229, 238) BLIZZARD_BLUE = RGB.new(0.6745098039215687, 0.8980392156862745, 0.9333333333333333) # Blond: #FAF0BE: (250, 240, 190) BLOND = RGB.new(0.9803921568627451, 0.9411764705882353, 0.7450980392156863) # Blood: #8A0303: (138, 3, 3) BLOOD = RGB.new(0.5411764705882353, 0.011764705882352941, 0.011764705882352941) # Blood orange: #D1001C: (210, 0, 27) BLOOD_ORANGE = RGB.new(0.8235294117647058, 0.0, 0.10588235294117647) # Blood red: #660000: (102, 0, 0) BLOOD_RED = RGB.new(0.4, 0.0, 0.0) # Blood (Animal): #A41313: (164, 19, 19) BLOOD_ANIMAL = RGB.new(0.6431372549019608, 0.07450980392156863, 0.07450980392156863) # Blood (organ): #630F0F: (99, 15, 15) BLOOD_ORGAN = RGB.new(0.38823529411764707, 0.058823529411764705, 0.058823529411764705) # Blue: #0000FF: (0, 0, 255) BLUE = RGB.new(0.0, 0.0, 1.0) # Blue (Crayola): #1F75FE: (31, 117, 254) BLUE_CRAYOLA = RGB.new(0.12156862745098039, 0.4588235294117647, 0.996078431372549) # Blue (Munsell): #0093AF: (0, 147, 175) BLUE_MUNSELL = RGB.new(0.0, 0.5764705882352941, 0.6862745098039216) # Blue (NCS): #0087BD: (0, 135, 189) BLUE_NCS = RGB.new(0.0, 0.5294117647058824, 0.7411764705882353) # Blue (Pantone): #0018A8: (0, 24, 168) BLUE_PANTONE = RGB.new(0.0, 0.09411764705882353, 0.6588235294117647) # Blue (pigment): #333399: (51, 51, 153) BLUE_PIGMENT = RGB.new(0.2, 0.2, 0.6) # Blue (RYB): #0247FE: (2, 71, 254) BLUE_RYB = RGB.new(0.00784313725490196, 0.2784313725490196, 0.996078431372549) # Blue bell: #A2A2D0: (162, 162, 208) BLUE_BELL = RGB.new(0.6352941176470588, 0.6352941176470588, 0.8156862745098039) # Blue bolt: #00B9FB: (0, 185, 251) BLUE_BOLT = RGB.new(0.0, 0.7254901960784313, 0.984313725490196) # Blue cola: #0088DC: (0, 136, 220) BLUE_COLA = RGB.new(0.0, 0.5333333333333333, 0.8627450980392157) # Blue-gray: #6699CC: (102, 153, 204) BLUE_GRAY = RGB.new(0.4, 0.6, 0.8) # Blue-green: #0D98BA: (13, 152, 186) BLUE_GREEN = RGB.new(0.050980392156862744, 0.596078431372549, 0.7294117647058823) # Blue-green (color wheel): #064E40: (6, 78, 64) BLUE_GREEN_COLOR_WHEEL = RGB.new(0.023529411764705882, 0.3058823529411765, 0.25098039215686274) # Blue jeans: #5DADEC: (93, 173, 236) BLUE_JEANS = RGB.new(0.36470588235294116, 0.6784313725490196, 0.9254901960784314) # Blue lagoon: #ACE5EE: (172, 229, 238) BLUE_LAGOON = RGB.new(0.6745098039215687, 0.8980392156862745, 0.9333333333333333) # Blue-magenta violet: #553592: (85, 53, 146) BLUE_MAGENTA_VIOLET = RGB.new(0.3333333333333333, 0.20784313725490197, 0.5725490196078431) # Blue raspberry: #0CBFE9: (12, 191, 233) BLUE_RASPBERRY = RGB.new(0.047058823529411764, 0.7490196078431373, 0.9137254901960784) # Blue sapphire: #126180: (18, 97, 128) BLUE_SAPPHIRE = RGB.new(0.07058823529411765, 0.3803921568627451, 0.5019607843137255) # Blue-violet: #8A2BE2: (138, 43, 226) BLUE_VIOLET = RGB.new(0.5411764705882353, 0.16862745098039217, 0.8862745098039215) # Blue-violet (Crayola): #7366BD: (115, 102, 189) BLUE_VIOLET_CRAYOLA = RGB.new(0.45098039215686275, 0.4, 0.7411764705882353) # Blue-violet (color wheel): #4D1A7F: (77, 26, 127) BLUE_VIOLET_COLOR_WHEEL = RGB.new(0.30196078431372547, 0.10196078431372549, 0.4980392156862745) # Blue yonder: #5072A7: (80, 114, 167) BLUE_YONDER = RGB.new(0.3137254901960784, 0.4470588235294118, 0.6549019607843137) # Blueberry: #4F86F7: (79, 134, 247) BLUEBERRY = RGB.new(0.30980392156862746, 0.5254901960784314, 0.9686274509803922) # Bluebonnet: #1C1CF0: (28, 28, 240) BLUEBONNET = RGB.new(0.10980392156862745, 0.10980392156862745, 0.9411764705882353) # Blush: #DE5D83: (222, 93, 131) BLUSH = RGB.new(0.8705882352941177, 0.36470588235294116, 0.5137254901960784) # Bole: #79443B: (121, 68, 59) BOLE = RGB.new(0.4745098039215686, 0.26666666666666666, 0.23137254901960785) # Bondi blue: #0095B6: (0, 149, 182) BONDI_BLUE = RGB.new(0.0, 0.5843137254901961, 0.7137254901960784) # Bone: #E3DAC9: (227, 218, 201) BONE = RGB.new(0.8901960784313725, 0.8549019607843137, 0.788235294117647) # Booger Buster: #DDE26A: (221, 226, 106) BOOGER_BUSTER = RGB.new(0.8666666666666667, 0.8862745098039215, 0.41568627450980394) # Boston University red: #CC0000: (204, 0, 0) BOSTON_UNIVERSITY_RED = RGB.new(0.8, 0.0, 0.0) # Bottle green: #006A4E: (0, 106, 78) BOTTLE_GREEN = RGB.new(0.0, 0.41568627450980394, 0.3058823529411765) # Boysenberry: #873260: (135, 50, 96) BOYSENBERRY = RGB.new(0.5294117647058824, 0.19607843137254902, 0.3764705882352941) # Brandeis blue: #0070FF: (0, 112, 255) BRANDEIS_BLUE = RGB.new(0.0, 0.4392156862745098, 1.0) # Brandy: #87413F: (135, 65, 63) BRANDY = RGB.new(0.5294117647058824, 0.2549019607843137, 0.24705882352941178) # Brave orange: #FF631C: (255, 99, 28) BRAVE_ORANGE = RGB.new(1.0, 0.38823529411764707, 0.10980392156862745) # Brick red: #CB4154: (203, 65, 84) BRICK_RED = RGB.new(0.796078431372549, 0.2549019607843137, 0.32941176470588235) # Bright cerulean: #1DACD6: (29, 172, 214) BRIGHT_CERULEAN = RGB.new(0.11372549019607843, 0.6745098039215687, 0.8392156862745098) # Bright gray: #EBECF0: (235, 236, 240) BRIGHT_GRAY = RGB.new(0.9215686274509803, 0.9254901960784314, 0.9411764705882353) # Bright green: #66FF00: (102, 255, 0) BRIGHT_GREEN = RGB.new(0.4, 1.0, 0.0) # Briquette: #E0475C: (224, 71, 92) BRIQUETTE = RGB.new(0.8784313725490196, 0.2784313725490196, 0.3607843137254902) # Bright lavender: #BF94E4: (191, 148, 228) BRIGHT_LAVENDER = RGB.new(0.7490196078431373, 0.5803921568627451, 0.8941176470588236) # Bright lilac: #D891EF: (216, 145, 239) BRIGHT_LILAC = RGB.new(0.8470588235294118, 0.5686274509803921, 0.9372549019607843) # Bright maroon: #C32148: (195, 33, 72) BRIGHT_MAROON = RGB.new(0.7647058823529411, 0.12941176470588237, 0.2823529411764706) # Bright navy blue: #1974D2: (25, 116, 210) BRIGHT_NAVY_BLUE = RGB.new(0.09803921568627451, 0.4549019607843137, 0.8235294117647058) # Bright pink: #FF007F: (255, 0, 127) BRIGHT_PINK = RGB.new(1.0, 0.0, 0.4980392156862745) # Bright turquoise: #08E8DE: (8, 232, 222) BRIGHT_TURQUOISE = RGB.new(0.03137254901960784, 0.9098039215686274, 0.8705882352941177) # Bright ube: #D19FE8: (209, 159, 232) BRIGHT_UBE = RGB.new(0.8196078431372549, 0.6235294117647059, 0.9098039215686274) # Bright yellow (Crayola): #FFAA1D: (255, 170, 29) BRIGHT_YELLOW_CRAYOLA = RGB.new(1.0, 0.6666666666666666, 0.11372549019607843) # Brilliant azure: #3399FF: (51, 153, 255) BRILLIANT_AZURE = RGB.new(0.2, 0.6, 1.0) # Brilliant lavender: #F4BBFF: (244, 187, 255) BRILLIANT_LAVENDER = RGB.new(0.9568627450980393, 0.7333333333333333, 1.0) # Brilliant rose: #FF55A3: (255, 85, 163) BRILLIANT_ROSE = RGB.new(1.0, 0.3333333333333333, 0.6392156862745098) # Brink pink: #FB607F: (251, 96, 127) BRINK_PINK = RGB.new(0.984313725490196, 0.3764705882352941, 0.4980392156862745) # British racing green: #004225: (0, 66, 37) BRITISH_RACING_GREEN = RGB.new(0.0, 0.25882352941176473, 0.1450980392156863) # Bronze: #88540B: (136, 84, 11) BRONZE = RGB.new(0.5333333333333333, 0.32941176470588235, 0.043137254901960784) # Bronze (metallic): #B08D57: (176, 140, 86) BRONZE_METALLIC = RGB.new(0.6901960784313725, 0.5490196078431373, 0.33725490196078434) # Bronze yellow: #737000: (115, 112, 0) BRONZE_YELLOW = RGB.new(0.45098039215686275, 0.4392156862745098, 0.0) # Brown: #993300: (153, 51, 0) BROWN = RGB.new(0.6, 0.2, 0.0) # Brown (Crayola): #AF593E: (175, 89, 62) BROWN_CRAYOLA = RGB.new(0.6862745098039216, 0.34901960784313724, 0.24313725490196078) # Brown (traditional): #964B00: (150, 75, 0) BROWN_TRADITIONAL = RGB.new(0.5882352941176471, 0.29411764705882354, 0.0) # Brown (web): #A52A2A: (165, 42, 42) BROWN_WEB = RGB.new(0.6470588235294118, 0.16470588235294117, 0.16470588235294117) # Brown-nose: #6B4423: (107, 68, 35) BROWN_NOSE = RGB.new(0.4196078431372549, 0.26666666666666666, 0.13725490196078433) # Brown sugar: #AF6E4D: (175, 110, 77) BROWN_SUGAR = RGB.new(0.6862745098039216, 0.43137254901960786, 0.30196078431372547) # Brunswick green: #1B4D3E: (27, 77, 62) BRUNSWICK_GREEN = RGB.new(0.10588235294117647, 0.30196078431372547, 0.24313725490196078) # Bubble gum: #FFC1CC: (255, 193, 204) BUBBLE_GUM = RGB.new(1.0, 0.7568627450980392, 0.8) # Bubbles: #E7FEFF: (231, 254, 255) BUBBLES = RGB.new(0.9058823529411765, 0.996078431372549, 1.0) # Bud green: #7BB661: (123, 182, 97) BUD_GREEN = RGB.new(0.4823529411764706, 0.7137254901960784, 0.3803921568627451) # Buff: #F0DC82: (240, 220, 130) BUFF = RGB.new(0.9411764705882353, 0.8627450980392157, 0.5098039215686274) # Bulgarian rose: #480607: (72, 6, 7) BULGARIAN_ROSE = RGB.new(0.2823529411764706, 0.023529411764705882, 0.027450980392156862) # Burgundy: #800020: (128, 0, 32) BURGUNDY = RGB.new(0.5019607843137255, 0.0, 0.12549019607843137) # Burlywood: #DEB887: (222, 184, 135) BURLYWOOD = RGB.new(0.8705882352941177, 0.7215686274509804, 0.5294117647058824) # Burnished brown: #A17A74: (161, 122, 116) BURNISHED_BROWN = RGB.new(0.6313725490196078, 0.47843137254901963, 0.4549019607843137) # Burnt orange: #CC5500: (204, 85, 0) BURNT_ORANGE = RGB.new(0.8, 0.3333333333333333, 0.0) # Burnt sienna: #E97451: (233, 116, 81) BURNT_SIENNA = RGB.new(0.9137254901960784, 0.4549019607843137, 0.3176470588235294) # Burnt umber: #8A3324: (138, 51, 36) BURNT_UMBER = RGB.new(0.5411764705882353, 0.2, 0.1411764705882353) # Button blue: #24A0ED: (36, 160, 237) BUTTON_BLUE = RGB.new(0.1411764705882353, 0.6274509803921569, 0.9294117647058824) # Byzantine: #BD33A4: (189, 51, 164) BYZANTINE = RGB.new(0.7411764705882353, 0.2, 0.6431372549019608) # Byzantium: #702963: (112, 41, 99) BYZANTIUM = RGB.new(0.4392156862745098, 0.1607843137254902, 0.38823529411764707) # Cadet: #536872: (83, 104, 114) CADET = RGB.new(0.3254901960784314, 0.40784313725490196, 0.4470588235294118) # Cadet blue: #5F9EA0: (95, 158, 160) CADET_BLUE = RGB.new(0.37254901960784315, 0.6196078431372549, 0.6274509803921569) # Cadet blue (Crayola): #A9B2C3: (169, 178, 195) CADET_BLUE_CRAYOLA = RGB.new(0.6627450980392157, 0.6980392156862745, 0.7647058823529411) # Cadet grey: #91A3B0: (145, 163, 176) CADET_GREY = RGB.new(0.5686274509803921, 0.6392156862745098, 0.6901960784313725) # Cadmium blue: #0A1195: (10, 17, 146) CADMIUM_BLUE = RGB.new(0.0392156862745098, 0.06666666666666667, 0.5725490196078431) # Cadmium green: #006B3C: (0, 107, 60) CADMIUM_GREEN = RGB.new(0.0, 0.4196078431372549, 0.23529411764705882) # Cadmium orange: #ED872D: (237, 135, 45) CADMIUM_ORANGE = RGB.new(0.9294117647058824, 0.5294117647058824, 0.17647058823529413) # Cadmium purple: #B60C26: (182, 12, 38) CADMIUM_PURPLE = RGB.new(0.7137254901960784, 0.047058823529411764, 0.14901960784313725) # Cadmium red: #E30022: (227, 0, 34) CADMIUM_RED = RGB.new(0.8901960784313725, 0.0, 0.13333333333333333) # Cadmium yellow: #FFF600: (255, 246, 0) CADMIUM_YELLOW = RGB.new(1.0, 0.9647058823529412, 0.0) # Cadmium violet: #7F3E98: (127, 62, 152) CADMIUM_VIOLET = RGB.new(0.4980392156862745, 0.24313725490196078, 0.596078431372549) # Café au lait: #A67B5B: (166, 123, 91) CAFE_AU_LAIT = RGB.new(0.6509803921568628, 0.4823529411764706, 0.3568627450980392) # Café noir: #4B3621: (75, 54, 33) CAFE_NOIR = RGB.new(0.29411764705882354, 0.21176470588235294, 0.12941176470588237) # Cal Poly Pomona green: #1E4D2B: (30, 77, 43) CAL_POLY_POMONA_GREEN = RGB.new(0.11764705882352941, 0.30196078431372547, 0.16862745098039217) # Calamansi: #FCFFA4: (252, 255, 164) CALAMANSI = RGB.new(0.9882352941176471, 1.0, 0.6431372549019608) # Cambridge blue: #A3C1AD: (163, 193, 173) CAMBRIDGE_BLUE = RGB.new(0.6392156862745098, 0.7568627450980392, 0.6784313725490196) # Camel: #C19A6B: (193, 154, 107) CAMEL = RGB.new(0.7568627450980392, 0.6039215686274509, 0.4196078431372549) # Cameo pink: #EFBBCC: (239, 187, 204) CAMEO_PINK = RGB.new(0.9372549019607843, 0.7333333333333333, 0.8) # Camouflage green: #78866B: (120, 134, 107) CAMOUFLAGE_GREEN = RGB.new(0.47058823529411764, 0.5254901960784314, 0.4196078431372549) # Canary: #FFFF99: (255, 255, 153) CANARY = RGB.new(1.0, 1.0, 0.6) # Canary yellow: #FFEF00: (255, 239, 0) CANARY_YELLOW = RGB.new(1.0, 0.9372549019607843, 0.0) # Candy apple red: #FF0800: (255, 8, 0) CANDY_APPLE_RED = RGB.new(1.0, 0.03137254901960784, 0.0) # Candy pink: #E4717A: (228, 113, 122) CANDY_PINK = RGB.new(0.8941176470588236, 0.44313725490196076, 0.47843137254901963) # Capri: #00BFFF: (0, 191, 255) CAPRI = RGB.new(0.0, 0.7490196078431373, 1.0) # Caput mortuum: #592720: (89, 39, 32) CAPUT_MORTUUM = RGB.new(0.34901960784313724, 0.15294117647058825, 0.12549019607843137) # Caramel: #FFD59A: (255, 213, 154) CARAMEL = RGB.new(1.0, 0.8352941176470589, 0.6039215686274509) # Cardinal: #C41E3A: (196, 30, 58) CARDINAL = RGB.new(0.7686274509803922, 0.11764705882352941, 0.22745098039215686) # Caribbean green: #00CC99: (0, 204, 153) CARIBBEAN_GREEN = RGB.new(0.0, 0.8, 0.6) # Carmine: #960018: (150, 0, 24) CARMINE = RGB.new(0.5882352941176471, 0.0, 0.09411764705882353) # Rich Carmine: #D70040: (215, 0, 64) RICH_CARMINE = RGB.new(0.8431372549019608, 0.0, 0.25098039215686274) # Carmine pink: #EB4C42: (235, 76, 66) CARMINE_PINK = RGB.new(0.9215686274509803, 0.2980392156862745, 0.25882352941176473) # Carmine red: #FF0038: (255, 0, 56) CARMINE_RED = RGB.new(1.0, 0.0, 0.2196078431372549) # Carnation pink: #FFA6C9: (255, 166, 201) CARNATION_PINK = RGB.new(1.0, 0.6509803921568628, 0.788235294117647) # Carnelian: #B31B1B: (179, 27, 27) CARNELIAN = RGB.new(0.7019607843137254, 0.10588235294117647, 0.10588235294117647) # Carolina blue: #56A0D3: (86, 160, 211) CAROLINA_BLUE = RGB.new(0.33725490196078434, 0.6274509803921569, 0.8274509803921568) # Carrot orange: #ED9121: (237, 145, 33) CARROT_ORANGE = RGB.new(0.9294117647058824, 0.5686274509803921, 0.12941176470588237) # Castleton green: #00563F: (0, 86, 63) CASTLETON_GREEN = RGB.new(0.0, 0.33725490196078434, 0.24705882352941178) # Catalina blue: #062A78: (6, 42, 120) CATALINA_BLUE = RGB.new(0.023529411764705882, 0.16470588235294117, 0.47058823529411764) # Catawba: #703642: (112, 54, 66) CATAWBA = RGB.new(0.4392156862745098, 0.21176470588235294, 0.25882352941176473) # Cedar Chest: #C95A49: (201, 90, 73) CEDAR_CHEST = RGB.new(0.788235294117647, 0.35294117647058826, 0.28627450980392155) # Ceil: #92A1CF: (146, 161, 207) CEIL = RGB.new(0.5725490196078431, 0.6313725490196078, 0.8117647058823529) # Celadon: #ACE1AF: (172, 225, 175) CELADON = RGB.new(0.6745098039215687, 0.8823529411764706, 0.6862745098039216) # Celadon blue: #007BA7: (0, 123, 167) CELADON_BLUE = RGB.new(0.0, 0.4823529411764706, 0.6549019607843137) # Celadon green: #2F847C: (47, 132, 124) CELADON_GREEN = RGB.new(0.1843137254901961, 0.5176470588235295, 0.48627450980392156) # Celeste: #B2FFFF: (178, 255, 255) CELESTE = RGB.new(0.6980392156862745, 1.0, 1.0) # Celestial blue: #4997D0: (73, 151, 208) CELESTIAL_BLUE = RGB.new(0.28627450980392155, 0.592156862745098, 0.8156862745098039) # Celtic blue: #246BCE: (36, 107, 206) CELTIC_BLUE = RGB.new(0.1411764705882353, 0.4196078431372549, 0.807843137254902) # Cerise: #DE3163: (222, 49, 99) CERISE = RGB.new(0.8705882352941177, 0.19215686274509805, 0.38823529411764707) # Cerise pink: #EC3B83: (236, 59, 131) CERISE_PINK = RGB.new(0.9254901960784314, 0.23137254901960785, 0.5137254901960784) # Cerulean: #007BA7: (0, 123, 167) CERULEAN = RGB.new(0.0, 0.4823529411764706, 0.6549019607843137) # Cerulean blue: #2A52BE: (42, 82, 190) CERULEAN_BLUE = RGB.new(0.16470588235294117, 0.3215686274509804, 0.7450980392156863) # Cetacean blue: #001440: (0, 20, 64) CETACEAN_BLUE = RGB.new(0.0, 0.0784313725490196, 0.25098039215686274) # Cerulean frost: #6D9BC3: (109, 155, 195) CERULEAN_FROST = RGB.new(0.42745098039215684, 0.6078431372549019, 0.7647058823529411) # Cerulean (Crayola): #1DACD6: (29, 172, 214) CERULEAN_CRAYOLA = RGB.new(0.11372549019607843, 0.6745098039215687, 0.8392156862745098) # CG blue: #007AA5: (0, 122, 165) CG_BLUE = RGB.new(0.0, 0.47843137254901963, 0.6470588235294118) # CG Red: #E03C31: (224, 60, 49) CG_RED = RGB.new(0.8784313725490196, 0.23529411764705882, 0.19215686274509805) # Chambray: #ADBFC8: (173, 191, 200) CHAMBRAY = RGB.new(0.6784313725490196, 0.7490196078431373, 0.7843137254901961) # Chamoisee: #A0785A: (160, 120, 90) CHAMOISEE = RGB.new(0.6274509803921569, 0.47058823529411764, 0.35294117647058826) # Champagne: #F7E7CE: (247, 231, 206) CHAMPAGNE = RGB.new(0.9686274509803922, 0.9058823529411765, 0.807843137254902) # Champagne pink: #F1DDCF: (241, 221, 207) CHAMPAGNE_PINK = RGB.new(0.9450980392156862, 0.8666666666666667, 0.8117647058823529) # Charcoal: #36454F: (54, 69, 79) CHARCOAL = RGB.new(0.21176470588235294, 0.27058823529411763, 0.30980392156862746) # Charleston green: #232B2B: (35, 43, 43) CHARLESTON_GREEN = RGB.new(0.13725490196078433, 0.16862745098039217, 0.16862745098039217) # Charm: #D0748B: (208, 116, 139) CHARM = RGB.new(0.8156862745098039, 0.4549019607843137, 0.5450980392156862) # Charm pink: #E68FAC: (230, 143, 172) CHARM_PINK = RGB.new(0.9019607843137255, 0.5607843137254902, 0.6745098039215687) # Chartreuse (traditional): #DFFF00: (223, 255, 0) CHARTREUSE_TRADITIONAL = RGB.new(0.8745098039215686, 1.0, 0.0) # Chartreuse (web): #7FFF00: (127, 255, 0) CHARTREUSE_WEB = RGB.new(0.4980392156862745, 1.0, 0.0) # Cheese: #FFA600: (255, 166, 0) CHEESE = RGB.new(1.0, 0.6509803921568628, 0.0) # Cherry: #DE3163: (222, 49, 99) CHERRY = RGB.new(0.8705882352941177, 0.19215686274509805, 0.38823529411764707) # Cherry blossom pink: #FFB7C5: (255, 183, 197) CHERRY_BLOSSOM_PINK = RGB.new(1.0, 0.7176470588235294, 0.7725490196078432) # Chestnut: #954535: (149, 69, 53) CHESTNUT = RGB.new(0.5843137254901961, 0.27058823529411763, 0.20784313725490197) # China pink: #DE6FA1: (222, 111, 161) CHINA_PINK = RGB.new(0.8705882352941177, 0.43529411764705883, 0.6313725490196078) # China rose: #A8516E: (168, 81, 110) CHINA_ROSE = RGB.new(0.6588235294117647, 0.3176470588235294, 0.43137254901960786) # Chinese black: #141414: (20, 20, 20) CHINESE_BLACK = RGB.new(0.0784313725490196, 0.0784313725490196, 0.0784313725490196) # Chinese blue: #365194: (54, 81, 148) CHINESE_BLUE = RGB.new(0.21176470588235294, 0.3176470588235294, 0.5803921568627451) # Chinese bronze: #CD8032: (205, 128, 50) CHINESE_BRONZE = RGB.new(0.803921568627451, 0.5019607843137255, 0.19607843137254902) # Chinese brown: #AB381F: (170, 56, 30) CHINESE_BROWN = RGB.new(0.6666666666666666, 0.2196078431372549, 0.11764705882352941) # Chinese green: #D0DB61: (208, 219, 97) CHINESE_GREEN = RGB.new(0.8156862745098039, 0.8588235294117647, 0.3803921568627451) # Chinese gold: #CC9900: (204, 153, 0) CHINESE_GOLD = RGB.new(0.8, 0.6, 0.0) # Chinese orange: #F37042: (243, 112, 66) CHINESE_ORANGE = RGB.new(0.9529411764705882, 0.4392156862745098, 0.25882352941176473) # Chinese pink: #DE70A1: (222, 112, 161) CHINESE_PINK = RGB.new(0.8705882352941177, 0.4392156862745098, 0.6313725490196078) # Chinese purple: #720B98: (114, 11, 152) CHINESE_PURPLE = RGB.new(0.4470588235294118, 0.043137254901960784, 0.596078431372549) # Chinese red: #CD071E: (205, 7, 30) CHINESE_RED = RGB.new(0.803921568627451, 0.027450980392156862, 0.11764705882352941) # Chinese silver: #CCCCCC: (204, 204, 204) CHINESE_SILVER = RGB.new(0.8, 0.8, 0.8) # Chinese violet: #856088: (133, 96, 136) CHINESE_VIOLET = RGB.new(0.5215686274509804, 0.3764705882352941, 0.5333333333333333) # Chinese white: #E2E5DE: (226, 229, 222) CHINESE_WHITE = RGB.new(0.8862745098039215, 0.8980392156862745, 0.8705882352941177) # Chinese yellow: #FFB200: (255, 178, 0) CHINESE_YELLOW = RGB.new(1.0, 0.6980392156862745, 0.0) # Chlorophyll green: #4AFF00: (74, 255, 0) CHLOROPHYLL_GREEN = RGB.new(0.2901960784313726, 1.0, 0.0) # Chocolate brown: #3F000F: (63, 0, 15) CHOCOLATE_BROWN = RGB.new(0.24705882352941178, 0.0, 0.058823529411764705) # Chocolate cosmos: #58111A: (88, 17, 26) CHOCOLATE_COSMOS = RGB.new(0.34509803921568627, 0.06666666666666667, 0.10196078431372549) # Chocolate Kisses: #3C1421: (60, 20, 33) CHOCOLATE_KISSES = RGB.new(0.23529411764705882, 0.0784313725490196, 0.12941176470588237) # Chocolate (traditional): #7B3F00: (123, 63, 0) CHOCOLATE_TRADITIONAL = RGB.new(0.4823529411764706, 0.24705882352941178, 0.0) # Chocolate (web): #D2691E: (210, 105, 30) CHOCOLATE_WEB = RGB.new(0.8235294117647058, 0.4117647058823529, 0.11764705882352941) # Christmas blue: #2A8FBD: (42, 143, 189) CHRISTMAS_BLUE = RGB.new(0.16470588235294117, 0.5607843137254902, 0.7411764705882353) # Christmas brown: #5D2B2C: (93, 43, 44) CHRISTMAS_BROWN = RGB.new(0.36470588235294116, 0.16862745098039217, 0.17254901960784313) # Christmas green: #3C8D0D: (60, 141, 13) CHRISTMAS_GREEN = RGB.new(0.23529411764705882, 0.5529411764705883, 0.050980392156862744) # Christmas gold: #CAA906: (202, 169, 6) CHRISTMAS_GOLD = RGB.new(0.792156862745098, 0.6627450980392157, 0.023529411764705882) # Christmas orange: #FF6600: (255, 102, 0) CHRISTMAS_ORANGE = RGB.new(1.0, 0.4, 0.0) # Christmas pink: #FFCCCB: (255, 204, 203) CHRISTMAS_PINK = RGB.new(1.0, 0.8, 0.796078431372549) # Christmas purple: #663398: (102, 51, 152) CHRISTMAS_PURPLE = RGB.new(0.4, 0.2, 0.596078431372549) # Christmas red: #AA0114: (170, 1, 20) CHRISTMAS_RED = RGB.new(0.6666666666666666, 0.00392156862745098, 0.0784313725490196) # Christmas silver: #E1DFE0: (225, 223, 224) CHRISTMAS_SILVER = RGB.new(0.8823529411764706, 0.8745098039215686, 0.8784313725490196) # Christmas yellow: #FFCC00: (255, 204, 0) CHRISTMAS_YELLOW = RGB.new(1.0, 0.8, 0.0) # Chrome yellow: #FFA700: (255, 167, 0) CHROME_YELLOW = RGB.new(1.0, 0.6549019607843137, 0.0) # Cinereous: #98817B: (152, 129, 123) CINEREOUS = RGB.new(0.596078431372549, 0.5058823529411764, 0.4823529411764706) # Cinnabar: #E34234: (227, 66, 52) CINNABAR = RGB.new(0.8901960784313725, 0.25882352941176473, 0.20392156862745098) # Cinnamon: #D2691E: (210, 105, 30) CINNAMON = RGB.new(0.8235294117647058, 0.4117647058823529, 0.11764705882352941) # Cinnamon Satin: #CD607E: (205, 96, 126) CINNAMON_SATIN = RGB.new(0.803921568627451, 0.3764705882352941, 0.49411764705882355) # Citrine: #E4D00A: (228, 208, 10) CITRINE = RGB.new(0.8941176470588236, 0.8156862745098039, 0.0392156862745098) # Citrine Brown: #933709: (147, 55, 9) CITRINE_BROWN = RGB.new(0.5764705882352941, 0.21568627450980393, 0.03529411764705882) # Citron: #9FA91F: (158, 169, 31) CITRON = RGB.new(0.6196078431372549, 0.6627450980392157, 0.12156862745098039) # Claret: #7F1734: (127, 23, 52) CLARET = RGB.new(0.4980392156862745, 0.09019607843137255, 0.20392156862745098) # Classic rose: #FBCCE7: (251, 204, 231) CLASSIC_ROSE = RGB.new(0.984313725490196, 0.8, 0.9058823529411765) # Cobalt blue: #0047AB: (0, 71, 171) COBALT_BLUE = RGB.new(0.0, 0.2784313725490196, 0.6705882352941176) # Cocoa brown: #D2691E: (210, 105, 30) COCOA_BROWN = RGB.new(0.8235294117647058, 0.4117647058823529, 0.11764705882352941) # Coconut: #965A3E: (150, 90, 62) COCONUT = RGB.new(0.5882352941176471, 0.35294117647058826, 0.24313725490196078) # Coffee: #6F4E37: (111, 78, 55) COFFEE = RGB.new(0.43529411764705883, 0.3058823529411765, 0.21568627450980393) # Cola: #3C3024: (60, 48, 36) COLA = RGB.new(0.23529411764705882, 0.18823529411764706, 0.1411764705882353) # Columbia Blue: #C4D8E2: (196, 216, 226) COLUMBIA_BLUE = RGB.new(0.7686274509803922, 0.8470588235294118, 0.8862745098039215) # Conditioner: #FFFFCC: (255, 255, 204) CONDITIONER = RGB.new(1.0, 1.0, 0.8) # Congo pink: #F88379: (248, 131, 121) CONGO_PINK = RGB.new(0.9725490196078431, 0.5137254901960784, 0.4745098039215686) # Cool black: #002E63: (0, 46, 99) COOL_BLACK = RGB.new(0.0, 0.1803921568627451, 0.38823529411764707) # Cool grey: #8C92AC: (140, 146, 172) COOL_GREY = RGB.new(0.5490196078431373, 0.5725490196078431, 0.6745098039215687) # Cookies and cream: #EEE0B1: (238, 224, 177) COOKIES_AND_CREAM = RGB.new(0.9333333333333333, 0.8784313725490196, 0.6941176470588235) # Copper: #B87333: (184, 115, 51) COPPER = RGB.new(0.7215686274509804, 0.45098039215686275, 0.2) # Copper (Crayola): #DA8A67: (218, 138, 103) COPPER_CRAYOLA = RGB.new(0.8549019607843137, 0.5411764705882353, 0.403921568627451) # Copper penny: #AD6F69: (173, 111, 105) COPPER_PENNY = RGB.new(0.6784313725490196, 0.43529411764705883, 0.4117647058823529) # Copper red: #CB6D51: (203, 109, 81) COPPER_RED = RGB.new(0.796078431372549, 0.42745098039215684, 0.3176470588235294) # Copper rose: #996666: (153, 102, 102) COPPER_ROSE = RGB.new(0.6, 0.4, 0.4) # Coquelicot: #FF3800: (255, 56, 0) COQUELICOT = RGB.new(1.0, 0.2196078431372549, 0.0) # Coral: #FF7F50: (255, 127, 80) CORAL = RGB.new(1.0, 0.4980392156862745, 0.3137254901960784) # Coral pink: #F88379: (248, 131, 121) CORAL_PINK = RGB.new(0.9725490196078431, 0.5137254901960784, 0.4745098039215686) # Coral red: #FF4040: (255, 64, 64) CORAL_RED = RGB.new(1.0, 0.25098039215686274, 0.25098039215686274) # Coral reef: #FD7C6E: (253, 124, 110) CORAL_REEF = RGB.new(0.9921568627450981, 0.48627450980392156, 0.43137254901960786) # Coral Reef (Valspar Paint Color): #F6A494: (246, 164, 148) CORAL_REEF_VALSPAR_PAINT_COLOR = RGB.new(0.9647058823529412, 0.6431372549019608, 0.5803921568627451) # Cordovan: #893F45: (137, 63, 69) CORDOVAN = RGB.new(0.5372549019607843, 0.24705882352941178, 0.27058823529411763) # Corn: #FBEC5D: (251, 236, 93) CORN = RGB.new(0.984313725490196, 0.9254901960784314, 0.36470588235294116) # Cornell red: #B31B1B: (179, 27, 27) CORNELL_RED = RGB.new(0.7019607843137254, 0.10588235294117647, 0.10588235294117647) # Cornflower blue: #6495ED: (100, 149, 237) CORNFLOWER_BLUE = RGB.new(0.39215686274509803, 0.5843137254901961, 0.9294117647058824) # Cornflower: #93CCEA: (1, 159, 222) CORNFLOWER = RGB.new(0.00392156862745098, 0.6235294117647059, 0.8705882352941177) # Cornsilk: #FFF8DC: (255, 248, 220) CORNSILK = RGB.new(1.0, 0.9725490196078431, 0.8627450980392157) # Cosmic cobalt: #2E2D88: (46, 45, 136) COSMIC_COBALT = RGB.new(0.1803921568627451, 0.17647058823529413, 0.5333333333333333) # Cosmic latte: #FFF8E7: (255, 248, 231) COSMIC_LATTE = RGB.new(1.0, 0.9725490196078431, 0.9058823529411765) # Coyote brown: #81613C: (129, 97, 60) COYOTE_BROWN = RGB.new(0.5058823529411764, 0.3803921568627451, 0.23529411764705882) # Cotton candy: #FFBCD9: (255, 188, 217) COTTON_CANDY = RGB.new(1.0, 0.7372549019607844, 0.8509803921568627) # Cream: #FFFDD0: (255, 253, 208) CREAM = RGB.new(1.0, 0.9921568627450981, 0.8156862745098039) # Crimson: #DC143C: (220, 20, 60) CRIMSON = RGB.new(0.8627450980392157, 0.0784313725490196, 0.23529411764705882) # Crimson glory: #BE0032: (190, 0, 50) CRIMSON_GLORY = RGB.new(0.7450980392156863, 0.0, 0.19607843137254902) # Crimson red: #990000: (153, 0, 0) CRIMSON_RED = RGB.new(0.6, 0.0, 0.0) # Cultured: #F5F5F5: (245, 245, 245) CULTURED = RGB.new(0.9607843137254902, 0.9607843137254902, 0.9607843137254902) # Cyan: #00FFFF: (0, 255, 255) CYAN = RGB.new(0.0, 1.0, 1.0) # Cyan azure: #4E82B4: (78, 130, 180) CYAN_AZURE = RGB.new(0.3058823529411765, 0.5098039215686274, 0.7058823529411765) # Cyan-blue azure: #4682BF: (70, 130, 191) CYAN_BLUE_AZURE = RGB.new(0.27450980392156865, 0.5098039215686274, 0.7490196078431373) # Cyan cobalt blue: #28589C: (40, 88, 156) CYAN_COBALT_BLUE = RGB.new(0.1568627450980392, 0.34509803921568627, 0.611764705882353) # Cyan cornflower blue: #188BC2: (24, 139, 194) CYAN_CORNFLOWER_BLUE = RGB.new(0.09411764705882353, 0.5450980392156862, 0.7607843137254902) # Cyan (process): #00B7EB: (0, 183, 235) CYAN_PROCESS = RGB.new(0.0, 0.7176470588235294, 0.9215686274509803) # Cyber grape: #58427C: (88, 66, 124) CYBER_GRAPE = RGB.new(0.34509803921568627, 0.25882352941176473, 0.48627450980392156) # Cyber yellow: #FFD300: (255, 211, 0) CYBER_YELLOW = RGB.new(1.0, 0.8274509803921568, 0.0) # Cyclamen: #F56FA1: (245, 111, 161) CYCLAMEN = RGB.new(0.9607843137254902, 0.43529411764705883, 0.6313725490196078) # Daffodil: #FFFF31: (255, 255, 49) DAFFODIL = RGB.new(1.0, 1.0, 0.19215686274509805) # Dandelion: #F0E130: (240, 225, 48) DANDELION = RGB.new(0.9411764705882353, 0.8823529411764706, 0.18823529411764706) # Dandelion (Crayola): #FDDB6D: (253, 219, 109) DANDELION_CRAYOLA = RGB.new(0.9921568627450981, 0.8588235294117647, 0.42745098039215684) # Dark blue: #00008B: (0, 0, 139) DARK_BLUE = RGB.new(0.0, 0.0, 0.5450980392156862) # Dark blue-gray: #666699: (102, 102, 153) DARK_BLUE_GRAY = RGB.new(0.4, 0.4, 0.6) # Dark bronze: #804A00: (128, 74, 45) DARK_BRONZE = RGB.new(0.5019607843137255, 0.2901960784313726, 0.17647058823529413) # Dark bronze (Coin): #514100: (81, 65, 0) DARK_BRONZE_COIN = RGB.new(0.3176470588235294, 0.2549019607843137, 0.0) # Dark brown: #654321: (101, 67, 33) DARK_BROWN = RGB.new(0.396078431372549, 0.2627450980392157, 0.12941176470588237) # Dark brown-tangelo: #88654E: (136, 101, 78) DARK_BROWN_TANGELO = RGB.new(0.5333333333333333, 0.396078431372549, 0.3058823529411765) # Dark byzantium: #5D3954: (93, 57, 84) DARK_BYZANTIUM = RGB.new(0.36470588235294116, 0.2235294117647059, 0.32941176470588235) # Dark candy apple red: #A40000: (164, 0, 0) DARK_CANDY_APPLE_RED = RGB.new(0.6431372549019608, 0.0, 0.0) # Dark cerulean: #08457E: (8, 69, 126) DARK_CERULEAN = RGB.new(0.03137254901960784, 0.27058823529411763, 0.49411764705882355) # Dark charcoal: #333333: (51, 51, 51) DARK_CHARCOAL = RGB.new(0.2, 0.2, 0.2) # Dark chestnut: #986960: (152, 105, 96) DARK_CHESTNUT = RGB.new(0.596078431372549, 0.4117647058823529, 0.3764705882352941) # Dark chocolate: #490206: (73, 2, 6) DARK_CHOCOLATE = RGB.new(0.28627450980392155, 0.00784313725490196, 0.023529411764705882) # Dark chocolate (Hershey's): #3C1321: (60, 19, 33) DARK_CHOCOLATE_HERSHEYS = RGB.new(0.23529411764705882, 0.07450980392156863, 0.12941176470588237) # Dark cornflower blue: #26428B: (38, 66, 139) DARK_CORNFLOWER_BLUE = RGB.new(0.14901960784313725, 0.25882352941176473, 0.5450980392156862) # Dark coral: #CD5B45: (205, 91, 69) DARK_CORAL = RGB.new(0.803921568627451, 0.3568627450980392, 0.27058823529411763) # Dark cyan: #008B8B: (0, 139, 139) DARK_CYAN = RGB.new(0.0, 0.5450980392156862, 0.5450980392156862) # Dark electric blue: #536878: (83, 104, 120) DARK_ELECTRIC_BLUE = RGB.new(0.3254901960784314, 0.40784313725490196, 0.47058823529411764) # Dark gold: #AA6C39: (170, 108, 57) DARK_GOLD = RGB.new(0.6666666666666666, 0.4235294117647059, 0.2235294117647059) # Dark goldenrod: #B8860B: (184, 134, 11) DARK_GOLDENROD = RGB.new(0.7215686274509804, 0.5254901960784314, 0.043137254901960784) # Dark gray (X11): #A9A9A9: (169, 169, 169) DARK_GRAY_X11 = RGB.new(0.6627450980392157, 0.6627450980392157, 0.6627450980392157) # Dark green: #013220: (1, 50, 32) DARK_GREEN = RGB.new(0.00392156862745098, 0.19607843137254902, 0.12549019607843137) # Dark green (X11): #006400: (0, 100, 0) DARK_GREEN_X11 = RGB.new(0.0, 0.39215686274509803, 0.0) # Dark gunmetal: #1F262A: (31, 38, 42) DARK_GUNMETAL = RGB.new(0.12156862745098039, 0.14901960784313725, 0.16470588235294117) # Dark imperial blue: #00416A: (0, 65, 106) DARK_IMPERIAL_BLUE = RGB.new(0.0, 0.2549019607843137, 0.41568627450980394) # Dark jungle green: #1A2421: (26, 36, 33) DARK_JUNGLE_GREEN = RGB.new(0.10196078431372549, 0.1411764705882353, 0.12941176470588237) # Dark khaki: #BDB76B: (189, 183, 107) DARK_KHAKI = RGB.new(0.7411764705882353, 0.7176470588235294, 0.4196078431372549) # Dark lava: #483C32: (72, 60, 50) DARK_LAVA = RGB.new(0.2823529411764706, 0.23529411764705882, 0.19607843137254902) # Dark lavender: #734F96: (115, 79, 150) DARK_LAVENDER = RGB.new(0.45098039215686275, 0.30980392156862746, 0.5882352941176471) # Dark lemon lime: #8BBE1B: (139, 190, 27) DARK_LEMON_LIME = RGB.new(0.5450980392156862, 0.7450980392156863, 0.10588235294117647) # Dark liver: #534B4F: (83, 75, 79) DARK_LIVER = RGB.new(0.3254901960784314, 0.29411764705882354, 0.30980392156862746) # Dark liver (horses): #543D37: (84, 61, 55) DARK_LIVER_HORSES = RGB.new(0.32941176470588235, 0.23921568627450981, 0.21568627450980393) # Dark magenta: #8B008B: (139, 0, 139) DARK_MAGENTA = RGB.new(0.5450980392156862, 0.0, 0.5450980392156862) # Dark medium gray: #A9A9A9: (169, 169, 169) DARK_MEDIUM_GRAY = RGB.new(0.6627450980392157, 0.6627450980392157, 0.6627450980392157) # Dark midnight blue: #003366: (0, 51, 102) DARK_MIDNIGHT_BLUE = RGB.new(0.0, 0.2, 0.4) # Dark moss green: #4A5D23: (74, 93, 35) DARK_MOSS_GREEN = RGB.new(0.2901960784313726, 0.36470588235294116, 0.13725490196078433) # Dark olive green: #556B2F: (85, 107, 47) DARK_OLIVE_GREEN = RGB.new(0.3333333333333333, 0.4196078431372549, 0.1843137254901961) # Dark orange: #FF8C00: (255, 140, 0) DARK_ORANGE = RGB.new(1.0, 0.5490196078431373, 0.0) # Dark orchid: #9932CC: (153, 50, 204) DARK_ORCHID = RGB.new(0.6, 0.19607843137254902, 0.8) # Dark pastel blue: #779ECB: (119, 158, 203) DARK_PASTEL_BLUE = RGB.new(0.4666666666666667, 0.6196078431372549, 0.796078431372549) # Dark pastel green: #03C03C: (3, 192, 60) DARK_PASTEL_GREEN = RGB.new(0.011764705882352941, 0.7529411764705882, 0.23529411764705882) # Dark pastel purple: #966FD6: (150, 111, 214) DARK_PASTEL_PURPLE = RGB.new(0.5882352941176471, 0.43529411764705883, 0.8392156862745098) # Dark pastel red: #C23B22: (194, 59, 34) DARK_PASTEL_RED = RGB.new(0.7607843137254902, 0.23137254901960785, 0.13333333333333333) # Dark pink: #E75480: (231, 84, 128) DARK_PINK = RGB.new(0.9058823529411765, 0.32941176470588235, 0.5019607843137255) # Dark powder blue: #003399: (0, 51, 153) DARK_POWDER_BLUE = RGB.new(0.0, 0.2, 0.6) # Dark puce: #4F3A3C: (79, 58, 60) DARK_PUCE = RGB.new(0.30980392156862746, 0.22745098039215686, 0.23529411764705882) # Dark purple: #301934: (48, 25, 52) DARK_PURPLE = RGB.new(0.18823529411764706, 0.09803921568627451, 0.20392156862745098) # Dark raspberry: #872657: (135, 38, 87) DARK_RASPBERRY = RGB.new(0.5294117647058824, 0.14901960784313725, 0.3411764705882353) # Dark red: #8B0000: (139, 0, 0) DARK_RED = RGB.new(0.5450980392156862, 0.0, 0.0) # Dark salmon: #E9967A: (233, 150, 122) DARK_SALMON = RGB.new(0.9137254901960784, 0.5882352941176471, 0.47843137254901963) # Dark scarlet: #560319: (86, 3, 25) DARK_SCARLET = RGB.new(0.33725490196078434, 0.011764705882352941, 0.09803921568627451) # Dark sea green: #8FBC8F: (143, 188, 143) DARK_SEA_GREEN = RGB.new(0.5607843137254902, 0.7372549019607844, 0.5607843137254902) # Dark sienna: #3C1414: (60, 20, 20) DARK_SIENNA = RGB.new(0.23529411764705882, 0.0784313725490196, 0.0784313725490196) # Dark silver: #71706E: (113, 112, 110) DARK_SILVER = RGB.new(0.44313725490196076, 0.4392156862745098, 0.43137254901960786) # Dark sky blue: #8CBED6: (140, 190, 214) DARK_SKY_BLUE = RGB.new(0.5490196078431373, 0.7450980392156863, 0.8392156862745098) # Dark slate blue: #483D8B: (72, 61, 139) DARK_SLATE_BLUE = RGB.new(0.2823529411764706, 0.23921568627450981, 0.5450980392156862) # Dark slate gray: #2F4F4F: (47, 79, 79) DARK_SLATE_GRAY = RGB.new(0.1843137254901961, 0.30980392156862746, 0.30980392156862746) # Dark spring green: #177245: (23, 114, 69) DARK_SPRING_GREEN = RGB.new(0.09019607843137255, 0.4470588235294118, 0.27058823529411763) # Dark tan: #918151: (145, 129, 81) DARK_TAN = RGB.new(0.5686274509803921, 0.5058823529411764, 0.3176470588235294) # Dark tangerine: #FFA812: (255, 168, 18) DARK_TANGERINE = RGB.new(1.0, 0.6588235294117647, 0.07058823529411765) # Dark taupe: #483C32: (72, 60, 50) DARK_TAUPE = RGB.new(0.2823529411764706, 0.23529411764705882, 0.19607843137254902) # Dark terra cotta: #CC4E5C: (204, 78, 92) DARK_TERRA_COTTA = RGB.new(0.8, 0.3058823529411765, 0.3607843137254902) # Dark turquoise: #00CED1: (0, 206, 209) DARK_TURQUOISE = RGB.new(0.0, 0.807843137254902, 0.8196078431372549) # Dark vanilla: #D1BEA8: (209, 190, 168) DARK_VANILLA = RGB.new(0.8196078431372549, 0.7450980392156863, 0.6588235294117647) # Dark violet: #9400D3: (148, 0, 211) DARK_VIOLET = RGB.new(0.5803921568627451, 0.0, 0.8274509803921568) # Dark yellow: #9B870C: (155, 135, 12) DARK_YELLOW = RGB.new(0.6078431372549019, 0.5294117647058824, 0.047058823529411764) # Dartmouth green: #00703C: (0, 112, 60) DARTMOUTH_GREEN = RGB.new(0.0, 0.4392156862745098, 0.23529411764705882) # Davy's grey: #555555: (85, 85, 85) DAVYS_GREY = RGB.new(0.3333333333333333, 0.3333333333333333, 0.3333333333333333) # Debian red: #D70A53: (215, 10, 83) DEBIAN_RED = RGB.new(0.8431372549019608, 0.0392156862745098, 0.3254901960784314) # Deep amethyst: #9C8AA4: (156, 138, 164) DEEP_AMETHYST = RGB.new(0.611764705882353, 0.5411764705882353, 0.6431372549019608) # Deep aquamarine: #40826D: (64, 130, 109) DEEP_AQUAMARINE = RGB.new(0.25098039215686274, 0.5098039215686274, 0.42745098039215684) # Deep carmine: #A9203E: (169, 32, 62) DEEP_CARMINE = RGB.new(0.6627450980392157, 0.12549019607843137, 0.24313725490196078) # Deep carmine pink: #EF3038: (239, 48, 56) DEEP_CARMINE_PINK = RGB.new(0.9372549019607843, 0.18823529411764706, 0.2196078431372549) # Deep carrot orange: #E9692C: (233, 105, 44) DEEP_CARROT_ORANGE = RGB.new(0.9137254901960784, 0.4117647058823529, 0.17254901960784313) # Deep cerise: #DA3287: (218, 50, 135) DEEP_CERISE = RGB.new(0.8549019607843137, 0.19607843137254902, 0.5294117647058824) # Deep champagne: #FAD6A5: (250, 214, 165) DEEP_CHAMPAGNE = RGB.new(0.9803921568627451, 0.8392156862745098, 0.6470588235294118) # Deep chestnut: #B94E48: (185, 78, 72) DEEP_CHESTNUT = RGB.new(0.7254901960784313, 0.3058823529411765, 0.2823529411764706) # Deep coffee: #704241: (112, 66, 65) DEEP_COFFEE = RGB.new(0.4392156862745098, 0.25882352941176473, 0.2549019607843137) # Deep fuchsia: #C154C1: (193, 84, 193) DEEP_FUCHSIA = RGB.new(0.7568627450980392, 0.32941176470588235, 0.7568627450980392) # Deep Green: #056608: (5, 102, 8) DEEP_GREEN = RGB.new(0.0196078431372549, 0.4, 0.03137254901960784) # Deep green-cyan turquoise: #0E7C61: (14, 124, 97) DEEP_GREEN_CYAN_TURQUOISE = RGB.new(0.054901960784313725, 0.48627450980392156, 0.3803921568627451) # Deep jungle green: #004B49: (0, 75, 73) DEEP_JUNGLE_GREEN = RGB.new(0.0, 0.29411764705882354, 0.28627450980392155) # Deep koamaru: #333366: (51, 51, 102) DEEP_KOAMARU = RGB.new(0.2, 0.2, 0.4) # Deep lemon: #F5C71A: (245, 199, 26) DEEP_LEMON = RGB.new(0.9607843137254902, 0.7803921568627451, 0.10196078431372549) # Deep lilac: #9955BB: (153, 85, 187) DEEP_LILAC = RGB.new(0.6, 0.3333333333333333, 0.7333333333333333) # Deep magenta: #CC00CC: (204, 0, 204) DEEP_MAGENTA = RGB.new(0.8, 0.0, 0.8) # Deep maroon: #820000: (130, 0, 0) DEEP_MAROON = RGB.new(0.5098039215686274, 0.0, 0.0) # Deep mauve: #D473D4: (212, 115, 212) DEEP_MAUVE = RGB.new(0.8313725490196079, 0.45098039215686275, 0.8313725490196079) # Deep moss green: #355E3B: (53, 94, 59) DEEP_MOSS_GREEN = RGB.new(0.20784313725490197, 0.3686274509803922, 0.23137254901960785) # Deep peach: #FFCBA4: (255, 203, 164) DEEP_PEACH = RGB.new(1.0, 0.796078431372549, 0.6431372549019608) # Deep pink: #FF1493: (255, 20, 147) DEEP_PINK = RGB.new(1.0, 0.0784313725490196, 0.5764705882352941) # Deep puce: #A95C68: (169, 92, 104) DEEP_PUCE = RGB.new(0.6627450980392157, 0.3607843137254902, 0.40784313725490196) # Deep Red: #850101: (133, 1, 1) DEEP_RED = RGB.new(0.5215686274509804, 0.00392156862745098, 0.00392156862745098) # Deep ruby: #843F5B: (132, 63, 91) DEEP_RUBY = RGB.new(0.5176470588235295, 0.24705882352941178, 0.3568627450980392) # Deep saffron: #FF9933: (255, 153, 51) DEEP_SAFFRON = RGB.new(1.0, 0.6, 0.2) # Deep sky blue: #00BFFF: (0, 191, 255) DEEP_SKY_BLUE = RGB.new(0.0, 0.7490196078431373, 1.0) # Deep Space Sparkle: #4A646C: (74, 100, 108) DEEP_SPACE_SPARKLE = RGB.new(0.2901960784313726, 0.39215686274509803, 0.4235294117647059) # Deep spring bud: #556B2F: (85, 107, 47) DEEP_SPRING_BUD = RGB.new(0.3333333333333333, 0.4196078431372549, 0.1843137254901961) # Deep Taupe: #7E5E60: (126, 94, 96) DEEP_TAUPE = RGB.new(0.49411764705882355, 0.3686274509803922, 0.3764705882352941) # Deep Tuscan red: #66424D: (102, 66, 77) DEEP_TUSCAN_RED = RGB.new(0.4, 0.25882352941176473, 0.30196078431372547) # Deep violet: #330066: (51, 0, 102) DEEP_VIOLET = RGB.new(0.2, 0.0, 0.4) # Deer: #BA8759: (186, 135, 89) DEER = RGB.new(0.7294117647058823, 0.5294117647058824, 0.34901960784313724) # Denim: #1560BD: (21, 96, 189) DENIM = RGB.new(0.08235294117647059, 0.3764705882352941, 0.7411764705882353) # Denim Blue: #2243B6: (34, 67, 182) DENIM_BLUE = RGB.new(0.13333333333333333, 0.2627450980392157, 0.7137254901960784) # Desaturated cyan: #669999: (102, 153, 153) DESATURATED_CYAN = RGB.new(0.4, 0.6, 0.6) # Desert: #C19A6B: (193, 154, 107) DESERT = RGB.new(0.7568627450980392, 0.6039215686274509, 0.4196078431372549) # Desert sand: #EDC9AF: (237, 201, 175) DESERT_SAND = RGB.new(0.9294117647058824, 0.788235294117647, 0.6862745098039216) # Desire: #EA3C53: (234, 60, 83) DESIRE = RGB.new(0.9176470588235294, 0.23529411764705882, 0.3254901960784314) # Diamond: #B9F2FF: (185, 242, 255) DIAMOND = RGB.new(0.7254901960784313, 0.9490196078431372, 1.0) # Dim gray: #696969: (105, 105, 105) DIM_GRAY = RGB.new(0.4117647058823529, 0.4117647058823529, 0.4117647058823529) # Dingy Dungeon: #C53151: (197, 49, 81) DINGY_DUNGEON = RGB.new(0.7725490196078432, 0.19215686274509805, 0.3176470588235294) # Dirt: #9B7653: (155, 118, 83) DIRT = RGB.new(0.6078431372549019, 0.4627450980392157, 0.3254901960784314) # Dirty brown: #B5651E: (181, 101, 30) DIRTY_BROWN = RGB.new(0.7098039215686275, 0.396078431372549, 0.11764705882352941) # Dirty white: #E8E4C9: (232, 228, 201) DIRTY_WHITE = RGB.new(0.9098039215686274, 0.8941176470588236, 0.788235294117647) # Dodger blue: #1E90FF: (30, 144, 255) DODGER_BLUE = RGB.new(0.11764705882352941, 0.5647058823529412, 1.0) # Dodie yellow: #FEF65B: (254, 246, 91) DODIE_YELLOW = RGB.new(0.996078431372549, 0.9647058823529412, 0.3568627450980392) # Dogwood rose: #D71868: (215, 24, 104) DOGWOOD_ROSE = RGB.new(0.8431372549019608, 0.09411764705882353, 0.40784313725490196) # Dollar bill: #85BB65: (133, 187, 101) DOLLAR_BILL = RGB.new(0.5215686274509804, 0.7333333333333333, 0.396078431372549) # Dolphin gray: #828E84: (130, 142, 132) DOLPHIN_GRAY = RGB.new(0.5098039215686274, 0.5568627450980392, 0.5176470588235295) # Donkey brown: #664C28: (102, 76, 40) DONKEY_BROWN = RGB.new(0.4, 0.2980392156862745, 0.1568627450980392) # Drab: #967117: (150, 113, 23) DRAB = RGB.new(0.5882352941176471, 0.44313725490196076, 0.09019607843137255) # Duke blue: #00009C: (0, 0, 156) DUKE_BLUE = RGB.new(0.0, 0.0, 0.611764705882353) # Dust storm: #E5CCC9: (229, 204, 201) DUST_STORM = RGB.new(0.8980392156862745, 0.8, 0.788235294117647) # Dutch white: #EFDFBB: (239, 223, 187) DUTCH_WHITE = RGB.new(0.9372549019607843, 0.8745098039215686, 0.7333333333333333) # Earthtone: #5D3A1A: (93, 58, 26) EARTHTONE = RGB.new(0.36470588235294116, 0.22745098039215686, 0.10196078431372549) # Earth yellow: #E1A95F: (225, 169, 95) EARTH_YELLOW = RGB.new(0.8823529411764706, 0.6627450980392157, 0.37254901960784315) # Ebony: #555D50: (85, 93, 80) EBONY = RGB.new(0.3333333333333333, 0.36470588235294116, 0.3137254901960784) # Ecru: #C2B280: (194, 178, 128) ECRU = RGB.new(0.7607843137254902, 0.6980392156862745, 0.5019607843137255) # Eerie black: #1B1B1B: (27, 27, 27) EERIE_BLACK = RGB.new(0.10588235294117647, 0.10588235294117647, 0.10588235294117647) # Eggplant: #614051: (97, 64, 81) EGGPLANT = RGB.new(0.3803921568627451, 0.25098039215686274, 0.3176470588235294) # Eggshell: #F0EAD6: (240, 234, 214) EGGSHELL = RGB.new(0.9411764705882353, 0.9176470588235294, 0.8392156862745098) # Egyptian blue: #1034A6: (16, 52, 166) EGYPTIAN_BLUE = RGB.new(0.06274509803921569, 0.20392156862745098, 0.6509803921568628) # Electric blue: #7DF9FF: (125, 249, 255) ELECTRIC_BLUE = RGB.new(0.49019607843137253, 0.9764705882352941, 1.0) # Electric brown: #B56257: (181, 98, 87) ELECTRIC_BROWN = RGB.new(0.7098039215686275, 0.3843137254901961, 0.3411764705882353) # Electric crimson: #FF003F: (255, 0, 63) ELECTRIC_CRIMSON = RGB.new(1.0, 0.0, 0.24705882352941178) # Electric cyan: #00FFFF: (0, 255, 255) ELECTRIC_CYAN = RGB.new(0.0, 1.0, 1.0) # Electric green: #00FF00: (0, 255, 0) ELECTRIC_GREEN = RGB.new(0.0, 1.0, 0.0) # Electric indigo: #6F00FF: (111, 0, 255) ELECTRIC_INDIGO = RGB.new(0.43529411764705883, 0.0, 1.0) # Electric lavender: #F4BBFF: (244, 187, 255) ELECTRIC_LAVENDER = RGB.new(0.9568627450980393, 0.7333333333333333, 1.0) # Electric lime: #CCFF00: (204, 255, 0) ELECTRIC_LIME = RGB.new(0.8, 1.0, 0.0) # Electric orange: #FF3503: (255, 53, 3) ELECTRIC_ORANGE = RGB.new(1.0, 0.20784313725490197, 0.011764705882352941) # Electric pink: #F62681: (246, 38, 129) ELECTRIC_PINK = RGB.new(0.9647058823529412, 0.14901960784313725, 0.5058823529411764) # Electric purple: #BF00FF: (191, 0, 255) ELECTRIC_PURPLE = RGB.new(0.7490196078431373, 0.0, 1.0) # Electric red: #E60000: (230, 0, 0) ELECTRIC_RED = RGB.new(0.9019607843137255, 0.0, 0.0) # Electric ultramarine: #3F00FF: (63, 0, 255) ELECTRIC_ULTRAMARINE = RGB.new(0.24705882352941178, 0.0, 1.0) # Electric violet: #8F00FF: (143, 0, 255) ELECTRIC_VIOLET = RGB.new(0.5607843137254902, 0.0, 1.0) # Electric yellow: #FFFF33: (255, 255, 51) ELECTRIC_YELLOW = RGB.new(1.0, 1.0, 0.2) # Emerald: #50C878: (80, 200, 120) EMERALD = RGB.new(0.3137254901960784, 0.7843137254901961, 0.47058823529411764) # Emerald green: #046307: (4, 99, 7) EMERALD_GREEN = RGB.new(0.01568627450980392, 0.38823529411764707, 0.027450980392156862) # Eminence: #6C3082: (108, 48, 130) EMINENCE = RGB.new(0.4235294117647059, 0.18823529411764706, 0.5098039215686274) # English green: #1B4D3E: (27, 77, 62) ENGLISH_GREEN = RGB.new(0.10588235294117647, 0.30196078431372547, 0.24313725490196078) # English lavender: #B48395: (180, 131, 149) ENGLISH_LAVENDER = RGB.new(0.7058823529411765, 0.5137254901960784, 0.5843137254901961) # English red: #AB4B52: (171, 75, 82) ENGLISH_RED = RGB.new(0.6705882352941176, 0.29411764705882354, 0.3215686274509804) # English vermillion: #CC474B: (204, 71, 75) ENGLISH_VERMILLION = RGB.new(0.8, 0.2784313725490196, 0.29411764705882354) # English violet: #563C5C: (86, 60, 92) ENGLISH_VIOLET = RGB.new(0.33725490196078434, 0.23529411764705882, 0.3607843137254902) # Eton blue: #96C8A2: (150, 200, 162) ETON_BLUE = RGB.new(0.5882352941176471, 0.7843137254901961, 0.6352941176470588) # Eucalyptus: #44D7A8: (68, 215, 168) EUCALYPTUS = RGB.new(0.26666666666666666, 0.8431372549019608, 0.6588235294117647) # Facebook Blue: #39569C: (57, 86, 156) FACEBOOK_BLUE = RGB.new(0.2235294117647059, 0.33725490196078434, 0.611764705882353) # Fallow: #C19A6B: (193, 154, 107) FALLOW = RGB.new(0.7568627450980392, 0.6039215686274509, 0.4196078431372549) # Falu red: #801818: (128, 24, 24) FALU_RED = RGB.new(0.5019607843137255, 0.09411764705882353, 0.09411764705882353) # Fandango: #B53389: (181, 51, 137) FANDANGO = RGB.new(0.7098039215686275, 0.2, 0.5372549019607843) # Fandango pink: #DE5285: (222, 82, 133) FANDANGO_PINK = RGB.new(0.8705882352941177, 0.3215686274509804, 0.5215686274509804) # Fashion fuchsia: #F400A1: (244, 0, 161) FASHION_FUCHSIA = RGB.new(0.9568627450980393, 0.0, 0.6313725490196078) # Fawn: #E5AA70: (229, 170, 112) FAWN = RGB.new(0.8980392156862745, 0.6666666666666666, 0.4392156862745098) # Feldgrau: #4D5D53: (77, 93, 83) FELDGRAU = RGB.new(0.30196078431372547, 0.36470588235294116, 0.3254901960784314) # Feldspar: #FDD5B1: (253, 213, 177) FELDSPAR = RGB.new(0.9921568627450981, 0.8352941176470589, 0.6941176470588235) # Fern green: #4F7942: (79, 121, 66) FERN_GREEN = RGB.new(0.30980392156862746, 0.4745098039215686, 0.25882352941176473) # Ferrari red: #FF2800: (255, 40, 0) FERRARI_RED = RGB.new(1.0, 0.1568627450980392, 0.0) # Field drab: #6C541E: (108, 84, 30) FIELD_DRAB = RGB.new(0.4235294117647059, 0.32941176470588235, 0.11764705882352941) # Fiery rose: #FF5470: (255, 84, 112) FIERY_ROSE = RGB.new(1.0, 0.32941176470588235, 0.4392156862745098) # Firebrick: #B22222: (178, 34, 34) FIREBRICK = RGB.new(0.6980392156862745, 0.13333333333333333, 0.13333333333333333) # Fire engine red: #CE2029: (206, 32, 41) FIRE_ENGINE_RED = RGB.new(0.807843137254902, 0.12549019607843137, 0.1607843137254902) # Fire opal: #E95C4B: (233, 92, 75) FIRE_OPAL = RGB.new(0.9137254901960784, 0.3607843137254902, 0.29411764705882354) # Flame: #E25822: (226, 88, 34) FLAME = RGB.new(0.8862745098039215, 0.34509803921568627, 0.13333333333333333) # Flamingo pink: #FC8EAC: (252, 142, 172) FLAMINGO_PINK = RGB.new(0.9882352941176471, 0.5568627450980392, 0.6745098039215687) # Flattery: #6B4423: (107, 68, 35) FLATTERY = RGB.new(0.4196078431372549, 0.26666666666666666, 0.13725490196078433) # Flavescent: #F7E98E: (247, 233, 142) FLAVESCENT = RGB.new(0.9686274509803922, 0.9137254901960784, 0.5568627450980392) # Flax: #EEDC82: (238, 220, 130) FLAX = RGB.new(0.9333333333333333, 0.8627450980392157, 0.5098039215686274) # Flickr Blue: #216BD6: (33, 107, 214) FLICKR_BLUE = RGB.new(0.12941176470588237, 0.4196078431372549, 0.8392156862745098) # Flickr Pink: #FB0081: (251, 0, 129) FLICKR_PINK = RGB.new(0.984313725490196, 0.0, 0.5058823529411764) # Flirt: #A2006D: (162, 0, 109) FLIRT = RGB.new(0.6352941176470588, 0.0, 0.42745098039215684) # Floral white: #FFFAF0: (255, 250, 240) FLORAL_WHITE = RGB.new(1.0, 0.9803921568627451, 0.9411764705882353) # Flower girl: #F498AD: (244, 152, 173) FLOWER_GIRL = RGB.new(0.9568627450980393, 0.596078431372549, 0.6784313725490196) # Fluorescent blue: #15F4EE: (21, 244, 238) FLUORESCENT_BLUE = RGB.new(0.08235294117647059, 0.9568627450980393, 0.9333333333333333) # Fluorescent orange: #FFBF00: (255, 191, 0) FLUORESCENT_ORANGE = RGB.new(1.0, 0.7490196078431373, 0.0) # Fluorescent pink: #FF1493: (255, 20, 147) FLUORESCENT_PINK = RGB.new(1.0, 0.0784313725490196, 0.5764705882352941) # Fluorescent yellow: #CCFF00: (204, 255, 0) FLUORESCENT_YELLOW = RGB.new(0.8, 1.0, 0.0) # Folly: #FF004F: (255, 0, 79) FOLLY = RGB.new(1.0, 0.0, 0.30980392156862746) # Forest green (Crayola): #5FA777: (95, 167, 119) FOREST_GREEN_CRAYOLA = RGB.new(0.37254901960784315, 0.6549019607843137, 0.4666666666666667) # Forest green (traditional): #014421: (1, 68, 33) FOREST_GREEN_TRADITIONAL = RGB.new(0.00392156862745098, 0.26666666666666666, 0.12941176470588237) # Forest green (web): #228B22: (34, 139, 34) FOREST_GREEN_WEB = RGB.new(0.13333333333333333, 0.5450980392156862, 0.13333333333333333) # French beige: #A67B5B: (166, 123, 91) FRENCH_BEIGE = RGB.new(0.6509803921568628, 0.4823529411764706, 0.3568627450980392) # French bistre: #856D4D: (133, 109, 77) FRENCH_BISTRE = RGB.new(0.5215686274509804, 0.42745098039215684, 0.30196078431372547) # French blue: #0072BB: (0, 114, 187) FRENCH_BLUE = RGB.new(0.0, 0.4470588235294118, 0.7333333333333333) # French fuchsia: #FD3F92: (253, 63, 146) FRENCH_FUCHSIA = RGB.new(0.9921568627450981, 0.24705882352941178, 0.5725490196078431) # French lilac: #86608E: (134, 96, 142) FRENCH_LILAC = RGB.new(0.5254901960784314, 0.3764705882352941, 0.5568627450980392) # French lime: #9EFD38: (158, 253, 56) FRENCH_LIME = RGB.new(0.6196078431372549, 0.9921568627450981, 0.2196078431372549) # French mauve: #D473D4: (212, 115, 212) FRENCH_MAUVE = RGB.new(0.8313725490196079, 0.45098039215686275, 0.8313725490196079) # French Middle Red Purple: #1C0218: (28, 2, 24) FRENCH_MIDDLE_RED_PURPLE = RGB.new(0.10980392156862745, 0.00784313725490196, 0.09411764705882353) # French pink: #FD6C9E: (253, 108, 158) FRENCH_PINK = RGB.new(0.9921568627450981, 0.4235294117647059, 0.6196078431372549) # French plum: #811453: (129, 20, 83) FRENCH_PLUM = RGB.new(0.5058823529411764, 0.0784313725490196, 0.3254901960784314) # French puce: #4E1609: (78, 22, 9) FRENCH_PUCE = RGB.new(0.3058823529411765, 0.08627450980392157, 0.03529411764705882) # French raspberry: #C72C48: (199, 44, 72) FRENCH_RASPBERRY = RGB.new(0.7803921568627451, 0.17254901960784313, 0.2823529411764706) # French rose: #F64A8A: (246, 74, 138) FRENCH_ROSE = RGB.new(0.9647058823529412, 0.2901960784313726, 0.5411764705882353) # French sky blue: #77B5FE: (119, 181, 254) FRENCH_SKY_BLUE = RGB.new(0.4666666666666667, 0.7098039215686275, 0.996078431372549) # French violet: #8806CE: (136, 6, 206) FRENCH_VIOLET = RGB.new(0.5333333333333333, 0.023529411764705882, 0.807843137254902) # French wine: #AC1E44: (172, 30, 68) FRENCH_WINE = RGB.new(0.6745098039215687, 0.11764705882352941, 0.26666666666666666) # Fresh Air: #A6E7FF: (166, 231, 255) FRESH_AIR = RGB.new(0.6509803921568628, 0.9058823529411765, 1.0) # Frostbite: #E936A7: (233, 54, 167) FROSTBITE = RGB.new(0.9137254901960784, 0.21176470588235294, 0.6549019607843137) # Fuchsia: #FF00FF: (255, 0, 255) FUCHSIA = RGB.new(1.0, 0.0, 1.0) # Fuchsia (Crayola): #C154C1: (193, 84, 193) FUCHSIA_CRAYOLA = RGB.new(0.7568627450980392, 0.32941176470588235, 0.7568627450980392) # Fuchsia pink: #FF77FF: (255, 119, 255) FUCHSIA_PINK = RGB.new(1.0, 0.4666666666666667, 1.0) # Fuchsia purple: #CC397B: (204, 57, 123) FUCHSIA_PURPLE = RGB.new(0.8, 0.2235294117647059, 0.4823529411764706) # Fuchsia rose: #C74375: (199, 67, 117) FUCHSIA_ROSE = RGB.new(0.7803921568627451, 0.2627450980392157, 0.4588235294117647) # Fulvous: #E48400: (228, 132, 0) FULVOUS = RGB.new(0.8941176470588236, 0.5176470588235295, 0.0) # Fuzzy Wuzzy: #CC6666: (204, 102, 102) FUZZY_WUZZY = RGB.new(0.8, 0.4, 0.4) # Gainsboro: #DCDCDC: (220, 220, 220) GAINSBORO = RGB.new(0.8627450980392157, 0.8627450980392157, 0.8627450980392157) # Gamboge: #E49B0F: (228, 155, 15) GAMBOGE = RGB.new(0.8941176470588236, 0.6078431372549019, 0.058823529411764705) # Gamboge orange (brown): #996600: (152, 102, 0) GAMBOGE_ORANGE_BROWN = RGB.new(0.596078431372549, 0.4, 0.0) # Garnet: #733635: (115, 54, 53) GARNET = RGB.new(0.45098039215686275, 0.21176470588235294, 0.20784313725490197) # Gargoyle Gas: #FFDF46: (255, 223, 70) GARGOYLE_GAS = RGB.new(1.0, 0.8745098039215686, 0.27450980392156865) # Generic viridian: #007F66: (0, 127, 102) GENERIC_VIRIDIAN = RGB.new(0.0, 0.4980392156862745, 0.4) # Ghost white: #F8F8FF: (248, 248, 255) GHOST_WHITE = RGB.new(0.9725490196078431, 0.9725490196078431, 1.0) # Giant's Club: #B05C52: (176, 92, 82) GIANTS_CLUB = RGB.new(0.6901960784313725, 0.3607843137254902, 0.3215686274509804) # Giants orange: #FE5A1D: (254, 90, 29) GIANTS_ORANGE = RGB.new(0.996078431372549, 0.35294117647058826, 0.11372549019607843) # Gin: #D8E4BC: (216, 228, 188) GIN = RGB.new(0.8470588235294118, 0.8941176470588236, 0.7372549019607844) # Glaucous: #6082B6: (96, 130, 182) GLAUCOUS = RGB.new(0.3764705882352941, 0.5098039215686274, 0.7137254901960784) # Glossy grape: #AB92B3: (171, 146, 179) GLOSSY_GRAPE = RGB.new(0.6705882352941176, 0.5725490196078431, 0.7019607843137254) # GO green: #00AB66: (0, 171, 102) GO_GREEN = RGB.new(0.0, 0.6705882352941176, 0.4) # Gold: #A57C00: (165, 124, 0) GOLD = RGB.new(0.6470588235294118, 0.48627450980392156, 0.0) # Gold (metallic): #D4AF37: (212, 175, 55) GOLD_METALLIC = RGB.new(0.8313725490196079, 0.6862745098039216, 0.21568627450980393) # Gold (web) (Golden): #FFD700: (255, 215, 0) GOLD_WEB_GOLDEN = RGB.new(1.0, 0.8431372549019608, 0.0) # Gold (Crayola): #E6BE8A: (230, 190, 138) GOLD_CRAYOLA = RGB.new(0.9019607843137255, 0.7450980392156863, 0.5411764705882353) # Gold Fusion: #85754E: (133, 117, 78) GOLD_FUSION = RGB.new(0.5215686274509804, 0.4588235294117647, 0.3058823529411765) # Gold foil: #BD9B16: (189, 155, 22) GOLD_FOIL = RGB.new(0.7411764705882353, 0.6078431372549019, 0.08627450980392157) # Golden brown: #996515: (153, 101, 21) GOLDEN_BROWN = RGB.new(0.6, 0.396078431372549, 0.08235294117647059) # Golden poppy: #FCC200: (252, 194, 0) GOLDEN_POPPY = RGB.new(0.9882352941176471, 0.7607843137254902, 0.0) # Golden yellow: #FFDF00: (255, 223, 0) GOLDEN_YELLOW = RGB.new(1.0, 0.8745098039215686, 0.0) # Goldenrod: #DAA520: (218, 165, 32) GOLDENROD = RGB.new(0.8549019607843137, 0.6470588235294118, 0.12549019607843137) # Google Chrome red: #DE5246: (222, 82, 70) GOOGLE_CHROME_RED = RGB.new(0.8705882352941177, 0.3215686274509804, 0.27450980392156865) # Google Chrome blue: #4C8BF5: (76, 139, 245) GOOGLE_CHROME_BLUE = RGB.new(0.2980392156862745, 0.5450980392156862, 0.9607843137254902) # Google Chrome green: #1AA260: (26, 162, 96) GOOGLE_CHROME_GREEN = RGB.new(0.10196078431372549, 0.6352941176470588, 0.3764705882352941) # Google Chrome yellow: #FFCE44: (255, 206, 68) GOOGLE_CHROME_YELLOW = RGB.new(1.0, 0.807843137254902, 0.26666666666666666) # Granite gray: #676767: (103, 103, 103) GRANITE_GRAY = RGB.new(0.403921568627451, 0.403921568627451, 0.403921568627451) # Granny Smith apple: #A8E4A0: (168, 228, 160) GRANNY_SMITH_APPLE = RGB.new(0.6588235294117647, 0.8941176470588236, 0.6274509803921569) # Grape: #6F2DA8: (111, 45, 168) GRAPE = RGB.new(0.43529411764705883, 0.17647058823529413, 0.6588235294117647) # Gray (HTML/CSS gray): #808080: (128, 128, 128) GRAY_HTML_CSS_GRAY = RGB.new(0.5019607843137255, 0.5019607843137255, 0.5019607843137255) # Gray (X11 gray): #BEBEBE: (190, 190, 190) GRAY_X11_GRAY = RGB.new(0.7450980392156863, 0.7450980392156863, 0.7450980392156863) # Gray-asparagus: #465945: (70, 89, 69) GRAY_ASPARAGUS = RGB.new(0.27450980392156865, 0.34901960784313724, 0.27058823529411763) # Gray-blue: #8C92AC: (140, 146, 172) GRAY_BLUE = RGB.new(0.5490196078431373, 0.5725490196078431, 0.6745098039215687) # Green: #008001: (0, 128, 1) GREEN = RGB.new(0.0, 0.5019607843137255, 0.00392156862745098) # Green (Color Wheel) (X11 green): #00FF00: (0, 255, 0) GREEN_COLOR_WHEEL_X11_GREEN = RGB.new(0.0, 1.0, 0.0) # Green (Crayola): #1CAC78: (28, 172, 120) GREEN_CRAYOLA = RGB.new(0.10980392156862745, 0.6745098039215687, 0.47058823529411764) # Green (HTML/CSS color): #008000: (0, 128, 0) GREEN_HTML_CSS_COLOR = RGB.new(0.0, 0.5019607843137255, 0.0) # Green (Munsell): #00A877: (0, 168, 119) GREEN_MUNSELL = RGB.new(0.0, 0.6588235294117647, 0.4666666666666667) # Green (NCS): #009F6B: (0, 159, 107) GREEN_NCS = RGB.new(0.0, 0.6235294117647059, 0.4196078431372549) # Green (Pantone): #00AD43: (0, 173, 67) GREEN_PANTONE = RGB.new(0.0, 0.6784313725490196, 0.2627450980392157) # Green (pigment): #00A550: (0, 165, 80) GREEN_PIGMENT = RGB.new(0.0, 0.6470588235294118, 0.3137254901960784) # Green (RYB): #66B032: (102, 176, 50) GREEN_RYB = RGB.new(0.4, 0.6901960784313725, 0.19607843137254902) # Green-blue: #1164B4: (17, 100, 180) GREEN_BLUE = RGB.new(0.06666666666666667, 0.39215686274509803, 0.7058823529411765) # Green-blue (Crayola): #2887C8: (40, 135, 200) GREEN_BLUE_CRAYOLA = RGB.new(0.1568627450980392, 0.5294117647058824, 0.7843137254901961) # Green Cola: #4C721D: (76, 114, 29) GREEN_COLA = RGB.new(0.2980392156862745, 0.4470588235294118, 0.11372549019607843) # Green-cyan: #009966: (0, 153, 102) GREEN_CYAN = RGB.new(0.0, 0.6, 0.4) # Green Lizard: #A7F432: (167, 244, 50) GREEN_LIZARD = RGB.new(0.6549019607843137, 0.9568627450980393, 0.19607843137254902) # Green Sheen: #6EAEA1: (110, 174, 161) GREEN_SHEEN = RGB.new(0.43137254901960786, 0.6823529411764706, 0.6313725490196078) # Green slime: #65FF00: (101, 255, 0) GREEN_SLIME = RGB.new(0.396078431372549, 1.0, 0.0) # Green-yellow: #ADFF2F: (173, 255, 47) GREEN_YELLOW = RGB.new(0.6784313725490196, 1.0, 0.1843137254901961) # Green-yellow (Crayola): #F0E891: (240, 232, 145) GREEN_YELLOW_CRAYOLA = RGB.new(0.9411764705882353, 0.9098039215686274, 0.5686274509803921) # Grullo: #A99A86: (169, 154, 134) GRULLO = RGB.new(0.6627450980392157, 0.6039215686274509, 0.5254901960784314) # Guppie green: #00FF7F: (0, 255, 127) GUPPIE_GREEN = RGB.new(0.0, 1.0, 0.4980392156862745) # Gunmetal: #2a3439: (42, 52, 57) GUNMETAL = RGB.new(0.16470588235294117, 0.20392156862745098, 0.2235294117647059) # Guyabano: #F8F8F8: (248, 248, 248) GUYABANO = RGB.new(0.9725490196078431, 0.9725490196078431, 0.9725490196078431) # Halayà úbe: #663854: (102, 55, 84) HALAYA_UBE = RGB.new(0.4, 0.21568627450980393, 0.32941176470588235) # Halloween orange: #EB6123: (235, 97, 35) HALLOWEEN_ORANGE = RGB.new(0.9215686274509803, 0.3803921568627451, 0.13725490196078433) # Han blue: #446CCF: (68, 108, 207) HAN_BLUE = RGB.new(0.26666666666666666, 0.4235294117647059, 0.8117647058823529) # Han purple: #5218FA: (82, 24, 250) HAN_PURPLE = RGB.new(0.3215686274509804, 0.09411764705882353, 0.9803921568627451) # Hansa yellow: #E9D66B: (233, 214, 107) HANSA_YELLOW = RGB.new(0.9137254901960784, 0.8392156862745098, 0.4196078431372549) # Harlequin: #3FFF00: (63, 255, 0) HARLEQUIN = RGB.new(0.24705882352941178, 1.0, 0.0) # Harlequin green: #46CB18: (70, 203, 24) HARLEQUIN_GREEN = RGB.new(0.27450980392156865, 0.796078431372549, 0.09411764705882353) # Harmonious rose: #F29CB7: (242, 156, 183) HARMONIOUS_ROSE = RGB.new(0.9490196078431372, 0.611764705882353, 0.7176470588235294) # Harvard crimson: #C90016: (201, 0, 22) HARVARD_CRIMSON = RGB.new(0.788235294117647, 0.0, 0.08627450980392157) # Harvest gold: #DA9100: (218, 145, 0) HARVEST_GOLD = RGB.new(0.8549019607843137, 0.5686274509803921, 0.0) # Heart gold: #808000: (128, 128, 0) HEART_GOLD = RGB.new(0.5019607843137255, 0.5019607843137255, 0.0) # Heat Wave: #FF7A00: (255, 122, 0) HEAT_WAVE = RGB.new(1.0, 0.47843137254901963, 0.0) # Heidelberg red: #960018: (150, 0, 24) HEIDELBERG_RED = RGB.new(0.5882352941176471, 0.0, 0.09411764705882353) # Heliotrope: #DF73FF: (223, 115, 255) HELIOTROPE = RGB.new(0.8745098039215686, 0.45098039215686275, 1.0) # Heliotrope gray: #AA98A9: (170, 152, 168) HELIOTROPE_GRAY = RGB.new(0.6666666666666666, 0.596078431372549, 0.6588235294117647) # Heliotrope magenta: #AA00BB: (170, 0, 187) HELIOTROPE_MAGENTA = RGB.new(0.6666666666666666, 0.0, 0.7333333333333333) # Hollywood cerise: #F400A1: (244, 0, 161) HOLLYWOOD_CERISE = RGB.new(0.9568627450980393, 0.0, 0.6313725490196078) # Honeydew: #F0FFF0: (240, 255, 240) HONEYDEW = RGB.new(0.9411764705882353, 1.0, 0.9411764705882353) # Honolulu blue: #006DB0: (0, 109, 176) HONOLULU_BLUE = RGB.new(0.0, 0.42745098039215684, 0.6901960784313725) # Hooker's green: #49796B: (73, 121, 107) HOOKERS_GREEN = RGB.new(0.28627450980392155, 0.4745098039215686, 0.4196078431372549) # Hot magenta: #FF1DCE: (255, 29, 206) HOT_MAGENTA = RGB.new(1.0, 0.11372549019607843, 0.807843137254902) # Hot pink: #FF69B4: (255, 105, 180) HOT_PINK = RGB.new(1.0, 0.4117647058823529, 0.7058823529411765) # Hunter green: #355E3B: (53, 94, 59) HUNTER_GREEN = RGB.new(0.20784313725490197, 0.3686274509803922, 0.23137254901960785) # Iceberg: #71A6D2: (113, 166, 210) ICEBERG = RGB.new(0.44313725490196076, 0.6509803921568628, 0.8235294117647058) # Iced tea: #923C01: (146, 60, 1) ICED_TEA = RGB.new(0.5725490196078431, 0.23529411764705882, 0.00392156862745098) # Icterine: #FCF75E: (252, 247, 94) ICTERINE = RGB.new(0.9882352941176471, 0.9686274509803922, 0.3686274509803922) # Iguana green: #71BC78: (113, 188, 120) IGUANA_GREEN = RGB.new(0.44313725490196076, 0.7372549019607844, 0.47058823529411764) # Illuminating emerald: #319177: (49, 145, 119) ILLUMINATING_EMERALD = RGB.new(0.19215686274509805, 0.5686274509803921, 0.4666666666666667) # Imperial: #602F6B: (96, 47, 107) IMPERIAL = RGB.new(0.3764705882352941, 0.1843137254901961, 0.4196078431372549) # Imperial blue: #002395: (0, 35, 149) IMPERIAL_BLUE = RGB.new(0.0, 0.13725490196078433, 0.5843137254901961) # Imperial purple: #66023C: (102, 2, 60) IMPERIAL_PURPLE = RGB.new(0.4, 0.00784313725490196, 0.23529411764705882) # Imperial red: #ED2939: (237, 41, 57) IMPERIAL_RED = RGB.new(0.9294117647058824, 0.1607843137254902, 0.2235294117647059) # Inchworm: #B2EC5D: (178, 236, 93) INCHWORM = RGB.new(0.6980392156862745, 0.9254901960784314, 0.36470588235294116) # Independence: #4C516D: (76, 81, 109) INDEPENDENCE = RGB.new(0.2980392156862745, 0.3176470588235294, 0.42745098039215684) # India green: #138808: (19, 136, 8) INDIA_GREEN = RGB.new(0.07450980392156863, 0.5333333333333333, 0.03137254901960784) # Indian red: #CD5C5C: (205, 92, 92) INDIAN_RED = RGB.new(0.803921568627451, 0.3607843137254902, 0.3607843137254902) # Indian yellow: #E3A857: (227, 168, 87) INDIAN_YELLOW = RGB.new(0.8901960784313725, 0.6588235294117647, 0.3411764705882353) # Indigo: #4B0082: (75, 0, 130) INDIGO = RGB.new(0.29411764705882354, 0.0, 0.5098039215686274) # Indigo dye: #091F92: (9, 31, 146) INDIGO_DYE = RGB.new(0.03529411764705882, 0.12156862745098039, 0.5725490196078431) # Indigo (Crayola): #4F69C6: (79, 105, 198) INDIGO_CRAYOLA = RGB.new(0.30980392156862746, 0.4117647058823529, 0.7764705882352941) # Indigo (Rainbow): #233067: (35, 48, 103) INDIGO_RAINBOW = RGB.new(0.13725490196078433, 0.18823529411764706, 0.403921568627451) # Indigo (web): #4B0082: (75, 0, 130) INDIGO_WEB = RGB.new(0.29411764705882354, 0.0, 0.5098039215686274) # Infra red: #FF496C: (255, 73, 108) INFRA_RED = RGB.new(1.0, 0.28627450980392155, 0.4235294117647059) # Interdimensional blue: #360CCC: (54, 12, 204) INTERDIMENSIONAL_BLUE = RGB.new(0.21176470588235294, 0.047058823529411764, 0.8) # International Klein Blue: #002FA7: (0, 47, 167) INTERNATIONAL_KLEIN_BLUE = RGB.new(0.0, 0.1843137254901961, 0.6549019607843137) # International orange (aerospace): #FF4F00: (255, 79, 0) INTERNATIONAL_ORANGE_AEROSPACE = RGB.new(1.0, 0.30980392156862746, 0.0) # International orange (engineering): #BA160C: (186, 22, 12) INTERNATIONAL_ORANGE_ENGINEERING = RGB.new(0.7294117647058823, 0.08627450980392157, 0.047058823529411764) # International orange (Golden Gate Bridge): #C0362C: (192, 54, 44) INTERNATIONAL_ORANGE_GOLDEN_GATE_BRIDGE = RGB.new(0.7529411764705882, 0.21176470588235294, 0.17254901960784313) # Iris: #5A4FCF: (90, 79, 207) IRIS = RGB.new(0.35294117647058826, 0.30980392156862746, 0.8117647058823529) # Iron: #A19D94: (161, 157, 148) IRON = RGB.new(0.6313725490196078, 0.615686274509804, 0.5803921568627451) # Irresistible: #B3446C: (179, 68, 108) IRRESISTIBLE = RGB.new(0.7019607843137254, 0.26666666666666666, 0.4235294117647059) # Isabelline: #F4F0EC: (244, 240, 236) ISABELLINE = RGB.new(0.9568627450980393, 0.9411764705882353, 0.9254901960784314) # Islamic green: #009000: (0, 144, 0) ISLAMIC_GREEN = RGB.new(0.0, 0.5647058823529412, 0.0) # Italian sky blue: #B2FFFF: (178, 255, 255) ITALIAN_SKY_BLUE = RGB.new(0.6980392156862745, 1.0, 1.0) # Ivory: #FFFFF0: (255, 255, 240) IVORY = RGB.new(1.0, 1.0, 0.9411764705882353) # Jacarta: #3D325D: (61, 50, 93) JACARTA = RGB.new(0.23921568627450981, 0.19607843137254902, 0.36470588235294116) # Jacko bean: #413628: (65, 54, 40) JACKO_BEAN = RGB.new(0.2549019607843137, 0.21176470588235294, 0.1568627450980392) # Jade: #00A86B: (0, 168, 107) JADE = RGB.new(0.0, 0.6588235294117647, 0.4196078431372549) # Japanese carmine: #9D2933: (157, 41, 51) JAPANESE_CARMINE = RGB.new(0.615686274509804, 0.1607843137254902, 0.2) # Japanese indigo: #264348: (38, 67, 72) JAPANESE_INDIGO = RGB.new(0.14901960784313725, 0.2627450980392157, 0.2823529411764706) # Japanese laurel: #2F7532: (47, 117, 50) JAPANESE_LAUREL = RGB.new(0.1843137254901961, 0.4588235294117647, 0.19607843137254902) # Japanese violet: #5B3256: (91, 50, 86) JAPANESE_VIOLET = RGB.new(0.3568627450980392, 0.19607843137254902, 0.33725490196078434) # Jasmine: #F8DE7E: (248, 222, 126) JASMINE = RGB.new(0.9725490196078431, 0.8705882352941177, 0.49411764705882355) # Jasper: #D73B3E: (215, 59, 62) JASPER = RGB.new(0.8431372549019608, 0.23137254901960785, 0.24313725490196078) # Jasper orange: #DE8F4E: (223, 145, 79) JASPER_ORANGE = RGB.new(0.8745098039215686, 0.5686274509803921, 0.30980392156862746) # Jazzberry jam: #A50B5E: (165, 11, 94) JAZZBERRY_JAM = RGB.new(0.6470588235294118, 0.043137254901960784, 0.3686274509803922) # Jelly bean: #DA614E: (218, 97, 78) JELLY_BEAN = RGB.new(0.8549019607843137, 0.3803921568627451, 0.3058823529411765) # Jelly bean blue: #44798E: (68, 121, 142) JELLY_BEAN_BLUE = RGB.new(0.26666666666666666, 0.4745098039215686, 0.5568627450980392) # Jet: #343434: (52, 52, 52) JET = RGB.new(0.20392156862745098, 0.20392156862745098, 0.20392156862745098) # Jet stream: #BBD0C9: (187, 208, 201) JET_STREAM = RGB.new(0.7333333333333333, 0.8156862745098039, 0.788235294117647) # Jonquil: #F4CA16: (244, 202, 22) JONQUIL = RGB.new(0.9568627450980393, 0.792156862745098, 0.08627450980392157) # Jordy blue: #8AB9F1: (138, 185, 241) JORDY_BLUE = RGB.new(0.5411764705882353, 0.7254901960784313, 0.9450980392156862) # June bud: #BDDA57: (189, 218, 87) JUNE_BUD = RGB.new(0.7411764705882353, 0.8549019607843137, 0.3411764705882353) # Jungle green: #29AB87: (41, 171, 135) JUNGLE_GREEN = RGB.new(0.1607843137254902, 0.6705882352941176, 0.5294117647058824) # Kelly green: #4CBB17: (76, 187, 23) KELLY_GREEN = RGB.new(0.2980392156862745, 0.7333333333333333, 0.09019607843137255) # Kenyan copper: #7C1C05: (124, 28, 5) KENYAN_COPPER = RGB.new(0.48627450980392156, 0.10980392156862745, 0.0196078431372549) # Keppel: #3AB09E: (58, 176, 158) KEPPEL = RGB.new(0.22745098039215686, 0.6901960784313725, 0.6196078431372549) # Key lime: #E8F48C: (232, 244, 140) KEY_LIME = RGB.new(0.9098039215686274, 0.9568627450980393, 0.5490196078431373) # Khaki: #C3B091: (195, 176, 145) KHAKI = RGB.new(0.7647058823529411, 0.6901960784313725, 0.5686274509803921) # Khaki (X11): #F0E68C: (240, 230, 140) KHAKI_X11 = RGB.new(0.9411764705882353, 0.9019607843137255, 0.5490196078431373) # Kiwi: #8EE53F: (142, 229, 63) KIWI = RGB.new(0.5568627450980392, 0.8980392156862745, 0.24705882352941178) # Kobe: #882D17: (136, 45, 23) KOBE = RGB.new(0.5333333333333333, 0.17647058823529413, 0.09019607843137255) # Kobi: #E79FC4: (231, 159, 196) KOBI = RGB.new(0.9058823529411765, 0.6235294117647059, 0.7686274509803922) # Kobicha: #6B4423: (107, 68, 35) KOBICHA = RGB.new(0.4196078431372549, 0.26666666666666666, 0.13725490196078433) # Kombu green: #354230: (53, 66, 48) KOMBU_GREEN = RGB.new(0.20784313725490197, 0.25882352941176473, 0.18823529411764706) # KSU Purple: #512888: (79, 38, 131) KSU_PURPLE = RGB.new(0.30980392156862746, 0.14901960784313725, 0.5137254901960784) # KU Crimson: #E8000D: (232, 0, 13) KU_CRIMSON = RGB.new(0.9098039215686274, 0.0, 0.050980392156862744) # La Salle green: #087830: (8, 120, 48) LA_SALLE_GREEN = RGB.new(0.03137254901960784, 0.47058823529411764, 0.18823529411764706) # Languid lavender: #D6CADD: (214, 202, 221) LANGUID_LAVENDER = RGB.new(0.8392156862745098, 0.792156862745098, 0.8666666666666667) # Lanzones: #E0BC5B: (224, 188, 91) LANZONES = RGB.new(0.8784313725490196, 0.7372549019607844, 0.3568627450980392) # Lapis lazuli: #26619C: (38, 97, 156) LAPIS_LAZULI = RGB.new(0.14901960784313725, 0.3803921568627451, 0.611764705882353) # Laser Lemon: #FFFF66: (255, 255, 102) LASER_LEMON = RGB.new(1.0, 1.0, 0.4) # Laurel green: #A9BA9D: (169, 186, 157) LAUREL_GREEN = RGB.new(0.6627450980392157, 0.7294117647058823, 0.615686274509804) # Lava: #CF1020: (207, 16, 32) LAVA = RGB.new(0.8117647058823529, 0.06274509803921569, 0.12549019607843137) # Lavender: #B57EDC: (181, 126, 220) LAVENDER = RGB.new(0.7098039215686275, 0.49411764705882355, 0.8627450980392157) # Lavender (web): #E6E6FA: (230, 230, 250) LAVENDER_WEB = RGB.new(0.9019607843137255, 0.9019607843137255, 0.9803921568627451) # Lavender blue: #CCCCFF: (204, 204, 255) LAVENDER_BLUE = RGB.new(0.8, 0.8, 1.0) # Lavender blush: #FFF0F5: (255, 240, 245) LAVENDER_BLUSH = RGB.new(1.0, 0.9411764705882353, 0.9607843137254902) # Lavender gray: #C4C3D0: (196, 195, 208) LAVENDER_GRAY = RGB.new(0.7686274509803922, 0.7647058823529411, 0.8156862745098039) # Lavender indigo: #9457EB: (148, 87, 235) LAVENDER_INDIGO = RGB.new(0.5803921568627451, 0.3411764705882353, 0.9215686274509803) # Lavender magenta: #EE82EE: (238, 130, 238) LAVENDER_MAGENTA = RGB.new(0.9333333333333333, 0.5098039215686274, 0.9333333333333333) # Lavender mist: #E6E6FA: (230, 230, 250) LAVENDER_MIST = RGB.new(0.9019607843137255, 0.9019607843137255, 0.9803921568627451) # Lavender pink: #FBAED2: (251, 174, 210) LAVENDER_PINK = RGB.new(0.984313725490196, 0.6823529411764706, 0.8235294117647058) # Lavender purple: #967BB6: (150, 123, 182) LAVENDER_PURPLE = RGB.new(0.5882352941176471, 0.4823529411764706, 0.7137254901960784) # Lavender rose: #FBA0E3: (251, 160, 227) LAVENDER_ROSE = RGB.new(0.984313725490196, 0.6274509803921569, 0.8901960784313725) # Lawn green: #7CFC00: (124, 252, 0) LAWN_GREEN = RGB.new(0.48627450980392156, 0.9882352941176471, 0.0) # Lemon: #FFF700: (255, 247, 0) LEMON = RGB.new(1.0, 0.9686274509803922, 0.0) # Lemon chiffon: #FFFACD: (255, 250, 205) LEMON_CHIFFON = RGB.new(1.0, 0.9803921568627451, 0.803921568627451) # Lemon curry: #CCA01D: (204, 160, 29) LEMON_CURRY = RGB.new(0.8, 0.6274509803921569, 0.11372549019607843) # Lemon glacier: #FDFF00: (253, 255, 0) LEMON_GLACIER = RGB.new(0.9921568627450981, 1.0, 0.0) # Lemon iced tea: #BD3000: (189, 48, 0) LEMON_ICED_TEA = RGB.new(0.7411764705882353, 0.18823529411764706, 0.0) # Lemon lime: #E3FF00: (227, 255, 0) LEMON_LIME = RGB.new(0.8901960784313725, 1.0, 0.0) # Lemon meringue: #F6EABE: (246, 234, 190) LEMON_MERINGUE = RGB.new(0.9647058823529412, 0.9176470588235294, 0.7450980392156863) # Lemon yellow: #FFF44F: (255, 244, 79) LEMON_YELLOW = RGB.new(1.0, 0.9568627450980393, 0.30980392156862746) # Lemon yellow (Crayola): #FFFF9F: (255, 255, 159) LEMON_YELLOW_CRAYOLA = RGB.new(1.0, 1.0, 0.6235294117647059) # Lenurple: #BA93D8: (186, 147, 216) LENURPLE = RGB.new(0.7294117647058823, 0.5764705882352941, 0.8470588235294118) # Liberty: #545AA7: (84, 90, 167) LIBERTY = RGB.new(0.32941176470588235, 0.35294117647058826, 0.6549019607843137) # Licorice: #1A1110: (26, 17, 16) LICORICE = RGB.new(0.10196078431372549, 0.06666666666666667, 0.06274509803921569) # Light apricot: #FDD5B1: (253, 213, 177) LIGHT_APRICOT = RGB.new(0.9921568627450981, 0.8352941176470589, 0.6941176470588235) # Light blue: #ADD8E6: (173, 216, 230) LIGHT_BLUE = RGB.new(0.6784313725490196, 0.8470588235294118, 0.9019607843137255) # Light brown: #B5651D: (181, 101, 29) LIGHT_BROWN = RGB.new(0.7098039215686275, 0.396078431372549, 0.11372549019607843) # Light carmine pink: #E66771: (230, 103, 113) LIGHT_CARMINE_PINK = RGB.new(0.9019607843137255, 0.403921568627451, 0.44313725490196076) # Light chocolate cosmos: #551F2F: (85, 31, 47) LIGHT_CHOCOLATE_COSMOS = RGB.new(0.3333333333333333, 0.12156862745098039, 0.1843137254901961) # Light cobalt blue: #88ACE0: (136, 172, 224) LIGHT_COBALT_BLUE = RGB.new(0.5333333333333333, 0.6745098039215687, 0.8784313725490196) # Light coral: #F08080: (240, 128, 128) LIGHT_CORAL = RGB.new(0.9411764705882353, 0.5019607843137255, 0.5019607843137255) # Light cornflower blue: #93CCEA: (147, 204, 234) LIGHT_CORNFLOWER_BLUE = RGB.new(0.5764705882352941, 0.8, 0.9176470588235294) # Light crimson: #F56991: (245, 105, 145) LIGHT_CRIMSON = RGB.new(0.9607843137254902, 0.4117647058823529, 0.5686274509803921) # Light cyan: #E0FFFF: (224, 255, 255) LIGHT_CYAN = RGB.new(0.8784313725490196, 1.0, 1.0) # Light deep pink: #FF5CCD: (255, 92, 205) LIGHT_DEEP_PINK = RGB.new(1.0, 0.3607843137254902, 0.803921568627451) # Light French beige: #C8AD7F: (200, 173, 127) LIGHT_FRENCH_BEIGE = RGB.new(0.7843137254901961, 0.6784313725490196, 0.4980392156862745) # Light fuchsia pink: #F984EF: (249, 132, 239) LIGHT_FUCHSIA_PINK = RGB.new(0.9764705882352941, 0.5176470588235295, 0.9372549019607843) # Light gold: #B29700: (178, 151, 0) LIGHT_GOLD = RGB.new(0.6980392156862745, 0.592156862745098, 0.0) # Light goldenrod: #FFEC8B: (255, 236, 139) LIGHT_GOLDENROD = RGB.new(1.0, 0.9254901960784314, 0.5450980392156862) # Light goldenrod yellow: #FAFAD2: (250, 250, 210) LIGHT_GOLDENROD_YELLOW = RGB.new(0.9803921568627451, 0.9803921568627451, 0.8235294117647058) # Light gray: #D3D3D3: (211, 211, 211) LIGHT_GRAY = RGB.new(0.8274509803921568, 0.8274509803921568, 0.8274509803921568) # Light grayish magenta: #CC99CC: (204, 153, 204) LIGHT_GRAYISH_MAGENTA = RGB.new(0.8, 0.6, 0.8) # Light green: #90EE90: (144, 238, 144) LIGHT_GREEN = RGB.new(0.5647058823529412, 0.9333333333333333, 0.5647058823529412) # Light hot pink: #FFB3DE: (255, 179, 222) LIGHT_HOT_PINK = RGB.new(1.0, 0.7019607843137254, 0.8705882352941177) # Light khaki: #F0E68C: (240, 230, 140) LIGHT_KHAKI = RGB.new(0.9411764705882353, 0.9019607843137255, 0.5490196078431373) # Light medium orchid: #D39BCB: (211, 155, 203) LIGHT_MEDIUM_ORCHID = RGB.new(0.8274509803921568, 0.6078431372549019, 0.796078431372549) # Light moss green: #ADDFAD: (173, 223, 173) LIGHT_MOSS_GREEN = RGB.new(0.6784313725490196, 0.8745098039215686, 0.6784313725490196) # Light mustard: #FF3333: (238, 221, 98) LIGHT_MUSTARD = RGB.new(0.9333333333333333, 0.8666666666666667, 0.3843137254901961) # Light orange: #FED8B1: (254, 216, 177) LIGHT_ORANGE = RGB.new(0.996078431372549, 0.8470588235294118, 0.6941176470588235) # Light orchid: #E6A8D7: (230, 168, 215) LIGHT_ORCHID = RGB.new(0.9019607843137255, 0.6588235294117647, 0.8431372549019608) # Light pastel purple: #B19CD9: (177, 156, 217) LIGHT_PASTEL_PURPLE = RGB.new(0.6941176470588235, 0.611764705882353, 0.8509803921568627) # Light periwinkle: #C5CBE1: (197, 203, 225) LIGHT_PERIWINKLE = RGB.new(0.7725490196078432, 0.796078431372549, 0.8823529411764706) # Light pink: #FFB6C1: (255, 182, 193) LIGHT_PINK = RGB.new(1.0, 0.7137254901960784, 0.7568627450980392) # Light red: #FF3333: (255, 51, 51) LIGHT_RED = RGB.new(1.0, 0.2, 0.2) # Light red ochre: #E97451: (233, 116, 81) LIGHT_RED_OCHRE = RGB.new(0.9137254901960784, 0.4549019607843137, 0.3176470588235294) # Light salmon: #FFA07A: (255, 160, 122) LIGHT_SALMON = RGB.new(1.0, 0.6274509803921569, 0.47843137254901963) # Light salmon pink: #FF9999: (255, 153, 153) LIGHT_SALMON_PINK = RGB.new(1.0, 0.6, 0.6) # Light sea green: #20B2AA: (32, 178, 170) LIGHT_SEA_GREEN = RGB.new(0.12549019607843137, 0.6980392156862745, 0.6666666666666666) # Light silver: #D8D8D8: (216, 216, 216) LIGHT_SILVER = RGB.new(0.8470588235294118, 0.8470588235294118, 0.8470588235294118) # Light sky blue: #87CEFA: (135, 206, 250) LIGHT_SKY_BLUE = RGB.new(0.5294117647058824, 0.807843137254902, 0.9803921568627451) # Light slate gray: #778899: (119, 136, 153) LIGHT_SLATE_GRAY = RGB.new(0.4666666666666667, 0.5333333333333333, 0.6) # Light steel blue: #B0C4DE: (176, 196, 222) LIGHT_STEEL_BLUE = RGB.new(0.6901960784313725, 0.7686274509803922, 0.8705882352941177) # Light taupe: #B38B6D: (179, 139, 109) LIGHT_TAUPE = RGB.new(0.7019607843137254, 0.5450980392156862, 0.42745098039215684) # Light Thulian pink: #E68FAC: (230, 143, 172) LIGHT_THULIAN_PINK = RGB.new(0.9019607843137255, 0.5607843137254902, 0.6745098039215687) # Light turquoise: #AFE4DE: (175, 228, 222) LIGHT_TURQUOISE = RGB.new(0.6862745098039216, 0.8941176470588236, 0.8705882352941177) # Light violet: #7A5299: (122, 82, 153) LIGHT_VIOLET = RGB.new(0.47843137254901963, 0.3215686274509804, 0.6) # Light yellow: #FFFFE0: (255, 255, 224) LIGHT_YELLOW = RGB.new(1.0, 1.0, 0.8784313725490196) # Lilac: #C8A2C8: (200, 162, 200) LILAC = RGB.new(0.7843137254901961, 0.6352941176470588, 0.7843137254901961) # Lilac Luster: #AE98AA: (174, 152, 170) LILAC_LUSTER = RGB.new(0.6823529411764706, 0.596078431372549, 0.6666666666666666) # Lime (color wheel): #BFFF00: (191, 255, 0) LIME_COLOR_WHEEL = RGB.new(0.7490196078431373, 1.0, 0.0) # Lime (web) (X11 green): #00FF00: (0, 255, 0) LIME_WEB_X11_GREEN = RGB.new(0.0, 1.0, 0.0) # Lime green: #32CD32: (50, 205, 50) LIME_GREEN = RGB.new(0.19607843137254902, 0.803921568627451, 0.19607843137254902) # Limerick: #9DC209: (157, 194, 9) LIMERICK = RGB.new(0.615686274509804, 0.7607843137254902, 0.03529411764705882) # Lincoln green: #195905: (25, 89, 5) LINCOLN_GREEN = RGB.new(0.09803921568627451, 0.34901960784313724, 0.0196078431372549) # Linen: #FAF0E6: (250, 240, 230) LINEN = RGB.new(0.9803921568627451, 0.9411764705882353, 0.9019607843137255) # Lion: #C19A6B: (193, 154, 107) LION = RGB.new(0.7568627450980392, 0.6039215686274509, 0.4196078431372549) # Liseran purple: #DE6FA1: (222, 111, 161) LISERAN_PURPLE = RGB.new(0.8705882352941177, 0.43529411764705883, 0.6313725490196078) # Little boy blue: #6CA0DC: (108, 160, 220) LITTLE_BOY_BLUE = RGB.new(0.4235294117647059, 0.6274509803921569, 0.8627450980392157) # Little girl pink: #F8B9D4: (248, 185, 212) LITTLE_GIRL_PINK = RGB.new(0.9725490196078431, 0.7254901960784313, 0.8313725490196079) # Liver: #674C47: (103, 76, 71) LIVER = RGB.new(0.403921568627451, 0.2980392156862745, 0.2784313725490196) # Liver (dogs): #B86D29: (184, 109, 41) LIVER_DOGS = RGB.new(0.7215686274509804, 0.42745098039215684, 0.1607843137254902) # Liver (organ): #6C2E1F: (108, 46, 31) LIVER_ORGAN = RGB.new(0.4235294117647059, 0.1803921568627451, 0.12156862745098039) # Liver chestnut: #987456: (152, 116, 86) LIVER_CHESTNUT = RGB.new(0.596078431372549, 0.4549019607843137, 0.33725490196078434) # Livid: #6699CC: (102, 153, 204) LIVID = RGB.new(0.4, 0.6, 0.8) # Lotion: #FEFDFA: (255, 254, 250) LOTION = RGB.new(1.0, 0.996078431372549, 0.9803921568627451) # Lotion blue: #15F2FD: (123, 154, 200) LOTION_BLUE = RGB.new(0.4823529411764706, 0.6039215686274509, 0.7843137254901961) # Lotion pink: #ECCFCF: (236, 207, 207) LOTION_PINK = RGB.new(0.9254901960784314, 0.8117647058823529, 0.8117647058823529) # Lumber: #FFE4CD: (255, 228, 205) LUMBER = RGB.new(1.0, 0.8941176470588236, 0.803921568627451) # Lust: #E62020: (230, 32, 32) LUST = RGB.new(0.9019607843137255, 0.12549019607843137, 0.12549019607843137) # Maastricht Blue: #001C3D: (0, 28, 61) MAASTRICHT_BLUE = RGB.new(0.0, 0.10980392156862745, 0.23921568627450981) # Macaroni and Cheese: #FFBD88: (255, 189, 136) MACARONI_AND_CHEESE = RGB.new(1.0, 0.7411764705882353, 0.5333333333333333) # Madder Lake: #CC3336: (204, 51, 54) MADDER_LAKE = RGB.new(0.8, 0.2, 0.21176470588235294) # Magenta: #FF00FF: (255, 0, 255) MAGENTA = RGB.new(1.0, 0.0, 1.0) # Mahogany: #C04000: (192, 64, 0) MAHOGANY = RGB.new(0.7529411764705882, 0.25098039215686274, 0.0) # Maize: #FBEC5D: (251, 236, 93) MAIZE = RGB.new(0.984313725490196, 0.9254901960784314, 0.36470588235294116) # Maize (Crayola): #F2C649: (242, 198, 73) MAIZE_CRAYOLA = RGB.new(0.9490196078431372, 0.7764705882352941, 0.28627450980392155) # Majorelle Blue: #6050DC: (96, 80, 220) MAJORELLE_BLUE = RGB.new(0.3764705882352941, 0.3137254901960784, 0.8627450980392157) # Malachite: #0BDA51: (11, 218, 81) MALACHITE = RGB.new(0.043137254901960784, 0.8549019607843137, 0.3176470588235294) # Manatee: #979AAA: (151, 154, 170) MANATEE = RGB.new(0.592156862745098, 0.6039215686274509, 0.6666666666666666) # Mandarin: #F37A48: (243, 122, 72) MANDARIN = RGB.new(0.9529411764705882, 0.47843137254901963, 0.2823529411764706) # Mango: #FDBE02: (253, 190, 2) MANGO = RGB.new(0.9921568627450981, 0.7450980392156863, 0.00784313725490196) # Mango green: #96FF00: (150, 255, 0) MANGO_GREEN = RGB.new(0.5882352941176471, 1.0, 0.0) # Mango Tango: #FF8243: (255, 130, 67) MANGO_TANGO = RGB.new(1.0, 0.5098039215686274, 0.2627450980392157) # Mantis: #74C365: (116, 195, 101) MANTIS = RGB.new(0.4549019607843137, 0.7647058823529411, 0.396078431372549) # Mardi Gras: #880085: (136, 0, 133) MARDI_GRAS = RGB.new(0.5333333333333333, 0.0, 0.5215686274509804) # Marigold: #EAA221: (234, 162, 33) MARIGOLD = RGB.new(0.9176470588235294, 0.6352941176470588, 0.12941176470588237) # Maroon (Crayola): #C32148: (195, 33, 72) MAROON_CRAYOLA = RGB.new(0.7647058823529411, 0.12941176470588237, 0.2823529411764706) # Maroon (HTML/CSS): #800000: (128, 0, 0) MAROON_HTML_CSS = RGB.new(0.5019607843137255, 0.0, 0.0) # Maroon (X11): #B03060: (176, 48, 96) MAROON_X11 = RGB.new(0.6901960784313725, 0.18823529411764706, 0.3764705882352941) # Mauve: #E0B0FF: (224, 176, 255) MAUVE = RGB.new(0.8784313725490196, 0.6901960784313725, 1.0) # Mauve taupe: #915F6D: (145, 95, 109) MAUVE_TAUPE = RGB.new(0.5686274509803921, 0.37254901960784315, 0.42745098039215684) # Mauvelous: #EF98AA: (239, 152, 170) MAUVELOUS = RGB.new(0.9372549019607843, 0.596078431372549, 0.6666666666666666) # Maximum Blue: #47ABCC: (71, 171, 204) MAXIMUM_BLUE = RGB.new(0.2784313725490196, 0.6705882352941176, 0.8) # Maximum Blue Green: #30BFBF: (48, 191, 191) MAXIMUM_BLUE_GREEN = RGB.new(0.18823529411764706, 0.7490196078431373, 0.7490196078431373) # Maximum Blue Purple: #ACACE6: (172, 172, 230) MAXIMUM_BLUE_PURPLE = RGB.new(0.6745098039215687, 0.6745098039215687, 0.9019607843137255) # Maximum Green: #5E8C31: (94, 140, 49) MAXIMUM_GREEN = RGB.new(0.3686274509803922, 0.5490196078431373, 0.19215686274509805) # Maximum Green Yellow: #D9E650: (217, 230, 80) MAXIMUM_GREEN_YELLOW = RGB.new(0.8509803921568627, 0.9019607843137255, 0.3137254901960784) # Maximum orange: #FF5B00: (255, 91, 0) MAXIMUM_ORANGE = RGB.new(1.0, 0.3568627450980392, 0.0) # Maximum Purple: #733380: (115, 51, 128) MAXIMUM_PURPLE = RGB.new(0.45098039215686275, 0.2, 0.5019607843137255) # Maximum pink: #F6A5F2: (246, 165, 242) MAXIMUM_PINK = RGB.new(0.9647058823529412, 0.6470588235294118, 0.9490196078431372) # Maximum red: #D92121: (217, 33, 33) MAXIMUM_RED = RGB.new(0.8509803921568627, 0.12941176470588237, 0.12941176470588237) # Maximum Red Purple: #A63A79: (166, 58, 121) MAXIMUM_RED_PURPLE = RGB.new(0.6509803921568628, 0.22745098039215686, 0.4745098039215686) # Maximum violet: #892F77: (137, 47, 119) MAXIMUM_VIOLET = RGB.new(0.5372549019607843, 0.1843137254901961, 0.4666666666666667) # Maximum yellow: #FAFA37: (250, 250, 55) MAXIMUM_YELLOW = RGB.new(0.9803921568627451, 0.9803921568627451, 0.21568627450980393) # Maximum yellow red: #F2BA49: (242, 186, 73) MAXIMUM_YELLOW_RED = RGB.new(0.9490196078431372, 0.7294117647058823, 0.28627450980392155) # May green: #4C9141: (76, 145, 65) MAY_GREEN = RGB.new(0.2980392156862745, 0.5686274509803921, 0.2549019607843137) # Maya blue: #73C2FB: (115, 194, 251) MAYA_BLUE = RGB.new(0.45098039215686275, 0.7607843137254902, 0.984313725490196) # Meat brown: #E5B73B: (229, 183, 59) MEAT_BROWN = RGB.new(0.8980392156862745, 0.7176470588235294, 0.23137254901960785) # Medium aquamarine: #66DDAA: (102, 221, 170) MEDIUM_AQUAMARINE = RGB.new(0.4, 0.8666666666666667, 0.6666666666666666) # Medium blue: #0000CD: (0, 0, 205) MEDIUM_BLUE = RGB.new(0.0, 0.0, 0.803921568627451) # Medium candy apple red: #E2062C: (226, 6, 44) MEDIUM_CANDY_APPLE_RED = RGB.new(0.8862745098039215, 0.023529411764705882, 0.17254901960784313) # Medium carmine: #AF4035: (175, 64, 53) MEDIUM_CARMINE = RGB.new(0.6862745098039216, 0.25098039215686274, 0.20784313725490197) # Medium champagne: #F3E5AB: (243, 229, 171) MEDIUM_CHAMPAGNE = RGB.new(0.9529411764705882, 0.8980392156862745, 0.6705882352941176) # Medium electric blue: #035096: (3, 80, 150) MEDIUM_ELECTRIC_BLUE = RGB.new(0.011764705882352941, 0.3137254901960784, 0.5882352941176471) # Medium green: #037949: (3, 121, 73) MEDIUM_GREEN = RGB.new(0.011764705882352941, 0.4745098039215686, 0.28627450980392155) # Medium jungle green: #1C352D: (28, 53, 45) MEDIUM_JUNGLE_GREEN = RGB.new(0.10980392156862745, 0.20784313725490197, 0.17647058823529413) # Medium lavender magenta: #DDA0DD: (221, 160, 221) MEDIUM_LAVENDER_MAGENTA = RGB.new(0.8666666666666667, 0.6274509803921569, 0.8666666666666667) # Medium orange: #FF7802: (255, 120, 2) MEDIUM_ORANGE = RGB.new(1.0, 0.47058823529411764, 0.00784313725490196) # Medium orchid: #BA55D3: (186, 85, 211) MEDIUM_ORCHID = RGB.new(0.7294117647058823, 0.3333333333333333, 0.8274509803921568) # Medium Persian blue: #0067A5: (0, 103, 165) MEDIUM_PERSIAN_BLUE = RGB.new(0.0, 0.403921568627451, 0.6470588235294118) # Medium pink: #FE6E9F: (254, 110, 159) MEDIUM_PINK = RGB.new(0.996078431372549, 0.43137254901960786, 0.6235294117647059) # Medium purple: #9370DB: (147, 112, 219) MEDIUM_PURPLE = RGB.new(0.5764705882352941, 0.4392156862745098, 0.8588235294117647) # Medium red: #B10304: (177, 3, 4) MEDIUM_RED = RGB.new(0.6941176470588235, 0.011764705882352941, 0.01568627450980392) # Medium red-violet: #BB3385: (187, 51, 133) MEDIUM_RED_VIOLET = RGB.new(0.7333333333333333, 0.2, 0.5215686274509804) # Medium ruby: #AA4069: (170, 64, 105) MEDIUM_RUBY = RGB.new(0.6666666666666666, 0.25098039215686274, 0.4117647058823529) # Medium sea green: #3CB371: (60, 179, 113) MEDIUM_SEA_GREEN = RGB.new(0.23529411764705882, 0.7019607843137254, 0.44313725490196076) # Medium sky blue: #80DAEB: (128, 218, 235) MEDIUM_SKY_BLUE = RGB.new(0.5019607843137255, 0.8549019607843137, 0.9215686274509803) # Medium slate blue: #7B68EE: (123, 104, 238) MEDIUM_SLATE_BLUE = RGB.new(0.4823529411764706, 0.40784313725490196, 0.9333333333333333) # Medium spring bud: #C9DC87: (201, 220, 135) MEDIUM_SPRING_BUD = RGB.new(0.788235294117647, 0.8627450980392157, 0.5294117647058824) # Medium spring green: #00FA9A: (0, 250, 154) MEDIUM_SPRING_GREEN = RGB.new(0.0, 0.9803921568627451, 0.6039215686274509) # Medium taupe: #674C47: (103, 76, 71) MEDIUM_TAUPE = RGB.new(0.403921568627451, 0.2980392156862745, 0.2784313725490196) # Medium turquoise: #48D1CC: (72, 209, 204) MEDIUM_TURQUOISE = RGB.new(0.2823529411764706, 0.8196078431372549, 0.8) # Medium Tuscan red: #79443B: (121, 68, 59) MEDIUM_TUSCAN_RED = RGB.new(0.4745098039215686, 0.26666666666666666, 0.23137254901960785) # Medium vermilion: #D9603B: (217, 96, 59) MEDIUM_VERMILION = RGB.new(0.8509803921568627, 0.3764705882352941, 0.23137254901960785) # Medium violet: #65315F: (101, 49, 95) MEDIUM_VIOLET = RGB.new(0.396078431372549, 0.19215686274509805, 0.37254901960784315) # Medium violet-red: #C71585: (199, 21, 133) MEDIUM_VIOLET_RED = RGB.new(0.7803921568627451, 0.08235294117647059, 0.5215686274509804) # Medium yellow: #FFE302: (255, 227, 2) MEDIUM_YELLOW = RGB.new(1.0, 0.8901960784313725, 0.00784313725490196) # Mellow apricot: #F8B878: (248, 184, 120) MELLOW_APRICOT = RGB.new(0.9725490196078431, 0.7215686274509804, 0.47058823529411764) # Mellow yellow: #F8DE7E: (248, 222, 126) MELLOW_YELLOW = RGB.new(0.9725490196078431, 0.8705882352941177, 0.49411764705882355) # Melon: #FDBCB4: (253, 188, 180) MELON = RGB.new(0.9921568627450981, 0.7372549019607844, 0.7058823529411765) # Melon (Crayola): #FEBAAD: (254, 186, 173) MELON_CRAYOLA = RGB.new(0.996078431372549, 0.7294117647058823, 0.6784313725490196) # Menthol: #C1F9A2: (193, 249, 162) MENTHOL = RGB.new(0.7568627450980392, 0.9764705882352941, 0.6352941176470588) # Metallic blue: #32527B: (50, 82, 123) METALLIC_BLUE = RGB.new(0.19607843137254902, 0.3215686274509804, 0.4823529411764706) # Metallic bronze: #A97142: (169, 113, 66) METALLIC_BRONZE = RGB.new(0.6627450980392157, 0.44313725490196076, 0.25882352941176473) # Metallic brown: #AC4313: (172, 67, 19) METALLIC_BROWN = RGB.new(0.6745098039215687, 0.2627450980392157, 0.07450980392156863) # Metallic gold: #D3AF37: (211, 175, 55) METALLIC_GOLD = RGB.new(0.8274509803921568, 0.6862745098039216, 0.21568627450980393) # Metallic green: #296E01: (41, 110, 1) METALLIC_GREEN = RGB.new(0.1607843137254902, 0.43137254901960786, 0.00392156862745098) # Metallic orange: #DA680F: (218, 104, 15) METALLIC_ORANGE = RGB.new(0.8549019607843137, 0.40784313725490196, 0.058823529411764705) # Metallic pink: #EDA6C4: (237, 166, 196) METALLIC_PINK = RGB.new(0.9294117647058824, 0.6509803921568628, 0.7686274509803922) # Metallic red: #A62C2B: (166, 44, 43) METALLIC_RED = RGB.new(0.6509803921568628, 0.17254901960784313, 0.16862745098039217) # Metallic Seaweed: #0A7E8C: (10, 126, 140) METALLIC_SEAWEED = RGB.new(0.0392156862745098, 0.49411764705882355, 0.5490196078431373) # Metallic silver: #A8A9AD: (168, 169, 173) METALLIC_SILVER = RGB.new(0.6588235294117647, 0.6627450980392157, 0.6784313725490196) # Metallic Sunburst: #9C7C38: (156, 124, 56) METALLIC_SUNBURST = RGB.new(0.611764705882353, 0.48627450980392156, 0.2196078431372549) # Metallic violet: #5B0A91: (90, 10, 145) METALLIC_VIOLET = RGB.new(0.35294117647058826, 0.0392156862745098, 0.5686274509803921) # Metallic yellow: #FDCC0D: (253, 204, 13) METALLIC_YELLOW = RGB.new(0.9921568627450981, 0.8, 0.050980392156862744) # Mexican pink: #E4007C: (228, 0, 124) MEXICAN_PINK = RGB.new(0.8941176470588236, 0.0, 0.48627450980392156) # Microsoft blue: #00A2ED: (0, 162, 237) MICROSOFT_BLUE = RGB.new(0.0, 0.6352941176470588, 0.9294117647058824) # Microsoft Edge blue: #0078D7: (0, 120, 215) MICROSOFT_EDGE_BLUE = RGB.new(0.0, 0.47058823529411764, 0.8431372549019608) # Microsoft green: #7DB700: (125, 183, 0) MICROSOFT_GREEN = RGB.new(0.49019607843137253, 0.7176470588235294, 0.0) # Microsoft red: #F04E1F: (240, 78, 31) MICROSOFT_RED = RGB.new(0.9411764705882353, 0.3058823529411765, 0.12156862745098039) # Microsoft yellow: #FDB900: (253, 185, 0) MICROSOFT_YELLOW = RGB.new(0.9921568627450981, 0.7254901960784313, 0.0) # Middle blue: #7ED4E6: (126, 212, 230) MIDDLE_BLUE = RGB.new(0.49411764705882355, 0.8313725490196079, 0.9019607843137255) # Middle blue green: #8DD9CC: (141, 217, 204) MIDDLE_BLUE_GREEN = RGB.new(0.5529411764705883, 0.8509803921568627, 0.8) # Middle blue purple: #8B72BE: (139, 114, 190) MIDDLE_BLUE_PURPLE = RGB.new(0.5450980392156862, 0.4470588235294118, 0.7450980392156863) # Middle grey: #8B8680: (139, 134, 128) MIDDLE_GREY = RGB.new(0.5450980392156862, 0.5254901960784314, 0.5019607843137255) # Middle green: #4D8C57: (77, 140, 87) MIDDLE_GREEN = RGB.new(0.30196078431372547, 0.5490196078431373, 0.3411764705882353) # Middle green yellow: #ACBF60: (172, 191, 96) MIDDLE_GREEN_YELLOW = RGB.new(0.6745098039215687, 0.7490196078431373, 0.3764705882352941) # Middle purple: #D982B5: (217, 130, 181) MIDDLE_PURPLE = RGB.new(0.8509803921568627, 0.5098039215686274, 0.7098039215686275) # Middle red: #E58E73: (229, 144, 115) MIDDLE_RED = RGB.new(0.8980392156862745, 0.5647058823529412, 0.45098039215686275) # Middle red purple: #A55353: (165, 83, 83) MIDDLE_RED_PURPLE = RGB.new(0.6470588235294118, 0.3254901960784314, 0.3254901960784314) # Middle yellow: #FFEB00: (255, 235, 0) MIDDLE_YELLOW = RGB.new(1.0, 0.9215686274509803, 0.0) # Middle yellow red: #ECB176: (236, 177, 118) MIDDLE_YELLOW_RED = RGB.new(0.9254901960784314, 0.6941176470588235, 0.4627450980392157) # Midnight: #702670: (112, 38, 112) MIDNIGHT = RGB.new(0.4392156862745098, 0.14901960784313725, 0.4392156862745098) # Midnight blue: #191970: (25, 25, 112) MIDNIGHT_BLUE = RGB.new(0.09803921568627451, 0.09803921568627451, 0.4392156862745098) # Midnight green (eagle green): #004953: (0, 73, 83) MIDNIGHT_GREEN_EAGLE_GREEN = RGB.new(0.0, 0.28627450980392155, 0.3254901960784314) # Mikado yellow: #FFC40C: (255, 196, 12) MIKADO_YELLOW = RGB.new(1.0, 0.7686274509803922, 0.047058823529411764) # Milk: #FDFFF5: (253, 255, 245) MILK = RGB.new(0.9921568627450981, 1.0, 0.9607843137254902) # Milk chocolate: #84563C: (132, 86, 60) MILK_CHOCOLATE = RGB.new(0.5176470588235295, 0.33725490196078434, 0.23529411764705882) # Mimi pink: #FFDAE9: (255, 218, 233) MIMI_PINK = RGB.new(1.0, 0.8549019607843137, 0.9137254901960784) # Mindaro: #E3F988: (227, 249, 136) MINDARO = RGB.new(0.8901960784313725, 0.9764705882352941, 0.5333333333333333) # Ming: #36747D: (54, 116, 125) MING = RGB.new(0.21176470588235294, 0.4549019607843137, 0.49019607843137253) # Minion yellow: #F5E050: (245, 220, 80) MINION_YELLOW = RGB.new(0.9607843137254902, 0.8627450980392157, 0.3137254901960784) # Mint: #3EB489: (62, 180, 137) MINT = RGB.new(0.24313725490196078, 0.7058823529411765, 0.5372549019607843) # Mint cream: #F5FFFA: (245, 255, 250) MINT_CREAM = RGB.new(0.9607843137254902, 1.0, 0.9803921568627451) # Mint green: #98FF98: (152, 255, 152) MINT_GREEN = RGB.new(0.596078431372549, 1.0, 0.596078431372549) # Misty Moss: #BBB477: (187, 180, 119) MISTY_MOSS = RGB.new(0.7333333333333333, 0.7058823529411765, 0.4666666666666667) # Misty rose: #FFE4E1: (255, 228, 225) MISTY_ROSE = RGB.new(1.0, 0.8941176470588236, 0.8823529411764706) # Moccasin: #FAEBD7: (250, 235, 215) MOCCASIN = RGB.new(0.9803921568627451, 0.9215686274509803, 0.8431372549019608) # Mocha: #BEA493: (190, 164, 147) MOCHA = RGB.new(0.7450980392156863, 0.6431372549019608, 0.5764705882352941) # Mode beige: #967117: (150, 113, 23) MODE_BEIGE = RGB.new(0.5882352941176471, 0.44313725490196076, 0.09019607843137255) # Moonstone: #3AA8C1: (58, 168, 193) MOONSTONE = RGB.new(0.22745098039215686, 0.6588235294117647, 0.7568627450980392) # Moonstone blue: #73A9C2: (115, 169, 194) MOONSTONE_BLUE = RGB.new(0.45098039215686275, 0.6627450980392157, 0.7607843137254902) # Mordant red 19: #AE0C00: (174, 12, 0) MORDANT_RED_19 = RGB.new(0.6823529411764706, 0.047058823529411764, 0.0) # Morning blue: #8DA399: (141, 163, 153) MORNING_BLUE = RGB.new(0.5529411764705883, 0.6392156862745098, 0.6) # Moss green: #8A9A5B: (138, 154, 91) MOSS_GREEN = RGB.new(0.5411764705882353, 0.6039215686274509, 0.3568627450980392) # Mountain Meadow: #30BA8F: (48, 186, 143) MOUNTAIN_MEADOW = RGB.new(0.18823529411764706, 0.7294117647058823, 0.5607843137254902) # Mountbatten pink: #997A8D: (153, 122, 141) MOUNTBATTEN_PINK = RGB.new(0.6, 0.47843137254901963, 0.5529411764705883) # MSU green: #18453B: (24, 69, 59) MSU_GREEN = RGB.new(0.09411764705882353, 0.27058823529411763, 0.23137254901960785) # Mud: #70543E: (111, 83, 61) MUD = RGB.new(0.43529411764705883, 0.3254901960784314, 0.23921568627450981) # Mughal green: #306030: (48, 96, 48) MUGHAL_GREEN = RGB.new(0.18823529411764706, 0.3764705882352941, 0.18823529411764706) # Mulberry: #C54B8C: (197, 75, 140) MULBERRY = RGB.new(0.7725490196078432, 0.29411764705882354, 0.5490196078431373) # Mulberry (Crayola): #C8509B: (200, 80, 155) MULBERRY_CRAYOLA = RGB.new(0.7843137254901961, 0.3137254901960784, 0.6078431372549019) # Mummy's Tomb: #828E84: (130, 142, 132) MUMMYS_TOMB = RGB.new(0.5098039215686274, 0.5568627450980392, 0.5176470588235295) # Mustard: #FFDB58: (255, 219, 88) MUSTARD = RGB.new(1.0, 0.8588235294117647, 0.34509803921568627) # Mustard brown: #CD7A00: (205, 122, 0) MUSTARD_BROWN = RGB.new(0.803921568627451, 0.47843137254901963, 0.0) # Mustard green: #6E6E30: (110, 110, 48) MUSTARD_GREEN = RGB.new(0.43137254901960786, 0.43137254901960786, 0.18823529411764706) # Mustard yellow: #E1AD01: (255, 173, 1) MUSTARD_YELLOW = RGB.new(1.0, 0.6784313725490196, 0.00392156862745098) # Myrtle green: #317873: (49, 120, 115) MYRTLE_GREEN = RGB.new(0.19215686274509805, 0.47058823529411764, 0.45098039215686275) # Mystic: #D65282: (214, 82, 130) MYSTIC = RGB.new(0.8392156862745098, 0.3215686274509804, 0.5098039215686274) # Mystic maroon: #AD4379: (173, 67, 121) MYSTIC_MAROON = RGB.new(0.6784313725490196, 0.2627450980392157, 0.4745098039215686) # Mystic red: #FF5500: (255, 34, 0) MYSTIC_RED = RGB.new(1.0, 0.13333333333333333, 0.0) # Nadeshiko pink: #F6ADC6: (246, 173, 198) NADESHIKO_PINK = RGB.new(0.9647058823529412, 0.6784313725490196, 0.7764705882352941) # Napier green: #2A8000: (42, 128, 0) NAPIER_GREEN = RGB.new(0.16470588235294117, 0.5019607843137255, 0.0) # Naples yellow: #FADA5E: (250, 218, 94) NAPLES_YELLOW = RGB.new(0.9803921568627451, 0.8549019607843137, 0.3686274509803922) # Navajo white: #FFDEAD: (255, 222, 173) NAVAJO_WHITE = RGB.new(1.0, 0.8705882352941177, 0.6784313725490196) # Navy blue: #000080: (0, 0, 128) NAVY_BLUE = RGB.new(0.0, 0.0, 0.5019607843137255) # Navy blue (Crayola): #1974D2: (25, 116, 210) NAVY_BLUE_CRAYOLA = RGB.new(0.09803921568627451, 0.4549019607843137, 0.8235294117647058) # Navy purple: #9457EB: (148, 87, 235) NAVY_PURPLE = RGB.new(0.5803921568627451, 0.3411764705882353, 0.9215686274509803) # Neon blue: #1B03A3: (27, 3, 163) NEON_BLUE = RGB.new(0.10588235294117647, 0.011764705882352941, 0.6392156862745098) # Neon brown: #C3732A: (195, 115, 42) NEON_BROWN = RGB.new(0.7647058823529411, 0.45098039215686275, 0.16470588235294117) # Neon Carrot: #FFA343: (255, 163, 67) NEON_CARROT = RGB.new(1.0, 0.6392156862745098, 0.2627450980392157) # Neon cyan: #00FEFC: (0, 254, 252) NEON_CYAN = RGB.new(0.0, 0.996078431372549, 0.9882352941176471) # Neon fuchsia: #FE4164: (254, 65, 100) NEON_FUCHSIA = RGB.new(0.996078431372549, 0.2549019607843137, 0.39215686274509803) # Neon gold: #CFAA01: (207, 170, 1) NEON_GOLD = RGB.new(0.8117647058823529, 0.6666666666666666, 0.00392156862745098) # Neon gray: #808080: (128, 128, 128) NEON_GRAY = RGB.new(0.5019607843137255, 0.5019607843137255, 0.5019607843137255) # Neon dark green: #008443: (0, 132, 67) NEON_DARK_GREEN = RGB.new(0.0, 0.5176470588235295, 0.2627450980392157) # Neon green: #139B42: (19, 155, 66) NEON_GREEN = RGB.new(0.07450980392156863, 0.6078431372549019, 0.25882352941176473) # Neon pink: #FE347E: (254, 52, 126) NEON_PINK = RGB.new(0.996078431372549, 0.20392156862745098, 0.49411764705882355) # Neon purple: #9457EB: (148, 87, 235) NEON_PURPLE = RGB.new(0.5803921568627451, 0.3411764705882353, 0.9215686274509803) # Neon red: #FF1818: (255, 24, 24) NEON_RED = RGB.new(1.0, 0.09411764705882353, 0.09411764705882353) # Neon scarlet: #FF2603: (255, 38, 3) NEON_SCARLET = RGB.new(1.0, 0.14901960784313725, 0.011764705882352941) # Neon silver: #CCCCCC: (204, 204, 204) NEON_SILVER = RGB.new(0.8, 0.8, 0.8) # Neon tangerine: #F6890A: (246, 137, 10) NEON_TANGERINE = RGB.new(0.9647058823529412, 0.5372549019607843, 0.0392156862745098) # Neon yellow: #FFF700: (255, 247, 0) NEON_YELLOW = RGB.new(1.0, 0.9686274509803922, 0.0) # New Car: #214FC6: (33, 79, 198) NEW_CAR = RGB.new(0.12941176470588237, 0.30980392156862746, 0.7764705882352941) # New York pink: #D7837F: (215, 131, 127) NEW_YORK_PINK = RGB.new(0.8431372549019608, 0.5137254901960784, 0.4980392156862745) # Nickel: #727472: (114, 116, 114) NICKEL = RGB.new(0.4470588235294118, 0.4549019607843137, 0.4470588235294118) # Nintendo red: #E4000F: (228, 0, 15) NINTENDO_RED = RGB.new(0.8941176470588236, 0.0, 0.058823529411764705) # Non-photo blue: #A4DDED: (164, 221, 237) NON_PHOTO_BLUE = RGB.new(0.6431372549019608, 0.8666666666666667, 0.9294117647058824) # Nyanza: #E9FFDB: (233, 255, 219) NYANZA = RGB.new(0.9137254901960784, 1.0, 0.8588235294117647) # Ocean blue: #4F42B5: (79, 66, 181) OCEAN_BLUE = RGB.new(0.30980392156862746, 0.25882352941176473, 0.7098039215686275) # Ocean boat blue: #0077BE: (0, 119, 190) OCEAN_BOAT_BLUE = RGB.new(0.0, 0.4666666666666667, 0.7450980392156863) # Ocean green: #48BF91: (72, 191, 145) OCEAN_GREEN = RGB.new(0.2823529411764706, 0.7490196078431373, 0.5686274509803921) # Ochre: #CC7722: (204, 119, 34) OCHRE = RGB.new(0.8, 0.4666666666666667, 0.13333333333333333) # Office green: #008000: (0, 128, 0) OFFICE_GREEN = RGB.new(0.0, 0.5019607843137255, 0.0) # Ogre Odor: #FD5240: (253, 82, 64) OGRE_ODOR = RGB.new(0.9921568627450981, 0.3215686274509804, 0.25098039215686274) # Old burgundy: #43302E: (67, 48, 46) OLD_BURGUNDY = RGB.new(0.2627450980392157, 0.18823529411764706, 0.1803921568627451) # Old gold: #CFB53B: (207, 181, 59) OLD_GOLD = RGB.new(0.8117647058823529, 0.7098039215686275, 0.23137254901960785) # Old heliotrope: #563C5C: (86, 60, 92) OLD_HELIOTROPE = RGB.new(0.33725490196078434, 0.23529411764705882, 0.3607843137254902) # Old lace: #FDF5E6: (253, 245, 230) OLD_LACE = RGB.new(0.9921568627450981, 0.9607843137254902, 0.9019607843137255) # Old lavender: #796878: (121, 104, 120) OLD_LAVENDER = RGB.new(0.4745098039215686, 0.40784313725490196, 0.47058823529411764) # Old mauve: #673147: (103, 49, 71) OLD_MAUVE = RGB.new(0.403921568627451, 0.19215686274509805, 0.2784313725490196) # Old moss green: #867E36: (134, 126, 54) OLD_MOSS_GREEN = RGB.new(0.5254901960784314, 0.49411764705882355, 0.21176470588235294) # Old rose: #C08081: (192, 128, 129) OLD_ROSE = RGB.new(0.7529411764705882, 0.5019607843137255, 0.5058823529411764) # Old silver: #848482: (132, 132, 130) OLD_SILVER = RGB.new(0.5176470588235295, 0.5176470588235295, 0.5098039215686274) # Olive: #808000: (128, 128, 0) OLIVE = RGB.new(0.5019607843137255, 0.5019607843137255, 0.0) # Olive drab (#3): #6B8E23: (107, 142, 35) OLIVE_DRAB3 = RGB.new(0.4196078431372549, 0.5568627450980392, 0.13725490196078433) # Olive drab #7: #3C341F: (60, 52, 31) OLIVE_DRAB7 = RGB.new(0.23529411764705882, 0.20392156862745098, 0.12156862745098039) # Olive green: #B5B35C: (181, 179, 92) OLIVE_GREEN = RGB.new(0.7098039215686275, 0.7019607843137254, 0.3607843137254902) # Olivine: #9AB973: (154, 185, 115) OLIVINE = RGB.new(0.6039215686274509, 0.7254901960784313, 0.45098039215686275) # Onyx: #353839: (53, 56, 57) ONYX = RGB.new(0.20784313725490197, 0.2196078431372549, 0.2235294117647059) # Opal: #A8C3BC: (168, 195, 188) OPAL = RGB.new(0.6588235294117647, 0.7647058823529411, 0.7372549019607844) # Opera mauve: #B784A7: (183, 132, 167) OPERA_MAUVE = RGB.new(0.7176470588235294, 0.5176470588235295, 0.6549019607843137) # Orange: #FF6600: (255, 102, 0) ORANGE = RGB.new(1.0, 0.4, 0.0) # Orange (color wheel): #FF7F00: (255, 127, 0) ORANGE_COLOR_WHEEL = RGB.new(1.0, 0.4980392156862745, 0.0) # Orange (Crayola): #FF7538: (255, 117, 56) ORANGE_CRAYOLA = RGB.new(1.0, 0.4588235294117647, 0.2196078431372549) # Orange (Pantone): #FF5800: (255, 88, 0) ORANGE_PANTONE = RGB.new(1.0, 0.34509803921568627, 0.0) # Orange (RYB): #FB9902: (251, 153, 2) ORANGE_RYB = RGB.new(0.984313725490196, 0.6, 0.00784313725490196) # Orange (web): #FFA500: (255, 165, 0) ORANGE_WEB = RGB.new(1.0, 0.6470588235294118, 0.0) # Orange iced tea: #FF6700: (255, 103, 0) ORANGE_ICED_TEA = RGB.new(1.0, 0.403921568627451, 0.0) # Orange peel: #FF9F00: (255, 159, 0) ORANGE_PEEL = RGB.new(1.0, 0.6235294117647059, 0.0) # Orange-red: #FF681F: (255, 104, 31) ORANGE_RED = RGB.new(1.0, 0.40784313725490196, 0.12156862745098039) # Orange-red (Crayola): #FF5349: (255, 83, 73) ORANGE_RED_CRAYOLA = RGB.new(1.0, 0.3254901960784314, 0.28627450980392155) # Orange soda: #E74E14: (231, 78, 20) ORANGE_SODA = RGB.new(0.9058823529411765, 0.3058823529411765, 0.0784313725490196) # Orange-yellow: #F5BD1F: (245, 189, 31) ORANGE_YELLOW = RGB.new(0.9607843137254902, 0.7411764705882353, 0.12156862745098039) # Orange-yellow (Crayola): #F8D568: (248, 213, 104) ORANGE_YELLOW_CRAYOLA = RGB.new(0.9725490196078431, 0.8352941176470589, 0.40784313725490196) # Orchid: #DA70D6: (218, 112, 214) ORCHID = RGB.new(0.8549019607843137, 0.4392156862745098, 0.8392156862745098) # Orchid pink: #F2BDCD: (242, 189, 205) ORCHID_PINK = RGB.new(0.9490196078431372, 0.7411764705882353, 0.803921568627451) # Orchid (Crayola): #E29CD2: (226, 156, 210) ORCHID_CRAYOLA = RGB.new(0.8862745098039215, 0.611764705882353, 0.8235294117647058) # Orioles orange: #FB4F14: (251, 79, 20) ORIOLES_ORANGE = RGB.new(0.984313725490196, 0.30980392156862746, 0.0784313725490196) # Otter brown: #654321: (101, 67, 33) OTTER_BROWN = RGB.new(0.396078431372549, 0.2627450980392157, 0.12941176470588237) # Outer Space: #414A4C: (65, 74, 76) OUTER_SPACE = RGB.new(0.2549019607843137, 0.2901960784313726, 0.2980392156862745) # Outer space (Crayola): #2D383A: (45, 56, 58) OUTER_SPACE_CRAYOLA = RGB.new(0.17647058823529413, 0.2196078431372549, 0.22745098039215686) # Outrageous Orange: #FF6E4A: (255, 110, 74) OUTRAGEOUS_ORANGE = RGB.new(1.0, 0.43137254901960786, 0.2901960784313726) # Oxblood: #800020: (128, 0, 32) OXBLOOD = RGB.new(0.5019607843137255, 0.0, 0.12549019607843137) # Oxford blue: #002147: (0, 33, 71) OXFORD_BLUE = RGB.new(0.0, 0.12941176470588237, 0.2784313725490196) # Oxley: #6D9A79: (109, 154, 121) OXLEY = RGB.new(0.42745098039215684, 0.6039215686274509, 0.4745098039215686) # OU Crimson red: #990000: (153, 0, 0) OU_CRIMSON_RED = RGB.new(0.6, 0.0, 0.0) # Pacific Blue: #1CA9C9: (28, 169, 201) PACIFIC_BLUE = RGB.new(0.10980392156862745, 0.6627450980392157, 0.788235294117647) # Pakistan green: #006600: (0, 102, 0) PAKISTAN_GREEN = RGB.new(0.0, 0.4, 0.0) # Palatinate blue: #273BE2: (39, 59, 226) PALATINATE_BLUE = RGB.new(0.15294117647058825, 0.23137254901960785, 0.8862745098039215) # Palatinate purple: #682860: (104, 40, 96) PALATINATE_PURPLE = RGB.new(0.40784313725490196, 0.1568627450980392, 0.3764705882352941) # Pale aqua: #BCD4E6: (188, 212, 230) PALE_AQUA = RGB.new(0.7372549019607844, 0.8313725490196079, 0.9019607843137255) # Pale blue: #AFEEEE: (175, 238, 238) PALE_BLUE = RGB.new(0.6862745098039216, 0.9333333333333333, 0.9333333333333333) # Pale brown: #987654: (152, 118, 84) PALE_BROWN = RGB.new(0.596078431372549, 0.4627450980392157, 0.32941176470588235) # Pale carmine: #AF4035: (175, 64, 53) PALE_CARMINE = RGB.new(0.6862745098039216, 0.25098039215686274, 0.20784313725490197) # Pale cerulean: #9BC4E2: (155, 196, 226) PALE_CERULEAN = RGB.new(0.6078431372549019, 0.7686274509803922, 0.8862745098039215) # Pale chestnut: #DDADAF: (221, 173, 175) PALE_CHESTNUT = RGB.new(0.8666666666666667, 0.6784313725490196, 0.6862745098039216) # Pale copper: #DA8A67: (218, 138, 103) PALE_COPPER = RGB.new(0.8549019607843137, 0.5411764705882353, 0.403921568627451) # Pale cornflower blue: #ABCDEF: (171, 205, 239) PALE_CORNFLOWER_BLUE = RGB.new(0.6705882352941176, 0.803921568627451, 0.9372549019607843) # Pale cyan: #87D3F8: (135, 211, 248) PALE_CYAN = RGB.new(0.5294117647058824, 0.8274509803921568, 0.9725490196078431) # Pale gold: #E6BE8A: (230, 190, 138) PALE_GOLD = RGB.new(0.9019607843137255, 0.7450980392156863, 0.5411764705882353) # Pale goldenrod: #EEE8AA: (238, 232, 170) PALE_GOLDENROD = RGB.new(0.9333333333333333, 0.9098039215686274, 0.6666666666666666) # Pale green: #98FB98: (152, 251, 152) PALE_GREEN = RGB.new(0.596078431372549, 0.984313725490196, 0.596078431372549) # Pale lavender: #DCD0FF: (220, 208, 255) PALE_LAVENDER = RGB.new(0.8627450980392157, 0.8156862745098039, 1.0) # Pale magenta: #F984E5: (249, 132, 229) PALE_MAGENTA = RGB.new(0.9764705882352941, 0.5176470588235295, 0.8980392156862745) # Pale magenta-pink: #FF99CC: (255, 153, 204) PALE_MAGENTA_PINK = RGB.new(1.0, 0.6, 0.8) # Pale pink: #FADADD: (250, 218, 221) PALE_PINK = RGB.new(0.9803921568627451, 0.8549019607843137, 0.8666666666666667) # Pale plum: #DDA0DD: (221, 160, 221) PALE_PLUM = RGB.new(0.8666666666666667, 0.6274509803921569, 0.8666666666666667) # Pale red-violet: #DB7093: (219, 112, 147) PALE_RED_VIOLET = RGB.new(0.8588235294117647, 0.4392156862745098, 0.5764705882352941) # Pale robin egg blue: #96DED1: (150, 222, 209) PALE_ROBIN_EGG_BLUE = RGB.new(0.5882352941176471, 0.8705882352941177, 0.8196078431372549) # Pale silver: #C9C0BB: (201, 192, 187) PALE_SILVER = RGB.new(0.788235294117647, 0.7529411764705882, 0.7333333333333333) # Pale spring bud: #ECEBBD: (236, 235, 189) PALE_SPRING_BUD = RGB.new(0.9254901960784314, 0.9215686274509803, 0.7411764705882353) # Pale taupe: #BC987E: (188, 152, 126) PALE_TAUPE = RGB.new(0.7372549019607844, 0.596078431372549, 0.49411764705882355) # Pale turquoise: #AFEEEE: (175, 238, 238) PALE_TURQUOISE = RGB.new(0.6862745098039216, 0.9333333333333333, 0.9333333333333333) # Pale violet: #CC99FF: (204, 153, 255) PALE_VIOLET = RGB.new(0.8, 0.6, 1.0) # Pale violet-red: #DB7093: (219, 112, 147) PALE_VIOLET_RED = RGB.new(0.8588235294117647, 0.4392156862745098, 0.5764705882352941) # Palm Leaf: #6F9940: (111, 153, 64) PALM_LEAF = RGB.new(0.43529411764705883, 0.6, 0.25098039215686274) # Pansy purple: #78184A: (120, 24, 74) PANSY_PURPLE = RGB.new(0.47058823529411764, 0.09411764705882353, 0.2901960784313726) # Paolo Veronese green: #009B7D: (0, 155, 125) PAOLO_VERONESE_GREEN = RGB.new(0.0, 0.6078431372549019, 0.49019607843137253) # Papaya whip: #FFEFD5: (255, 239, 213) PAPAYA_WHIP = RGB.new(1.0, 0.9372549019607843, 0.8352941176470589) # Paradise pink: #E63E62: (230, 62, 98) PARADISE_PINK = RGB.new(0.9019607843137255, 0.24313725490196078, 0.3843137254901961) # Paris Green: #50C878: (80, 200, 120) PARIS_GREEN = RGB.new(0.3137254901960784, 0.7843137254901961, 0.47058823529411764) # Parrot Pink: #D998A0: (217, 152, 160) PARROT_PINK = RGB.new(0.8509803921568627, 0.596078431372549, 0.6274509803921569) # Pastel blue: #AEC6CF: (174, 198, 207) PASTEL_BLUE = RGB.new(0.6823529411764706, 0.7764705882352941, 0.8117647058823529) # Pastel brown: #836953: (130, 105, 83) PASTEL_BROWN = RGB.new(0.5098039215686274, 0.4117647058823529, 0.3254901960784314) # Pastel gray: #CFCFC4: (207, 207, 196) PASTEL_GRAY = RGB.new(0.8117647058823529, 0.8117647058823529, 0.7686274509803922) # Pastel green: #77DD77: (119, 221, 119) PASTEL_GREEN = RGB.new(0.4666666666666667, 0.8666666666666667, 0.4666666666666667) # Pastel magenta: #F49AC2: (244, 154, 194) PASTEL_MAGENTA = RGB.new(0.9568627450980393, 0.6039215686274509, 0.7607843137254902) # Pastel orange: #FFB347: (255, 179, 71) PASTEL_ORANGE = RGB.new(1.0, 0.7019607843137254, 0.2784313725490196) # Pastel pink: #DEA5A4: (222, 165, 164) PASTEL_PINK = RGB.new(0.8705882352941177, 0.6470588235294118, 0.6431372549019608) # Pastel purple: #B39EB5: (179, 158, 181) PASTEL_PURPLE = RGB.new(0.7019607843137254, 0.6196078431372549, 0.7098039215686275) # Pastel red: #FF6961: (255, 105, 97) PASTEL_RED = RGB.new(1.0, 0.4117647058823529, 0.3803921568627451) # Pastel violet: #CB99C9: (203, 153, 201) PASTEL_VIOLET = RGB.new(0.796078431372549, 0.6, 0.788235294117647) # Pastel yellow: #FDFD96: (253, 253, 150) PASTEL_YELLOW = RGB.new(0.9921568627450981, 0.9921568627450981, 0.5882352941176471) # Patriarch: #800080: (128, 0, 128) PATRIARCH = RGB.new(0.5019607843137255, 0.0, 0.5019607843137255) # Payne's grey: #536878: (83, 104, 120) PAYNES_GREY = RGB.new(0.3254901960784314, 0.40784313725490196, 0.47058823529411764) # Peach: #FFE5B4: (255, 229, 180) PEACH = RGB.new(1.0, 0.8980392156862745, 0.7058823529411765) # Peach (Crayola): #FFCBA4: (255, 203, 164) PEACH_CRAYOLA = RGB.new(1.0, 0.796078431372549, 0.6431372549019608) # Peach-orange: #FFCC99: (255, 204, 153) PEACH_ORANGE = RGB.new(1.0, 0.8, 0.6) # Peach puff: #FFDAB9: (255, 218, 185) PEACH_PUFF = RGB.new(1.0, 0.8549019607843137, 0.7254901960784313) # Peach-yellow: #FADFAD: (250, 223, 173) PEACH_YELLOW = RGB.new(0.9803921568627451, 0.8745098039215686, 0.6784313725490196) # Pear: #D1E231: (209, 226, 49) PEAR = RGB.new(0.8196078431372549, 0.8862745098039215, 0.19215686274509805) # Pearl: #EAE0C8: (234, 224, 200) PEARL = RGB.new(0.9176470588235294, 0.8784313725490196, 0.7843137254901961) # Pearl Aqua: #88D8C0: (136, 216, 192) PEARL_AQUA = RGB.new(0.5333333333333333, 0.8470588235294118, 0.7529411764705882) # Pearly purple: #B768A2: (183, 104, 162) PEARLY_PURPLE = RGB.new(0.7176470588235294, 0.40784313725490196, 0.6352941176470588) # Peridot: #E6E200: (230, 226, 0) PERIDOT = RGB.new(0.9019607843137255, 0.8862745098039215, 0.0) # Periwinkle: #CCCCFF: (204, 204, 255) PERIWINKLE = RGB.new(0.8, 0.8, 1.0) # Periwinkle (Crayola): #C3CDE6: (195, 205, 230) PERIWINKLE_CRAYOLA = RGB.new(0.7647058823529411, 0.803921568627451, 0.9019607843137255) # Permanent Geranium Lake: #E12C2C: (225, 44, 44) PERMANENT_GERANIUM_LAKE = RGB.new(0.8823529411764706, 0.17254901960784313, 0.17254901960784313) # Persian blue: #1C39BB: (28, 57, 187) PERSIAN_BLUE = RGB.new(0.10980392156862745, 0.2235294117647059, 0.7333333333333333) # Persian green: #00A693: (0, 166, 147) PERSIAN_GREEN = RGB.new(0.0, 0.6509803921568628, 0.5764705882352941) # Persian indigo: #32127A: (50, 18, 122) PERSIAN_INDIGO = RGB.new(0.19607843137254902, 0.07058823529411765, 0.47843137254901963) # Persian orange: #D99058: (217, 144, 88) PERSIAN_ORANGE = RGB.new(0.8509803921568627, 0.5647058823529412, 0.34509803921568627) # Persian pink: #F77FBE: (247, 127, 190) PERSIAN_PINK = RGB.new(0.9686274509803922, 0.4980392156862745, 0.7450980392156863) # Persian plum: #701C1C: (112, 28, 28) PERSIAN_PLUM = RGB.new(0.4392156862745098, 0.10980392156862745, 0.10980392156862745) # Persian red: #CC3333: (204, 51, 51) PERSIAN_RED = RGB.new(0.8, 0.2, 0.2) # Persian rose: #FE28A2: (254, 40, 162) PERSIAN_ROSE = RGB.new(0.996078431372549, 0.1568627450980392, 0.6352941176470588) # Persimmon: #EC5800: (236, 88, 0) PERSIMMON = RGB.new(0.9254901960784314, 0.34509803921568627, 0.0) # Peru: #CD853F: (205, 133, 63) PERU = RGB.new(0.803921568627451, 0.5215686274509804, 0.24705882352941178) # Pewter Blue: #8BA8B7: (139, 168, 183) PEWTER_BLUE = RGB.new(0.5450980392156862, 0.6588235294117647, 0.7176470588235294) # Philippine blue: #0038A7: (0, 56, 167) PHILIPPINE_BLUE = RGB.new(0.0, 0.2196078431372549, 0.6549019607843137) # Philippine bronze: #6E3A07: (110, 58, 7) PHILIPPINE_BRONZE = RGB.new(0.43137254901960786, 0.22745098039215686, 0.027450980392156862) # Philippine brown: #5D1916: (93, 25, 22) PHILIPPINE_BROWN = RGB.new(0.36470588235294116, 0.09803921568627451, 0.08627450980392157) # Philippine gold: #B17304: (177, 115, 4) PHILIPPINE_GOLD = RGB.new(0.6941176470588235, 0.45098039215686275, 0.01568627450980392) # Philippine golden yellow: #FFDF00: (253, 223, 22) PHILIPPINE_GOLDEN_YELLOW = RGB.new(0.9921568627450981, 0.8745098039215686, 0.08627450980392157) # Philippine gray: #8C8C8C: (140, 140, 140) PHILIPPINE_GRAY = RGB.new(0.5490196078431373, 0.5490196078431373, 0.5490196078431373) # Philippine green: #008543: (0, 133, 67) PHILIPPINE_GREEN = RGB.new(0.0, 0.5215686274509804, 0.2627450980392157) # Philippine indigo: #00416A: (0, 65, 106) PHILIPPINE_INDIGO = RGB.new(0.0, 0.2549019607843137, 0.41568627450980394) # Philippine orange: #FF7300: (255, 115, 0) PHILIPPINE_ORANGE = RGB.new(1.0, 0.45098039215686275, 0.0) # Philippine pink: #FA1A8E: (255, 26, 142) PHILIPPINE_PINK = RGB.new(1.0, 0.10196078431372549, 0.5568627450980392) # Philippine red: #CE1127: (206, 17, 39) PHILIPPINE_RED = RGB.new(0.807843137254902, 0.06666666666666667, 0.15294117647058825) # Philippine silver: #B3B3B3: (179, 179, 179) PHILIPPINE_SILVER = RGB.new(0.7019607843137254, 0.7019607843137254, 0.7019607843137254) # Philippine sky blue: #0066FF: (0, 102, 255) PHILIPPINE_SKY_BLUE = RGB.new(0.0, 0.4, 1.0) # Philippine violet: #81007F: (129, 0, 127) PHILIPPINE_VIOLET = RGB.new(0.5058823529411764, 0.0, 0.4980392156862745) # Philippine yellow: #FECB00: (254, 203, 0) PHILIPPINE_YELLOW = RGB.new(0.996078431372549, 0.796078431372549, 0.0) # Phlox: #DF00FF: (223, 0, 255) PHLOX = RGB.new(0.8745098039215686, 0.0, 1.0) # Phthalo blue: #000F89: (0, 15, 137) PHTHALO_BLUE = RGB.new(0.0, 0.058823529411764705, 0.5372549019607843) # Phthalo green: #123524: (18, 53, 36) PHTHALO_GREEN = RGB.new(0.07058823529411765, 0.20784313725490197, 0.1411764705882353) # Picton blue: #45B1E8: (69, 177, 232) PICTON_BLUE = RGB.new(0.27058823529411763, 0.6941176470588235, 0.9098039215686274) # Pictorial carmine: #C30B4E: (195, 11, 78) PICTORIAL_CARMINE = RGB.new(0.7647058823529411, 0.043137254901960784, 0.3058823529411765) # Piggy pink: #FDDDE6: (253, 221, 230) PIGGY_PINK = RGB.new(0.9921568627450981, 0.8666666666666667, 0.9019607843137255) # Pine green: #01796F: (1, 121, 111) PINE_GREEN = RGB.new(0.00392156862745098, 0.4745098039215686, 0.43529411764705883) # Pine tree: #2A2F23: (42, 47, 35) PINE_TREE = RGB.new(0.16470588235294117, 0.1843137254901961, 0.13725490196078433) # Pineapple: #563C0D: (86, 60, 13) PINEAPPLE = RGB.new(0.33725490196078434, 0.23529411764705882, 0.050980392156862744) # Pink: #FFC0CB: (255, 192, 203) PINK = RGB.new(1.0, 0.7529411764705882, 0.796078431372549) # Pink (Pantone): #D74894: (215, 72, 148) PINK_PANTONE = RGB.new(0.8431372549019608, 0.2823529411764706, 0.5803921568627451) # Pink Diamond (Ace Hardware Color): #F6D6DE: (246, 214, 222) PINK_DIAMOND_ACE_HARDWARE_COLOR = RGB.new(0.9647058823529412, 0.8392156862745098, 0.8705882352941177) # Pink Diamond (Independent Retailers Colors): #F0D3DC: (240, 211, 220) PINK_DIAMOND_INDEPENDENT_RETAILERS_COLORS = RGB.new(0.9411764705882353, 0.8274509803921568, 0.8627450980392157) # Pink flamingo: #FC74FD: (252, 116, 253) PINK_FLAMINGO = RGB.new(0.9882352941176471, 0.4549019607843137, 0.9921568627450981) # Pink lace: #FFDDF4: (255, 221, 244) PINK_LACE = RGB.new(1.0, 0.8666666666666667, 0.9568627450980393) # Pink lavender: #D8B2D1: (216, 178, 209) PINK_LAVENDER = RGB.new(0.8470588235294118, 0.6980392156862745, 0.8196078431372549) # Pink-orange: #FF9966: (255, 153, 102) PINK_ORANGE = RGB.new(1.0, 0.6, 0.4) # Pink pearl: #E7ACCF: (231, 172, 207) PINK_PEARL = RGB.new(0.9058823529411765, 0.6745098039215687, 0.8117647058823529) # Pink raspberry: #980036: (152, 0, 54) PINK_RASPBERRY = RGB.new(0.596078431372549, 0.0, 0.21176470588235294) # Pink Sherbet: #F78FA7: (247, 143, 167) PINK_SHERBET = RGB.new(0.9686274509803922, 0.5607843137254902, 0.6549019607843137) # Pistachio: #93C572: (147, 197, 114) PISTACHIO = RGB.new(0.5764705882352941, 0.7725490196078432, 0.4470588235294118) # Pixie Powder: #391285: (57, 18, 133) PIXIE_POWDER = RGB.new(0.2235294117647059, 0.07058823529411765, 0.5215686274509804) # Platinum: #E5E4E2: (229, 228, 226) PLATINUM = RGB.new(0.8980392156862745, 0.8941176470588236, 0.8862745098039215) # Plum: #8E4585: (142, 69, 133) PLUM = RGB.new(0.5568627450980392, 0.27058823529411763, 0.5215686274509804) # Plum (web): #DDA0DD: (221, 160, 221) PLUM_WEB = RGB.new(0.8666666666666667, 0.6274509803921569, 0.8666666666666667) # Plump Purple: #5946B2: (89, 70, 178) PLUMP_PURPLE = RGB.new(0.34901960784313724, 0.27450980392156865, 0.6980392156862745) # Police blue: #374F6B: (55, 79, 107) POLICE_BLUE = RGB.new(0.21568627450980393, 0.30980392156862746, 0.4196078431372549) # Polished Pine: #5DA493: (93, 164, 147) POLISHED_PINE = RGB.new(0.36470588235294116, 0.6431372549019608, 0.5764705882352941) # Pomp and Power: #86608E: (134, 96, 142) POMP_AND_POWER = RGB.new(0.5254901960784314, 0.3764705882352941, 0.5568627450980392) # Popstar: #BE4F62: (190, 79, 98) POPSTAR = RGB.new(0.7450980392156863, 0.30980392156862746, 0.3843137254901961) # Portland Orange: #FF5A36: (255, 90, 54) PORTLAND_ORANGE = RGB.new(1.0, 0.35294117647058826, 0.21176470588235294) # Powder blue: #B0E0E6: (176, 224, 230) POWDER_BLUE = RGB.new(0.6901960784313725, 0.8784313725490196, 0.9019607843137255) # Prilly blue: #329CC3: (50, 156, 195) PRILLY_BLUE = RGB.new(0.19607843137254902, 0.611764705882353, 0.7647058823529411) # Prilly pink: #FF40A0: (255, 64, 160) PRILLY_PINK = RGB.new(1.0, 0.25098039215686274, 0.6274509803921569) # Prilly red: #FF0040: (255, 0, 64) PRILLY_RED = RGB.new(1.0, 0.0, 0.25098039215686274) # Princess Perfume: #FF85CF: (255, 133, 207) PRINCESS_PERFUME = RGB.new(1.0, 0.5215686274509804, 0.8117647058823529) # Princeton orange: #F58025: (245, 128, 37) PRINCETON_ORANGE = RGB.new(0.9607843137254902, 0.5019607843137255, 0.1450980392156863) # Prune: #701C1C: (112, 28, 28) PRUNE = RGB.new(0.4392156862745098, 0.10980392156862745, 0.10980392156862745) # Prussian blue: #003153: (0, 49, 83) PRUSSIAN_BLUE = RGB.new(0.0, 0.19215686274509805, 0.3254901960784314) # Psychedelic purple: #DF00FF: (223, 0, 255) PSYCHEDELIC_PURPLE = RGB.new(0.8745098039215686, 0.0, 1.0) # Puce: #CC8899: (204, 136, 153) PUCE = RGB.new(0.8, 0.5333333333333333, 0.6) # Puce red: #722F37: (114, 47, 55) PUCE_RED = RGB.new(0.4470588235294118, 0.1843137254901961, 0.21568627450980393) # Pullman Brown (UPS Brown): #644117: (100, 65, 23) PULLMAN_BROWN_UPS_BROWN = RGB.new(0.39215686274509803, 0.2549019607843137, 0.09019607843137255) # Pullman Green: #3B331C: (59, 51, 28) PULLMAN_GREEN = RGB.new(0.23137254901960785, 0.2, 0.10980392156862745) # Pumpkin: #FF7518: (255, 117, 24) PUMPKIN = RGB.new(1.0, 0.4588235294117647, 0.09411764705882353) # Purple (HTML): #800080: (128, 0, 128) PURPLE_HTML = RGB.new(0.5019607843137255, 0.0, 0.5019607843137255) # Purple (Munsell): #9F00C5: (159, 0, 197) PURPLE_MUNSELL = RGB.new(0.6235294117647059, 0.0, 0.7725490196078432) # Purple (X11): #A020F0: (160, 32, 240) PURPLE_X11 = RGB.new(0.6274509803921569, 0.12549019607843137, 0.9411764705882353) # Purple Heart: #69359C: (105, 53, 156) PURPLE_HEART = RGB.new(0.4117647058823529, 0.20784313725490197, 0.611764705882353) # Purple mountain majesty: #9678B6: (150, 120, 182) PURPLE_MOUNTAIN_MAJESTY = RGB.new(0.5882352941176471, 0.47058823529411764, 0.7137254901960784) # Purple navy: #4E5180: (78, 81, 128) PURPLE_NAVY = RGB.new(0.3058823529411765, 0.3176470588235294, 0.5019607843137255) # Purple pizzazz: #FE4EDA: (254, 78, 218) PURPLE_PIZZAZZ = RGB.new(0.996078431372549, 0.3058823529411765, 0.8549019607843137) # Purple Plum: #9C51B6: (156, 81, 182) PURPLE_PLUM = RGB.new(0.611764705882353, 0.3176470588235294, 0.7137254901960784) # Purple taupe: #50404D: (80, 64, 77) PURPLE_TAUPE = RGB.new(0.3137254901960784, 0.25098039215686274, 0.30196078431372547) # Purpureus: #9A4EAE: (154, 78, 174) PURPUREUS = RGB.new(0.6039215686274509, 0.3058823529411765, 0.6823529411764706) # Quartz: #51484F: (81, 72, 79) QUARTZ = RGB.new(0.3176470588235294, 0.2823529411764706, 0.30980392156862746) # Queen blue: #436B95: (67, 107, 149) QUEEN_BLUE = RGB.new(0.2627450980392157, 0.4196078431372549, 0.5843137254901961) # Queen pink: #E8CCD7: (232, 204, 215) QUEEN_PINK = RGB.new(0.9098039215686274, 0.8, 0.8431372549019608) # Quick Silver: #A6A6A6: (166, 166, 166) QUICK_SILVER = RGB.new(0.6509803921568628, 0.6509803921568628, 0.6509803921568628) # Quinacridone magenta: #8E3A59: (142, 58, 89) QUINACRIDONE_MAGENTA = RGB.new(0.5568627450980392, 0.22745098039215686, 0.34901960784313724) # Quincy: #6A5445: (106, 84, 69) QUINCY = RGB.new(0.41568627450980394, 0.32941176470588235, 0.27058823529411763) # Rackley: #5D8AA8: (93, 138, 168) RACKLEY = RGB.new(0.36470588235294116, 0.5411764705882353, 0.6588235294117647) # Radical Red: #FF355E: (255, 53, 94) RADICAL_RED = RGB.new(1.0, 0.20784313725490197, 0.3686274509803922) # Raisin black: #242124: (36, 33, 36) RAISIN_BLACK = RGB.new(0.1411764705882353, 0.12941176470588237, 0.1411764705882353) # Rajah: #FBAB60: (251, 171, 96) RAJAH = RGB.new(0.984313725490196, 0.6705882352941176, 0.3764705882352941) # Raspberry: #E30B5D: (227, 11, 92) RASPBERRY = RGB.new(0.8901960784313725, 0.043137254901960784, 0.3607843137254902) # Raspberry glace: #915F6D: (145, 95, 109) RASPBERRY_GLACE = RGB.new(0.5686274509803921, 0.37254901960784315, 0.42745098039215684) # Raspberry pink: #E25098: (226, 80, 152) RASPBERRY_PINK = RGB.new(0.8862745098039215, 0.3137254901960784, 0.596078431372549) # Raspberry rose: #B3446C: (179, 68, 108) RASPBERRY_ROSE = RGB.new(0.7019607843137254, 0.26666666666666666, 0.4235294117647059) # Raw Sienna: #D68A59: (214, 138, 89) RAW_SIENNA = RGB.new(0.8392156862745098, 0.5411764705882353, 0.34901960784313724) # Raw umber: #826644: (130, 102, 68) RAW_UMBER = RGB.new(0.5098039215686274, 0.4, 0.26666666666666666) # Razzle dazzle rose: #FF33CC: (255, 51, 204) RAZZLE_DAZZLE_ROSE = RGB.new(1.0, 0.2, 0.8) # Razzmatazz: #E3256B: (227, 37, 107) RAZZMATAZZ = RGB.new(0.8901960784313725, 0.1450980392156863, 0.4196078431372549) # Razzmic Berry: #8D4E85: (141, 78, 133) RAZZMIC_BERRY = RGB.new(0.5529411764705883, 0.3058823529411765, 0.5215686274509804) # Rebecca Purple: #663399: (102, 52, 153) REBECCA_PURPLE = RGB.new(0.4, 0.20392156862745098, 0.6) # Red: #FF0000: (255, 0, 0) RED = RGB.new(1.0, 0.0, 0.0) # Red (Crayola): #EE204D: (238, 32, 77) RED_CRAYOLA = RGB.new(0.9333333333333333, 0.12549019607843137, 0.30196078431372547) # Red (Munsell): #F2003C: (242, 0, 60) RED_MUNSELL = RGB.new(0.9490196078431372, 0.0, 0.23529411764705882) # Red (NCS): #C40233: (196, 2, 51) RED_NCS = RGB.new(0.7686274509803922, 0.00784313725490196, 0.2) # Red (Pantone): #ED2939: (237, 41, 57) RED_PANTONE = RGB.new(0.9294117647058824, 0.1607843137254902, 0.2235294117647059) # Red (pigment): #ED1C24: (237, 28, 36) RED_PIGMENT = RGB.new(0.9294117647058824, 0.10980392156862745, 0.1411764705882353) # Red (RYB): #FE2712: (254, 39, 18) RED_RYB = RGB.new(0.996078431372549, 0.15294117647058825, 0.07058823529411765) # Red-brown: #A52A2A: (165, 42, 42) RED_BROWN = RGB.new(0.6470588235294118, 0.16470588235294117, 0.16470588235294117) # Red cola: #DF0118: (223, 1, 24) RED_COLA = RGB.new(0.8745098039215686, 0.00392156862745098, 0.09411764705882353) # Red devil: #860111: (134, 1, 17) RED_DEVIL = RGB.new(0.5254901960784314, 0.00392156862745098, 0.06666666666666667) # Red-orange: #FF5349: (255, 83, 73) RED_ORANGE = RGB.new(1.0, 0.3254901960784314, 0.28627450980392155) # Red-orange (Crayola): #FF681F: (255, 104, 31) RED_ORANGE_CRAYOLA = RGB.new(1.0, 0.40784313725490196, 0.12156862745098039) # Red-orange (Color wheel): #FF4500: (255, 69, 0) RED_ORANGE_COLOR_WHEEL = RGB.new(1.0, 0.27058823529411763, 0.0) # Red-purple: #E40078: (228, 0, 120) RED_PURPLE = RGB.new(0.8941176470588236, 0.0, 0.47058823529411764) # Red rum: #973A4A: (151, 58, 74) RED_RUM = RGB.new(0.592156862745098, 0.22745098039215686, 0.2901960784313726) # Red Salsa: #FD3A4A: (253, 58, 74) RED_SALSA = RGB.new(0.9921568627450981, 0.22745098039215686, 0.2901960784313726) # Red strawberry: #EC0304: (236, 3, 1) RED_STRAWBERRY = RGB.new(0.9254901960784314, 0.011764705882352941, 0.00392156862745098) # Red-violet: #C71585: (199, 21, 133) RED_VIOLET = RGB.new(0.7803921568627451, 0.08235294117647059, 0.5215686274509804) # Red-violet (Crayola): #C0448F: (192, 68, 143) RED_VIOLET_CRAYOLA = RGB.new(0.7529411764705882, 0.26666666666666666, 0.5607843137254902) # Red-violet (Color wheel): #922B3E: (146, 43, 62) RED_VIOLET_COLOR_WHEEL = RGB.new(0.5725490196078431, 0.16862745098039217, 0.24313725490196078) # Redwood: #A45A52: (164, 90, 82) REDWOOD = RGB.new(0.6431372549019608, 0.35294117647058826, 0.3215686274509804) # Registration black: #000000: (0, 0, 0) REGISTRATION_BLACK = RGB.new(0.0, 0.0, 0.0) # Resolution blue: #002387: (0, 35, 135) RESOLUTION_BLUE = RGB.new(0.0, 0.13725490196078433, 0.5294117647058824) # Rhythm: #777696: (119, 118, 150) RHYTHM = RGB.new(0.4666666666666667, 0.4627450980392157, 0.5882352941176471) # Rich brilliant lavender: #F1A7FE: (241, 167, 254) RICH_BRILLIANT_LAVENDER = RGB.new(0.9450980392156862, 0.6549019607843137, 0.996078431372549) # Rich electric blue: #0892D0: (8, 146, 208) RICH_ELECTRIC_BLUE = RGB.new(0.03137254901960784, 0.5725490196078431, 0.8156862745098039) # Rich lavender: #A76BCF: (167, 107, 207) RICH_LAVENDER = RGB.new(0.6549019607843137, 0.4196078431372549, 0.8117647058823529) # Rich lilac: #B666D2: (182, 102, 210) RICH_LILAC = RGB.new(0.7137254901960784, 0.4, 0.8235294117647058) # Rich maroon: #B03060: (176, 48, 96) RICH_MAROON = RGB.new(0.6901960784313725, 0.18823529411764706, 0.3764705882352941) # Rifle green: #444C38: (68, 76, 56) RIFLE_GREEN = RGB.new(0.26666666666666666, 0.2980392156862745, 0.2196078431372549) # Ripe mango: #FFC324: (255, 195, 36) RIPE_MANGO = RGB.new(1.0, 0.7647058823529411, 0.1411764705882353) # Roast coffee: #704241: (112, 66, 65) ROAST_COFFEE = RGB.new(0.4392156862745098, 0.25882352941176473, 0.2549019607843137) # Robin egg blue: #00CCCC: (0, 204, 204) ROBIN_EGG_BLUE = RGB.new(0.0, 0.8, 0.8) # Rocket metallic: #8A7F80: (138, 127, 128) ROCKET_METALLIC = RGB.new(0.5411764705882353, 0.4980392156862745, 0.5019607843137255) # Roman silver: #838996: (131, 137, 150) ROMAN_SILVER = RGB.new(0.5137254901960784, 0.5372549019607843, 0.5882352941176471) # Root beer: #290E05: (41, 14, 5) ROOT_BEER = RGB.new(0.1607843137254902, 0.054901960784313725, 0.0196078431372549) # Rose: #FF007F: (255, 0, 127) ROSE = RGB.new(1.0, 0.0, 0.4980392156862745) # Rose bonbon: #F9429E: (249, 66, 158) ROSE_BONBON = RGB.new(0.9764705882352941, 0.25882352941176473, 0.6196078431372549) # Rose Dust: #9E5E6F: (158, 94, 111) ROSE_DUST = RGB.new(0.6196078431372549, 0.3686274509803922, 0.43529411764705883) # Rose ebony: #674846: (103, 72, 70) ROSE_EBONY = RGB.new(0.403921568627451, 0.2823529411764706, 0.27450980392156865) # Rose garnet: #960145: (150, 1, 69) ROSE_GARNET = RGB.new(0.5882352941176471, 0.00392156862745098, 0.27058823529411763) # Rose gold: #B76E79: (183, 110, 121) ROSE_GOLD = RGB.new(0.7176470588235294, 0.43137254901960786, 0.4745098039215686) # Rose madder: #E32636: (227, 38, 54) ROSE_MADDER = RGB.new(0.8901960784313725, 0.14901960784313725, 0.21176470588235294) # Rose pink: #FF66CC: (255, 102, 204) ROSE_PINK = RGB.new(1.0, 0.4, 0.8) # Rose quartz: #AA98A9: (170, 152, 169) ROSE_QUARTZ = RGB.new(0.6666666666666666, 0.596078431372549, 0.6627450980392157) # Rose quartz pink: #BD559C: (189, 85, 156) ROSE_QUARTZ_PINK = RGB.new(0.7411764705882353, 0.3333333333333333, 0.611764705882353) # Rose red: #C21E56: (194, 30, 86) ROSE_RED = RGB.new(0.7607843137254902, 0.11764705882352941, 0.33725490196078434) # Rose taupe: #905D5D: (144, 93, 93) ROSE_TAUPE = RGB.new(0.5647058823529412, 0.36470588235294116, 0.36470588235294116) # Rose vale: #AB4E52: (171, 78, 82) ROSE_VALE = RGB.new(0.6705882352941176, 0.3058823529411765, 0.3215686274509804) # Rosewood: #65000B: (101, 0, 11) ROSEWOOD = RGB.new(0.396078431372549, 0.0, 0.043137254901960784) # Rosy brown: #BC8F8F: (188, 143, 143) ROSY_BROWN = RGB.new(0.7372549019607844, 0.5607843137254902, 0.5607843137254902) # Royal azure: #0038A8: (0, 56, 168) ROYAL_AZURE = RGB.new(0.0, 0.2196078431372549, 0.6588235294117647) # Royal blue: #002366: (0, 35, 102) ROYAL_BLUE = RGB.new(0.0, 0.13725490196078433, 0.4) # Royal brown: #523B35: (82, 59, 53) ROYAL_BROWN = RGB.new(0.3215686274509804, 0.23137254901960785, 0.20784313725490197) # Royal fuchsia: #CA2C92: (202, 44, 146) ROYAL_FUCHSIA = RGB.new(0.792156862745098, 0.17254901960784313, 0.5725490196078431) # Royal green: #136207: (19, 98, 7) ROYAL_GREEN = RGB.new(0.07450980392156863, 0.3843137254901961, 0.027450980392156862) # Royal orange: #F99245: (249, 146, 69) ROYAL_ORANGE = RGB.new(0.9764705882352941, 0.5725490196078431, 0.27058823529411763) # Royal pink: #E73895: (231, 56, 149) ROYAL_PINK = RGB.new(0.9058823529411765, 0.2196078431372549, 0.5843137254901961) # Royal red: #9B1C31: (155, 28, 49) ROYAL_RED = RGB.new(0.6078431372549019, 0.10980392156862745, 0.19215686274509805) # Royal purple: #7851A9: (120, 81, 169) ROYAL_PURPLE = RGB.new(0.47058823529411764, 0.3176470588235294, 0.6627450980392157) # Royal yellow: #FADA5E: (250, 218, 94) ROYAL_YELLOW = RGB.new(0.9803921568627451, 0.8549019607843137, 0.3686274509803922) # Ruber: #CE4676: (206, 70, 118) RUBER = RGB.new(0.807843137254902, 0.27450980392156865, 0.4627450980392157) # Rubine red: #D10056: (209, 0, 86) RUBINE_RED = RGB.new(0.8196078431372549, 0.0, 0.33725490196078434) # Ruby: #E0115F: (224, 17, 95) RUBY = RGB.new(0.8784313725490196, 0.06666666666666667, 0.37254901960784315) # Ruby red: #9B111E: (155, 17, 30) RUBY_RED = RGB.new(0.6078431372549019, 0.06666666666666667, 0.11764705882352941) # Rufous: #A81C07: (168, 28, 7) RUFOUS = RGB.new(0.6588235294117647, 0.10980392156862745, 0.027450980392156862) # Rum: #9A4E40: (154, 78, 64) RUM = RGB.new(0.6039215686274509, 0.3058823529411765, 0.25098039215686274) # Russet: #80461B: (128, 70, 27) RUSSET = RGB.new(0.5019607843137255, 0.27450980392156865, 0.10588235294117647) # Russian green: #679267: (103, 146, 103) RUSSIAN_GREEN = RGB.new(0.403921568627451, 0.5725490196078431, 0.403921568627451) # Russian violet: #32174D: (50, 23, 77) RUSSIAN_VIOLET = RGB.new(0.19607843137254902, 0.09019607843137255, 0.30196078431372547) # Rust: #B7410E: (183, 65, 14) RUST = RGB.new(0.7176470588235294, 0.2549019607843137, 0.054901960784313725) # Rusty red: #DA2C43: (218, 44, 67) RUSTY_RED = RGB.new(0.8549019607843137, 0.17254901960784313, 0.2627450980392157) # Sacramento State green: #043927: (4, 57, 39) SACRAMENTO_STATE_GREEN = RGB.new(0.01568627450980392, 0.2235294117647059, 0.15294117647058825) # Saddle brown: #8B4513: (139, 69, 19) SADDLE_BROWN = RGB.new(0.5450980392156862, 0.27058823529411763, 0.07450980392156863) # Safety orange: #FF7800: (255, 120, 0) SAFETY_ORANGE = RGB.new(1.0, 0.47058823529411764, 0.0) # Safety orange (blaze orange): #FF6700: (255, 103, 0) SAFETY_ORANGE_BLAZE_ORANGE = RGB.new(1.0, 0.403921568627451, 0.0) # Safety yellow: #EED202: (238, 210, 2) SAFETY_YELLOW = RGB.new(0.9333333333333333, 0.8235294117647058, 0.00784313725490196) # Saffron: #F4C430: (244, 196, 48) SAFFRON = RGB.new(0.9568627450980393, 0.7686274509803922, 0.18823529411764706) # Sage: #BCB88A: (188, 184, 138) SAGE = RGB.new(0.7372549019607844, 0.7215686274509804, 0.5411764705882353) # St. Patrick's blue: #23297A: (35, 41, 122) ST_PATRICKS_BLUE = RGB.new(0.13725490196078433, 0.1607843137254902, 0.47843137254901963) # Salem: #177B4D: (23, 123, 77) SALEM = RGB.new(0.09019607843137255, 0.4823529411764706, 0.30196078431372547) # Salmon: #FA8072: (250, 128, 114) SALMON = RGB.new(0.9803921568627451, 0.5019607843137255, 0.4470588235294118) # Salmon Rose: #E7968B: (231, 150, 139) SALMON_ROSE = RGB.new(0.9058823529411765, 0.5882352941176471, 0.5450980392156862) # Salmon pink: #FF91A4: (255, 145, 164) SALMON_PINK = RGB.new(1.0, 0.5686274509803921, 0.6431372549019608) # Samsung blue: #12279E: (18, 39, 158) SAMSUNG_BLUE = RGB.new(0.07058823529411765, 0.15294117647058825, 0.6196078431372549) # Sand: #C2B280: (194, 178, 128) SAND = RGB.new(0.7607843137254902, 0.6980392156862745, 0.5019607843137255) # Sand dune: #967117: (150, 113, 23) SAND_DUNE = RGB.new(0.5882352941176471, 0.44313725490196076, 0.09019607843137255) # Sandstorm: #ECD540: (236, 213, 64) SANDSTORM = RGB.new(0.9254901960784314, 0.8352941176470589, 0.25098039215686274) # Sandy brown: #F4A460: (244, 164, 96) SANDY_BROWN = RGB.new(0.9568627450980393, 0.6431372549019608, 0.3764705882352941) # Sandy Tan: #FDD9B5: (253, 217, 181) SANDY_TAN = RGB.new(0.9921568627450981, 0.8509803921568627, 0.7098039215686275) # Sandy taupe: #967117: (150, 113, 23) SANDY_TAUPE = RGB.new(0.5882352941176471, 0.44313725490196076, 0.09019607843137255) # Sap green: #507D2A: (80, 125, 42) SAP_GREEN = RGB.new(0.3137254901960784, 0.49019607843137253, 0.16470588235294117) # Sapphire: #0F52BA: (15, 82, 186) SAPPHIRE = RGB.new(0.058823529411764705, 0.3215686274509804, 0.7294117647058823) # Sapphire blue: #0067A5: (0, 103, 165) SAPPHIRE_BLUE = RGB.new(0.0, 0.403921568627451, 0.6470588235294118) # Sasquatch Socks: #FF4681: (255, 70, 129) SASQUATCH_SOCKS = RGB.new(1.0, 0.27450980392156865, 0.5058823529411764) # Satin sheen gold: #CBA135: (203, 161, 53) SATIN_SHEEN_GOLD = RGB.new(0.796078431372549, 0.6313725490196078, 0.20784313725490197) # Scarlet: #FF2400: (255, 36, 0) SCARLET = RGB.new(1.0, 0.1411764705882353, 0.0) # Schauss pink: #FF91AF: (255, 145, 175) SCHAUSS_PINK = RGB.new(1.0, 0.5686274509803921, 0.6862745098039216) # School bus yellow: #FFD800: (255, 216, 0) SCHOOL_BUS_YELLOW = RGB.new(1.0, 0.8470588235294118, 0.0) # Screamin' Green: #66FF66: (102, 255, 102) SCREAMIN_GREEN = RGB.new(0.4, 1.0, 0.4) # Sea blue: #006994: (0, 105, 148) SEA_BLUE = RGB.new(0.0, 0.4117647058823529, 0.5803921568627451) # Sea Foam Green: #9FE2BF: (195, 226, 191) SEA_FOAM_GREEN = RGB.new(0.7647058823529411, 0.8862745098039215, 0.7490196078431373) # Sea green: #2E8B57: (46, 139, 87) SEA_GREEN = RGB.new(0.1803921568627451, 0.5450980392156862, 0.3411764705882353) # Sea green (Crayola): #00FFCD: (1, 255, 205) SEA_GREEN_CRAYOLA = RGB.new(0.00392156862745098, 1.0, 0.803921568627451) # Sea Serpent: #4BC7CF: (75, 199, 207) SEA_SERPENT = RGB.new(0.29411764705882354, 0.7803921568627451, 0.8117647058823529) # Seal brown: #59260B: (50, 20, 20) SEAL_BROWN = RGB.new(0.19607843137254902, 0.0784313725490196, 0.0784313725490196) # Seashell: #FFF5EE: (255, 245, 238) SEASHELL = RGB.new(1.0, 0.9607843137254902, 0.9333333333333333) # Selective yellow: #FFBA00: (255, 186, 0) SELECTIVE_YELLOW = RGB.new(1.0, 0.7294117647058823, 0.0) # Sepia: #704214: (112, 66, 20) SEPIA = RGB.new(0.4392156862745098, 0.25882352941176473, 0.0784313725490196) # Shadow: #8A795D: (138, 121, 93) SHADOW = RGB.new(0.5411764705882353, 0.4745098039215686, 0.36470588235294116) # Shadow blue: #778BA5: (119, 139, 165) SHADOW_BLUE = RGB.new(0.4666666666666667, 0.5450980392156862, 0.6470588235294118) # Shampoo: #FFCFF1: (255, 207, 241) SHAMPOO = RGB.new(1.0, 0.8117647058823529, 0.9450980392156862) # Shamrock green: #009E60: (0, 158, 96) SHAMROCK_GREEN = RGB.new(0.0, 0.6196078431372549, 0.3764705882352941) # Shandy: #FFE670: (255, 230, 112) SHANDY = RGB.new(1.0, 0.9019607843137255, 0.4392156862745098) # Sheen green: #8FD400: (143, 212, 0) SHEEN_GREEN = RGB.new(0.5607843137254902, 0.8313725490196079, 0.0) # Shimmering Blush: #D98695: (217, 134, 149) SHIMMERING_BLUSH = RGB.new(0.8509803921568627, 0.5254901960784314, 0.5843137254901961) # Shiny Shamrock: #5FA778: (95, 167, 120) SHINY_SHAMROCK = RGB.new(0.37254901960784315, 0.6549019607843137, 0.47058823529411764) # Shocking pink: #FC0FC0: (252, 15, 192) SHOCKING_PINK = RGB.new(0.9882352941176471, 0.058823529411764705, 0.7529411764705882) # Shocking pink (Crayola): #FF6FFF: (255, 111, 255) SHOCKING_PINK_CRAYOLA = RGB.new(1.0, 0.43529411764705883, 1.0) # Sienna: #882D17: (136, 45, 23) SIENNA = RGB.new(0.5333333333333333, 0.17647058823529413, 0.09019607843137255) # Silver: #C0C0C0: (192, 192, 192) SILVER = RGB.new(0.7529411764705882, 0.7529411764705882, 0.7529411764705882) # Silver (Crayola): #C9C0BB: (201, 192, 187) SILVER_CRAYOLA = RGB.new(0.788235294117647, 0.7529411764705882, 0.7333333333333333) # Silver (Metallic): #AAA9AD: (170, 169, 173) SILVER_METALLIC = RGB.new(0.6666666666666666, 0.6627450980392157, 0.6784313725490196) # Silver chalice: #ACACAC: (172, 172, 172) SILVER_CHALICE = RGB.new(0.6745098039215687, 0.6745098039215687, 0.6745098039215687) # Silver foil: #AFB1AE: (175, 177, 174) SILVER_FOIL = RGB.new(0.6862745098039216, 0.6941176470588235, 0.6823529411764706) # Silver Lake blue: #5D89BA: (93, 137, 186) SILVER_LAKE_BLUE = RGB.new(0.36470588235294116, 0.5372549019607843, 0.7294117647058823) # Silver pink: #C4AEAD: (196, 174, 173) SILVER_PINK = RGB.new(0.7686274509803922, 0.6823529411764706, 0.6784313725490196) # Silver sand: #BFC1C2: (191, 193, 194) SILVER_SAND = RGB.new(0.7490196078431373, 0.7568627450980392, 0.7607843137254902) # Sinopia: #CB410B: (203, 65, 11) SINOPIA = RGB.new(0.796078431372549, 0.2549019607843137, 0.043137254901960784) # Sizzling Red: #FF3855: (255, 56, 85) SIZZLING_RED = RGB.new(1.0, 0.2196078431372549, 0.3333333333333333) # Sizzling Sunrise: #FFDB00: (255, 219, 0) SIZZLING_SUNRISE = RGB.new(1.0, 0.8588235294117647, 0.0) # Skobeloff: #007474: (0, 116, 116) SKOBELOFF = RGB.new(0.0, 0.4549019607843137, 0.4549019607843137) # Sky blue: #87CEEB: (135, 206, 235) SKY_BLUE = RGB.new(0.5294117647058824, 0.807843137254902, 0.9215686274509803) # Sky blue (Crayola): #76D7EA: (118, 215, 234) SKY_BLUE_CRAYOLA = RGB.new(0.4627450980392157, 0.8431372549019608, 0.9176470588235294) # Sky magenta: #CF71AF: (207, 113, 175) SKY_MAGENTA = RGB.new(0.8117647058823529, 0.44313725490196076, 0.6862745098039216) # Slate blue: #6A5ACD: (106, 90, 205) SLATE_BLUE = RGB.new(0.41568627450980394, 0.35294117647058826, 0.803921568627451) # Slate gray: #708090: (112, 128, 144) SLATE_GRAY = RGB.new(0.4392156862745098, 0.5019607843137255, 0.5647058823529412) # Slimy green: #299617: (41, 150, 23) SLIMY_GREEN = RGB.new(0.1607843137254902, 0.5882352941176471, 0.09019607843137255) # Smalt (Dark powder blue): #003399: (0, 51, 153) SMALT_DARK_POWDER_BLUE = RGB.new(0.0, 0.2, 0.6) # Smashed Pumpkin: #FF6D3A: (255, 109, 58) SMASHED_PUMPKIN = RGB.new(1.0, 0.42745098039215684, 0.22745098039215686) # Smitten: #C84186: (200, 65, 134) SMITTEN = RGB.new(0.7843137254901961, 0.2549019607843137, 0.5254901960784314) # Smoke: #738276: (115, 130, 118) SMOKE = RGB.new(0.45098039215686275, 0.5098039215686274, 0.4627450980392157) # Smokey Topaz: #832A0D: (131, 42, 34) SMOKEY_TOPAZ = RGB.new(0.5137254901960784, 0.16470588235294117, 0.13333333333333333) # Smoky black: #100C08: (16, 12, 8) SMOKY_BLACK = RGB.new(0.06274509803921569, 0.047058823529411764, 0.03137254901960784) # Snow: #FFFAFA: (255, 250, 250) SNOW = RGB.new(1.0, 0.9803921568627451, 0.9803921568627451) # Soap: #CEC8EF: (206, 200, 239) SOAP = RGB.new(0.807843137254902, 0.7843137254901961, 0.9372549019607843) # Solid pink: #893843: (137, 56, 67) SOLID_PINK = RGB.new(0.5372549019607843, 0.2196078431372549, 0.2627450980392157) # Sonic silver: #757575: (117, 117, 117) SONIC_SILVER = RGB.new(0.4588235294117647, 0.4588235294117647, 0.4588235294117647) # Spartan Crimson: #9E1316: (158, 19, 22) SPARTAN_CRIMSON = RGB.new(0.6196078431372549, 0.07450980392156863, 0.08627450980392157) # Space cadet: #1D2951: (29, 41, 81) SPACE_CADET = RGB.new(0.11372549019607843, 0.1607843137254902, 0.3176470588235294) # Spanish bistre: #807532: (128, 117, 50) SPANISH_BISTRE = RGB.new(0.5019607843137255, 0.4588235294117647, 0.19607843137254902) # Spanish blue: #0070B8: (0, 112, 184) SPANISH_BLUE = RGB.new(0.0, 0.4392156862745098, 0.7215686274509804) # Spanish carmine: #D10047: (209, 0, 71) SPANISH_CARMINE = RGB.new(0.8196078431372549, 0.0, 0.2784313725490196) # Spanish crimson: #E51A4C: (229, 26, 76) SPANISH_CRIMSON = RGB.new(0.8980392156862745, 0.10196078431372549, 0.2980392156862745) # Spanish gray: #989898: (152, 152, 152) SPANISH_GRAY = RGB.new(0.596078431372549, 0.596078431372549, 0.596078431372549) # Spanish green: #009150: (0, 145, 80) SPANISH_GREEN = RGB.new(0.0, 0.5686274509803921, 0.3137254901960784) # Spanish orange: #E86100: (232, 97, 0) SPANISH_ORANGE = RGB.new(0.9098039215686274, 0.3803921568627451, 0.0) # Spanish pink: #F7BFBE: (247, 191, 190) SPANISH_PINK = RGB.new(0.9686274509803922, 0.7490196078431373, 0.7450980392156863) # Spanish purple: #66033C: (102, 3, 60) SPANISH_PURPLE = RGB.new(0.4, 0.011764705882352941, 0.23529411764705882) # Spanish red: #E60026: (230, 0, 38) SPANISH_RED = RGB.new(0.9019607843137255, 0.0, 0.14901960784313725) # Spanish sky blue: #00FFFF: (0, 255, 255) SPANISH_SKY_BLUE = RGB.new(0.0, 1.0, 1.0) # Spanish violet: #4C2882: (76, 40, 130) SPANISH_VIOLET = RGB.new(0.2980392156862745, 0.1568627450980392, 0.5098039215686274) # Spanish viridian: #007F5C: (0, 127, 92) SPANISH_VIRIDIAN = RGB.new(0.0, 0.4980392156862745, 0.3607843137254902) # Spanish yellow: #F6B511: (246, 181, 17) SPANISH_YELLOW = RGB.new(0.9647058823529412, 0.7098039215686275, 0.06666666666666667) # Spicy mix: #8B5f4D: (139, 95, 77) SPICY_MIX = RGB.new(0.5450980392156862, 0.37254901960784315, 0.30196078431372547) # Spiro Disco Ball: #0FC0FC: (15, 192, 252) SPIRO_DISCO_BALL = RGB.new(0.058823529411764705, 0.7529411764705882, 0.9882352941176471) # Spring bud: #A7FC00: (167, 252, 0) SPRING_BUD = RGB.new(0.6549019607843137, 0.9882352941176471, 0.0) # Spring Frost: #87FF2A: (135, 255, 42) SPRING_FROST = RGB.new(0.5294117647058824, 1.0, 0.16470588235294117) # Spring green: #00FF7F: (0, 255, 127) SPRING_GREEN = RGB.new(0.0, 1.0, 0.4980392156862745) # Spring green (Crayola): #ECEBBD: (236, 235, 189) SPRING_GREEN_CRAYOLA = RGB.new(0.9254901960784314, 0.9215686274509803, 0.7411764705882353) # Star command blue: #007BB8: (0, 123, 184) STAR_COMMAND_BLUE = RGB.new(0.0, 0.4823529411764706, 0.7215686274509804) # Steel blue: #4682B4: (70, 130, 180) STEEL_BLUE = RGB.new(0.27450980392156865, 0.5098039215686274, 0.7058823529411765) # Steel pink: #CC33CC: (204, 51, 204) STEEL_PINK = RGB.new(0.8, 0.2, 0.8) # Steel Teal: #5F8A8B: (95, 138, 139) STEEL_TEAL = RGB.new(0.37254901960784315, 0.5411764705882353, 0.5450980392156862) # Stil de grain yellow: #FADA5E: (250, 218, 94) STIL_DE_GRAIN_YELLOW = RGB.new(0.9803921568627451, 0.8549019607843137, 0.3686274509803922) # Straw: #E4D96F: (228, 217, 111) STRAW = RGB.new(0.8941176470588236, 0.8509803921568627, 0.43529411764705883) # Strawberry: #FC5A8D: (252, 90, 141) STRAWBERRY = RGB.new(0.9882352941176471, 0.35294117647058826, 0.5529411764705883) # Stop red: #CF142B: (207, 20, 43) STOP_RED = RGB.new(0.8117647058823529, 0.0784313725490196, 0.16862745098039217) # Strawberry iced tea: #FC5A8D: (252, 90, 141) STRAWBERRY_ICED_TEA = RGB.new(0.9882352941176471, 0.35294117647058826, 0.5529411764705883) # Strawberry red: #C83F49: (200, 63, 73) STRAWBERRY_RED = RGB.new(0.7843137254901961, 0.24705882352941178, 0.28627450980392155) # Sugar Plum: #914E75: (145, 78, 117) SUGAR_PLUM = RGB.new(0.5686274509803921, 0.3058823529411765, 0.4588235294117647) # Sunburnt Cyclops: #FF404C: (255, 64, 76) SUNBURNT_CYCLOPS = RGB.new(1.0, 0.25098039215686274, 0.2980392156862745) # Sunglow: #FFCC33: (255, 204, 51) SUNGLOW = RGB.new(1.0, 0.8, 0.2) # Sunny: #F2F27A: (242, 242, 122) SUNNY = RGB.new(0.9490196078431372, 0.9490196078431372, 0.47843137254901963) # Sunray: #E3AB57: (227, 171, 87) SUNRAY = RGB.new(0.8901960784313725, 0.6705882352941176, 0.3411764705882353) # Sunset: #FAD6A5: (250, 214, 165) SUNSET = RGB.new(0.9803921568627451, 0.8392156862745098, 0.6470588235294118) # Sunset orange: #FD5E53: (253, 94, 83) SUNSET_ORANGE = RGB.new(0.9921568627450981, 0.3686274509803922, 0.3254901960784314) # Super pink: #CF6BA9: (207, 107, 169) SUPER_PINK = RGB.new(0.8117647058823529, 0.4196078431372549, 0.6627450980392157) # Sweet Brown: #A83731: (168, 55, 49) SWEET_BROWN = RGB.new(0.6588235294117647, 0.21568627450980393, 0.19215686274509805) # Tan: #D2B48C: (210, 180, 140) TAN = RGB.new(0.8235294117647058, 0.7058823529411765, 0.5490196078431373) # Tan (Crayola): #D99A6C: (217, 154, 108) TAN_CRAYOLA = RGB.new(0.8509803921568627, 0.6039215686274509, 0.4235294117647059) # Tangelo: #F94D00: (249, 77, 0) TANGELO = RGB.new(0.9764705882352941, 0.30196078431372547, 0.0) # Tangerine: #F28500: (242, 133, 0) TANGERINE = RGB.new(0.9490196078431372, 0.5215686274509804, 0.0) # Tangerine yellow: #FFCC00: (255, 204, 0) TANGERINE_YELLOW = RGB.new(1.0, 0.8, 0.0) # Tango pink: #E4717A: (228, 113, 122) TANGO_PINK = RGB.new(0.8941176470588236, 0.44313725490196076, 0.47843137254901963) # Tart Orange: #FB4D46: (251, 77, 70) TART_ORANGE = RGB.new(0.984313725490196, 0.30196078431372547, 0.27450980392156865) # Taupe: #483C32: (72, 60, 50) TAUPE = RGB.new(0.2823529411764706, 0.23529411764705882, 0.19607843137254902) # Taupe gray: #8B8589: (139, 133, 137) TAUPE_GRAY = RGB.new(0.5450980392156862, 0.5215686274509804, 0.5372549019607843) # Tea green: #D0F0C0: (208, 240, 192) TEA_GREEN = RGB.new(0.8156862745098039, 0.9411764705882353, 0.7529411764705882) # Tea rose: #F88379: (248, 131, 121) TEA_ROSE = RGB.new(0.9725490196078431, 0.5137254901960784, 0.4745098039215686) # Teal: #008080: (0, 128, 128) TEAL = RGB.new(0.0, 0.5019607843137255, 0.5019607843137255) # Teal blue: #367588: (54, 117, 136) TEAL_BLUE = RGB.new(0.21176470588235294, 0.4588235294117647, 0.5333333333333333) # Teal deer: #99E6B3: (153, 230, 179) TEAL_DEER = RGB.new(0.6, 0.9019607843137255, 0.7019607843137254) # Teal green: #00827F: (0, 130, 127) TEAL_GREEN = RGB.new(0.0, 0.5098039215686274, 0.4980392156862745) # Telemagenta: #CF3476: (207, 52, 118) TELEMAGENTA = RGB.new(0.8117647058823529, 0.20392156862745098, 0.4627450980392157) # Temptress: #3C2126: (60, 33, 38) TEMPTRESS = RGB.new(0.23529411764705882, 0.12941176470588237, 0.14901960784313725) # Tenné (tawny): #CD5700: (205, 87, 0) TAWNY = RGB.new(0.803921568627451, 0.3411764705882353, 0.0) # Terra cotta: #E2725B: (226, 114, 91) TERRA_COTTA = RGB.new(0.8862745098039215, 0.4470588235294118, 0.3568627450980392) # Thistle: #D8BFD8: (216, 191, 216) THISTLE = RGB.new(0.8470588235294118, 0.7490196078431373, 0.8470588235294118) # Thistle (Crayola): #EBB0D7: (235, 176, 215) THISTLE_CRAYOLA = RGB.new(0.9215686274509803, 0.6901960784313725, 0.8431372549019608) # Thulian pink: #DE6FA1: (222, 111, 161) THULIAN_PINK = RGB.new(0.8705882352941177, 0.43529411764705883, 0.6313725490196078) # Tickle Me Pink: #FC89AC: (252, 137, 172) TICKLE_ME_PINK = RGB.new(0.9882352941176471, 0.5372549019607843, 0.6745098039215687) # Tiffany Blue: #0ABAB5: (10, 186, 181) TIFFANY_BLUE = RGB.new(0.0392156862745098, 0.7294117647058823, 0.7098039215686275) # Tiger's eye: #E08D3C: (224, 141, 60) TIGERS_EYE = RGB.new(0.8784313725490196, 0.5529411764705883, 0.23529411764705882) # Timberwolf: #DBD7D2: (219, 215, 210) TIMBERWOLF = RGB.new(0.8588235294117647, 0.8431372549019608, 0.8235294117647058) # Titanium: #878681: (135, 134, 129) TITANIUM = RGB.new(0.5294117647058824, 0.5254901960784314, 0.5058823529411764) # Titanium yellow: #EEE600: (238, 230, 0) TITANIUM_YELLOW = RGB.new(0.9333333333333333, 0.9019607843137255, 0.0) # Tomato: #FF6347: (255, 99, 71) TOMATO = RGB.new(1.0, 0.38823529411764707, 0.2784313725490196) # Tomato sauce: #B21807: (178, 24, 7) TOMATO_SAUCE = RGB.new(0.6980392156862745, 0.09411764705882353, 0.027450980392156862) # Toolbox: #746CC0: (116, 108, 192) TOOLBOX = RGB.new(0.4549019607843137, 0.4235294117647059, 0.7529411764705882) # Tooth: #FFFAFA: (255, 250, 250) TOOTH = RGB.new(1.0, 0.9803921568627451, 0.9803921568627451) # Topaz: #FFC87C: (255, 200, 124) TOPAZ = RGB.new(1.0, 0.7843137254901961, 0.48627450980392156) # Tractor red: #FD0E35: (253, 14, 53) TRACTOR_RED = RGB.new(0.9921568627450981, 0.054901960784313725, 0.20784313725490197) # Trolley grey: #808080: (128, 128, 128) TROLLEY_GREY = RGB.new(0.5019607843137255, 0.5019607843137255, 0.5019607843137255) # Tropical rain forest: #00755E: (0, 117, 94) TROPICAL_RAIN_FOREST = RGB.new(0.0, 0.4588235294117647, 0.3686274509803922) # Tropical violet: #CDA4DE: (205, 164, 222) TROPICAL_VIOLET = RGB.new(0.803921568627451, 0.6431372549019608, 0.8705882352941177) # True blue: #0073CF: (0, 115, 207) TRUE_BLUE = RGB.new(0.0, 0.45098039215686275, 0.8117647058823529) # Tufts blue: #3E8EDE: (62, 142, 222) TUFTS_BLUE = RGB.new(0.24313725490196078, 0.5568627450980392, 0.8705882352941177) # Tulip: #FF878D: (255, 135, 141) TULIP = RGB.new(1.0, 0.5294117647058824, 0.5529411764705883) # Tumbleweed: #DEAA88: (222, 170, 136) TUMBLEWEED = RGB.new(0.8705882352941177, 0.6666666666666666, 0.5333333333333333) # Turkish rose: #B57281: (181, 114, 129) TURKISH_ROSE = RGB.new(0.7098039215686275, 0.4470588235294118, 0.5058823529411764) # Turquoise: #40E0D0: (64, 224, 208) TURQUOISE = RGB.new(0.25098039215686274, 0.8784313725490196, 0.8156862745098039) # Turquoise blue: #00FFEF: (0, 255, 239) TURQUOISE_BLUE = RGB.new(0.0, 1.0, 0.9372549019607843) # Turquoise green: #A0D6B4: (160, 214, 180) TURQUOISE_GREEN = RGB.new(0.6274509803921569, 0.8392156862745098, 0.7058823529411765) # Turquoise Surf: #00C5CD: (0, 197, 205) TURQUOISE_SURF = RGB.new(0.0, 0.7725490196078432, 0.803921568627451) # Turtle green: #8A9A5B: (138, 154, 91) TURTLE_GREEN = RGB.new(0.5411764705882353, 0.6039215686274509, 0.3568627450980392) # Tuscan: #FAD6A5: (250, 214, 165) TUSCAN = RGB.new(0.9803921568627451, 0.8392156862745098, 0.6470588235294118) # Tuscan brown: #6F4E37: (111, 78, 55) TUSCAN_BROWN = RGB.new(0.43529411764705883, 0.3058823529411765, 0.21568627450980393) # Tuscan red: #7C4848: (124, 72, 72) TUSCAN_RED = RGB.new(0.48627450980392156, 0.2823529411764706, 0.2823529411764706) # Tuscan tan: #A67B5B: (166, 123, 91) TUSCAN_TAN = RGB.new(0.6509803921568628, 0.4823529411764706, 0.3568627450980392) # Tuscany: #C09999: (192, 153, 153) TUSCANY = RGB.new(0.7529411764705882, 0.6, 0.6) # Twilight lavender: #8A496B: (138, 73, 107) TWILIGHT_LAVENDER = RGB.new(0.5411764705882353, 0.28627450980392155, 0.4196078431372549) # Twitter blue: #26A7DE: (38, 167, 222) TWITTER_BLUE = RGB.new(0.14901960784313725, 0.6549019607843137, 0.8705882352941177) # Tyrian purple: #66023C: (102, 2, 60) TYRIAN_PURPLE = RGB.new(0.4, 0.00784313725490196, 0.23529411764705882) # Ultramarine: #3F00FF: (18, 10, 143) ULTRAMARINE = RGB.new(0.07058823529411765, 0.0392156862745098, 0.5607843137254902) # Ultramarine blue: #4166F5: (65, 102, 245) ULTRAMARINE_BLUE = RGB.new(0.2549019607843137, 0.4, 0.9607843137254902) # Ultramarine blue (Caran d'Ache): #2111EF: (33, 17, 239) ULTRAMARINE_BLUE_CARAN_DACHE = RGB.new(0.12941176470588237, 0.06666666666666667, 0.9372549019607843) # Ultra pink: #FF6FFF: (255, 111, 255) ULTRA_PINK = RGB.new(1.0, 0.43529411764705883, 1.0) # Ultra red: #FC6C85: (252, 108, 133) ULTRA_RED = RGB.new(0.9882352941176471, 0.4235294117647059, 0.5215686274509804) # Umber: #635147: (99, 81, 71) UMBER = RGB.new(0.38823529411764707, 0.3176470588235294, 0.2784313725490196) # Unbleached silk: #FFDDCA: (255, 221, 202) UNBLEACHED_SILK = RGB.new(1.0, 0.8666666666666667, 0.792156862745098) # United Nations blue: #5B92E5: (91, 146, 229) UNITED_NATIONS_BLUE = RGB.new(0.3568627450980392, 0.5725490196078431, 0.8980392156862745) # Unmellow yellow: #FFFF66: (255, 255, 102) UNMELLOW_YELLOW = RGB.new(1.0, 1.0, 0.4) # UP maroon: #7B1113: (123, 17, 19) UP_MAROON = RGB.new(0.4823529411764706, 0.06666666666666667, 0.07450980392156863) # Upsdell red: #AE2029: (174, 32, 41) UPSDELL_RED = RGB.new(0.6823529411764706, 0.12549019607843137, 0.1607843137254902) # Urobilin: #E1AD21: (225, 173, 33) UROBILIN = RGB.new(0.8823529411764706, 0.6784313725490196, 0.12941176470588237) # Vampire black: #080808: (8, 8, 8) VAMPIRE_BLACK = RGB.new(0.03137254901960784, 0.03137254901960784, 0.03137254901960784) # Van Dyke brown: #664228: (102, 66, 40) VAN_DYKE_BROWN = RGB.new(0.4, 0.25882352941176473, 0.1568627450980392) # Vanilla: #F3E5AB: (243, 229, 171) VANILLA = RGB.new(0.9529411764705882, 0.8980392156862745, 0.6705882352941176) # Vanilla ice: #F38FA9: (243, 143, 169) VANILLA_ICE = RGB.new(0.9529411764705882, 0.5607843137254902, 0.6627450980392157) # Vegas gold: #C5B358: (197, 179, 88) VEGAS_GOLD = RGB.new(0.7725490196078432, 0.7019607843137254, 0.34509803921568627) # Venetian red: #C80815: (200, 8, 21) VENETIAN_RED = RGB.new(0.7843137254901961, 0.03137254901960784, 0.08235294117647059) # Verdigris: #43B3AE: (67, 179, 174) VERDIGRIS = RGB.new(0.2627450980392157, 0.7019607843137254, 0.6823529411764706) # Vermilion: #E34234: (227, 66, 52) VERMILION = RGB.new(0.8901960784313725, 0.25882352941176473, 0.20392156862745098) # Veronica: #A020F0: (160, 32, 240) VERONICA = RGB.new(0.6274509803921569, 0.12549019607843137, 0.9411764705882353) # Verse green: #18880d: (24, 136, 13) VERSE_GREEN = RGB.new(0.09411764705882353, 0.5333333333333333, 0.050980392156862744) # Very light azure: #74BBFB: (116, 187, 251) VERY_LIGHT_AZURE = RGB.new(0.4549019607843137, 0.7333333333333333, 0.984313725490196) # Very light blue: #6666FF: (102, 102, 255) VERY_LIGHT_BLUE = RGB.new(0.4, 0.4, 1.0) # Very light malachite green: #64E986: (100, 233, 134) VERY_LIGHT_MALACHITE_GREEN = RGB.new(0.39215686274509803, 0.9137254901960784, 0.5254901960784314) # Very light tangelo: #FFB077: (255, 176, 119) VERY_LIGHT_TANGELO = RGB.new(1.0, 0.6901960784313725, 0.4666666666666667) # Very pale orange: #FFDFBF: (255, 223, 191) VERY_PALE_ORANGE = RGB.new(1.0, 0.8745098039215686, 0.7490196078431373) # Very pale yellow: #FFFFBF: (255, 255, 191) VERY_PALE_YELLOW = RGB.new(1.0, 1.0, 0.7490196078431373) # Vine Green: #164010: (22, 64, 16) VINE_GREEN = RGB.new(0.08627450980392157, 0.25098039215686274, 0.06274509803921569) # Violet: #8F00FF: (143, 0, 255) VIOLET = RGB.new(0.5607843137254902, 0.0, 1.0) # Violet (Caran d'Ache): #6E00C0: (110, 0, 192) VIOLET_CARAN_DACHE = RGB.new(0.43137254901960786, 0.0, 0.7529411764705882) # Violet (color wheel): #7F00FF: (127, 0, 255) VIOLET_COLOR_WHEEL = RGB.new(0.4980392156862745, 0.0, 1.0) # Violet (crayola): #963D7F: (150, 61, 127) VIOLET_CRAYOLA = RGB.new(0.5882352941176471, 0.23921568627450981, 0.4980392156862745) # Violet (RYB): #8601AF: (134, 1, 175) VIOLET_RYB = RGB.new(0.5254901960784314, 0.00392156862745098, 0.6862745098039216) # Violet (web): #EE82EE: (238, 130, 238) VIOLET_WEB = RGB.new(0.9333333333333333, 0.5098039215686274, 0.9333333333333333) # Violet-blue: #324AB2: (50, 74, 178) VIOLET_BLUE = RGB.new(0.19607843137254902, 0.2901960784313726, 0.6980392156862745) # Violet-blue (Crayola): #766EC8: (118, 110, 200) VIOLET_BLUE_CRAYOLA = RGB.new(0.4627450980392157, 0.43137254901960786, 0.7843137254901961) # Violet-red: #F75394: (247, 83, 148) VIOLET_RED = RGB.new(0.9686274509803922, 0.3254901960784314, 0.5803921568627451) # Violin Brown: #674403: (103, 68, 3) VIOLIN_BROWN = RGB.new(0.403921568627451, 0.26666666666666666, 0.011764705882352941) # Viridian: #40826D: (64, 130, 109) VIRIDIAN = RGB.new(0.25098039215686274, 0.5098039215686274, 0.42745098039215684) # Viridian green: #009698: (0, 150, 152) VIRIDIAN_GREEN = RGB.new(0.0, 0.5882352941176471, 0.596078431372549) # Vista blue: #7C9ED9: (124, 158, 217) VISTA_BLUE = RGB.new(0.48627450980392156, 0.6196078431372549, 0.8509803921568627) # Vivid amber: #cc9900: (204, 153, 0) VIVID_AMBER = RGB.new(0.8, 0.6, 0.0) # Vivid auburn: #922724: (146, 39, 36) VIVID_AUBURN = RGB.new(0.5725490196078431, 0.15294117647058825, 0.1411764705882353) # Vivid burgundy: #9F1D35: (159, 29, 53) VIVID_BURGUNDY = RGB.new(0.6235294117647059, 0.11372549019607843, 0.20784313725490197) # Vivid cerise: #DA1D81: (218, 29, 129) VIVID_CERISE = RGB.new(0.8549019607843137, 0.11372549019607843, 0.5058823529411764) # Vivid cerulean: #00AAEE: (0, 170, 238) VIVID_CERULEAN = RGB.new(0.0, 0.6666666666666666, 0.9333333333333333) # Vivid crimson: #CC0033: (204, 0, 51) VIVID_CRIMSON = RGB.new(0.8, 0.0, 0.2) # Vivid gamboge: #FF9900: (255, 153, 0) VIVID_GAMBOGE = RGB.new(1.0, 0.6, 0.0) # Vivid lime green: #a6d608: (166, 214, 8) VIVID_LIME_GREEN = RGB.new(0.6509803921568628, 0.8392156862745098, 0.03137254901960784) # Vivid malachite: #00cc33: (0, 204, 51) VIVID_MALACHITE = RGB.new(0.0, 0.8, 0.2) # Vivid mulberry: #B80CE3: (184, 12, 227) VIVID_MULBERRY = RGB.new(0.7215686274509804, 0.047058823529411764, 0.8901960784313725) # Vivid orange: #FF5F00: (255, 95, 0) VIVID_ORANGE = RGB.new(1.0, 0.37254901960784315, 0.0) # Vivid orange peel: #FFA000: (255, 160, 0) VIVID_ORANGE_PEEL = RGB.new(1.0, 0.6274509803921569, 0.0) # Vivid orchid: #CC00FF: (204, 0, 255) VIVID_ORCHID = RGB.new(0.8, 0.0, 1.0) # Vivid raspberry: #FF006C: (255, 0, 108) VIVID_RASPBERRY = RGB.new(1.0, 0.0, 0.4235294117647059) # Vivid red: #F70D1A: (247, 13, 26) VIVID_RED = RGB.new(0.9686274509803922, 0.050980392156862744, 0.10196078431372549) # Vivid red-tangelo: #DF6124: (223, 97, 36) VIVID_RED_TANGELO = RGB.new(0.8745098039215686, 0.3803921568627451, 0.1411764705882353) # Vivid sky blue: #00CCFF: (0, 204, 255) VIVID_SKY_BLUE = RGB.new(0.0, 0.8, 1.0) # Vivid tangelo: #F07427: (240, 116, 39) VIVID_TANGELO = RGB.new(0.9411764705882353, 0.4549019607843137, 0.15294117647058825) # Vivid tangerine: #FFA089: (255, 160, 137) VIVID_TANGERINE = RGB.new(1.0, 0.6274509803921569, 0.5372549019607843) # Vivid vermilion: #e56024: (229, 96, 36) VIVID_VERMILION = RGB.new(0.8980392156862745, 0.3764705882352941, 0.1411764705882353) # Vivid violet: #9F00FF: (159, 0, 255) VIVID_VIOLET = RGB.new(0.6235294117647059, 0.0, 1.0) # Vivid yellow: #FFE302: (255, 227, 2) VIVID_YELLOW = RGB.new(1.0, 0.8901960784313725, 0.00784313725490196) # Water: #D4F1F9: (212, 241, 249) WATER = RGB.new(0.8313725490196079, 0.9450980392156862, 0.9764705882352941) # Watermelon: #F05C85: (240, 92, 133) WATERMELON = RGB.new(0.9411764705882353, 0.3607843137254902, 0.5215686274509804) # Watermelon red: #BF4147: (190, 65, 71) WATERMELON_RED = RGB.new(0.7450980392156863, 0.2549019607843137, 0.2784313725490196) # Watermelon Yellow: #EEFF1B: (238, 255, 27) WATERMELON_YELLOW = RGB.new(0.9333333333333333, 1.0, 0.10588235294117647) # Waterspout: #A4F4F9: (164, 244, 249) WATERSPOUT = RGB.new(0.6431372549019608, 0.9568627450980393, 0.9764705882352941) # Weldon Blue: #7C98AB: (124, 152, 171) WELDON_BLUE = RGB.new(0.48627450980392156, 0.596078431372549, 0.6705882352941176) # Wenge: #645452: (100, 84, 82) WENGE = RGB.new(0.39215686274509803, 0.32941176470588235, 0.3215686274509804) # Wheat: #F5DEB3: (245, 222, 179) WHEAT = RGB.new(0.9607843137254902, 0.8705882352941177, 0.7019607843137254) # White: #FFFFFF: (255, 255, 255) WHITE = RGB.new(1.0, 1.0, 1.0) # White chocolate: #EDE6D6: (237, 230, 214) WHITE_CHOCOLATE = RGB.new(0.9294117647058824, 0.9019607843137255, 0.8392156862745098) # White coffee: #E6E0D4: (230, 224, 212) WHITE_COFFEE = RGB.new(0.9019607843137255, 0.8784313725490196, 0.8313725490196079) # White smoke: #F5F5F5: (245, 245, 245) WHITE_SMOKE = RGB.new(0.9607843137254902, 0.9607843137254902, 0.9607843137254902) # Wild orchid: #D470A2: (212, 112, 162) WILD_ORCHID = RGB.new(0.8313725490196079, 0.4392156862745098, 0.6352941176470588) # Wild Strawberry: #FF43A4: (255, 67, 164) WILD_STRAWBERRY = RGB.new(1.0, 0.2627450980392157, 0.6431372549019608) # Wild watermelon: #FC6C85: (252, 108, 133) WILD_WATERMELON = RGB.new(0.9882352941176471, 0.4235294117647059, 0.5215686274509804) # Willpower orange: #FD5800: (253, 88, 0) WILLPOWER_ORANGE = RGB.new(0.9921568627450981, 0.34509803921568627, 0.0) # Windsor tan: #A75502: (167, 85, 2) WINDSOR_TAN = RGB.new(0.6549019607843137, 0.3333333333333333, 0.00784313725490196) # Wine: #722F37: (114, 47, 55) WINE = RGB.new(0.4470588235294118, 0.1843137254901961, 0.21568627450980393) # Wine dregs: #673147: (103, 49, 71) WINE_DREGS = RGB.new(0.403921568627451, 0.19215686274509805, 0.2784313725490196) # Wine red: #B11226: (177, 18, 38) WINE_RED = RGB.new(0.6941176470588235, 0.07058823529411765, 0.14901960784313725) # Winter Sky: #FF007C: (255, 0, 124) WINTER_SKY = RGB.new(1.0, 0.0, 0.48627450980392156) # Winter Wizard: #A0E6FF: (160, 230, 255) WINTER_WIZARD = RGB.new(0.6274509803921569, 0.9019607843137255, 1.0) # Wintergreen Dream: #56887D: (86, 136, 125) WINTERGREEN_DREAM = RGB.new(0.33725490196078434, 0.5333333333333333, 0.49019607843137253) # Wisteria: #C9A0DC: (201, 160, 220) WISTERIA = RGB.new(0.788235294117647, 0.6274509803921569, 0.8627450980392157) # Wood brown: #C19A6B: (193, 154, 107) WOOD_BROWN = RGB.new(0.7568627450980392, 0.6039215686274509, 0.4196078431372549) # Xanadu: #738678: (115, 134, 120) XANADU = RGB.new(0.45098039215686275, 0.5254901960784314, 0.47058823529411764) # Yellow: #FFFF00: (255, 255, 0) YELLOW = RGB.new(1.0, 1.0, 0.0) # Yellow (Crayola): #FCE883: (252, 232, 131) YELLOW_CRAYOLA = RGB.new(0.9882352941176471, 0.9098039215686274, 0.5137254901960784) # Yellow (Munsell): #EFCC00: (239, 204, 0) YELLOW_MUNSELL = RGB.new(0.9372549019607843, 0.8, 0.0) # Yellow (NCS): #FFD300: (255, 211, 0) YELLOW_NCS = RGB.new(1.0, 0.8274509803921568, 0.0) # Yellow (Pantone): #FEDF00: (254, 223, 0) YELLOW_PANTONE = RGB.new(0.996078431372549, 0.8745098039215686, 0.0) # Yellow (process): #FFEF00: (255, 239, 0) YELLOW_PROCESS = RGB.new(1.0, 0.9372549019607843, 0.0) # Yellow (RYB): #FEFE33: (254, 254, 51) YELLOW_RYB = RGB.new(0.996078431372549, 0.996078431372549, 0.2) # Yellow-green: #9ACD32: (154, 205, 50) YELLOW_GREEN = RGB.new(0.6039215686274509, 0.803921568627451, 0.19607843137254902) # Yellow-green (Crayola): #C5E384: (197, 227, 132) YELLOW_GREEN_CRAYOLA = RGB.new(0.7725490196078432, 0.8901960784313725, 0.5176470588235295) # Yellow Orange: #FFAE42: (255, 174, 66) YELLOW_ORANGE = RGB.new(1.0, 0.6823529411764706, 0.25882352941176473) # Yellow Orange (Color Wheel): #FF9505: (255, 149, 5) YELLOW_ORANGE_COLOR_WHEEL = RGB.new(1.0, 0.5843137254901961, 0.0196078431372549) # Yellow rose: #FFF000: (255, 240, 0) YELLOW_ROSE = RGB.new(1.0, 0.9411764705882353, 0.0) # Yellow Sunshine: #FFF700: (255, 247, 0) YELLOW_SUNSHINE = RGB.new(1.0, 0.9686274509803922, 0.0) # YInMn Blue: #2E5090: (46, 80, 144) YINMN_BLUE = RGB.new(0.1803921568627451, 0.3137254901960784, 0.5647058823529412) # Zaffre: #0014A8: (0, 20, 168) ZAFFRE = RGB.new(0.0, 0.0784313725490196, 0.6588235294117647) # Zebra White: #F5F5F5: (245, 245, 245) ZEBRA_WHITE = RGB.new(0.9607843137254902, 0.9607843137254902, 0.9607843137254902) # Zinnwaldite: #2C1608: (44, 22, 8) ZINNWALDITE = RGB.new(0.17254901960784313, 0.08627450980392157, 0.03137254901960784) module X11 # Alice Blue: #F0F8FF: (240, 248, 255) ALICE_BLUE = RGB.new(0.9411764705882353, 0.9725490196078431, 1.0) # Antique White: #FAEBD7: (250, 235, 215) ANTIQUE_WHITE = RGB.new(0.9803921568627451, 0.9215686274509803, 0.8431372549019608) # Aqua: #00FFFF: (0, 255, 255) AQUA = RGB.new(0.0, 1.0, 1.0) # Aquamarine: #7FFFD4: (127, 255, 212) AQUAMARINE = RGB.new(0.4980392156862745, 1.0, 0.8313725490196079) # Azure: #F0FFFF: (240, 255, 255) AZURE = RGB.new(0.9411764705882353, 1.0, 1.0) # Beige: #F5F5DC: (245, 245, 220) BEIGE = RGB.new(0.9607843137254902, 0.9607843137254902, 0.8627450980392157) # Bisque: #FFE4C4: (255, 228, 196) BISQUE = RGB.new(1.0, 0.8941176470588236, 0.7686274509803922) # Black: #000000: (0, 0, 0) BLACK = RGB.new(0.0, 0.0, 0.0) # Blanched Almond: #FFEBCD: (255, 235, 205) BLANCHED_ALMOND = RGB.new(1.0, 0.9215686274509803, 0.803921568627451) # Blue: #0000FF: (0, 0, 255) BLUE = RGB.new(0.0, 0.0, 1.0) # Blue Violet: #8A2BE2: (138, 43, 226) BLUE_VIOLET = RGB.new(0.5411764705882353, 0.16862745098039217, 0.8862745098039215) # Brown: #A52A2A: (165, 42, 42) BROWN = RGB.new(0.6470588235294118, 0.16470588235294117, 0.16470588235294117) # Burlywood: #DEB887: (222, 184, 135) BURLYWOOD = RGB.new(0.8705882352941177, 0.7215686274509804, 0.5294117647058824) # Cadet Blue: #5F9EA0: (95, 158, 160) CADET_BLUE = RGB.new(0.37254901960784315, 0.6196078431372549, 0.6274509803921569) # Chartreuse: #7FFF00: (127, 255, 0) CHARTREUSE = RGB.new(0.4980392156862745, 1.0, 0.0) # Chocolate: #D2691E: (210, 105, 30) CHOCOLATE = RGB.new(0.8235294117647058, 0.4117647058823529, 0.11764705882352941) # Coral: #FF7F50: (255, 127, 80) CORAL = RGB.new(1.0, 0.4980392156862745, 0.3137254901960784) # Cornflower Blue: #6495ED: (100, 149, 237) CORNFLOWER_BLUE = RGB.new(0.39215686274509803, 0.5843137254901961, 0.9294117647058824) # Cornsilk: #FFF8DC: (255, 248, 220) CORNSILK = RGB.new(1.0, 0.9725490196078431, 0.8627450980392157) # Crimson: #DC143C: (220, 20, 60) CRIMSON = RGB.new(0.8627450980392157, 0.0784313725490196, 0.23529411764705882) # Cyan: #00FFFF: (0, 255, 255) CYAN = RGB.new(0.0, 1.0, 1.0) # Dark Blue: #00008B: (0, 0, 139) DARK_BLUE = RGB.new(0.0, 0.0, 0.5450980392156862) # Dark Cyan: #008B8B: (0, 139, 139) DARK_CYAN = RGB.new(0.0, 0.5450980392156862, 0.5450980392156862) # Dark Goldenrod: #B8860B: (184, 134, 11) DARK_GOLDENROD = RGB.new(0.7215686274509804, 0.5254901960784314, 0.043137254901960784) # Dark Gray: #A9A9A9: (169, 169, 169) DARK_GRAY = RGB.new(0.6627450980392157, 0.6627450980392157, 0.6627450980392157) # Dark Green: #006400: (0, 100, 0) DARK_GREEN = RGB.new(0.0, 0.39215686274509803, 0.0) # Dark Khaki: #BDB76B: (189, 183, 107) DARK_KHAKI = RGB.new(0.7411764705882353, 0.7176470588235294, 0.4196078431372549) # Dark Magenta: #8B008B: (139, 0, 139) DARK_MAGENTA = RGB.new(0.5450980392156862, 0.0, 0.5450980392156862) # Dark Olive Green: #556B2F: (85, 107, 47) DARK_OLIVE_GREEN = RGB.new(0.3333333333333333, 0.4196078431372549, 0.1843137254901961) # Dark Orange: #FF8C00: (255, 140, 0) DARK_ORANGE = RGB.new(1.0, 0.5490196078431373, 0.0) # Dark Orchid: #9932CC: (153, 50, 204) DARK_ORCHID = RGB.new(0.6, 0.19607843137254902, 0.8) # Dark Red: #8B0000: (139, 0, 0) DARK_RED = RGB.new(0.5450980392156862, 0.0, 0.0) # Dark Salmon: #E9967A: (233, 150, 122) DARK_SALMON = RGB.new(0.9137254901960784, 0.5882352941176471, 0.47843137254901963) # Dark Sea Green: #8FBC8F: (143, 188, 143) DARK_SEA_GREEN = RGB.new(0.5607843137254902, 0.7372549019607844, 0.5607843137254902) # Dark Slate Blue: #483D8B: (72, 61, 139) DARK_SLATE_BLUE = RGB.new(0.2823529411764706, 0.23921568627450981, 0.5450980392156862) # Dark Slate Gray: #2F4F4F: (47, 79, 79) DARK_SLATE_GRAY = RGB.new(0.1843137254901961, 0.30980392156862746, 0.30980392156862746) # Dark Turquoise: #00CED1: (0, 206, 209) DARK_TURQUOISE = RGB.new(0.0, 0.807843137254902, 0.8196078431372549) # Dark Violet: #9400D3: (148, 0, 211) DARK_VIOLET = RGB.new(0.5803921568627451, 0.0, 0.8274509803921568) # Deep Pink: #FF1493: (255, 20, 147) DEEP_PINK = RGB.new(1.0, 0.0784313725490196, 0.5764705882352941) # Deep Sky Blue: #00BFFF: (0, 191, 255) DEEP_SKY_BLUE = RGB.new(0.0, 0.7490196078431373, 1.0) # Dim Gray: #696969: (105, 105, 105) DIM_GRAY = RGB.new(0.4117647058823529, 0.4117647058823529, 0.4117647058823529) # Dodger Blue: #1E90FF: (30, 144, 255) DODGER_BLUE = RGB.new(0.11764705882352941, 0.5647058823529412, 1.0) # Firebrick: #B22222: (178, 34, 34) FIREBRICK = RGB.new(0.6980392156862745, 0.13333333333333333, 0.13333333333333333) # Floral White: #FFFAF0: (255, 250, 240) FLORAL_WHITE = RGB.new(1.0, 0.9803921568627451, 0.9411764705882353) # Forest Green: #228B22: (34, 139, 34) FOREST_GREEN = RGB.new(0.13333333333333333, 0.5450980392156862, 0.13333333333333333) # Fuchsia: #FF00FF: (255, 0, 255) FUCHSIA = RGB.new(1.0, 0.0, 1.0) # Gainsboro: #DCDCDC: (220, 220, 220) GAINSBORO = RGB.new(0.8627450980392157, 0.8627450980392157, 0.8627450980392157) # Ghost White: #F8F8FF: (248, 248, 255) GHOST_WHITE = RGB.new(0.9725490196078431, 0.9725490196078431, 1.0) # Gold: #FFD700: (255, 215, 0) GOLD = RGB.new(1.0, 0.8431372549019608, 0.0) # Goldenrod: #DAA520: (218, 165, 32) GOLDENROD = RGB.new(0.8549019607843137, 0.6470588235294118, 0.12549019607843137) # Gray: #BEBEBE: (190, 190, 190) GRAY = RGB.new(0.7450980392156863, 0.7450980392156863, 0.7450980392156863) # Web Gray: #808080: (128, 128, 128) WEB_GRAY = RGB.new(0.5019607843137255, 0.5019607843137255, 0.5019607843137255) # Green: #00FF00: (0, 255, 0) GREEN = RGB.new(0.0, 1.0, 0.0) # Web Green: #008000: (0, 128, 0) WEB_GREEN = RGB.new(0.0, 0.5019607843137255, 0.0) # Green Yellow: #ADFF2F: (173, 255, 47) GREEN_YELLOW = RGB.new(0.6784313725490196, 1.0, 0.1843137254901961) # Honeydew: #F0FFF0: (240, 255, 240) HONEYDEW = RGB.new(0.9411764705882353, 1.0, 0.9411764705882353) # Hot Pink: #FF69B4: (255, 105, 180) HOT_PINK = RGB.new(1.0, 0.4117647058823529, 0.7058823529411765) # Indian Red: #CD5C5C: (205, 92, 92) INDIAN_RED = RGB.new(0.803921568627451, 0.3607843137254902, 0.3607843137254902) # Indigo: #4B0082: (75, 0, 130) INDIGO = RGB.new(0.29411764705882354, 0.0, 0.5098039215686274) # Ivory: #FFFFF0: (255, 255, 240) IVORY = RGB.new(1.0, 1.0, 0.9411764705882353) # Khaki: #F0E68C: (240, 230, 140) KHAKI = RGB.new(0.9411764705882353, 0.9019607843137255, 0.5490196078431373) # Lavender: #E6E6FA: (230, 230, 250) LAVENDER = RGB.new(0.9019607843137255, 0.9019607843137255, 0.9803921568627451) # Lavender Blush: #FFF0F5: (255, 240, 245) LAVENDER_BLUSH = RGB.new(1.0, 0.9411764705882353, 0.9607843137254902) # Lawn Green: #7CFC00: (124, 252, 0) LAWN_GREEN = RGB.new(0.48627450980392156, 0.9882352941176471, 0.0) # Lemon Chiffon: #FFFACD: (255, 250, 205) LEMON_CHIFFON = RGB.new(1.0, 0.9803921568627451, 0.803921568627451) # Light Blue: #ADD8E6: (173, 216, 230) LIGHT_BLUE = RGB.new(0.6784313725490196, 0.8470588235294118, 0.9019607843137255) # Light Coral: #F08080: (240, 128, 128) LIGHT_CORAL = RGB.new(0.9411764705882353, 0.5019607843137255, 0.5019607843137255) # Light Cyan: #E0FFFF: (224, 255, 255) LIGHT_CYAN = RGB.new(0.8784313725490196, 1.0, 1.0) # Light Goldenrod: #FAFAD2: (250, 250, 210) LIGHT_GOLDENROD = RGB.new(0.9803921568627451, 0.9803921568627451, 0.8235294117647058) # Light Gray: #D3D3D3: (211, 211, 211) LIGHT_GRAY = RGB.new(0.8274509803921568, 0.8274509803921568, 0.8274509803921568) # Light Green: #90EE90: (144, 238, 144) LIGHT_GREEN = RGB.new(0.5647058823529412, 0.9333333333333333, 0.5647058823529412) # Light Pink: #FFB6C1: (255, 182, 193) LIGHT_PINK = RGB.new(1.0, 0.7137254901960784, 0.7568627450980392) # Light Salmon: #FFA07A: (255, 160, 122) LIGHT_SALMON = RGB.new(1.0, 0.6274509803921569, 0.47843137254901963) # Light Sea Green: #20B2AA: (32, 178, 170) LIGHT_SEA_GREEN = RGB.new(0.12549019607843137, 0.6980392156862745, 0.6666666666666666) # Light Sky Blue: #87CEFA: (135, 206, 250) LIGHT_SKY_BLUE = RGB.new(0.5294117647058824, 0.807843137254902, 0.9803921568627451) # Light Slate Gray: #778899: (119, 136, 153) LIGHT_SLATE_GRAY = RGB.new(0.4666666666666667, 0.5333333333333333, 0.6) # Light Steel Blue: #B0C4DE: (176, 196, 222) LIGHT_STEEL_BLUE = RGB.new(0.6901960784313725, 0.7686274509803922, 0.8705882352941177) # Light Yellow: #FFFFE0: (255, 255, 224) LIGHT_YELLOW = RGB.new(1.0, 1.0, 0.8784313725490196) # Lime: #00FF00: (0, 255, 0) LIME = RGB.new(0.0, 1.0, 0.0) # Lime Green: #32CD32: (50, 205, 50) LIME_GREEN = RGB.new(0.19607843137254902, 0.803921568627451, 0.19607843137254902) # Linen: #FAF0E6: (250, 240, 230) LINEN = RGB.new(0.9803921568627451, 0.9411764705882353, 0.9019607843137255) # Magenta: #FF00FF: (255, 0, 255) MAGENTA = RGB.new(1.0, 0.0, 1.0) # Maroon: #B03060: (176, 48, 96) MAROON = RGB.new(0.6901960784313725, 0.18823529411764706, 0.3764705882352941) # Web Maroon: #800000: (128, 0, 0) WEB_MAROON = RGB.new(0.5019607843137255, 0.0, 0.0) # Medium Aquamarine: #66CDAA: (102, 205, 170) MEDIUM_AQUAMARINE = RGB.new(0.4, 0.803921568627451, 0.6666666666666666) # Medium Blue: #0000CD: (0, 0, 205) MEDIUM_BLUE = RGB.new(0.0, 0.0, 0.803921568627451) # Medium Orchid: #BA55D3: (186, 85, 211) MEDIUM_ORCHID = RGB.new(0.7294117647058823, 0.3333333333333333, 0.8274509803921568) # Medium Purple: #9370DB: (147, 112, 219) MEDIUM_PURPLE = RGB.new(0.5764705882352941, 0.4392156862745098, 0.8588235294117647) # Medium Sea Green: #3CB371: (60, 179, 113) MEDIUM_SEA_GREEN = RGB.new(0.23529411764705882, 0.7019607843137254, 0.44313725490196076) # Medium Slate Blue: #7B68EE: (123, 104, 238) MEDIUM_SLATE_BLUE = RGB.new(0.4823529411764706, 0.40784313725490196, 0.9333333333333333) # Medium Spring Green: #00FA9A: (0, 250, 154) MEDIUM_SPRING_GREEN = RGB.new(0.0, 0.9803921568627451, 0.6039215686274509) # Medium Turquoise: #48D1CC: (72, 209, 204) MEDIUM_TURQUOISE = RGB.new(0.2823529411764706, 0.8196078431372549, 0.8) # Medium Violet Red: #C71585: (199, 21, 133) MEDIUM_VIOLET_RED = RGB.new(0.7803921568627451, 0.08235294117647059, 0.5215686274509804) # Midnight Blue: #191970: (25, 25, 112) MIDNIGHT_BLUE = RGB.new(0.09803921568627451, 0.09803921568627451, 0.4392156862745098) # Mint Cream: #F5FFFA: (245, 255, 250) MINT_CREAM = RGB.new(0.9607843137254902, 1.0, 0.9803921568627451) # Misty Rose: #FFE4E1: (255, 228, 225) MISTY_ROSE = RGB.new(1.0, 0.8941176470588236, 0.8823529411764706) # Moccasin: #FFE4B5: (255, 228, 181) MOCCASIN = RGB.new(1.0, 0.8941176470588236, 0.7098039215686275) # Navajo White: #FFDEAD: (255, 222, 173) NAVAJO_WHITE = RGB.new(1.0, 0.8705882352941177, 0.6784313725490196) # Navy Blue: #000080: (0, 0, 128) NAVY_BLUE = RGB.new(0.0, 0.0, 0.5019607843137255) # Old Lace: #FDF5E6: (253, 245, 230) OLD_LACE = RGB.new(0.9921568627450981, 0.9607843137254902, 0.9019607843137255) # Olive: #808000: (128, 128, 0) OLIVE = RGB.new(0.5019607843137255, 0.5019607843137255, 0.0) # Olive Drab: #6B8E23: (107, 142, 35) OLIVE_DRAB = RGB.new(0.4196078431372549, 0.5568627450980392, 0.13725490196078433) # Orange: #FFA500: (255, 165, 0) ORANGE = RGB.new(1.0, 0.6470588235294118, 0.0) # Orange Red: #FF4500: (255, 69, 0) ORANGE_RED = RGB.new(1.0, 0.27058823529411763, 0.0) # Orchid: #DA70D6: (218, 112, 214) ORCHID = RGB.new(0.8549019607843137, 0.4392156862745098, 0.8392156862745098) # Pale Goldenrod: #EEE8AA: (238, 232, 170) PALE_GOLDENROD = RGB.new(0.9333333333333333, 0.9098039215686274, 0.6666666666666666) # Pale Green: #98FB98: (152, 251, 152) PALE_GREEN = RGB.new(0.596078431372549, 0.984313725490196, 0.596078431372549) # Pale Turquoise: #AFEEEE: (175, 238, 238) PALE_TURQUOISE = RGB.new(0.6862745098039216, 0.9333333333333333, 0.9333333333333333) # Pale Violet Red: #DB7093: (219, 112, 147) PALE_VIOLET_RED = RGB.new(0.8588235294117647, 0.4392156862745098, 0.5764705882352941) # Papaya Whip: #FFEFD5: (255, 239, 213) PAPAYA_WHIP = RGB.new(1.0, 0.9372549019607843, 0.8352941176470589) # Peach Puff: #FFDAB9: (255, 218, 185) PEACH_PUFF = RGB.new(1.0, 0.8549019607843137, 0.7254901960784313) # Peru: #CD853F: (205, 133, 63) PERU = RGB.new(0.803921568627451, 0.5215686274509804, 0.24705882352941178) # Pink: #FFC0CB: (255, 192, 203) PINK = RGB.new(1.0, 0.7529411764705882, 0.796078431372549) # Plum: #DDA0DD: (221, 160, 221) PLUM = RGB.new(0.8666666666666667, 0.6274509803921569, 0.8666666666666667) # Powder Blue: #B0E0E6: (176, 224, 230) POWDER_BLUE = RGB.new(0.6901960784313725, 0.8784313725490196, 0.9019607843137255) # Purple: #A020F0: (160, 32, 240) PURPLE = RGB.new(0.6274509803921569, 0.12549019607843137, 0.9411764705882353) # Web Purple: #800080: (128, 0, 128) WEB_PURPLE = RGB.new(0.5019607843137255, 0.0, 0.5019607843137255) # Rebecca Purple: #663399: (102, 51, 153) REBECCA_PURPLE = RGB.new(0.4, 0.2, 0.6) # Red: #FF0000: (255, 0, 0) RED = RGB.new(1.0, 0.0, 0.0) # Rosy Brown: #BC8F8F: (188, 143, 143) ROSY_BROWN = RGB.new(0.7372549019607844, 0.5607843137254902, 0.5607843137254902) # Royal Blue: #4169E1: (65, 105, 225) ROYAL_BLUE = RGB.new(0.2549019607843137, 0.4117647058823529, 0.8823529411764706) # Saddle Brown: #8B4513: (139, 69, 19) SADDLE_BROWN = RGB.new(0.5450980392156862, 0.27058823529411763, 0.07450980392156863) # Salmon: #FA8072: (250, 128, 114) SALMON = RGB.new(0.9803921568627451, 0.5019607843137255, 0.4470588235294118) # Sandy Brown: #F4A460: (244, 164, 96) SANDY_BROWN = RGB.new(0.9568627450980393, 0.6431372549019608, 0.3764705882352941) # Sea Green: #2E8B57: (46, 139, 87) SEA_GREEN = RGB.new(0.1803921568627451, 0.5450980392156862, 0.3411764705882353) # Seashell: #FFF5EE: (255, 245, 238) SEASHELL = RGB.new(1.0, 0.9607843137254902, 0.9333333333333333) # Sienna: #A0522D: (160, 82, 45) SIENNA = RGB.new(0.6274509803921569, 0.3215686274509804, 0.17647058823529413) # Silver: #C0C0C0: (192, 192, 192) SILVER = RGB.new(0.7529411764705882, 0.7529411764705882, 0.7529411764705882) # Sky Blue: #87CEEB: (135, 206, 235) SKY_BLUE = RGB.new(0.5294117647058824, 0.807843137254902, 0.9215686274509803) # Slate Blue: #6A5ACD: (106, 90, 205) SLATE_BLUE = RGB.new(0.41568627450980394, 0.35294117647058826, 0.803921568627451) # Slate Gray: #708090: (112, 128, 144) SLATE_GRAY = RGB.new(0.4392156862745098, 0.5019607843137255, 0.5647058823529412) # Snow: #FFFAFA: (255, 250, 250) SNOW = RGB.new(1.0, 0.9803921568627451, 0.9803921568627451) # Spring Green: #00FF7F: (0, 255, 127) SPRING_GREEN = RGB.new(0.0, 1.0, 0.4980392156862745) # Steel Blue: #4682B4: (70, 130, 180) STEEL_BLUE = RGB.new(0.27450980392156865, 0.5098039215686274, 0.7058823529411765) # Tan: #D2B48C: (210, 180, 140) TAN = RGB.new(0.8235294117647058, 0.7058823529411765, 0.5490196078431373) # Teal: #008080: (0, 128, 128) TEAL = RGB.new(0.0, 0.5019607843137255, 0.5019607843137255) # Thistle: #D8BFD8: (216, 191, 216) THISTLE = RGB.new(0.8470588235294118, 0.7490196078431373, 0.8470588235294118) # Tomato: #FF6347: (255, 99, 71) TOMATO = RGB.new(1.0, 0.38823529411764707, 0.2784313725490196) # Turquoise: #40E0D0: (64, 224, 208) TURQUOISE = RGB.new(0.25098039215686274, 0.8784313725490196, 0.8156862745098039) # Violet: #EE82EE: (238, 130, 238) VIOLET = RGB.new(0.9333333333333333, 0.5098039215686274, 0.9333333333333333) # Wheat: #F5DEB3: (245, 222, 179) WHEAT = RGB.new(0.9607843137254902, 0.8705882352941177, 0.7019607843137254) # White: #FFFFFF: (255, 255, 255) WHITE = RGB.new(1.0, 1.0, 1.0) # White Smoke: #F5F5F5: (245, 245, 245) WHITE_SMOKE = RGB.new(0.9607843137254902, 0.9607843137254902, 0.9607843137254902) # Yellow: #FFFF00: (255, 255, 0) YELLOW = RGB.new(1.0, 1.0, 0.0) # Yellow Green: #9ACD32: (154, 205, 50) YELLOW_GREEN = RGB.new(0.6039215686274509, 0.803921568627451, 0.19607843137254902) end include X11 end end rcairo-1.16.6/lib/cairo/constants.rb000066400000000000000000000016131370612400100172630ustar00rootroot00000000000000module Cairo define_constants = Proc.new do |const_module, prefix, target| target ||= self const_module.constants.each do |const_name| target.const_set([prefix, const_name].compact.join("_"), const_module.const_get(const_name)) end end %w(operator antialias fill_rule line_cap line_join font_slant font_weight subpixel_order hint_style hint_metrics content format extend filter).each do |name| module_name = name.split(/_/).collect {|component| component.capitalize}.join define_constants.call(const_get(module_name), name.upcase) end define_constants.call(PathDataType, "PATH") define_constants.call(PathDataType, nil, Path) define_constants.call(SVGVersion, nil, SVGSurface) define_constants.call(SVGVersion, "SVG") if const_defined?(:TextClusterFlag) define_constants.call(TextClusterFlag, "TEXT_CLUSTER_FLAG") end end rcairo-1.16.6/lib/cairo/context.rb000066400000000000000000000010301370612400100167240ustar00rootroot00000000000000require 'cairo/context/rectangle' require 'cairo/context/triangle' require 'cairo/context/circle' require 'cairo/context/path' require 'cairo/context/blur' require 'cairo/context/color' module Cairo class Context include Rectangle include Triangle include Circle include Path include Blur include Color def stroke_preserve(&block) stroke(true, &block) end def fill_preserve(&block) fill(true, &block) end def clip_preserve(&block) clip(true, &block) end end end rcairo-1.16.6/lib/cairo/context/000077500000000000000000000000001370612400100164055ustar00rootroot00000000000000rcairo-1.16.6/lib/cairo/context/blur.rb000066400000000000000000000020771370612400100177040ustar00rootroot00000000000000module Cairo class Context module Blur def pseudo_blur(radius=3, &block) raise ArgumentError, "should specify block" if block.nil? pattern = push_group(Cairo::CONTENT_COLOR_ALPHA, false, &block) save do set_source(pattern) paint(0.5) end 1.step(radius, 1) do |i| opacity = 0.075 - 0.005 * i next if opacity <= 0 5.downto(1) do |ratio| r = i / ratio.to_f r_13 = r / 3.0 r_23 = 2 * r_13 [ [-r, 0], [-r_23, r_23], [-r_23, r_13], [0, r], [r_13, r_23], [r_23, r_23], [r, 0], [r_23, -r_13], [r_23, -r_23], [0, -r], [-r_13, -r_23], [-r_23, -r_23], ].each do |x, y| save do translate(x, y) set_source(pattern) paint(opacity) end end end end end end end end rcairo-1.16.6/lib/cairo/context/circle.rb000066400000000000000000000002611370612400100201720ustar00rootroot00000000000000module Cairo class Context module Circle def circle(center_x, center_y, radius) arc(center_x, center_y, radius, 0, 2 * Math::PI) end end end end rcairo-1.16.6/lib/cairo/context/color.rb000066400000000000000000000003031370612400100200440ustar00rootroot00000000000000require 'cairo/color' module Cairo class Context module Color def set_source_color(color) set_source_rgba(*Cairo::Color.parse(color).to_rgb.to_a) end end end end rcairo-1.16.6/lib/cairo/context/path.rb000066400000000000000000000077271370612400100177030ustar00rootroot00000000000000module Cairo class Context module Path def transform_path(path, &block) transformed_path = Cairo::Path.new path.each do |type, points| case type when PATH_MOVE_TO transformed_path.move_to(*points.collect(&block).flatten) when PATH_LINE_TO transformed_path.line_to(*points.collect(&block).flatten) when PATH_CURVE_TO transformed_path.curve_to(*points.collect(&block).flatten) when PATH_CLOSE_PATH transformed_path.close end end transformed_path end def map_path_onto(path) parameterized_path = parameterize_path(path) transformed_path = transform_path(copy_path) do |x, y| current_point = nil d = x i = -1 type = points = nil path.each do |_type, _points| type, points = _type, _points i += 1 break if d < parameterized_path[i] d -= parameterized_path[i] case type when PATH_MOVE_TO current_point = points[0] when PATH_LINE_TO current_point = points[0] when PATH_CURVE_TO current_point = points[2] when PATH_CLOSE_PATH end end case type when PATH_MOVE_TO [x, y] when PATH_LINE_TO ratio = d / parameterized_path[i] current_x, current_y = current_point lx, ly = points[0] new_x = current_x * (1 - ratio) + lx * ratio new_y = current_y * (1 - ratio) + ly * ratio dx = -(current_x - lx) dy = -(current_y - ly) ratio = y / parameterized_path[i] [new_x + -dy * ratio, new_y + dx * ratio] when PATH_CURVE_TO ratio = d / parameterized_path[i] current_x, current_y = current_point cx0, cy0 = points[0] cx1, cy1 = points[1] cx2, cy2 = points[2] new_x = current_x * (1 - ratio) * (1 - ratio) * (1 - ratio) + 3 * cx0 * (1 - ratio) * (1 - ratio) * ratio + 3 * cx1 * (1 - ratio) * ratio * ratio + cx2 * ratio * ratio * ratio new_y = current_y * (1 - ratio) * (1 - ratio) * (1 - ratio) + 3 * cy0 * (1 - ratio) * (1 - ratio) * ratio + 3 * cy1 * (1 - ratio) * ratio * ratio + cy2 * ratio * ratio * ratio dx = -3 * current_x * (1 - ratio) * (1 - ratio) + 3 * cx0 * (1 - 4 * ratio + 3 * ratio * ratio) + 3 * cx1 * ( 2 * ratio - 3 * ratio * ratio) + 3 * cx2 * ratio * ratio dy = -3 * current_y * (1 - ratio) * (1 - ratio) + 3 * cy0 * (1 - 4 * ratio + 3 * ratio * ratio) + 3 * cy1 * ( 2 * ratio - 3 * ratio * ratio) + 3 * cy2 * ratio * ratio ratio = y / Math.sqrt(dx ** 2 + dy ** 2) [new_x + -dy * ratio, new_y + dx * ratio] when PATH_CLOSE_PATH [x, y] end end new_path append_path(transformed_path) end private def parameterize_path(path) current_point = nil path.collect do |type, points| result = 0 case type when PATH_MOVE_TO current_point = points[0] when PATH_LINE_TO result = current_point.distance(points[0]) current_point = points[0] when PATH_CURVE_TO result = current_point.distance(points[0]) result += points[0].distance(points[1]) result += points[1].distance(points[2]) current_point = points[2] when PATH_CLOSE_PATH end result end end end end end rcairo-1.16.6/lib/cairo/context/rectangle.rb000066400000000000000000000015441370612400100207020ustar00rootroot00000000000000module Cairo class Context module Rectangle def rounded_rectangle(x, y, width, height, x_radius, y_radius=nil) x1 = x x2 = x1 + width y1 = y y2 = y1 + height y_radius ||= x_radius x_radius = [x_radius, width / 2.0].min y_radius = [y_radius, height / 2.0].min xr1 = x_radius xr2 = x_radius / 2.0 yr1 = y_radius yr2 = y_radius / 2.0 move_to(x1 + xr1, y1) line_to(x2 - xr1, y1) curve_to(x2 - xr2, y1, x2, y1 + yr2, x2, y1 + yr1) line_to(x2, y2 - yr1) curve_to(x2, y2 - yr2, x2 - xr2, y2, x2 - xr1, y2) line_to(x1 + xr1, y2) curve_to(x1 + xr2, y2, x1, y2 - yr2, x1, y2 - yr1) line_to(x1, y1 + yr1) curve_to(x1, y1 + yr2, x1 + xr2, y1, x1 + xr1, y1) close_path end end end end rcairo-1.16.6/lib/cairo/context/triangle.rb000066400000000000000000000003231370612400100205350ustar00rootroot00000000000000module Cairo class Context module Triangle def triangle(x1, y1, x2, y2, x3, y3) move_to(x1, y1) line_to(x2, y2) line_to(x3, y3) close_path end end end end rcairo-1.16.6/lib/cairo/device.rb000066400000000000000000000004721370612400100165100ustar00rootroot00000000000000module Cairo if const_defined?(:Device) class Device class << self def supported?(type) supported_predicate = "#{type.to_s.downcase}_supported?" return false unless respond_to?(supported_predicate) send(supported_predicate) end end end end end rcairo-1.16.6/lib/cairo/paper.rb000066400000000000000000000117751370612400100163700ustar00rootroot00000000000000module Cairo class Paper class ParseError < ArgumentError end class UnknownPaperName < ParseError attr_reader :name def initialize(name) @name = name super("unknown paper name: #{name}") end end class UnknownUnit < ParseError attr_reader :unit def initialize(unit) @unit = unit super("unknown unit: #{unit}") end end class UnrecognizedPaperDescription < ParseError attr_reader :description def initialize(description) @description = description super("unrecognized paper description: #{description.inspect}") end end class << self def parse(paper_description, robust=false) case paper_description when Paper return paper_description.dup when Symbol paper = resolve_constant(paper_description) return paper.dup if paper raise UnknownPaperName.new(paper_description) when String paper = resolve_constant(paper_description) paper ||= parse_size(paper_description) return paper.dup if paper when Array return new(*paper_description) end raise UnrecognizedPaperDescription.new(paper_description) if robust nil end @@default_unit = nil def default_unit @@default_unit end def default_unit=(unit) @@default_unit = unit end @@unit_resolvers = {} def register_unit_resolver(from_units, to_units, &resolver) from_units = [from_units] unless from_units.is_a?(Array) to_units = [to_units] unless to_units.is_a?(Array) from_units.each do |from_unit| @@unit_resolvers[from_unit] ||= [] to_units.each do |unit| @@unit_resolvers[from_unit] << [unit, resolver] end end end def resolve_unit(size, from_unit, to_unit) from_unit ||= default_unit return size if from_unit == to_unit from_units = @@unit_resolvers[from_unit] || [] raise UnknownUnit.new(from_unit) if from_units.empty? from_units.each do |unit, resolver| return resolver.call(size) if to_unit == unit end raise UnknownUnit.new(to_unit) end private def resolve_constant(name) name = name.to_s.upcase.gsub(/\s+|-/, '_') if /\A[A-Z]/ =~ name and const_defined?(name) const_get(name) else nil end end def parse_size(size) size_re = /(\d+(\.\d*)?)/ unit_re = /([a-zA-Z]+?)/ if /\A#{size_re}#{unit_re}?x#{size_re}#{unit_re}?(?:#(.*))?\z/ !~ size return nil end width = $1 width_fractional = $2 width_unit = $3 height = $4 height_fractional = $5 height_unit = $6 name = $7 width = width_fractional ? Float(width) : Integer(width) height = height_fractional ? Float(height) : Integer(height) new(resolve_unit(width, width_unit, "pt"), resolve_unit(height, height_unit, "pt"), nil, name) end end self.default_unit = "pt" register_unit_resolver("pt", ["in", "inch"]) {|size| size / 72.0} register_unit_resolver(["in", "inch"], "pt") {|size| size * 72} register_unit_resolver("pt", "mm") {|size| size * 25.4 / 72.0} register_unit_resolver("mm", "pt") {|size| size / 25.4 * 72} register_unit_resolver("pt", "cm") {|size| size * 2.54 / 72.0} register_unit_resolver("cm", "pt") {|size| size / 2.54 * 72} register_unit_resolver("pt", "m") {|size| size * 0.0254 / 72.0} register_unit_resolver("m", "pt") {|size| size / 0.0254 * 72} attr_reader :unit attr_writer :width, :height attr_accessor :name def initialize(width, height, unit=nil, name=nil) @width = width @height = height @unit = unit @name = name end def unit=(unit) if @unit != unit @width = self.class.resolve_unit(width, @unit, unit) @height = self.class.resolve_unit(height, @unit, unit) end @unit = unit end def width(unit=nil) return @width if unit.nil? self.class.resolve_unit(@width, @unit, unit) end def height(unit=nil) return @height if unit.nil? self.class.resolve_unit(@height, @unit, unit) end def size(unit=nil) [width(unit), height(unit)] end def ==(other) other.is_a?(self.class) and @name == other.name and width_in_delta?(other.width(@unit)) and height_in_delta?(other.height(@unit)) end def to_s string = "#{@width}#{@unit}x#{@height}#{@unit}" string << "\##{@name}" if @name string end private def width_in_delta?(value, delta=nil) in_delta?(@width, delta, value) end def height_in_delta?(value, delta=nil) in_delta?(@height, delta, value) end def in_delta?(value, delta, other) delta ||= 0.001 value - delta < other and other < value + delta end end end rcairo-1.16.6/lib/cairo/papers.rb000066400000000000000000000030361370612400100165420ustar00rootroot00000000000000require 'cairo/paper' module Cairo class Paper [ [841, 1189, "A0"], [594, 841, "A1"], [420, 594, "A2"], [297, 420, "A3"], [210, 297, "A4"], [148, 210, "A5"], [105, 148, "A6"], [74, 105, "A7"], [52, 74, "A8"], [37, 52, "A9"], [26, 37, "A10"], [1000, 1414 , "ISO_B0"], [707, 1000 , "ISO_B1"], [500, 707 , "ISO_B2"], [353, 500 , "ISO_B3"], [250, 353 , "ISO_B4"], [176, 250 , "ISO_B5"], [125, 176 , "ISO_B6"], [88, 125 , "ISO_B7"], [62, 88 , "ISO_B8"], [44, 62 , "ISO_B9"], [31, 44 , "ISO_B10"], [1030, 1456, "JIS_B0"], [728, 1030, "JIS_B1"], [515, 728, "JIS_B2"], [364, 515, "JIS_B3"], [257, 364, "JIS_B4"], [182, 257, "JIS_B5"], [128, 182, "JIS_B6"], [91, 128, "JIS_B7"], [64, 91, "JIS_B8"], [45, 64, "JIS_B9"], [32, 45, "JIS_B10"], [1030, 1456, "B0"], [728, 1030, "B1"], [515, 728, "B2"], [364, 515, "B3"], [257, 364, "B4"], [182, 257, "B5"], [128, 182, "B6"], [91, 128, "B7"], [64, 91, "B8"], [45, 64, "B9"], [32, 45, "B10"], [215.9, 279.4, "letter"], [215.9, 355.6, "legal"], [279.9, 431.8, "tabloid"], [100, 148, "Japanese postcard"], ].each do |width, height, name| constant_name = name.upcase.gsub(/ +/, '_') const_set(constant_name, new(width, height, "mm", name)) const_set("#{constant_name}_LANDSCAPE", new(height, width, "mm", "#{name} (landscape)")) end end end rcairo-1.16.6/lib/cairo/path.rb000066400000000000000000000005461370612400100162070ustar00rootroot00000000000000require 'forwardable' module Cairo class Path extend Forwardable methods = %w(new_path new_sub_path move_to line_to curve_to arc arc_negative rel_move_to rel_line_to rel_curve_to rectangle rounded_rectangle circle) def_delegators :@context, *methods def close @context.close_path end end end rcairo-1.16.6/lib/cairo/pattern.rb000066400000000000000000000004741370612400100167300ustar00rootroot00000000000000module Cairo class Pattern class << self def supported?(type) type = type.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase supported_predicate = "#{type}_supported?" return false unless respond_to?(supported_predicate) send(supported_predicate) end end end end rcairo-1.16.6/lib/cairo/point.rb000066400000000000000000000001601370612400100163740ustar00rootroot00000000000000module Cairo class Point def distance(other) Math.hypot(other.x - x, other.y - y) end end end rcairo-1.16.6/lib/cairo/region.rb000066400000000000000000000003751370612400100165360ustar00rootroot00000000000000module Cairo class Region def each_rectangle return to_enum(:each_rectangle) unless block_given? num_rectangles.times.each do |i| yield(self[i]) end end def rectangles each_rectangle.to_a end end end rcairo-1.16.6/lib/cairo/surface.rb000066400000000000000000000006301370612400100166750ustar00rootroot00000000000000module Cairo class Surface class << self def supported?(type) type_components = type.to_s.split(/([A-Z][a-z\d]+)/).reject(&:empty?) snake_case_type_name = type_components.join("_").downcase supported_predicate = "#{snake_case_type_name}_supported?" return false unless respond_to?(supported_predicate) send(supported_predicate) end end end end rcairo-1.16.6/misc/000077500000000000000000000000001370612400100140115ustar00rootroot00000000000000rcairo-1.16.6/misc/update-colors.rb000077500000000000000000000132531370612400100171260ustar00rootroot00000000000000#!/usr/bin/env ruby require "open-uri" require "nokogiri" class Color < Struct.new(:name, :red, :green, :blue, :hex_triplet) def valid? name and hex_triplet and red and green and blue end def hex_rgb hex_triplet.scan(/[\da-f]{2,2}/i).collect do |hex| hex.hex end end def red=(red) super(Integer(red, 10)) end def green=(green) super(Integer(green, 10)) end def blue=(blue) super(Integer(blue, 10)) end end def collect_popular_colors colors = [] names = {} open("https://en.wikipedia.org/wiki/List_of_colors_(compact)") do |source| document = Nokogiri::HTML(source) document.css("div").each do |div| elements = div.elements next unless elements.collect(&:name) == ["p", "p"] color = Color.new name = elements[1].text case name when "Carmine (M&P)" color.name = "Rich Carmine" when "Khaki (HTML/CSS) (Khaki)" color.name = "Khaki" when "Khaki (X11) (Light khaki)" color.name = "Khaki (X11)" when "Lavender (floral)" color.name = "Lavender" else color.name = name end if names.key?(color.name.downcase) puts("#{color.name} is duplicated") next end title = elements[0]["title"].unicode_normalize(:nfkc) /RGB \((?\d+)\s+(?\d+)\s+(?\d+)\)/ =~ title color.red = red color.green = green color.blue = blue style = elements[0]["style"] /HEX \#(?[a-zA-Z\d]+)/ =~ title color.hex_triplet = hex_triplet color.hex_triplet ||= "C04000" if color.name == "Mahogany" unless color.valid? puts("Invalid color: #{color.inspect}") next end colors << color names[color.name.downcase] = true end end colors end def collect_x11_colors colors = [] open("https://en.wikipedia.org/wiki/X11_color_names") do |source| document = Nokogiri::HTML(source) document.css("table").each do |table| caption = (table.css("caption").text || "").strip next unless caption == "X11 color names" table.css("tr")[1..-1].each do |tr| color = Color.new th = tr.css("th").first color.name = th.text.strip tds = tr.css("td") color.hex_triplet = tds[0].text.strip.gsub(/\A\#/, "") color.red = tds[1]["title"].split("/")[0] color.green = tds[2]["title"].split("/")[0] color.blue = tds[3]["title"].split("/")[0] unless color.valid? puts("Invalid X11 color: #{color.inspect}") next end colors << color end end end colors end def constanize_color_name(name) case name when "Tenné (tawny)" "TAWNY" else normalized_chars = name.chars.collect do |char| char.unicode_normalize(:nfkd)[0] end name = normalized_chars.join("") name = name.gsub(/é/, "e") name = name.gsub(/['().’]/, "") name = name.gsub(/\s+\#(\d+)/, "\\1") name = name.gsub(/[ \-\/]/, "_") name.upcase end end colors = collect_popular_colors x11_colors = collect_x11_colors top_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) colors_rb = File.join(top_dir, "lib", "cairo", "colors.rb") test_colors_rb = File.join(top_dir, "test", "test_colors.rb") File.open(colors_rb, "w") do |rb| File.open(test_colors_rb, "w") do |test_rb| rb.puts(<<-HEADER) require "cairo/color" module Cairo module Color HEADER test_rb.puts(<<-HEADER) class ColorsTest < Test::Unit::TestCase HEADER [ [colors, nil], [x11_colors, "X11"] ].each do |colors, mod| indent = " " * 2 test_indent = " " if mod rb.puts rb.puts("#{indent}module #{mod}") indent << " " test_rb.puts test_rb.puts("#{test_indent}class #{mod}Test < self") test_indent << " " end first_color = true colors.each do |color| name = constanize_color_name(color.name) red_hex, green_hex, blue_hex = color.hex_rgb red = color.red green = color.green blue = color.blue if [red_hex, green_hex, blue_hex] != [red, green, blue] warning_message = "Hex triplet(#{color.hex_triplet}) of " warning_message << "#{color.name} is difference from RGB" warning_message << "(#{red}, #{green}, #{blue}). " warning_message << "Use RGB value." puts(warning_message) end r, g, b = [red, green, blue].collect {|v| v / 255.0} rb.puts("#{indent}\# #{color.name}: \##{color.hex_triplet}: " + "(#{red}, #{green}, #{blue})") rb.puts("#{indent}#{name} = RGB.new(#{r}, #{g}, #{b})") test_rb.puts unless first_color test_rb.puts("#{test_indent}\# #{color.name}: \##{color.hex_triplet}: " + "(#{red}, #{green}, #{blue})") test_rb.puts("#{test_indent}test(#{color.name.dump}) do") full_name = "Cairo::Color" full_name += "::#{mod}" if mod full_name += "::#{name}" test_rb.puts("#{test_indent} assert_equal(\"\\\#%02X%02X%02XFF\" % " + "[#{red}, #{green}, #{blue}],") test_rb.puts("#{test_indent} #{full_name}.to_s)") test_rb.puts("#{test_indent}end") first_color = false end if mod indent = indent[0..-3] rb.puts("#{indent}end") rb.puts("#{indent}include #{mod}") test_indent = test_indent[0..-3] test_rb.puts("#{test_indent}end") end end rb.puts(<<-FOOTER) end end FOOTER test_rb.puts(<<-FOOTER) end FOOTER end end rcairo-1.16.6/samples/000077500000000000000000000000001370612400100145225ustar00rootroot00000000000000rcairo-1.16.6/samples/.cvsignore000066400000000000000000000000221370612400100165140ustar00rootroot00000000000000*.pdf *.ps *.png rcairo-1.16.6/samples/agg/000077500000000000000000000000001370612400100152605ustar00rootroot00000000000000rcairo-1.16.6/samples/agg/README000066400000000000000000000001651370612400100161420ustar00rootroot00000000000000There are many samples ported from Anti-Grain Geometry (AGG: http://www.antigrain.com/) They use Ruby/GTK+ for GUI. rcairo-1.16.6/samples/agg/aa_test.rb000077500000000000000000000200351370612400100172300ustar00rootroot00000000000000#!/usr/bin/env ruby # ported from examples/aa_test.cpp in AGG source tree. top = File.expand_path(File.join(File.dirname(__FILE__), "..", "..")) src = File.join(top, "src") $LOAD_PATH.unshift src $LOAD_PATH.unshift File.join(src, "lib") require 'gtk2' window = Gtk::Window.new window.set_default_size(480, 350) area = Gtk::DrawingArea.new def stroke_line(context, x1, y1, x2, y2, line_width, dash_length) context.save do yield if block_given? context.move_to(x1, y1) context.line_to(x2, y2) context.set_dash(dash_length) if dash_length > 0 context.line_width = line_width context.line_cap = :round context.stroke end end def fill_triangle(context, x1, y1, x2, y2, x3, y3) context.save do yield if block_given? context.triangle(x1, y1, x2, y2, x3, y3) context.fill end end def set_gradient(context, x1, y1, x2, y2, color_stops) pattern = Cairo::LinearPattern.new(x1, y1, x2, y2) color_stops.each do |offset, color| pattern.add_color_stop(offset, color) end context.set_source(pattern) end def stroke_gradient_line(context, x1, y1, x2, y2, line_width, dash_length, color_stops) stroke_line(context, x1, y1, x2, y2, line_width, dash_length) do set_gradient(context, x1, y1, x2, y2, color_stops) end end def fill_gradient_triangle(context, x1, y1, x2, y2, x3, y3, color_stops) fill_triangle(context, x1, y1, x2, y2, x3, y3) do set_gradient(context, x1, y1, x3 - (x3 - x2) / 2.0, y3 - (y3 - y2) / 2.0, color_stops) end end def draw_background_circle(context, w, h) context.set_source_color([1.0, 1.0, 1.0, 0.2]) cx = w / 2.0 cy = h / 2.0 radius = [cx, cy].min 1.upto(180) do |i| n = 2 * Math::PI * i / 180.0 stroke_line(context, cx + radius * Math.sin(n), cy + radius * Math.cos(n), cx, cy, 1.0, i < 90 ? i : 0) end end def draw_upper_small_circles(context, i) context.circle(18 + i * 4 + 0.5, 33 + 0.5, i / 20.0) context.fill context.circle(18 + i * 4 + (i - 1) / 10.0 + 0.5, 27 + (i - 1) / 10.0 + 0.5, 0.5) context.fill end def draw_upper_circles(context, i) context.set_source_color(:white) context.circle(20 + i * (i + 1) + 0.5, 20.5, i / 2.0) context.fill draw_upper_small_circles(context, i) end def draw_upper_gradient_lines(context, i) stroke_gradient_line(context, 20 + i * (i + 1), 40.5, 20 + i * (i + 1) + (i - 1) * 4, 100.5, i, 0, [[0, :white], [1, [i % 2, (i % 3) * 0.5, (i % 5) * 0.25]]]) end def draw_middle_small_circles(context, i) stroke_gradient_line(context, 17.5 + i * 4, 107, 17.5 + i * 4 + i / 6.66666667, 107, 1, 0, [[0, :red], [1, :blue]]) stroke_gradient_line(context, 18 + i * 4, 112.5, 18 + i * 4, 112.5 + i / 6.66666667, 1, 0, [[0, :red], [1, :blue]]) end def draw_middle_gradient_lines(context, i) stroke_gradient_line(context, 21.5, 120 + (i - 1) * 3.1, 52.5, 120 + (i - 1) * 3.1, 1, 0, [[0, :red], [1, :white]]) stroke_gradient_line(context, 52.5, 118 + i * 3, 83.5, 118 + i * 3, 2 - (i - 1) / 10.0, 0, [[0, :green], [1, :white]]) stroke_gradient_line(context, 83.5, 119 + i * 3, 114.5, 119 + i * 3, 2 - (i - 1) / 10.0, 3.0, [[0, :blue], [1, :white]]) end def draw_middle_white_lines(context, i) context.set_source_color(:white) stroke_line(context, 125.5, 119.5 + (i + 2) * (i / 2.0), 135.5, 119.5 + (i + 2) * (i / 2.0), i, 0) end def draw_lower_short_lines(context, i) context.set_source_color(:white) stroke_line(context, 17.5 + i * 4, 192, 18.5 + i * 4, 192, i / 10.0, 0) stroke_line(context, 17.5 + i * 4 + (i - 1) / 10.0, 186, 18.5 + i * 4 + (i - 1) / 10.0, 186, 1.0, 0) end def draw_right_triangles(context, i, w, h) x1 = w - 150 x2 = w - 20 y_upper = h - 20 - i * (i + 2) y_middle = h - 20 - i * (i + 1.5) y_lower = h - 20 - i * (i + 1) context.save do pattern = Cairo::LinearPattern.new(x1, y_middle, x2, y_middle) pattern.add_color_stop(0, :white) pattern.add_color_stop(1, [i % 2, (i % 3) * 0.5, (i % 5) * 0.25]) context.set_source(pattern) context.move_to(x1, y_middle) context.line_to(x2, y_lower) context.line_to(x2, y_upper) context.fill end end def draw_sample_shapes(context, w, h) context.set_source_color(:black) context.paint draw_background_circle(context, w, h) 1.upto(20) do |i| draw_upper_circles(context, i) draw_upper_gradient_lines(context, i) draw_middle_small_circles(context, i) draw_middle_gradient_lines(context, i) draw_middle_white_lines(context, i) if i <= 10 draw_lower_short_lines(context, i) end 1.upto(13) do |i| draw_right_triangles(context, i, w, h) end end def draw_random_shapes(context, w, h) srand(123) context.set_source_color(:black) context.paint n_circles = 20000 start = Time.now n_circles.times do |i| context.circle(rand(w), rand(h), rand(20.0) + 1.0) context.set_source_color([rand, rand, rand, 0.5 + rand / 2]) context.fill end circle_draw_time = Time.now - start n_lines = 2000 start = Time.now n_lines.times do |i| x1 = rand(w) y1 = rand(h) stroke_gradient_line(context, x1, y1, x1 + rand(w * 0.5) - w * 0.25, y1 + rand(h * 0.5) - h * 0.25, 10.0, 0, [[0, [rand, rand, rand, 0.5 + rand / 2]], [1, [rand, rand, rand, rand]]]) end line_draw_time = Time.now - start n_triangles = 2000 start = Time.now n_triangles.times do |i| x1 = rand(w) y1 = rand(h) fill_gradient_triangle(context, x1, y1, x1 + rand(w * 0.4) - w * 0.2, y1 + rand(h * 0.4) - h * 0.2, x1 + rand(w * 0.4) - w * 0.2, y1 + rand(h * 0.4) - h * 0.2, [[0, [rand, rand, rand, 0.5 + rand / 2]], [0.5, [rand, rand, rand, rand]], [1, [rand, rand, rand, rand]]]) end triangle_draw_time = Time.now - start puts "Points=%.2fK/sec, Lines=%.2fK/sec, Triangles=%.2fK/sec" % [n_circles.to_f / circle_draw_time, n_lines.to_f / line_draw_time, n_triangles.to_f / triangle_draw_time] end random_mode = false area.add_events(Gdk::Event::BUTTON_PRESS_MASK) area.signal_connect("button-press-event") do |widget, event| random_mode = !random_mode widget.queue_draw false end area.signal_connect("expose-event") do |widget, event| context = widget.window.create_cairo_context x, y, w, h = widget.allocation.to_a if random_mode draw_random_shapes(context, w, h) else draw_sample_shapes(context, w, h) end true end window.add(area) window.show_all Gtk.main rcairo-1.16.6/samples/blur.rb000077500000000000000000000021531370612400100160170ustar00rootroot00000000000000#!/usr/bin/env ruby top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require 'cairo' margin = 10 rectangle_width = 300 rectangle_height = 100 width = rectangle_width + 2 * margin height = (rectangle_height + 2 * margin) * 3 surface = Cairo::ImageSurface.new(width, height) context = Cairo::Context.new(surface) context.set_source_color(:white) context.paint module Cairo module Color GRAY30 = Cairo::Color::RGB.new(0.3, 0.3, 0.3) end end context.set_source_color(:gray30) context.rectangle(margin, margin, rectangle_width, rectangle_height) context.fill context.pseudo_blur do context.set_source_color(:gray30) context.rectangle(margin, rectangle_height + 2 * margin + margin / 2, rectangle_width, rectangle_height) context.fill end context.pseudo_blur(5) do context.set_source_color(:gray30) context.rectangle(margin, (rectangle_height + 2 * margin) * 2 + margin / 2, rectangle_width, rectangle_height) context.fill end surface.write_to_png("blur.png") rcairo-1.16.6/samples/link.rb000077500000000000000000000007411370612400100160110ustar00rootroot00000000000000#!/usr/bin/env ruby top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require "cairo" width = 200 height = 200 Cairo::PDFSurface.new("link.pdf", width, height) do |surface| Cairo::Context.new(surface) do |context| context.move_to(50, 50) context.tag(Cairo::Tag::LINK, "uri='http://rcairo.github.io/'") do context.show_text("rcairo site") end end end rcairo-1.16.6/samples/pac-nomralize.rb000066400000000000000000000104271370612400100176140ustar00rootroot00000000000000=begin pac-normalize.rb - rcairo sample script with #scale and #translate. Original: pac.rb in http://www.artima.com/rubycs/articles/pdf_writer3.html =end top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require "cairo" def pac(surface, width, height) cr = Cairo::Context.new(surface) # NOTE: You may need to set line width when use Cairo::Context#scale cr.set_line_width(cr.line_width / [width, height].max) cr.scale(width, height) cr.save do cr.set_source_color(:black) cr.rectangle(0, 0, 1, 1) cr.fill end # Wall wall_width = 0.89 wall_height = 0.03 wall_space = 0.5 wall_x = 0.02 wall1_y = 1 - 0.86 wall2_y = wall1_y + wall_space wall_radius = 0.01 cr.set_source_color(:magenta) cr.rounded_rectangle(wall_x, wall1_y, wall_width, wall_height, wall_radius) cr.fill cr.set_source_color(:cyan) cr.rounded_rectangle(wall_x, wall1_y, wall_width, wall_height, wall_radius) cr.stroke cr.set_source_color(:magenta) cr.rounded_rectangle(wall_x, wall2_y, wall_width, wall_height, wall_radius) cr.fill cr.set_source_color(:cyan) cr.rounded_rectangle(wall_x, wall2_y, wall_width, wall_height, wall_radius) cr.stroke # Body body_x = 0.17 body_y = 1 - 0.58 body_width = 0.23 body_height = 0.33 cr.save do cr.translate(body_x, body_y) cr.set_source_color(:yellow) cr.scale(body_width, body_height) cr.arc(0, 0, 0.5, 30 * (Math::PI / 180), 330 * (Math::PI / 180)) cr.line_to(0, 0) cr.close_path cr.fill end # Dot dot_width = 0.02 dot_height = 0.03 small_dot_width = 0.01 small_dot_height = 0.015 dot_x = 0.29 dot_y = 1 - 0.58 dot_step = 0.05 cr.save do cr.set_source_color(:yellow) cr.save do cr.translate(dot_x, dot_y) cr.scale(dot_width, dot_height) cr.circle(0, 0, 1).fill end 4.times do |i| cr.save do cr.translate(dot_x + dot_step * (i + 1), dot_y) cr.scale(small_dot_width, small_dot_height) cr.circle(0, 0, 1).fill end end end # Ghost ghost_x = 0.59 ghost_x_step = 0.03 ghost_y = 1 - 0.42 ghost_y_step = 0.04 ghost_width = 0.18 ghost_height = 0.29 ghost_radius= 0.08 cr.move_to(ghost_x, ghost_y) cr.line_to(ghost_x, ghost_y - ghost_height) cr.curve_to(ghost_x + ghost_width / 3.0, ghost_y - ghost_height - ghost_radius, ghost_x + ghost_width * (2.0 / 3.0), ghost_y - ghost_height - ghost_radius, ghost_x + ghost_width, ghost_y - ghost_height) cr.line_to(ghost_x + ghost_width, ghost_y) i = 0 (ghost_x + ghost_width).step(ghost_x, -ghost_x_step) do |x| cr.line_to(x, ghost_y + -ghost_y_step * (i % 2)) i += 1 end cr.close_path cr.set_source_color(:blue) cr.fill_preserve cr.set_source_color(:cyan) cr.stroke # Ghost Eyes eye_x = 0.62 eye_y = 1 - 0.63 eye_space = 0.06 white_eye_width = 0.03 white_eye_height = 0.04 black_eye_width = 0.01 black_eye_height = 0.02 cr.set_source_color(:white) cr.rectangle(eye_x, eye_y - white_eye_height, white_eye_width, white_eye_height) cr.fill cr.rectangle(eye_x + eye_space, eye_y - white_eye_height, white_eye_width, white_eye_height) cr.fill cr.set_source_color(:black) cr.rectangle(eye_x, eye_y - black_eye_height, black_eye_width, black_eye_height) cr.fill cr.rectangle(eye_x + eye_space, eye_y - black_eye_height, black_eye_width, black_eye_height) cr.fill cr.show_page end paper = Cairo::Paper.parse(:a4_landscape) size_in_points = paper.size("pt") Cairo::ImageSurface.new(*size_in_points) do |surface| cr = pac(surface, *size_in_points) cr.target.write_to_png("pac-normalize.png") end scalable_surface_output = Proc.new do |surface_class_name, suffix| if Cairo.const_defined?(surface_class_name) surface_class = Cairo.const_get(surface_class_name) surface_class.new("pac-normalize.#{suffix}", paper) do |surface| pac(surface, *size_in_points) end else puts("#{surface_class_name} isn't supported.") end end scalable_surface_output.call("PSSurface", "ps") scalable_surface_output.call("PDFSurface", "pdf") scalable_surface_output.call("SVGSurface", "svg") rcairo-1.16.6/samples/pac-tee.rb000066400000000000000000000103671370612400100163740ustar00rootroot00000000000000=begin pac-tee.rb - rcairo sample script with TeeSurface. Original: pac.rb in http://www.artima.com/rubycs/articles/pdf_writer3.html =end top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require "cairo" def pac(surface, width, height) cr = Cairo::Context.new(surface) # NOTE: You may need to set line width when use Cairo::Context#scale cr.set_line_width(cr.line_width / [width, height].max) cr.scale(width, height) cr.save do cr.set_source_color(:black) cr.rectangle(0, 0, 1, 1) cr.fill end # Wall wall_width = 0.89 wall_height = 0.03 wall_space = 0.5 wall_x = 0.02 wall1_y = 1 - 0.86 wall2_y = wall1_y + wall_space wall_radius = 0.01 cr.set_source_color(:magenta) cr.rounded_rectangle(wall_x, wall1_y, wall_width, wall_height, wall_radius) cr.fill cr.set_source_color(:cyan) cr.rounded_rectangle(wall_x, wall1_y, wall_width, wall_height, wall_radius) cr.stroke cr.set_source_color(:magenta) cr.rounded_rectangle(wall_x, wall2_y, wall_width, wall_height, wall_radius) cr.fill cr.set_source_color(:cyan) cr.rounded_rectangle(wall_x, wall2_y, wall_width, wall_height, wall_radius) cr.stroke # Body body_x = 0.17 body_y = 1 - 0.58 body_width = 0.23 body_height = 0.33 cr.save do cr.translate(body_x, body_y) cr.set_source_color(:yellow) cr.scale(body_width, body_height) cr.arc(0, 0, 0.5, 30 * (Math::PI / 180), 330 * (Math::PI / 180)) cr.line_to(0, 0) cr.close_path cr.fill end # Dot dot_width = 0.02 dot_height = 0.03 small_dot_width = 0.01 small_dot_height = 0.015 dot_x = 0.29 dot_y = 1 - 0.58 dot_step = 0.05 cr.save do cr.set_source_color(:yellow) cr.save do cr.translate(dot_x, dot_y) cr.scale(dot_width, dot_height) cr.circle(0, 0, 1).fill end 4.times do |i| cr.save do cr.translate(dot_x + dot_step * (i + 1), dot_y) cr.scale(small_dot_width, small_dot_height) cr.circle(0, 0, 1).fill end end end # Ghost ghost_x = 0.59 ghost_x_step = 0.03 ghost_y = 1 - 0.42 ghost_y_step = 0.04 ghost_width = 0.18 ghost_height = 0.29 ghost_radius= 0.08 cr.move_to(ghost_x, ghost_y) cr.line_to(ghost_x, ghost_y - ghost_height) cr.curve_to(ghost_x + ghost_width / 3.0, ghost_y - ghost_height - ghost_radius, ghost_x + ghost_width * (2.0 / 3.0), ghost_y - ghost_height - ghost_radius, ghost_x + ghost_width, ghost_y - ghost_height) cr.line_to(ghost_x + ghost_width, ghost_y) i = 0 (ghost_x + ghost_width).step(ghost_x, -ghost_x_step) do |x| cr.line_to(x, ghost_y + -ghost_y_step * (i % 2)) i += 1 end cr.close_path cr.set_source_color(:blue) cr.fill_preserve cr.set_source_color(:cyan) cr.stroke # Ghost Eyes eye_x = 0.62 eye_y = 1 - 0.63 eye_space = 0.06 white_eye_width = 0.03 white_eye_height = 0.04 black_eye_width = 0.01 black_eye_height = 0.02 cr.set_source_color(:white) cr.rectangle(eye_x, eye_y - white_eye_height, white_eye_width, white_eye_height) cr.fill cr.rectangle(eye_x + eye_space, eye_y - white_eye_height, white_eye_width, white_eye_height) cr.fill cr.set_source_color(:black) cr.rectangle(eye_x, eye_y - black_eye_height, black_eye_width, black_eye_height) cr.fill cr.rectangle(eye_x + eye_space, eye_y - black_eye_height, black_eye_width, black_eye_height) cr.fill cr.show_page end paper = Cairo::Paper.parse(:a4_landscape) size_in_points = paper.size("pt") image_surface = Cairo::ImageSurface.new(*size_in_points) tee_surface = Cairo::TeeSurface.new(image_surface) add_scalable_surface = Proc.new do |surface_class_name, suffix| if Cairo.const_defined?(surface_class_name) surface_class = Cairo.const_get(surface_class_name) tee_surface << surface_class.new("pac-tee.#{suffix}", paper) else puts("#{surface_class_name} isn't supported.") end end add_scalable_surface.call("PSSurface", "ps") add_scalable_surface.call("PDFSurface", "pdf") add_scalable_surface.call("SVGSurface", "svg") pac(tee_surface, *size_in_points) image_surface.write_to_png("pac-tee.png") rcairo-1.16.6/samples/pac.rb000066400000000000000000000044301370612400100156130ustar00rootroot00000000000000=begin pac.rb - rcairo sample script. Original: pac.rb in http://www.artima.com/rubycs/articles/pdf_writer3.html =end top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require "cairo" paper = Cairo::Paper::A4_LANDSCAPE def pac(surface) cr = Cairo::Context.new(surface) cr.set_source_color(:black) cr.paint # Wall cr.set_source_color(:magenta) cr.rounded_rectangle(20, 80, 750, 20, 10) cr.fill cr.set_source_color(:cyan) cr.rounded_rectangle(20, 80, 750, 20, 10) cr.stroke cr.set_source_color(:magenta) cr.rounded_rectangle(20, 380, 750, 20, 10) cr.fill cr.set_source_color(:cyan) cr.rounded_rectangle(20, 380, 750, 20, 10) cr.stroke # Body cr.set_source_color(:yellow) cr.fill do cr.arc(150, 250, 100, 30 * (Math::PI / 180), 330 * (Math::PI / 180)) cr.line_to(150, 250) end # Dot cr.set_source_color(:yellow) cr.circle(250, 250, 20).fill cr.circle(300, 250, 10).fill cr.circle(350, 250, 10).fill cr.circle(400, 250, 10).fill cr.circle(450, 250, 10).fill # Ghost cr.move_to(500, 350) cr.line_to(500, 175) cr.curve_to(550, 125, 600, 125, 650, 175) cr.line_to(650, 350) cr.line_to(625, 325) cr.line_to(600, 350) cr.line_to(575, 325) cr.line_to(550, 350) cr.line_to(525, 325) cr.line_to(500, 350) cr.set_source_color(:blue) cr.fill_preserve cr.set_source_color(:cyan) cr.stroke # Ghost Eyes cr.set_source_color(:white) cr.rectangle(525, 200, 25, 25).fill cr.rectangle(575, 200, 25, 25).fill cr.set_source_color(:black) cr.rectangle(525, 215, 10, 10).fill cr.rectangle(575, 215, 10, 10).fill cr.show_page end Cairo::ImageSurface.new(*paper.size("pt")) do |surface| cr = pac(surface) cr.target.write_to_png("pac.png") end def scalable_surface_output(surface_class_name, paper, suffix) if Cairo.const_defined?(surface_class_name) surface_class = Cairo.const_get(surface_class_name) surface_class.new("pac.#{suffix}", paper) do |surface| pac(surface) end else puts("#{surface_class_name} isn't supported.") end end scalable_surface_output("PSSurface", paper, "ps") scalable_surface_output("PDFSurface", paper, "pdf") scalable_surface_output("SVGSurface", paper, "svg") rcairo-1.16.6/samples/png.rb000077500000000000000000000016271370612400100156440ustar00rootroot00000000000000#!/usr/bin/env ruby top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require 'cairo' width = 200 height = 200 data = nil stride = nil Cairo::ImageSurface.new(width, height) do |surface| cr = Cairo::Context.new(surface) # fill background with white cr.set_source_color("#fffc") cr.paint # create shape cr.move_to(50, 50) cr.curve_to(100, 25, 100, 75, 150, 50) cr.line_to(150, 150) cr.line_to(50, 150) cr.close_path cr.set_source_color(:black) cr.fill_preserve cr.set_source_color(:red) cr.set_line_join(Cairo::LINE_JOIN_MITER) cr.set_line_width(4) cr.stroke cr.target.write_to_png("test.png") data = cr.target.data stride = cr.target.stride end Cairo::ImageSurface.new(data, :argb32, width, height, stride) do |surface| surface.write_to_png("test-renew.png") end rcairo-1.16.6/samples/scalable.rb000077500000000000000000000024001370612400100166140ustar00rootroot00000000000000#!/usr/bin/env ruby top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require 'cairo' require 'stringio' def render(output, surface_class) surface_class.new(output, 200, 200) do |surface| cr = Cairo::Context.new(surface) # fill background with white cr.set_source_color("#fffc") cr.paint # create shape cr.move_to(50, 50) cr.curve_to(100, 25, 100, 75, 150, 50) cr.line_to(150, 150) cr.line_to(50, 150) cr.close_path cr.set_source_color(:black) cr.fill_preserve cr.set_source_color(:red) cr.set_line_join(Cairo::LINE_JOIN_MITER) cr.set_line_width(4) cr.stroke cr.show_page surface.finish end end def output(surface_class_name, suffix) if Cairo.const_defined?(surface_class_name) surface_class = Cairo.const_get(surface_class_name) render("test.#{suffix}", surface_class) output = StringIO.new render(output, surface_class) output.rewind File.open("test2.#{suffix}", "wb") do |f| f.print(output.read) end else puts("#{surface_class_name} isn't supported.") end end output("PSSurface", "ps") output("PDFSurface", "pdf") output("SVGSurface", "svg") rcairo-1.16.6/samples/text-on-path.rb000077500000000000000000000023121370612400100174000ustar00rootroot00000000000000#!/usr/bin/env ruby top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require 'cairo' require 'pango' def render_background(cr) cr.set_source_color(:white) cr.paint end def make_layout(cr, text) layout = cr.create_pango_layout layout.text = text layout.font_description = Pango::FontDescription.new("Serif 36") cr.update_pango_layout(layout) layout end def render(surface) text = "It was a dream... Oh Just a dream..." cr = Cairo::Context.new(surface) render_background(cr) cr.set_source_color(:red) cr.move_to(25, 350) cr.line_to(150, 375) cr.curve_to(275, 400, 450, 350, 450, 200) cr.curve_to(450, 0, 300, 150, 50, 50) cr.stroke_preserve path = cr.copy_path_flat cr.line_width = 1 cr.new_path layout = make_layout(cr, text) cr.pango_layout_line_path(layout.get_line(0)) cr.map_path_onto(path) cr.set_source_rgba(0.3, 0.3, 1.0, 0.3) cr.fill_preserve cr.set_source_rgba(0.1, 0.1, 0.1) cr.stroke cr.show_page end def output Cairo::ImageSurface.new(500, 500) do |surface| render(surface) surface.write_to_png("text-on-path.png") end end output rcairo-1.16.6/samples/text2.rb000077500000000000000000000066271370612400100161330ustar00rootroot00000000000000#!/usr/bin/env ruby top = File.expand_path(File.join(File.dirname(__FILE__), "..")) $LOAD_PATH.unshift File.join(top, "ext", "cairo") $LOAD_PATH.unshift File.join(top, "lib") require 'optparse' require 'ostruct' require 'cairo' require 'pango' def parse(args=ARGV) options = OpenStruct.new options.width = 595.275590551181.round options.height = 841.889763779528.round options.font_description = "Monospace 12" options.fade_out = false opts = OptionParser.new do |opts| opts.on("--width=WIDTH", Integer, "paper width") do |width| options.width = width end opts.on("--height=HEIGHT", Integer, "paper height") do |height| options.height = height end opts.on("--font-description=DESCRIPTION", "font description (e.g. 'Monospace 14')") do |desc| options.font_description = desc end opts.on("--[no-]fade-out", "fade-out one-third of page") do |fade_out| options.fade_out = fade_out end end opts.parse!(args) options end def render_background(cr) cr.set_source_color(:white) cr.paint end def make_layout(cr, text, width, font_description) layout = cr.create_pango_layout layout.text = text layout.width = width * Pango::SCALE layout.font_description = Pango::FontDescription.new(font_description) cr.update_pango_layout(layout) layout end def setup_fade_out(cr, width) fade_out = Cairo::LinearPattern.new(0, 0, width, 0) fade_out.add_color_stop(0, "#000f") fade_out.add_color_stop(0.66, "#000f") fade_out.add_color_stop(1, "#0000") cr.set_source(fade_out) end def render_layout(cr, layout, margin_left, margin_top, body_height) x = margin_left y = margin_top limit_y = margin_top + body_height iter = layout.iter prev_baseline = iter.baseline / Pango::SCALE begin line = iter.line ink_rect, logical_rect = iter.line_extents y_begin, y_end = iter.line_yrange if limit_y < (y + y_end / Pango::SCALE) cr.show_page y = margin_top - prev_baseline end baseline = iter.baseline / Pango::SCALE cr.move_to(x + logical_rect.x / Pango::SCALE, y + baseline) cr.show_pango_layout_line(line) prev_baseline = baseline end while iter.next_line! end def render(options, output, surface_class) text = options.text width = options.width height = options.height font_description = options.font_description fade_out = options.fade_out margin_left = (width * 0.05).ceil margin_right = (width * 0.05).ceil margin_top = (height * 0.05).ceil margin_bottom = (height * 0.05).ceil body_width = width - margin_left - margin_right body_height = height - margin_top - margin_bottom surface_class.new(output, width, height) do |surface| cr = Cairo::Context.new(surface) render_background(cr) layout = make_layout(cr, text, body_width, font_description) if fade_out setup_fade_out(cr, body_width) else cr.set_source_color(:black) end render_layout(cr, layout, margin_left, margin_top, body_height) cr.show_page end end def output(options, surface_class_name, suffix) if Cairo.const_defined?(surface_class_name) surface_class = Cairo.const_get(surface_class_name) render(options, "text2.#{suffix}", surface_class) else puts("#{surface_class_name} isn't supported.") end end options = parse options.text = ARGF.read output(options, "PSSurface", "ps") output(options, "PDFSurface", "pdf") output(options, "SVGSurface", "svg") rcairo-1.16.6/test/000077500000000000000000000000001370612400100140355ustar00rootroot00000000000000rcairo-1.16.6/test/fixture/000077500000000000000000000000001370612400100155235ustar00rootroot00000000000000rcairo-1.16.6/test/fixture/a.otf000066400000000000000000000030701370612400100164550ustar00rootroot00000000000000OTTO 0CFF 22DFFTM~GDEFOS/2Ugd `cmap PBhead LayerCount: 2 Fore SplineSet 764 597 m 1 750 571 l 0 749 565 749 559 749 553 c 0 749 543 750 534 750 525 c 0 752 490 761 454 780 425 c 0 818 367 l 0 830 321 l 0 834 217 l 0 804 151 l 0 792 147 794 143 782 143 c 0 750 143 704 164 704 203 c 0 696 249 l 0 694 345 l 0 706 417 l 0 650 363 l 0 638 355 625 339 618 329 c 0 601 305 571 298 554 277 c 0 522 244 467 242 448 197 c 0 426 154 395 132 352 121 c 0 341 121 327 117 320 117 c 0 263 117 204 177 176 229 c 0 166 248 156 265 148 285 c 0 133 325 125 365 125 407 c 0 125 417 125 427 126 437 c 0 126 441 126 444 126 448 c 0 126 611 317 727 469 727 c 0 471 727 472 727 474 727 c 0 532 724 591 717 648 699 c 0 669 692 692 682 710 667 c 0 746 631 l 0 764 597 l 1 EndSplineSet Validated: 1 EndChar EndChars EndSplineFont rcairo-1.16.6/test/helper.rb000066400000000000000000000020501370612400100156360ustar00rootroot00000000000000require "cairo" require "poppler" require "stringio" module Helper private def only_cairo_version(major, minor, micro=nil) unless Cairo.satisfied_version?(major, minor, micro) omit("Require cairo >= #{major}.#{minor}.#{micro}") end end def only_windows omit("Only for Windows platform") unless windows? end def only_not_windows omit("Only for not Windows platform") if windows? end def windows? /cygwin|mingw|mswin|bccwin/ === RUBY_PLATFORM end def quartz? Cairo::FontFace.quartz_supported? end def only_device(name) only_cairo_version(1, 10) unless Cairo::Device.supported?(name) omit("Only for #{name} device available") end end def only_surface(name) unless Cairo::Surface.supported?(name) omit("Only for #{name} device available") end end def only_pattern(name) unless Cairo::Pattern.supported?(name) omit("Only for #{name} device available") end end def fixture_path(*components) File.join(__dir__, "fixture", *components) end end rcairo-1.16.6/test/run-test.rb000077500000000000000000000010511370612400100161430ustar00rootroot00000000000000#!/usr/bin/env ruby source_dir = File.expand_path(File.join(__dir__, "..")) build_dir = File.expand_path(".") ext_dir = File.join(build_dir, "ext", "cairo") lib_dir = File.join(source_dir, "lib") test_dir = File.join(source_dir, "test") if system("which make >/dev/null 2>&1") Dir.chdir(build_dir) do if File.exist?("Makefile") system("make > /dev/null") or exit(1) end end end require "test-unit" $LOAD_PATH.unshift(ext_dir) $LOAD_PATH.unshift(lib_dir) require_relative "helper" exit(Test::Unit::AutoRunner.run(true, test_dir)) rcairo-1.16.6/test/test_color.rb000066400000000000000000000004511370612400100165370ustar00rootroot00000000000000require 'cairo' class ColorTest < Test::Unit::TestCase def test_rgb_to_hsv color = rgb(0.3, 0.5, 0.75) assert_equal(color, color.to_hsv.to_rgb) end private def rgb(r, g, b) Cairo::Color::RGB.new(r, g, b) end def hsv(h, s, v) Cairo::Color::HSV.new(h, s, v) end end rcairo-1.16.6/test/test_colors.rb000066400000000000000000011062451370612400100167330ustar00rootroot00000000000000class ColorsTest < Test::Unit::TestCase # Absolute Zero: #0048BA: (0, 72, 186) test("Absolute Zero") do assert_equal("\#%02X%02X%02XFF" % [0, 72, 186], Cairo::Color::ABSOLUTE_ZERO.to_s) end # Acid green: #B0BF1A: (176, 191, 26) test("Acid green") do assert_equal("\#%02X%02X%02XFF" % [176, 191, 26], Cairo::Color::ACID_GREEN.to_s) end # Aero: #7CB9E8: (124, 185, 232) test("Aero") do assert_equal("\#%02X%02X%02XFF" % [124, 185, 232], Cairo::Color::AERO.to_s) end # Aero blue: #C9FFE5: (201, 255, 229) test("Aero blue") do assert_equal("\#%02X%02X%02XFF" % [201, 255, 229], Cairo::Color::AERO_BLUE.to_s) end # African violet: #B284BE: (178, 132, 190) test("African violet") do assert_equal("\#%02X%02X%02XFF" % [178, 132, 190], Cairo::Color::AFRICAN_VIOLET.to_s) end # Alabama crimson: #AF002A: (175, 0, 42) test("Alabama crimson") do assert_equal("\#%02X%02X%02XFF" % [175, 0, 42], Cairo::Color::ALABAMA_CRIMSON.to_s) end # Alabaster: #F2F0E6: (242, 240, 230) test("Alabaster") do assert_equal("\#%02X%02X%02XFF" % [242, 240, 230], Cairo::Color::ALABASTER.to_s) end # Alice blue: #F0F8FF: (240, 248, 255) test("Alice blue") do assert_equal("\#%02X%02X%02XFF" % [240, 248, 255], Cairo::Color::ALICE_BLUE.to_s) end # Alien Armpit: #84DE02: (132, 222, 2) test("Alien Armpit") do assert_equal("\#%02X%02X%02XFF" % [132, 222, 2], Cairo::Color::ALIEN_ARMPIT.to_s) end # Alloy orange: #C46210: (196, 98, 16) test("Alloy orange") do assert_equal("\#%02X%02X%02XFF" % [196, 98, 16], Cairo::Color::ALLOY_ORANGE.to_s) end # Almond: #EFDECD: (239, 222, 205) test("Almond") do assert_equal("\#%02X%02X%02XFF" % [239, 222, 205], Cairo::Color::ALMOND.to_s) end # Amaranth: #E52B50: (229, 43, 80) test("Amaranth") do assert_equal("\#%02X%02X%02XFF" % [229, 43, 80], Cairo::Color::AMARANTH.to_s) end # Amaranth deep purple: #9F2B68: (159, 43, 104) test("Amaranth deep purple") do assert_equal("\#%02X%02X%02XFF" % [159, 43, 104], Cairo::Color::AMARANTH_DEEP_PURPLE.to_s) end # Amaranth pink: #F19CBB: (241, 156, 187) test("Amaranth pink") do assert_equal("\#%02X%02X%02XFF" % [241, 156, 187], Cairo::Color::AMARANTH_PINK.to_s) end # Amaranth purple: #AB274F: (171, 39, 79) test("Amaranth purple") do assert_equal("\#%02X%02X%02XFF" % [171, 39, 79], Cairo::Color::AMARANTH_PURPLE.to_s) end # Amaranth red: #D3212D: (211, 33, 45) test("Amaranth red") do assert_equal("\#%02X%02X%02XFF" % [211, 33, 45], Cairo::Color::AMARANTH_RED.to_s) end # Amazon: #3B7A57: (59, 122, 87) test("Amazon") do assert_equal("\#%02X%02X%02XFF" % [59, 122, 87], Cairo::Color::AMAZON.to_s) end # Amber: #FFBF00: (255, 191, 0) test("Amber") do assert_equal("\#%02X%02X%02XFF" % [255, 191, 0], Cairo::Color::AMBER.to_s) end # Amber (SAE/ECE): #FF7E00: (255, 126, 0) test("Amber (SAE/ECE)") do assert_equal("\#%02X%02X%02XFF" % [255, 126, 0], Cairo::Color::AMBER_SAE_ECE.to_s) end # Amethyst: #9966CC: (153, 102, 204) test("Amethyst") do assert_equal("\#%02X%02X%02XFF" % [153, 102, 204], Cairo::Color::AMETHYST.to_s) end # Android green: #A4C639: (164, 198, 57) test("Android green") do assert_equal("\#%02X%02X%02XFF" % [164, 198, 57], Cairo::Color::ANDROID_GREEN.to_s) end # Anti-flash white: #F2F3F4: (242, 243, 244) test("Anti-flash white") do assert_equal("\#%02X%02X%02XFF" % [242, 243, 244], Cairo::Color::ANTI_FLASH_WHITE.to_s) end # Antique brass: #CD9575: (205, 149, 117) test("Antique brass") do assert_equal("\#%02X%02X%02XFF" % [205, 149, 117], Cairo::Color::ANTIQUE_BRASS.to_s) end # Antique bronze: #665D1E: (102, 93, 30) test("Antique bronze") do assert_equal("\#%02X%02X%02XFF" % [102, 93, 30], Cairo::Color::ANTIQUE_BRONZE.to_s) end # Antique fuchsia: #915C83: (145, 92, 131) test("Antique fuchsia") do assert_equal("\#%02X%02X%02XFF" % [145, 92, 131], Cairo::Color::ANTIQUE_FUCHSIA.to_s) end # Antique ruby: #841B2D: (132, 27, 45) test("Antique ruby") do assert_equal("\#%02X%02X%02XFF" % [132, 27, 45], Cairo::Color::ANTIQUE_RUBY.to_s) end # Antique white: #FAEBD7: (250, 235, 215) test("Antique white") do assert_equal("\#%02X%02X%02XFF" % [250, 235, 215], Cairo::Color::ANTIQUE_WHITE.to_s) end # Ao (English): #008000: (0, 128, 0) test("Ao (English)") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 0], Cairo::Color::AO_ENGLISH.to_s) end # Apple: #66B447: (102, 180, 71) test("Apple") do assert_equal("\#%02X%02X%02XFF" % [102, 180, 71], Cairo::Color::APPLE.to_s) end # Apple green: #8DB600: (141, 182, 0) test("Apple green") do assert_equal("\#%02X%02X%02XFF" % [141, 182, 0], Cairo::Color::APPLE_GREEN.to_s) end # Apricot: #FBCEB1: (251, 206, 177) test("Apricot") do assert_equal("\#%02X%02X%02XFF" % [251, 206, 177], Cairo::Color::APRICOT.to_s) end # Aqua: #00FFFF: (0, 255, 255) test("Aqua") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 255], Cairo::Color::AQUA.to_s) end # Aquamarine: #7FFFD4: (127, 255, 212) test("Aquamarine") do assert_equal("\#%02X%02X%02XFF" % [127, 255, 212], Cairo::Color::AQUAMARINE.to_s) end # Arctic lime: #D0FF14: (208, 255, 20) test("Arctic lime") do assert_equal("\#%02X%02X%02XFF" % [208, 255, 20], Cairo::Color::ARCTIC_LIME.to_s) end # Army green: #4B5320: (75, 83, 32) test("Army green") do assert_equal("\#%02X%02X%02XFF" % [75, 83, 32], Cairo::Color::ARMY_GREEN.to_s) end # Artichoke: #8F9779: (143, 151, 121) test("Artichoke") do assert_equal("\#%02X%02X%02XFF" % [143, 151, 121], Cairo::Color::ARTICHOKE.to_s) end # Arylide yellow: #E9D66B: (233, 214, 107) test("Arylide yellow") do assert_equal("\#%02X%02X%02XFF" % [233, 214, 107], Cairo::Color::ARYLIDE_YELLOW.to_s) end # Ash grey: #B2BEB5: (178, 190, 181) test("Ash grey") do assert_equal("\#%02X%02X%02XFF" % [178, 190, 181], Cairo::Color::ASH_GREY.to_s) end # Asparagus: #87A96B: (135, 169, 107) test("Asparagus") do assert_equal("\#%02X%02X%02XFF" % [135, 169, 107], Cairo::Color::ASPARAGUS.to_s) end # Atomic tangerine: #FF9966: (255, 153, 102) test("Atomic tangerine") do assert_equal("\#%02X%02X%02XFF" % [255, 153, 102], Cairo::Color::ATOMIC_TANGERINE.to_s) end # Auburn: #A52A2A: (165, 42, 42) test("Auburn") do assert_equal("\#%02X%02X%02XFF" % [165, 42, 42], Cairo::Color::AUBURN.to_s) end # Aureolin: #FDEE00: (253, 238, 0) test("Aureolin") do assert_equal("\#%02X%02X%02XFF" % [253, 238, 0], Cairo::Color::AUREOLIN.to_s) end # AuroMetalSaurus: #6E7F80: (110, 127, 128) test("AuroMetalSaurus") do assert_equal("\#%02X%02X%02XFF" % [110, 127, 128], Cairo::Color::AUROMETALSAURUS.to_s) end # Avocado: #568203: (86, 130, 3) test("Avocado") do assert_equal("\#%02X%02X%02XFF" % [86, 130, 3], Cairo::Color::AVOCADO.to_s) end # Axolotl: #63775B: (99, 119, 91) test("Axolotl") do assert_equal("\#%02X%02X%02XFF" % [99, 119, 91], Cairo::Color::AXOLOTL.to_s) end # Azure: #007FFF: (0, 127, 255) test("Azure") do assert_equal("\#%02X%02X%02XFF" % [0, 127, 255], Cairo::Color::AZURE.to_s) end # Azure mist: #F0FFFF: (240, 255, 255) test("Azure mist") do assert_equal("\#%02X%02X%02XFF" % [240, 255, 255], Cairo::Color::AZURE_MIST.to_s) end # B'dazzled blue: #2E5894: (46, 88, 149) test("B'dazzled blue") do assert_equal("\#%02X%02X%02XFF" % [46, 88, 149], Cairo::Color::BDAZZLED_BLUE.to_s) end # Baby blue: #89CFF0: (137, 207, 240) test("Baby blue") do assert_equal("\#%02X%02X%02XFF" % [137, 207, 240], Cairo::Color::BABY_BLUE.to_s) end # Baby blue eyes: #A1CAF1: (161, 202, 241) test("Baby blue eyes") do assert_equal("\#%02X%02X%02XFF" % [161, 202, 241], Cairo::Color::BABY_BLUE_EYES.to_s) end # Baby pink: #F4C2C2: (244, 194, 194) test("Baby pink") do assert_equal("\#%02X%02X%02XFF" % [244, 194, 194], Cairo::Color::BABY_PINK.to_s) end # Baby powder: #FEFEFA: (254, 254, 250) test("Baby powder") do assert_equal("\#%02X%02X%02XFF" % [254, 254, 250], Cairo::Color::BABY_POWDER.to_s) end # Baker-Miller pink: #FF91AF: (255, 145, 175) test("Baker-Miller pink") do assert_equal("\#%02X%02X%02XFF" % [255, 145, 175], Cairo::Color::BAKER_MILLER_PINK.to_s) end # Ball blue: #21ABCD: (33, 171, 205) test("Ball blue") do assert_equal("\#%02X%02X%02XFF" % [33, 171, 205], Cairo::Color::BALL_BLUE.to_s) end # Banana Mania: #FAE7B5: (250, 231, 181) test("Banana Mania") do assert_equal("\#%02X%02X%02XFF" % [250, 231, 181], Cairo::Color::BANANA_MANIA.to_s) end # Banana yellow: #FFE135: (255, 225, 53) test("Banana yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 225, 53], Cairo::Color::BANANA_YELLOW.to_s) end # Bangladesh green: #006A4E: (0, 106, 78) test("Bangladesh green") do assert_equal("\#%02X%02X%02XFF" % [0, 106, 78], Cairo::Color::BANGLADESH_GREEN.to_s) end # Barbie pink: #E0218A: (224, 33, 138) test("Barbie pink") do assert_equal("\#%02X%02X%02XFF" % [224, 33, 138], Cairo::Color::BARBIE_PINK.to_s) end # Barn red: #7C0A02: (124, 10, 2) test("Barn red") do assert_equal("\#%02X%02X%02XFF" % [124, 10, 2], Cairo::Color::BARN_RED.to_s) end # Battery charged blue: #1DACD6: (29, 172, 214) test("Battery charged blue") do assert_equal("\#%02X%02X%02XFF" % [29, 172, 214], Cairo::Color::BATTERY_CHARGED_BLUE.to_s) end # Battleship grey: #848482: (132, 132, 130) test("Battleship grey") do assert_equal("\#%02X%02X%02XFF" % [132, 132, 130], Cairo::Color::BATTLESHIP_GREY.to_s) end # Bayside: #5FC9BF: (95, 201, 191) test("Bayside") do assert_equal("\#%02X%02X%02XFF" % [95, 201, 191], Cairo::Color::BAYSIDE.to_s) end # Bazaar: #98777B: (152, 119, 123) test("Bazaar") do assert_equal("\#%02X%02X%02XFF" % [152, 119, 123], Cairo::Color::BAZAAR.to_s) end # Beau blue: #BCD4E6: (188, 212, 230) test("Beau blue") do assert_equal("\#%02X%02X%02XFF" % [188, 212, 230], Cairo::Color::BEAU_BLUE.to_s) end # Begonia: #FA6E79: (250, 110, 121) test("Begonia") do assert_equal("\#%02X%02X%02XFF" % [250, 110, 121], Cairo::Color::BEGONIA.to_s) end # Beaver: #9F8170: (159, 129, 112) test("Beaver") do assert_equal("\#%02X%02X%02XFF" % [159, 129, 112], Cairo::Color::BEAVER.to_s) end # Beer: #F28E1C: (242, 142, 28) test("Beer") do assert_equal("\#%02X%02X%02XFF" % [242, 142, 28], Cairo::Color::BEER.to_s) end # Beige: #F5F5DC: (245, 245, 220) test("Beige") do assert_equal("\#%02X%02X%02XFF" % [245, 245, 220], Cairo::Color::BEIGE.to_s) end # Big dip o’ruby: #9C2542: (156, 37, 66) test("Big dip o\u2019ruby") do assert_equal("\#%02X%02X%02XFF" % [156, 37, 66], Cairo::Color::BIG_DIP_ORUBY.to_s) end # Big Foot Feet: #E88E5A: (232, 142, 90) test("Big Foot Feet") do assert_equal("\#%02X%02X%02XFF" % [232, 142, 90], Cairo::Color::BIG_FOOT_FEET.to_s) end # Bisque: #FFE4C4: (255, 228, 196) test("Bisque") do assert_equal("\#%02X%02X%02XFF" % [255, 228, 196], Cairo::Color::BISQUE.to_s) end # Bistre: #3D2B1F: (61, 43, 31) test("Bistre") do assert_equal("\#%02X%02X%02XFF" % [61, 43, 31], Cairo::Color::BISTRE.to_s) end # Bistre brown: #967117: (150, 113, 23) test("Bistre brown") do assert_equal("\#%02X%02X%02XFF" % [150, 113, 23], Cairo::Color::BISTRE_BROWN.to_s) end # Bitter lemon: #CAE00D: (202, 224, 13) test("Bitter lemon") do assert_equal("\#%02X%02X%02XFF" % [202, 224, 13], Cairo::Color::BITTER_LEMON.to_s) end # Bitter lime: #BFFF00: (191, 255, 0) test("Bitter lime") do assert_equal("\#%02X%02X%02XFF" % [191, 255, 0], Cairo::Color::BITTER_LIME.to_s) end # Bittersweet: #FE6F5E: (254, 111, 94) test("Bittersweet") do assert_equal("\#%02X%02X%02XFF" % [254, 111, 94], Cairo::Color::BITTERSWEET.to_s) end # Bittersweet shimmer: #BF4F51: (191, 79, 81) test("Bittersweet shimmer") do assert_equal("\#%02X%02X%02XFF" % [191, 79, 81], Cairo::Color::BITTERSWEET_SHIMMER.to_s) end # Black: #000000: (0, 0, 0) test("Black") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 0], Cairo::Color::BLACK.to_s) end # Black bean: #3D0C02: (61, 12, 2) test("Black bean") do assert_equal("\#%02X%02X%02XFF" % [61, 12, 2], Cairo::Color::BLACK_BEAN.to_s) end # Black chocolate: #1B1811: (27, 24, 17) test("Black chocolate") do assert_equal("\#%02X%02X%02XFF" % [27, 24, 17], Cairo::Color::BLACK_CHOCOLATE.to_s) end # Black coffee: #3B2F2F: (59, 47, 47) test("Black coffee") do assert_equal("\#%02X%02X%02XFF" % [59, 47, 47], Cairo::Color::BLACK_COFFEE.to_s) end # Black coral: #54626F: (84, 98, 111) test("Black coral") do assert_equal("\#%02X%02X%02XFF" % [84, 98, 111], Cairo::Color::BLACK_CORAL.to_s) end # Black leather jacket: #253529: (37, 53, 41) test("Black leather jacket") do assert_equal("\#%02X%02X%02XFF" % [37, 53, 41], Cairo::Color::BLACK_LEATHER_JACKET.to_s) end # Black olive: #3B3C36: (59, 60, 54) test("Black olive") do assert_equal("\#%02X%02X%02XFF" % [59, 60, 54], Cairo::Color::BLACK_OLIVE.to_s) end # Blackberry: #8F5973: (143, 89, 115) test("Blackberry") do assert_equal("\#%02X%02X%02XFF" % [143, 89, 115], Cairo::Color::BLACKBERRY.to_s) end # Black Shadows: #BFAFB2: (191, 175, 178) test("Black Shadows") do assert_equal("\#%02X%02X%02XFF" % [191, 175, 178], Cairo::Color::BLACK_SHADOWS.to_s) end # Blanched almond: #FFEBCD: (255, 235, 205) test("Blanched almond") do assert_equal("\#%02X%02X%02XFF" % [255, 235, 205], Cairo::Color::BLANCHED_ALMOND.to_s) end # Blast-off bronze: #A57164: (165, 113, 100) test("Blast-off bronze") do assert_equal("\#%02X%02X%02XFF" % [165, 113, 100], Cairo::Color::BLAST_OFF_BRONZE.to_s) end # Bleu de France: #318CE7: (49, 140, 231) test("Bleu de France") do assert_equal("\#%02X%02X%02XFF" % [49, 140, 231], Cairo::Color::BLEU_DE_FRANCE.to_s) end # Blizzard blue: #ACE5EE: (172, 229, 238) test("Blizzard blue") do assert_equal("\#%02X%02X%02XFF" % [172, 229, 238], Cairo::Color::BLIZZARD_BLUE.to_s) end # Blond: #FAF0BE: (250, 240, 190) test("Blond") do assert_equal("\#%02X%02X%02XFF" % [250, 240, 190], Cairo::Color::BLOND.to_s) end # Blood: #8A0303: (138, 3, 3) test("Blood") do assert_equal("\#%02X%02X%02XFF" % [138, 3, 3], Cairo::Color::BLOOD.to_s) end # Blood orange: #D1001C: (210, 0, 27) test("Blood orange") do assert_equal("\#%02X%02X%02XFF" % [210, 0, 27], Cairo::Color::BLOOD_ORANGE.to_s) end # Blood red: #660000: (102, 0, 0) test("Blood red") do assert_equal("\#%02X%02X%02XFF" % [102, 0, 0], Cairo::Color::BLOOD_RED.to_s) end # Blood (Animal): #A41313: (164, 19, 19) test("Blood (Animal)") do assert_equal("\#%02X%02X%02XFF" % [164, 19, 19], Cairo::Color::BLOOD_ANIMAL.to_s) end # Blood (organ): #630F0F: (99, 15, 15) test("Blood (organ)") do assert_equal("\#%02X%02X%02XFF" % [99, 15, 15], Cairo::Color::BLOOD_ORGAN.to_s) end # Blue: #0000FF: (0, 0, 255) test("Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 255], Cairo::Color::BLUE.to_s) end # Blue (Crayola): #1F75FE: (31, 117, 254) test("Blue (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [31, 117, 254], Cairo::Color::BLUE_CRAYOLA.to_s) end # Blue (Munsell): #0093AF: (0, 147, 175) test("Blue (Munsell)") do assert_equal("\#%02X%02X%02XFF" % [0, 147, 175], Cairo::Color::BLUE_MUNSELL.to_s) end # Blue (NCS): #0087BD: (0, 135, 189) test("Blue (NCS)") do assert_equal("\#%02X%02X%02XFF" % [0, 135, 189], Cairo::Color::BLUE_NCS.to_s) end # Blue (Pantone): #0018A8: (0, 24, 168) test("Blue (Pantone)") do assert_equal("\#%02X%02X%02XFF" % [0, 24, 168], Cairo::Color::BLUE_PANTONE.to_s) end # Blue (pigment): #333399: (51, 51, 153) test("Blue (pigment)") do assert_equal("\#%02X%02X%02XFF" % [51, 51, 153], Cairo::Color::BLUE_PIGMENT.to_s) end # Blue (RYB): #0247FE: (2, 71, 254) test("Blue (RYB)") do assert_equal("\#%02X%02X%02XFF" % [2, 71, 254], Cairo::Color::BLUE_RYB.to_s) end # Blue bell: #A2A2D0: (162, 162, 208) test("Blue bell") do assert_equal("\#%02X%02X%02XFF" % [162, 162, 208], Cairo::Color::BLUE_BELL.to_s) end # Blue bolt: #00B9FB: (0, 185, 251) test("Blue bolt") do assert_equal("\#%02X%02X%02XFF" % [0, 185, 251], Cairo::Color::BLUE_BOLT.to_s) end # Blue cola: #0088DC: (0, 136, 220) test("Blue cola") do assert_equal("\#%02X%02X%02XFF" % [0, 136, 220], Cairo::Color::BLUE_COLA.to_s) end # Blue-gray: #6699CC: (102, 153, 204) test("Blue-gray") do assert_equal("\#%02X%02X%02XFF" % [102, 153, 204], Cairo::Color::BLUE_GRAY.to_s) end # Blue-green: #0D98BA: (13, 152, 186) test("Blue-green") do assert_equal("\#%02X%02X%02XFF" % [13, 152, 186], Cairo::Color::BLUE_GREEN.to_s) end # Blue-green (color wheel): #064E40: (6, 78, 64) test("Blue-green (color wheel)") do assert_equal("\#%02X%02X%02XFF" % [6, 78, 64], Cairo::Color::BLUE_GREEN_COLOR_WHEEL.to_s) end # Blue jeans: #5DADEC: (93, 173, 236) test("Blue jeans") do assert_equal("\#%02X%02X%02XFF" % [93, 173, 236], Cairo::Color::BLUE_JEANS.to_s) end # Blue lagoon: #ACE5EE: (172, 229, 238) test("Blue lagoon") do assert_equal("\#%02X%02X%02XFF" % [172, 229, 238], Cairo::Color::BLUE_LAGOON.to_s) end # Blue-magenta violet: #553592: (85, 53, 146) test("Blue-magenta violet") do assert_equal("\#%02X%02X%02XFF" % [85, 53, 146], Cairo::Color::BLUE_MAGENTA_VIOLET.to_s) end # Blue raspberry: #0CBFE9: (12, 191, 233) test("Blue raspberry") do assert_equal("\#%02X%02X%02XFF" % [12, 191, 233], Cairo::Color::BLUE_RASPBERRY.to_s) end # Blue sapphire: #126180: (18, 97, 128) test("Blue sapphire") do assert_equal("\#%02X%02X%02XFF" % [18, 97, 128], Cairo::Color::BLUE_SAPPHIRE.to_s) end # Blue-violet: #8A2BE2: (138, 43, 226) test("Blue-violet") do assert_equal("\#%02X%02X%02XFF" % [138, 43, 226], Cairo::Color::BLUE_VIOLET.to_s) end # Blue-violet (Crayola): #7366BD: (115, 102, 189) test("Blue-violet (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [115, 102, 189], Cairo::Color::BLUE_VIOLET_CRAYOLA.to_s) end # Blue-violet (color wheel): #4D1A7F: (77, 26, 127) test("Blue-violet (color wheel)") do assert_equal("\#%02X%02X%02XFF" % [77, 26, 127], Cairo::Color::BLUE_VIOLET_COLOR_WHEEL.to_s) end # Blue yonder: #5072A7: (80, 114, 167) test("Blue yonder") do assert_equal("\#%02X%02X%02XFF" % [80, 114, 167], Cairo::Color::BLUE_YONDER.to_s) end # Blueberry: #4F86F7: (79, 134, 247) test("Blueberry") do assert_equal("\#%02X%02X%02XFF" % [79, 134, 247], Cairo::Color::BLUEBERRY.to_s) end # Bluebonnet: #1C1CF0: (28, 28, 240) test("Bluebonnet") do assert_equal("\#%02X%02X%02XFF" % [28, 28, 240], Cairo::Color::BLUEBONNET.to_s) end # Blush: #DE5D83: (222, 93, 131) test("Blush") do assert_equal("\#%02X%02X%02XFF" % [222, 93, 131], Cairo::Color::BLUSH.to_s) end # Bole: #79443B: (121, 68, 59) test("Bole") do assert_equal("\#%02X%02X%02XFF" % [121, 68, 59], Cairo::Color::BOLE.to_s) end # Bondi blue: #0095B6: (0, 149, 182) test("Bondi blue") do assert_equal("\#%02X%02X%02XFF" % [0, 149, 182], Cairo::Color::BONDI_BLUE.to_s) end # Bone: #E3DAC9: (227, 218, 201) test("Bone") do assert_equal("\#%02X%02X%02XFF" % [227, 218, 201], Cairo::Color::BONE.to_s) end # Booger Buster: #DDE26A: (221, 226, 106) test("Booger Buster") do assert_equal("\#%02X%02X%02XFF" % [221, 226, 106], Cairo::Color::BOOGER_BUSTER.to_s) end # Boston University red: #CC0000: (204, 0, 0) test("Boston University red") do assert_equal("\#%02X%02X%02XFF" % [204, 0, 0], Cairo::Color::BOSTON_UNIVERSITY_RED.to_s) end # Bottle green: #006A4E: (0, 106, 78) test("Bottle green") do assert_equal("\#%02X%02X%02XFF" % [0, 106, 78], Cairo::Color::BOTTLE_GREEN.to_s) end # Boysenberry: #873260: (135, 50, 96) test("Boysenberry") do assert_equal("\#%02X%02X%02XFF" % [135, 50, 96], Cairo::Color::BOYSENBERRY.to_s) end # Brandeis blue: #0070FF: (0, 112, 255) test("Brandeis blue") do assert_equal("\#%02X%02X%02XFF" % [0, 112, 255], Cairo::Color::BRANDEIS_BLUE.to_s) end # Brandy: #87413F: (135, 65, 63) test("Brandy") do assert_equal("\#%02X%02X%02XFF" % [135, 65, 63], Cairo::Color::BRANDY.to_s) end # Brave orange: #FF631C: (255, 99, 28) test("Brave orange") do assert_equal("\#%02X%02X%02XFF" % [255, 99, 28], Cairo::Color::BRAVE_ORANGE.to_s) end # Brick red: #CB4154: (203, 65, 84) test("Brick red") do assert_equal("\#%02X%02X%02XFF" % [203, 65, 84], Cairo::Color::BRICK_RED.to_s) end # Bright cerulean: #1DACD6: (29, 172, 214) test("Bright cerulean") do assert_equal("\#%02X%02X%02XFF" % [29, 172, 214], Cairo::Color::BRIGHT_CERULEAN.to_s) end # Bright gray: #EBECF0: (235, 236, 240) test("Bright gray") do assert_equal("\#%02X%02X%02XFF" % [235, 236, 240], Cairo::Color::BRIGHT_GRAY.to_s) end # Bright green: #66FF00: (102, 255, 0) test("Bright green") do assert_equal("\#%02X%02X%02XFF" % [102, 255, 0], Cairo::Color::BRIGHT_GREEN.to_s) end # Briquette: #E0475C: (224, 71, 92) test("Briquette") do assert_equal("\#%02X%02X%02XFF" % [224, 71, 92], Cairo::Color::BRIQUETTE.to_s) end # Bright lavender: #BF94E4: (191, 148, 228) test("Bright lavender") do assert_equal("\#%02X%02X%02XFF" % [191, 148, 228], Cairo::Color::BRIGHT_LAVENDER.to_s) end # Bright lilac: #D891EF: (216, 145, 239) test("Bright lilac") do assert_equal("\#%02X%02X%02XFF" % [216, 145, 239], Cairo::Color::BRIGHT_LILAC.to_s) end # Bright maroon: #C32148: (195, 33, 72) test("Bright maroon") do assert_equal("\#%02X%02X%02XFF" % [195, 33, 72], Cairo::Color::BRIGHT_MAROON.to_s) end # Bright navy blue: #1974D2: (25, 116, 210) test("Bright navy blue") do assert_equal("\#%02X%02X%02XFF" % [25, 116, 210], Cairo::Color::BRIGHT_NAVY_BLUE.to_s) end # Bright pink: #FF007F: (255, 0, 127) test("Bright pink") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 127], Cairo::Color::BRIGHT_PINK.to_s) end # Bright turquoise: #08E8DE: (8, 232, 222) test("Bright turquoise") do assert_equal("\#%02X%02X%02XFF" % [8, 232, 222], Cairo::Color::BRIGHT_TURQUOISE.to_s) end # Bright ube: #D19FE8: (209, 159, 232) test("Bright ube") do assert_equal("\#%02X%02X%02XFF" % [209, 159, 232], Cairo::Color::BRIGHT_UBE.to_s) end # Bright yellow (Crayola): #FFAA1D: (255, 170, 29) test("Bright yellow (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 170, 29], Cairo::Color::BRIGHT_YELLOW_CRAYOLA.to_s) end # Brilliant azure: #3399FF: (51, 153, 255) test("Brilliant azure") do assert_equal("\#%02X%02X%02XFF" % [51, 153, 255], Cairo::Color::BRILLIANT_AZURE.to_s) end # Brilliant lavender: #F4BBFF: (244, 187, 255) test("Brilliant lavender") do assert_equal("\#%02X%02X%02XFF" % [244, 187, 255], Cairo::Color::BRILLIANT_LAVENDER.to_s) end # Brilliant rose: #FF55A3: (255, 85, 163) test("Brilliant rose") do assert_equal("\#%02X%02X%02XFF" % [255, 85, 163], Cairo::Color::BRILLIANT_ROSE.to_s) end # Brink pink: #FB607F: (251, 96, 127) test("Brink pink") do assert_equal("\#%02X%02X%02XFF" % [251, 96, 127], Cairo::Color::BRINK_PINK.to_s) end # British racing green: #004225: (0, 66, 37) test("British racing green") do assert_equal("\#%02X%02X%02XFF" % [0, 66, 37], Cairo::Color::BRITISH_RACING_GREEN.to_s) end # Bronze: #88540B: (136, 84, 11) test("Bronze") do assert_equal("\#%02X%02X%02XFF" % [136, 84, 11], Cairo::Color::BRONZE.to_s) end # Bronze (metallic): #B08D57: (176, 140, 86) test("Bronze (metallic)") do assert_equal("\#%02X%02X%02XFF" % [176, 140, 86], Cairo::Color::BRONZE_METALLIC.to_s) end # Bronze yellow: #737000: (115, 112, 0) test("Bronze yellow") do assert_equal("\#%02X%02X%02XFF" % [115, 112, 0], Cairo::Color::BRONZE_YELLOW.to_s) end # Brown: #993300: (153, 51, 0) test("Brown") do assert_equal("\#%02X%02X%02XFF" % [153, 51, 0], Cairo::Color::BROWN.to_s) end # Brown (Crayola): #AF593E: (175, 89, 62) test("Brown (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [175, 89, 62], Cairo::Color::BROWN_CRAYOLA.to_s) end # Brown (traditional): #964B00: (150, 75, 0) test("Brown (traditional)") do assert_equal("\#%02X%02X%02XFF" % [150, 75, 0], Cairo::Color::BROWN_TRADITIONAL.to_s) end # Brown (web): #A52A2A: (165, 42, 42) test("Brown (web)") do assert_equal("\#%02X%02X%02XFF" % [165, 42, 42], Cairo::Color::BROWN_WEB.to_s) end # Brown-nose: #6B4423: (107, 68, 35) test("Brown-nose") do assert_equal("\#%02X%02X%02XFF" % [107, 68, 35], Cairo::Color::BROWN_NOSE.to_s) end # Brown sugar: #AF6E4D: (175, 110, 77) test("Brown sugar") do assert_equal("\#%02X%02X%02XFF" % [175, 110, 77], Cairo::Color::BROWN_SUGAR.to_s) end # Brunswick green: #1B4D3E: (27, 77, 62) test("Brunswick green") do assert_equal("\#%02X%02X%02XFF" % [27, 77, 62], Cairo::Color::BRUNSWICK_GREEN.to_s) end # Bubble gum: #FFC1CC: (255, 193, 204) test("Bubble gum") do assert_equal("\#%02X%02X%02XFF" % [255, 193, 204], Cairo::Color::BUBBLE_GUM.to_s) end # Bubbles: #E7FEFF: (231, 254, 255) test("Bubbles") do assert_equal("\#%02X%02X%02XFF" % [231, 254, 255], Cairo::Color::BUBBLES.to_s) end # Bud green: #7BB661: (123, 182, 97) test("Bud green") do assert_equal("\#%02X%02X%02XFF" % [123, 182, 97], Cairo::Color::BUD_GREEN.to_s) end # Buff: #F0DC82: (240, 220, 130) test("Buff") do assert_equal("\#%02X%02X%02XFF" % [240, 220, 130], Cairo::Color::BUFF.to_s) end # Bulgarian rose: #480607: (72, 6, 7) test("Bulgarian rose") do assert_equal("\#%02X%02X%02XFF" % [72, 6, 7], Cairo::Color::BULGARIAN_ROSE.to_s) end # Burgundy: #800020: (128, 0, 32) test("Burgundy") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 32], Cairo::Color::BURGUNDY.to_s) end # Burlywood: #DEB887: (222, 184, 135) test("Burlywood") do assert_equal("\#%02X%02X%02XFF" % [222, 184, 135], Cairo::Color::BURLYWOOD.to_s) end # Burnished brown: #A17A74: (161, 122, 116) test("Burnished brown") do assert_equal("\#%02X%02X%02XFF" % [161, 122, 116], Cairo::Color::BURNISHED_BROWN.to_s) end # Burnt orange: #CC5500: (204, 85, 0) test("Burnt orange") do assert_equal("\#%02X%02X%02XFF" % [204, 85, 0], Cairo::Color::BURNT_ORANGE.to_s) end # Burnt sienna: #E97451: (233, 116, 81) test("Burnt sienna") do assert_equal("\#%02X%02X%02XFF" % [233, 116, 81], Cairo::Color::BURNT_SIENNA.to_s) end # Burnt umber: #8A3324: (138, 51, 36) test("Burnt umber") do assert_equal("\#%02X%02X%02XFF" % [138, 51, 36], Cairo::Color::BURNT_UMBER.to_s) end # Button blue: #24A0ED: (36, 160, 237) test("Button blue") do assert_equal("\#%02X%02X%02XFF" % [36, 160, 237], Cairo::Color::BUTTON_BLUE.to_s) end # Byzantine: #BD33A4: (189, 51, 164) test("Byzantine") do assert_equal("\#%02X%02X%02XFF" % [189, 51, 164], Cairo::Color::BYZANTINE.to_s) end # Byzantium: #702963: (112, 41, 99) test("Byzantium") do assert_equal("\#%02X%02X%02XFF" % [112, 41, 99], Cairo::Color::BYZANTIUM.to_s) end # Cadet: #536872: (83, 104, 114) test("Cadet") do assert_equal("\#%02X%02X%02XFF" % [83, 104, 114], Cairo::Color::CADET.to_s) end # Cadet blue: #5F9EA0: (95, 158, 160) test("Cadet blue") do assert_equal("\#%02X%02X%02XFF" % [95, 158, 160], Cairo::Color::CADET_BLUE.to_s) end # Cadet blue (Crayola): #A9B2C3: (169, 178, 195) test("Cadet blue (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [169, 178, 195], Cairo::Color::CADET_BLUE_CRAYOLA.to_s) end # Cadet grey: #91A3B0: (145, 163, 176) test("Cadet grey") do assert_equal("\#%02X%02X%02XFF" % [145, 163, 176], Cairo::Color::CADET_GREY.to_s) end # Cadmium blue: #0A1195: (10, 17, 146) test("Cadmium blue") do assert_equal("\#%02X%02X%02XFF" % [10, 17, 146], Cairo::Color::CADMIUM_BLUE.to_s) end # Cadmium green: #006B3C: (0, 107, 60) test("Cadmium green") do assert_equal("\#%02X%02X%02XFF" % [0, 107, 60], Cairo::Color::CADMIUM_GREEN.to_s) end # Cadmium orange: #ED872D: (237, 135, 45) test("Cadmium orange") do assert_equal("\#%02X%02X%02XFF" % [237, 135, 45], Cairo::Color::CADMIUM_ORANGE.to_s) end # Cadmium purple: #B60C26: (182, 12, 38) test("Cadmium purple") do assert_equal("\#%02X%02X%02XFF" % [182, 12, 38], Cairo::Color::CADMIUM_PURPLE.to_s) end # Cadmium red: #E30022: (227, 0, 34) test("Cadmium red") do assert_equal("\#%02X%02X%02XFF" % [227, 0, 34], Cairo::Color::CADMIUM_RED.to_s) end # Cadmium yellow: #FFF600: (255, 246, 0) test("Cadmium yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 246, 0], Cairo::Color::CADMIUM_YELLOW.to_s) end # Cadmium violet: #7F3E98: (127, 62, 152) test("Cadmium violet") do assert_equal("\#%02X%02X%02XFF" % [127, 62, 152], Cairo::Color::CADMIUM_VIOLET.to_s) end # Café au lait: #A67B5B: (166, 123, 91) test("Caf\u00E9 au lait") do assert_equal("\#%02X%02X%02XFF" % [166, 123, 91], Cairo::Color::CAFE_AU_LAIT.to_s) end # Café noir: #4B3621: (75, 54, 33) test("Caf\u00E9 noir") do assert_equal("\#%02X%02X%02XFF" % [75, 54, 33], Cairo::Color::CAFE_NOIR.to_s) end # Cal Poly Pomona green: #1E4D2B: (30, 77, 43) test("Cal Poly Pomona green") do assert_equal("\#%02X%02X%02XFF" % [30, 77, 43], Cairo::Color::CAL_POLY_POMONA_GREEN.to_s) end # Calamansi: #FCFFA4: (252, 255, 164) test("Calamansi") do assert_equal("\#%02X%02X%02XFF" % [252, 255, 164], Cairo::Color::CALAMANSI.to_s) end # Cambridge blue: #A3C1AD: (163, 193, 173) test("Cambridge blue") do assert_equal("\#%02X%02X%02XFF" % [163, 193, 173], Cairo::Color::CAMBRIDGE_BLUE.to_s) end # Camel: #C19A6B: (193, 154, 107) test("Camel") do assert_equal("\#%02X%02X%02XFF" % [193, 154, 107], Cairo::Color::CAMEL.to_s) end # Cameo pink: #EFBBCC: (239, 187, 204) test("Cameo pink") do assert_equal("\#%02X%02X%02XFF" % [239, 187, 204], Cairo::Color::CAMEO_PINK.to_s) end # Camouflage green: #78866B: (120, 134, 107) test("Camouflage green") do assert_equal("\#%02X%02X%02XFF" % [120, 134, 107], Cairo::Color::CAMOUFLAGE_GREEN.to_s) end # Canary: #FFFF99: (255, 255, 153) test("Canary") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 153], Cairo::Color::CANARY.to_s) end # Canary yellow: #FFEF00: (255, 239, 0) test("Canary yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 239, 0], Cairo::Color::CANARY_YELLOW.to_s) end # Candy apple red: #FF0800: (255, 8, 0) test("Candy apple red") do assert_equal("\#%02X%02X%02XFF" % [255, 8, 0], Cairo::Color::CANDY_APPLE_RED.to_s) end # Candy pink: #E4717A: (228, 113, 122) test("Candy pink") do assert_equal("\#%02X%02X%02XFF" % [228, 113, 122], Cairo::Color::CANDY_PINK.to_s) end # Capri: #00BFFF: (0, 191, 255) test("Capri") do assert_equal("\#%02X%02X%02XFF" % [0, 191, 255], Cairo::Color::CAPRI.to_s) end # Caput mortuum: #592720: (89, 39, 32) test("Caput mortuum") do assert_equal("\#%02X%02X%02XFF" % [89, 39, 32], Cairo::Color::CAPUT_MORTUUM.to_s) end # Caramel: #FFD59A: (255, 213, 154) test("Caramel") do assert_equal("\#%02X%02X%02XFF" % [255, 213, 154], Cairo::Color::CARAMEL.to_s) end # Cardinal: #C41E3A: (196, 30, 58) test("Cardinal") do assert_equal("\#%02X%02X%02XFF" % [196, 30, 58], Cairo::Color::CARDINAL.to_s) end # Caribbean green: #00CC99: (0, 204, 153) test("Caribbean green") do assert_equal("\#%02X%02X%02XFF" % [0, 204, 153], Cairo::Color::CARIBBEAN_GREEN.to_s) end # Carmine: #960018: (150, 0, 24) test("Carmine") do assert_equal("\#%02X%02X%02XFF" % [150, 0, 24], Cairo::Color::CARMINE.to_s) end # Rich Carmine: #D70040: (215, 0, 64) test("Rich Carmine") do assert_equal("\#%02X%02X%02XFF" % [215, 0, 64], Cairo::Color::RICH_CARMINE.to_s) end # Carmine pink: #EB4C42: (235, 76, 66) test("Carmine pink") do assert_equal("\#%02X%02X%02XFF" % [235, 76, 66], Cairo::Color::CARMINE_PINK.to_s) end # Carmine red: #FF0038: (255, 0, 56) test("Carmine red") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 56], Cairo::Color::CARMINE_RED.to_s) end # Carnation pink: #FFA6C9: (255, 166, 201) test("Carnation pink") do assert_equal("\#%02X%02X%02XFF" % [255, 166, 201], Cairo::Color::CARNATION_PINK.to_s) end # Carnelian: #B31B1B: (179, 27, 27) test("Carnelian") do assert_equal("\#%02X%02X%02XFF" % [179, 27, 27], Cairo::Color::CARNELIAN.to_s) end # Carolina blue: #56A0D3: (86, 160, 211) test("Carolina blue") do assert_equal("\#%02X%02X%02XFF" % [86, 160, 211], Cairo::Color::CAROLINA_BLUE.to_s) end # Carrot orange: #ED9121: (237, 145, 33) test("Carrot orange") do assert_equal("\#%02X%02X%02XFF" % [237, 145, 33], Cairo::Color::CARROT_ORANGE.to_s) end # Castleton green: #00563F: (0, 86, 63) test("Castleton green") do assert_equal("\#%02X%02X%02XFF" % [0, 86, 63], Cairo::Color::CASTLETON_GREEN.to_s) end # Catalina blue: #062A78: (6, 42, 120) test("Catalina blue") do assert_equal("\#%02X%02X%02XFF" % [6, 42, 120], Cairo::Color::CATALINA_BLUE.to_s) end # Catawba: #703642: (112, 54, 66) test("Catawba") do assert_equal("\#%02X%02X%02XFF" % [112, 54, 66], Cairo::Color::CATAWBA.to_s) end # Cedar Chest: #C95A49: (201, 90, 73) test("Cedar Chest") do assert_equal("\#%02X%02X%02XFF" % [201, 90, 73], Cairo::Color::CEDAR_CHEST.to_s) end # Ceil: #92A1CF: (146, 161, 207) test("Ceil") do assert_equal("\#%02X%02X%02XFF" % [146, 161, 207], Cairo::Color::CEIL.to_s) end # Celadon: #ACE1AF: (172, 225, 175) test("Celadon") do assert_equal("\#%02X%02X%02XFF" % [172, 225, 175], Cairo::Color::CELADON.to_s) end # Celadon blue: #007BA7: (0, 123, 167) test("Celadon blue") do assert_equal("\#%02X%02X%02XFF" % [0, 123, 167], Cairo::Color::CELADON_BLUE.to_s) end # Celadon green: #2F847C: (47, 132, 124) test("Celadon green") do assert_equal("\#%02X%02X%02XFF" % [47, 132, 124], Cairo::Color::CELADON_GREEN.to_s) end # Celeste: #B2FFFF: (178, 255, 255) test("Celeste") do assert_equal("\#%02X%02X%02XFF" % [178, 255, 255], Cairo::Color::CELESTE.to_s) end # Celestial blue: #4997D0: (73, 151, 208) test("Celestial blue") do assert_equal("\#%02X%02X%02XFF" % [73, 151, 208], Cairo::Color::CELESTIAL_BLUE.to_s) end # Celtic blue: #246BCE: (36, 107, 206) test("Celtic blue") do assert_equal("\#%02X%02X%02XFF" % [36, 107, 206], Cairo::Color::CELTIC_BLUE.to_s) end # Cerise: #DE3163: (222, 49, 99) test("Cerise") do assert_equal("\#%02X%02X%02XFF" % [222, 49, 99], Cairo::Color::CERISE.to_s) end # Cerise pink: #EC3B83: (236, 59, 131) test("Cerise pink") do assert_equal("\#%02X%02X%02XFF" % [236, 59, 131], Cairo::Color::CERISE_PINK.to_s) end # Cerulean: #007BA7: (0, 123, 167) test("Cerulean") do assert_equal("\#%02X%02X%02XFF" % [0, 123, 167], Cairo::Color::CERULEAN.to_s) end # Cerulean blue: #2A52BE: (42, 82, 190) test("Cerulean blue") do assert_equal("\#%02X%02X%02XFF" % [42, 82, 190], Cairo::Color::CERULEAN_BLUE.to_s) end # Cetacean blue: #001440: (0, 20, 64) test("Cetacean blue") do assert_equal("\#%02X%02X%02XFF" % [0, 20, 64], Cairo::Color::CETACEAN_BLUE.to_s) end # Cerulean frost: #6D9BC3: (109, 155, 195) test("Cerulean frost") do assert_equal("\#%02X%02X%02XFF" % [109, 155, 195], Cairo::Color::CERULEAN_FROST.to_s) end # Cerulean (Crayola): #1DACD6: (29, 172, 214) test("Cerulean (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [29, 172, 214], Cairo::Color::CERULEAN_CRAYOLA.to_s) end # CG blue: #007AA5: (0, 122, 165) test("CG blue") do assert_equal("\#%02X%02X%02XFF" % [0, 122, 165], Cairo::Color::CG_BLUE.to_s) end # CG Red: #E03C31: (224, 60, 49) test("CG Red") do assert_equal("\#%02X%02X%02XFF" % [224, 60, 49], Cairo::Color::CG_RED.to_s) end # Chambray: #ADBFC8: (173, 191, 200) test("Chambray") do assert_equal("\#%02X%02X%02XFF" % [173, 191, 200], Cairo::Color::CHAMBRAY.to_s) end # Chamoisee: #A0785A: (160, 120, 90) test("Chamoisee") do assert_equal("\#%02X%02X%02XFF" % [160, 120, 90], Cairo::Color::CHAMOISEE.to_s) end # Champagne: #F7E7CE: (247, 231, 206) test("Champagne") do assert_equal("\#%02X%02X%02XFF" % [247, 231, 206], Cairo::Color::CHAMPAGNE.to_s) end # Champagne pink: #F1DDCF: (241, 221, 207) test("Champagne pink") do assert_equal("\#%02X%02X%02XFF" % [241, 221, 207], Cairo::Color::CHAMPAGNE_PINK.to_s) end # Charcoal: #36454F: (54, 69, 79) test("Charcoal") do assert_equal("\#%02X%02X%02XFF" % [54, 69, 79], Cairo::Color::CHARCOAL.to_s) end # Charleston green: #232B2B: (35, 43, 43) test("Charleston green") do assert_equal("\#%02X%02X%02XFF" % [35, 43, 43], Cairo::Color::CHARLESTON_GREEN.to_s) end # Charm: #D0748B: (208, 116, 139) test("Charm") do assert_equal("\#%02X%02X%02XFF" % [208, 116, 139], Cairo::Color::CHARM.to_s) end # Charm pink: #E68FAC: (230, 143, 172) test("Charm pink") do assert_equal("\#%02X%02X%02XFF" % [230, 143, 172], Cairo::Color::CHARM_PINK.to_s) end # Chartreuse (traditional): #DFFF00: (223, 255, 0) test("Chartreuse (traditional)") do assert_equal("\#%02X%02X%02XFF" % [223, 255, 0], Cairo::Color::CHARTREUSE_TRADITIONAL.to_s) end # Chartreuse (web): #7FFF00: (127, 255, 0) test("Chartreuse (web)") do assert_equal("\#%02X%02X%02XFF" % [127, 255, 0], Cairo::Color::CHARTREUSE_WEB.to_s) end # Cheese: #FFA600: (255, 166, 0) test("Cheese") do assert_equal("\#%02X%02X%02XFF" % [255, 166, 0], Cairo::Color::CHEESE.to_s) end # Cherry: #DE3163: (222, 49, 99) test("Cherry") do assert_equal("\#%02X%02X%02XFF" % [222, 49, 99], Cairo::Color::CHERRY.to_s) end # Cherry blossom pink: #FFB7C5: (255, 183, 197) test("Cherry blossom pink") do assert_equal("\#%02X%02X%02XFF" % [255, 183, 197], Cairo::Color::CHERRY_BLOSSOM_PINK.to_s) end # Chestnut: #954535: (149, 69, 53) test("Chestnut") do assert_equal("\#%02X%02X%02XFF" % [149, 69, 53], Cairo::Color::CHESTNUT.to_s) end # China pink: #DE6FA1: (222, 111, 161) test("China pink") do assert_equal("\#%02X%02X%02XFF" % [222, 111, 161], Cairo::Color::CHINA_PINK.to_s) end # China rose: #A8516E: (168, 81, 110) test("China rose") do assert_equal("\#%02X%02X%02XFF" % [168, 81, 110], Cairo::Color::CHINA_ROSE.to_s) end # Chinese black: #141414: (20, 20, 20) test("Chinese black") do assert_equal("\#%02X%02X%02XFF" % [20, 20, 20], Cairo::Color::CHINESE_BLACK.to_s) end # Chinese blue: #365194: (54, 81, 148) test("Chinese blue") do assert_equal("\#%02X%02X%02XFF" % [54, 81, 148], Cairo::Color::CHINESE_BLUE.to_s) end # Chinese bronze: #CD8032: (205, 128, 50) test("Chinese bronze") do assert_equal("\#%02X%02X%02XFF" % [205, 128, 50], Cairo::Color::CHINESE_BRONZE.to_s) end # Chinese brown: #AB381F: (170, 56, 30) test("Chinese brown") do assert_equal("\#%02X%02X%02XFF" % [170, 56, 30], Cairo::Color::CHINESE_BROWN.to_s) end # Chinese green: #D0DB61: (208, 219, 97) test("Chinese green") do assert_equal("\#%02X%02X%02XFF" % [208, 219, 97], Cairo::Color::CHINESE_GREEN.to_s) end # Chinese gold: #CC9900: (204, 153, 0) test("Chinese gold") do assert_equal("\#%02X%02X%02XFF" % [204, 153, 0], Cairo::Color::CHINESE_GOLD.to_s) end # Chinese orange: #F37042: (243, 112, 66) test("Chinese orange") do assert_equal("\#%02X%02X%02XFF" % [243, 112, 66], Cairo::Color::CHINESE_ORANGE.to_s) end # Chinese pink: #DE70A1: (222, 112, 161) test("Chinese pink") do assert_equal("\#%02X%02X%02XFF" % [222, 112, 161], Cairo::Color::CHINESE_PINK.to_s) end # Chinese purple: #720B98: (114, 11, 152) test("Chinese purple") do assert_equal("\#%02X%02X%02XFF" % [114, 11, 152], Cairo::Color::CHINESE_PURPLE.to_s) end # Chinese red: #CD071E: (205, 7, 30) test("Chinese red") do assert_equal("\#%02X%02X%02XFF" % [205, 7, 30], Cairo::Color::CHINESE_RED.to_s) end # Chinese silver: #CCCCCC: (204, 204, 204) test("Chinese silver") do assert_equal("\#%02X%02X%02XFF" % [204, 204, 204], Cairo::Color::CHINESE_SILVER.to_s) end # Chinese violet: #856088: (133, 96, 136) test("Chinese violet") do assert_equal("\#%02X%02X%02XFF" % [133, 96, 136], Cairo::Color::CHINESE_VIOLET.to_s) end # Chinese white: #E2E5DE: (226, 229, 222) test("Chinese white") do assert_equal("\#%02X%02X%02XFF" % [226, 229, 222], Cairo::Color::CHINESE_WHITE.to_s) end # Chinese yellow: #FFB200: (255, 178, 0) test("Chinese yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 178, 0], Cairo::Color::CHINESE_YELLOW.to_s) end # Chlorophyll green: #4AFF00: (74, 255, 0) test("Chlorophyll green") do assert_equal("\#%02X%02X%02XFF" % [74, 255, 0], Cairo::Color::CHLOROPHYLL_GREEN.to_s) end # Chocolate brown: #3F000F: (63, 0, 15) test("Chocolate brown") do assert_equal("\#%02X%02X%02XFF" % [63, 0, 15], Cairo::Color::CHOCOLATE_BROWN.to_s) end # Chocolate cosmos: #58111A: (88, 17, 26) test("Chocolate cosmos") do assert_equal("\#%02X%02X%02XFF" % [88, 17, 26], Cairo::Color::CHOCOLATE_COSMOS.to_s) end # Chocolate Kisses: #3C1421: (60, 20, 33) test("Chocolate Kisses") do assert_equal("\#%02X%02X%02XFF" % [60, 20, 33], Cairo::Color::CHOCOLATE_KISSES.to_s) end # Chocolate (traditional): #7B3F00: (123, 63, 0) test("Chocolate (traditional)") do assert_equal("\#%02X%02X%02XFF" % [123, 63, 0], Cairo::Color::CHOCOLATE_TRADITIONAL.to_s) end # Chocolate (web): #D2691E: (210, 105, 30) test("Chocolate (web)") do assert_equal("\#%02X%02X%02XFF" % [210, 105, 30], Cairo::Color::CHOCOLATE_WEB.to_s) end # Christmas blue: #2A8FBD: (42, 143, 189) test("Christmas blue") do assert_equal("\#%02X%02X%02XFF" % [42, 143, 189], Cairo::Color::CHRISTMAS_BLUE.to_s) end # Christmas brown: #5D2B2C: (93, 43, 44) test("Christmas brown") do assert_equal("\#%02X%02X%02XFF" % [93, 43, 44], Cairo::Color::CHRISTMAS_BROWN.to_s) end # Christmas green: #3C8D0D: (60, 141, 13) test("Christmas green") do assert_equal("\#%02X%02X%02XFF" % [60, 141, 13], Cairo::Color::CHRISTMAS_GREEN.to_s) end # Christmas gold: #CAA906: (202, 169, 6) test("Christmas gold") do assert_equal("\#%02X%02X%02XFF" % [202, 169, 6], Cairo::Color::CHRISTMAS_GOLD.to_s) end # Christmas orange: #FF6600: (255, 102, 0) test("Christmas orange") do assert_equal("\#%02X%02X%02XFF" % [255, 102, 0], Cairo::Color::CHRISTMAS_ORANGE.to_s) end # Christmas pink: #FFCCCB: (255, 204, 203) test("Christmas pink") do assert_equal("\#%02X%02X%02XFF" % [255, 204, 203], Cairo::Color::CHRISTMAS_PINK.to_s) end # Christmas purple: #663398: (102, 51, 152) test("Christmas purple") do assert_equal("\#%02X%02X%02XFF" % [102, 51, 152], Cairo::Color::CHRISTMAS_PURPLE.to_s) end # Christmas red: #AA0114: (170, 1, 20) test("Christmas red") do assert_equal("\#%02X%02X%02XFF" % [170, 1, 20], Cairo::Color::CHRISTMAS_RED.to_s) end # Christmas silver: #E1DFE0: (225, 223, 224) test("Christmas silver") do assert_equal("\#%02X%02X%02XFF" % [225, 223, 224], Cairo::Color::CHRISTMAS_SILVER.to_s) end # Christmas yellow: #FFCC00: (255, 204, 0) test("Christmas yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 204, 0], Cairo::Color::CHRISTMAS_YELLOW.to_s) end # Chrome yellow: #FFA700: (255, 167, 0) test("Chrome yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 167, 0], Cairo::Color::CHROME_YELLOW.to_s) end # Cinereous: #98817B: (152, 129, 123) test("Cinereous") do assert_equal("\#%02X%02X%02XFF" % [152, 129, 123], Cairo::Color::CINEREOUS.to_s) end # Cinnabar: #E34234: (227, 66, 52) test("Cinnabar") do assert_equal("\#%02X%02X%02XFF" % [227, 66, 52], Cairo::Color::CINNABAR.to_s) end # Cinnamon: #D2691E: (210, 105, 30) test("Cinnamon") do assert_equal("\#%02X%02X%02XFF" % [210, 105, 30], Cairo::Color::CINNAMON.to_s) end # Cinnamon Satin: #CD607E: (205, 96, 126) test("Cinnamon Satin") do assert_equal("\#%02X%02X%02XFF" % [205, 96, 126], Cairo::Color::CINNAMON_SATIN.to_s) end # Citrine: #E4D00A: (228, 208, 10) test("Citrine") do assert_equal("\#%02X%02X%02XFF" % [228, 208, 10], Cairo::Color::CITRINE.to_s) end # Citrine Brown: #933709: (147, 55, 9) test("Citrine Brown") do assert_equal("\#%02X%02X%02XFF" % [147, 55, 9], Cairo::Color::CITRINE_BROWN.to_s) end # Citron: #9FA91F: (158, 169, 31) test("Citron") do assert_equal("\#%02X%02X%02XFF" % [158, 169, 31], Cairo::Color::CITRON.to_s) end # Claret: #7F1734: (127, 23, 52) test("Claret") do assert_equal("\#%02X%02X%02XFF" % [127, 23, 52], Cairo::Color::CLARET.to_s) end # Classic rose: #FBCCE7: (251, 204, 231) test("Classic rose") do assert_equal("\#%02X%02X%02XFF" % [251, 204, 231], Cairo::Color::CLASSIC_ROSE.to_s) end # Cobalt blue: #0047AB: (0, 71, 171) test("Cobalt blue") do assert_equal("\#%02X%02X%02XFF" % [0, 71, 171], Cairo::Color::COBALT_BLUE.to_s) end # Cocoa brown: #D2691E: (210, 105, 30) test("Cocoa brown") do assert_equal("\#%02X%02X%02XFF" % [210, 105, 30], Cairo::Color::COCOA_BROWN.to_s) end # Coconut: #965A3E: (150, 90, 62) test("Coconut") do assert_equal("\#%02X%02X%02XFF" % [150, 90, 62], Cairo::Color::COCONUT.to_s) end # Coffee: #6F4E37: (111, 78, 55) test("Coffee") do assert_equal("\#%02X%02X%02XFF" % [111, 78, 55], Cairo::Color::COFFEE.to_s) end # Cola: #3C3024: (60, 48, 36) test("Cola") do assert_equal("\#%02X%02X%02XFF" % [60, 48, 36], Cairo::Color::COLA.to_s) end # Columbia Blue: #C4D8E2: (196, 216, 226) test("Columbia Blue") do assert_equal("\#%02X%02X%02XFF" % [196, 216, 226], Cairo::Color::COLUMBIA_BLUE.to_s) end # Conditioner: #FFFFCC: (255, 255, 204) test("Conditioner") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 204], Cairo::Color::CONDITIONER.to_s) end # Congo pink: #F88379: (248, 131, 121) test("Congo pink") do assert_equal("\#%02X%02X%02XFF" % [248, 131, 121], Cairo::Color::CONGO_PINK.to_s) end # Cool black: #002E63: (0, 46, 99) test("Cool black") do assert_equal("\#%02X%02X%02XFF" % [0, 46, 99], Cairo::Color::COOL_BLACK.to_s) end # Cool grey: #8C92AC: (140, 146, 172) test("Cool grey") do assert_equal("\#%02X%02X%02XFF" % [140, 146, 172], Cairo::Color::COOL_GREY.to_s) end # Cookies and cream: #EEE0B1: (238, 224, 177) test("Cookies and cream") do assert_equal("\#%02X%02X%02XFF" % [238, 224, 177], Cairo::Color::COOKIES_AND_CREAM.to_s) end # Copper: #B87333: (184, 115, 51) test("Copper") do assert_equal("\#%02X%02X%02XFF" % [184, 115, 51], Cairo::Color::COPPER.to_s) end # Copper (Crayola): #DA8A67: (218, 138, 103) test("Copper (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [218, 138, 103], Cairo::Color::COPPER_CRAYOLA.to_s) end # Copper penny: #AD6F69: (173, 111, 105) test("Copper penny") do assert_equal("\#%02X%02X%02XFF" % [173, 111, 105], Cairo::Color::COPPER_PENNY.to_s) end # Copper red: #CB6D51: (203, 109, 81) test("Copper red") do assert_equal("\#%02X%02X%02XFF" % [203, 109, 81], Cairo::Color::COPPER_RED.to_s) end # Copper rose: #996666: (153, 102, 102) test("Copper rose") do assert_equal("\#%02X%02X%02XFF" % [153, 102, 102], Cairo::Color::COPPER_ROSE.to_s) end # Coquelicot: #FF3800: (255, 56, 0) test("Coquelicot") do assert_equal("\#%02X%02X%02XFF" % [255, 56, 0], Cairo::Color::COQUELICOT.to_s) end # Coral: #FF7F50: (255, 127, 80) test("Coral") do assert_equal("\#%02X%02X%02XFF" % [255, 127, 80], Cairo::Color::CORAL.to_s) end # Coral pink: #F88379: (248, 131, 121) test("Coral pink") do assert_equal("\#%02X%02X%02XFF" % [248, 131, 121], Cairo::Color::CORAL_PINK.to_s) end # Coral red: #FF4040: (255, 64, 64) test("Coral red") do assert_equal("\#%02X%02X%02XFF" % [255, 64, 64], Cairo::Color::CORAL_RED.to_s) end # Coral reef: #FD7C6E: (253, 124, 110) test("Coral reef") do assert_equal("\#%02X%02X%02XFF" % [253, 124, 110], Cairo::Color::CORAL_REEF.to_s) end # Coral Reef (Valspar Paint Color): #F6A494: (246, 164, 148) test("Coral Reef (Valspar Paint Color)") do assert_equal("\#%02X%02X%02XFF" % [246, 164, 148], Cairo::Color::CORAL_REEF_VALSPAR_PAINT_COLOR.to_s) end # Cordovan: #893F45: (137, 63, 69) test("Cordovan") do assert_equal("\#%02X%02X%02XFF" % [137, 63, 69], Cairo::Color::CORDOVAN.to_s) end # Corn: #FBEC5D: (251, 236, 93) test("Corn") do assert_equal("\#%02X%02X%02XFF" % [251, 236, 93], Cairo::Color::CORN.to_s) end # Cornell red: #B31B1B: (179, 27, 27) test("Cornell red") do assert_equal("\#%02X%02X%02XFF" % [179, 27, 27], Cairo::Color::CORNELL_RED.to_s) end # Cornflower blue: #6495ED: (100, 149, 237) test("Cornflower blue") do assert_equal("\#%02X%02X%02XFF" % [100, 149, 237], Cairo::Color::CORNFLOWER_BLUE.to_s) end # Cornflower: #93CCEA: (1, 159, 222) test("Cornflower") do assert_equal("\#%02X%02X%02XFF" % [1, 159, 222], Cairo::Color::CORNFLOWER.to_s) end # Cornsilk: #FFF8DC: (255, 248, 220) test("Cornsilk") do assert_equal("\#%02X%02X%02XFF" % [255, 248, 220], Cairo::Color::CORNSILK.to_s) end # Cosmic cobalt: #2E2D88: (46, 45, 136) test("Cosmic cobalt") do assert_equal("\#%02X%02X%02XFF" % [46, 45, 136], Cairo::Color::COSMIC_COBALT.to_s) end # Cosmic latte: #FFF8E7: (255, 248, 231) test("Cosmic latte") do assert_equal("\#%02X%02X%02XFF" % [255, 248, 231], Cairo::Color::COSMIC_LATTE.to_s) end # Coyote brown: #81613C: (129, 97, 60) test("Coyote brown") do assert_equal("\#%02X%02X%02XFF" % [129, 97, 60], Cairo::Color::COYOTE_BROWN.to_s) end # Cotton candy: #FFBCD9: (255, 188, 217) test("Cotton candy") do assert_equal("\#%02X%02X%02XFF" % [255, 188, 217], Cairo::Color::COTTON_CANDY.to_s) end # Cream: #FFFDD0: (255, 253, 208) test("Cream") do assert_equal("\#%02X%02X%02XFF" % [255, 253, 208], Cairo::Color::CREAM.to_s) end # Crimson: #DC143C: (220, 20, 60) test("Crimson") do assert_equal("\#%02X%02X%02XFF" % [220, 20, 60], Cairo::Color::CRIMSON.to_s) end # Crimson glory: #BE0032: (190, 0, 50) test("Crimson glory") do assert_equal("\#%02X%02X%02XFF" % [190, 0, 50], Cairo::Color::CRIMSON_GLORY.to_s) end # Crimson red: #990000: (153, 0, 0) test("Crimson red") do assert_equal("\#%02X%02X%02XFF" % [153, 0, 0], Cairo::Color::CRIMSON_RED.to_s) end # Cultured: #F5F5F5: (245, 245, 245) test("Cultured") do assert_equal("\#%02X%02X%02XFF" % [245, 245, 245], Cairo::Color::CULTURED.to_s) end # Cyan: #00FFFF: (0, 255, 255) test("Cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 255], Cairo::Color::CYAN.to_s) end # Cyan azure: #4E82B4: (78, 130, 180) test("Cyan azure") do assert_equal("\#%02X%02X%02XFF" % [78, 130, 180], Cairo::Color::CYAN_AZURE.to_s) end # Cyan-blue azure: #4682BF: (70, 130, 191) test("Cyan-blue azure") do assert_equal("\#%02X%02X%02XFF" % [70, 130, 191], Cairo::Color::CYAN_BLUE_AZURE.to_s) end # Cyan cobalt blue: #28589C: (40, 88, 156) test("Cyan cobalt blue") do assert_equal("\#%02X%02X%02XFF" % [40, 88, 156], Cairo::Color::CYAN_COBALT_BLUE.to_s) end # Cyan cornflower blue: #188BC2: (24, 139, 194) test("Cyan cornflower blue") do assert_equal("\#%02X%02X%02XFF" % [24, 139, 194], Cairo::Color::CYAN_CORNFLOWER_BLUE.to_s) end # Cyan (process): #00B7EB: (0, 183, 235) test("Cyan (process)") do assert_equal("\#%02X%02X%02XFF" % [0, 183, 235], Cairo::Color::CYAN_PROCESS.to_s) end # Cyber grape: #58427C: (88, 66, 124) test("Cyber grape") do assert_equal("\#%02X%02X%02XFF" % [88, 66, 124], Cairo::Color::CYBER_GRAPE.to_s) end # Cyber yellow: #FFD300: (255, 211, 0) test("Cyber yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 211, 0], Cairo::Color::CYBER_YELLOW.to_s) end # Cyclamen: #F56FA1: (245, 111, 161) test("Cyclamen") do assert_equal("\#%02X%02X%02XFF" % [245, 111, 161], Cairo::Color::CYCLAMEN.to_s) end # Daffodil: #FFFF31: (255, 255, 49) test("Daffodil") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 49], Cairo::Color::DAFFODIL.to_s) end # Dandelion: #F0E130: (240, 225, 48) test("Dandelion") do assert_equal("\#%02X%02X%02XFF" % [240, 225, 48], Cairo::Color::DANDELION.to_s) end # Dandelion (Crayola): #FDDB6D: (253, 219, 109) test("Dandelion (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [253, 219, 109], Cairo::Color::DANDELION_CRAYOLA.to_s) end # Dark blue: #00008B: (0, 0, 139) test("Dark blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 139], Cairo::Color::DARK_BLUE.to_s) end # Dark blue-gray: #666699: (102, 102, 153) test("Dark blue-gray") do assert_equal("\#%02X%02X%02XFF" % [102, 102, 153], Cairo::Color::DARK_BLUE_GRAY.to_s) end # Dark bronze: #804A00: (128, 74, 45) test("Dark bronze") do assert_equal("\#%02X%02X%02XFF" % [128, 74, 45], Cairo::Color::DARK_BRONZE.to_s) end # Dark bronze (Coin): #514100: (81, 65, 0) test("Dark bronze (Coin)") do assert_equal("\#%02X%02X%02XFF" % [81, 65, 0], Cairo::Color::DARK_BRONZE_COIN.to_s) end # Dark brown: #654321: (101, 67, 33) test("Dark brown") do assert_equal("\#%02X%02X%02XFF" % [101, 67, 33], Cairo::Color::DARK_BROWN.to_s) end # Dark brown-tangelo: #88654E: (136, 101, 78) test("Dark brown-tangelo") do assert_equal("\#%02X%02X%02XFF" % [136, 101, 78], Cairo::Color::DARK_BROWN_TANGELO.to_s) end # Dark byzantium: #5D3954: (93, 57, 84) test("Dark byzantium") do assert_equal("\#%02X%02X%02XFF" % [93, 57, 84], Cairo::Color::DARK_BYZANTIUM.to_s) end # Dark candy apple red: #A40000: (164, 0, 0) test("Dark candy apple red") do assert_equal("\#%02X%02X%02XFF" % [164, 0, 0], Cairo::Color::DARK_CANDY_APPLE_RED.to_s) end # Dark cerulean: #08457E: (8, 69, 126) test("Dark cerulean") do assert_equal("\#%02X%02X%02XFF" % [8, 69, 126], Cairo::Color::DARK_CERULEAN.to_s) end # Dark charcoal: #333333: (51, 51, 51) test("Dark charcoal") do assert_equal("\#%02X%02X%02XFF" % [51, 51, 51], Cairo::Color::DARK_CHARCOAL.to_s) end # Dark chestnut: #986960: (152, 105, 96) test("Dark chestnut") do assert_equal("\#%02X%02X%02XFF" % [152, 105, 96], Cairo::Color::DARK_CHESTNUT.to_s) end # Dark chocolate: #490206: (73, 2, 6) test("Dark chocolate") do assert_equal("\#%02X%02X%02XFF" % [73, 2, 6], Cairo::Color::DARK_CHOCOLATE.to_s) end # Dark chocolate (Hershey's): #3C1321: (60, 19, 33) test("Dark chocolate (Hershey's)") do assert_equal("\#%02X%02X%02XFF" % [60, 19, 33], Cairo::Color::DARK_CHOCOLATE_HERSHEYS.to_s) end # Dark cornflower blue: #26428B: (38, 66, 139) test("Dark cornflower blue") do assert_equal("\#%02X%02X%02XFF" % [38, 66, 139], Cairo::Color::DARK_CORNFLOWER_BLUE.to_s) end # Dark coral: #CD5B45: (205, 91, 69) test("Dark coral") do assert_equal("\#%02X%02X%02XFF" % [205, 91, 69], Cairo::Color::DARK_CORAL.to_s) end # Dark cyan: #008B8B: (0, 139, 139) test("Dark cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 139, 139], Cairo::Color::DARK_CYAN.to_s) end # Dark electric blue: #536878: (83, 104, 120) test("Dark electric blue") do assert_equal("\#%02X%02X%02XFF" % [83, 104, 120], Cairo::Color::DARK_ELECTRIC_BLUE.to_s) end # Dark gold: #AA6C39: (170, 108, 57) test("Dark gold") do assert_equal("\#%02X%02X%02XFF" % [170, 108, 57], Cairo::Color::DARK_GOLD.to_s) end # Dark goldenrod: #B8860B: (184, 134, 11) test("Dark goldenrod") do assert_equal("\#%02X%02X%02XFF" % [184, 134, 11], Cairo::Color::DARK_GOLDENROD.to_s) end # Dark gray (X11): #A9A9A9: (169, 169, 169) test("Dark gray (X11)") do assert_equal("\#%02X%02X%02XFF" % [169, 169, 169], Cairo::Color::DARK_GRAY_X11.to_s) end # Dark green: #013220: (1, 50, 32) test("Dark green") do assert_equal("\#%02X%02X%02XFF" % [1, 50, 32], Cairo::Color::DARK_GREEN.to_s) end # Dark green (X11): #006400: (0, 100, 0) test("Dark green (X11)") do assert_equal("\#%02X%02X%02XFF" % [0, 100, 0], Cairo::Color::DARK_GREEN_X11.to_s) end # Dark gunmetal: #1F262A: (31, 38, 42) test("Dark gunmetal") do assert_equal("\#%02X%02X%02XFF" % [31, 38, 42], Cairo::Color::DARK_GUNMETAL.to_s) end # Dark imperial blue: #00416A: (0, 65, 106) test("Dark imperial blue") do assert_equal("\#%02X%02X%02XFF" % [0, 65, 106], Cairo::Color::DARK_IMPERIAL_BLUE.to_s) end # Dark jungle green: #1A2421: (26, 36, 33) test("Dark jungle green") do assert_equal("\#%02X%02X%02XFF" % [26, 36, 33], Cairo::Color::DARK_JUNGLE_GREEN.to_s) end # Dark khaki: #BDB76B: (189, 183, 107) test("Dark khaki") do assert_equal("\#%02X%02X%02XFF" % [189, 183, 107], Cairo::Color::DARK_KHAKI.to_s) end # Dark lava: #483C32: (72, 60, 50) test("Dark lava") do assert_equal("\#%02X%02X%02XFF" % [72, 60, 50], Cairo::Color::DARK_LAVA.to_s) end # Dark lavender: #734F96: (115, 79, 150) test("Dark lavender") do assert_equal("\#%02X%02X%02XFF" % [115, 79, 150], Cairo::Color::DARK_LAVENDER.to_s) end # Dark lemon lime: #8BBE1B: (139, 190, 27) test("Dark lemon lime") do assert_equal("\#%02X%02X%02XFF" % [139, 190, 27], Cairo::Color::DARK_LEMON_LIME.to_s) end # Dark liver: #534B4F: (83, 75, 79) test("Dark liver") do assert_equal("\#%02X%02X%02XFF" % [83, 75, 79], Cairo::Color::DARK_LIVER.to_s) end # Dark liver (horses): #543D37: (84, 61, 55) test("Dark liver (horses)") do assert_equal("\#%02X%02X%02XFF" % [84, 61, 55], Cairo::Color::DARK_LIVER_HORSES.to_s) end # Dark magenta: #8B008B: (139, 0, 139) test("Dark magenta") do assert_equal("\#%02X%02X%02XFF" % [139, 0, 139], Cairo::Color::DARK_MAGENTA.to_s) end # Dark medium gray: #A9A9A9: (169, 169, 169) test("Dark medium gray") do assert_equal("\#%02X%02X%02XFF" % [169, 169, 169], Cairo::Color::DARK_MEDIUM_GRAY.to_s) end # Dark midnight blue: #003366: (0, 51, 102) test("Dark midnight blue") do assert_equal("\#%02X%02X%02XFF" % [0, 51, 102], Cairo::Color::DARK_MIDNIGHT_BLUE.to_s) end # Dark moss green: #4A5D23: (74, 93, 35) test("Dark moss green") do assert_equal("\#%02X%02X%02XFF" % [74, 93, 35], Cairo::Color::DARK_MOSS_GREEN.to_s) end # Dark olive green: #556B2F: (85, 107, 47) test("Dark olive green") do assert_equal("\#%02X%02X%02XFF" % [85, 107, 47], Cairo::Color::DARK_OLIVE_GREEN.to_s) end # Dark orange: #FF8C00: (255, 140, 0) test("Dark orange") do assert_equal("\#%02X%02X%02XFF" % [255, 140, 0], Cairo::Color::DARK_ORANGE.to_s) end # Dark orchid: #9932CC: (153, 50, 204) test("Dark orchid") do assert_equal("\#%02X%02X%02XFF" % [153, 50, 204], Cairo::Color::DARK_ORCHID.to_s) end # Dark pastel blue: #779ECB: (119, 158, 203) test("Dark pastel blue") do assert_equal("\#%02X%02X%02XFF" % [119, 158, 203], Cairo::Color::DARK_PASTEL_BLUE.to_s) end # Dark pastel green: #03C03C: (3, 192, 60) test("Dark pastel green") do assert_equal("\#%02X%02X%02XFF" % [3, 192, 60], Cairo::Color::DARK_PASTEL_GREEN.to_s) end # Dark pastel purple: #966FD6: (150, 111, 214) test("Dark pastel purple") do assert_equal("\#%02X%02X%02XFF" % [150, 111, 214], Cairo::Color::DARK_PASTEL_PURPLE.to_s) end # Dark pastel red: #C23B22: (194, 59, 34) test("Dark pastel red") do assert_equal("\#%02X%02X%02XFF" % [194, 59, 34], Cairo::Color::DARK_PASTEL_RED.to_s) end # Dark pink: #E75480: (231, 84, 128) test("Dark pink") do assert_equal("\#%02X%02X%02XFF" % [231, 84, 128], Cairo::Color::DARK_PINK.to_s) end # Dark powder blue: #003399: (0, 51, 153) test("Dark powder blue") do assert_equal("\#%02X%02X%02XFF" % [0, 51, 153], Cairo::Color::DARK_POWDER_BLUE.to_s) end # Dark puce: #4F3A3C: (79, 58, 60) test("Dark puce") do assert_equal("\#%02X%02X%02XFF" % [79, 58, 60], Cairo::Color::DARK_PUCE.to_s) end # Dark purple: #301934: (48, 25, 52) test("Dark purple") do assert_equal("\#%02X%02X%02XFF" % [48, 25, 52], Cairo::Color::DARK_PURPLE.to_s) end # Dark raspberry: #872657: (135, 38, 87) test("Dark raspberry") do assert_equal("\#%02X%02X%02XFF" % [135, 38, 87], Cairo::Color::DARK_RASPBERRY.to_s) end # Dark red: #8B0000: (139, 0, 0) test("Dark red") do assert_equal("\#%02X%02X%02XFF" % [139, 0, 0], Cairo::Color::DARK_RED.to_s) end # Dark salmon: #E9967A: (233, 150, 122) test("Dark salmon") do assert_equal("\#%02X%02X%02XFF" % [233, 150, 122], Cairo::Color::DARK_SALMON.to_s) end # Dark scarlet: #560319: (86, 3, 25) test("Dark scarlet") do assert_equal("\#%02X%02X%02XFF" % [86, 3, 25], Cairo::Color::DARK_SCARLET.to_s) end # Dark sea green: #8FBC8F: (143, 188, 143) test("Dark sea green") do assert_equal("\#%02X%02X%02XFF" % [143, 188, 143], Cairo::Color::DARK_SEA_GREEN.to_s) end # Dark sienna: #3C1414: (60, 20, 20) test("Dark sienna") do assert_equal("\#%02X%02X%02XFF" % [60, 20, 20], Cairo::Color::DARK_SIENNA.to_s) end # Dark silver: #71706E: (113, 112, 110) test("Dark silver") do assert_equal("\#%02X%02X%02XFF" % [113, 112, 110], Cairo::Color::DARK_SILVER.to_s) end # Dark sky blue: #8CBED6: (140, 190, 214) test("Dark sky blue") do assert_equal("\#%02X%02X%02XFF" % [140, 190, 214], Cairo::Color::DARK_SKY_BLUE.to_s) end # Dark slate blue: #483D8B: (72, 61, 139) test("Dark slate blue") do assert_equal("\#%02X%02X%02XFF" % [72, 61, 139], Cairo::Color::DARK_SLATE_BLUE.to_s) end # Dark slate gray: #2F4F4F: (47, 79, 79) test("Dark slate gray") do assert_equal("\#%02X%02X%02XFF" % [47, 79, 79], Cairo::Color::DARK_SLATE_GRAY.to_s) end # Dark spring green: #177245: (23, 114, 69) test("Dark spring green") do assert_equal("\#%02X%02X%02XFF" % [23, 114, 69], Cairo::Color::DARK_SPRING_GREEN.to_s) end # Dark tan: #918151: (145, 129, 81) test("Dark tan") do assert_equal("\#%02X%02X%02XFF" % [145, 129, 81], Cairo::Color::DARK_TAN.to_s) end # Dark tangerine: #FFA812: (255, 168, 18) test("Dark tangerine") do assert_equal("\#%02X%02X%02XFF" % [255, 168, 18], Cairo::Color::DARK_TANGERINE.to_s) end # Dark taupe: #483C32: (72, 60, 50) test("Dark taupe") do assert_equal("\#%02X%02X%02XFF" % [72, 60, 50], Cairo::Color::DARK_TAUPE.to_s) end # Dark terra cotta: #CC4E5C: (204, 78, 92) test("Dark terra cotta") do assert_equal("\#%02X%02X%02XFF" % [204, 78, 92], Cairo::Color::DARK_TERRA_COTTA.to_s) end # Dark turquoise: #00CED1: (0, 206, 209) test("Dark turquoise") do assert_equal("\#%02X%02X%02XFF" % [0, 206, 209], Cairo::Color::DARK_TURQUOISE.to_s) end # Dark vanilla: #D1BEA8: (209, 190, 168) test("Dark vanilla") do assert_equal("\#%02X%02X%02XFF" % [209, 190, 168], Cairo::Color::DARK_VANILLA.to_s) end # Dark violet: #9400D3: (148, 0, 211) test("Dark violet") do assert_equal("\#%02X%02X%02XFF" % [148, 0, 211], Cairo::Color::DARK_VIOLET.to_s) end # Dark yellow: #9B870C: (155, 135, 12) test("Dark yellow") do assert_equal("\#%02X%02X%02XFF" % [155, 135, 12], Cairo::Color::DARK_YELLOW.to_s) end # Dartmouth green: #00703C: (0, 112, 60) test("Dartmouth green") do assert_equal("\#%02X%02X%02XFF" % [0, 112, 60], Cairo::Color::DARTMOUTH_GREEN.to_s) end # Davy's grey: #555555: (85, 85, 85) test("Davy's grey") do assert_equal("\#%02X%02X%02XFF" % [85, 85, 85], Cairo::Color::DAVYS_GREY.to_s) end # Debian red: #D70A53: (215, 10, 83) test("Debian red") do assert_equal("\#%02X%02X%02XFF" % [215, 10, 83], Cairo::Color::DEBIAN_RED.to_s) end # Deep amethyst: #9C8AA4: (156, 138, 164) test("Deep amethyst") do assert_equal("\#%02X%02X%02XFF" % [156, 138, 164], Cairo::Color::DEEP_AMETHYST.to_s) end # Deep aquamarine: #40826D: (64, 130, 109) test("Deep aquamarine") do assert_equal("\#%02X%02X%02XFF" % [64, 130, 109], Cairo::Color::DEEP_AQUAMARINE.to_s) end # Deep carmine: #A9203E: (169, 32, 62) test("Deep carmine") do assert_equal("\#%02X%02X%02XFF" % [169, 32, 62], Cairo::Color::DEEP_CARMINE.to_s) end # Deep carmine pink: #EF3038: (239, 48, 56) test("Deep carmine pink") do assert_equal("\#%02X%02X%02XFF" % [239, 48, 56], Cairo::Color::DEEP_CARMINE_PINK.to_s) end # Deep carrot orange: #E9692C: (233, 105, 44) test("Deep carrot orange") do assert_equal("\#%02X%02X%02XFF" % [233, 105, 44], Cairo::Color::DEEP_CARROT_ORANGE.to_s) end # Deep cerise: #DA3287: (218, 50, 135) test("Deep cerise") do assert_equal("\#%02X%02X%02XFF" % [218, 50, 135], Cairo::Color::DEEP_CERISE.to_s) end # Deep champagne: #FAD6A5: (250, 214, 165) test("Deep champagne") do assert_equal("\#%02X%02X%02XFF" % [250, 214, 165], Cairo::Color::DEEP_CHAMPAGNE.to_s) end # Deep chestnut: #B94E48: (185, 78, 72) test("Deep chestnut") do assert_equal("\#%02X%02X%02XFF" % [185, 78, 72], Cairo::Color::DEEP_CHESTNUT.to_s) end # Deep coffee: #704241: (112, 66, 65) test("Deep coffee") do assert_equal("\#%02X%02X%02XFF" % [112, 66, 65], Cairo::Color::DEEP_COFFEE.to_s) end # Deep fuchsia: #C154C1: (193, 84, 193) test("Deep fuchsia") do assert_equal("\#%02X%02X%02XFF" % [193, 84, 193], Cairo::Color::DEEP_FUCHSIA.to_s) end # Deep Green: #056608: (5, 102, 8) test("Deep Green") do assert_equal("\#%02X%02X%02XFF" % [5, 102, 8], Cairo::Color::DEEP_GREEN.to_s) end # Deep green-cyan turquoise: #0E7C61: (14, 124, 97) test("Deep green-cyan turquoise") do assert_equal("\#%02X%02X%02XFF" % [14, 124, 97], Cairo::Color::DEEP_GREEN_CYAN_TURQUOISE.to_s) end # Deep jungle green: #004B49: (0, 75, 73) test("Deep jungle green") do assert_equal("\#%02X%02X%02XFF" % [0, 75, 73], Cairo::Color::DEEP_JUNGLE_GREEN.to_s) end # Deep koamaru: #333366: (51, 51, 102) test("Deep koamaru") do assert_equal("\#%02X%02X%02XFF" % [51, 51, 102], Cairo::Color::DEEP_KOAMARU.to_s) end # Deep lemon: #F5C71A: (245, 199, 26) test("Deep lemon") do assert_equal("\#%02X%02X%02XFF" % [245, 199, 26], Cairo::Color::DEEP_LEMON.to_s) end # Deep lilac: #9955BB: (153, 85, 187) test("Deep lilac") do assert_equal("\#%02X%02X%02XFF" % [153, 85, 187], Cairo::Color::DEEP_LILAC.to_s) end # Deep magenta: #CC00CC: (204, 0, 204) test("Deep magenta") do assert_equal("\#%02X%02X%02XFF" % [204, 0, 204], Cairo::Color::DEEP_MAGENTA.to_s) end # Deep maroon: #820000: (130, 0, 0) test("Deep maroon") do assert_equal("\#%02X%02X%02XFF" % [130, 0, 0], Cairo::Color::DEEP_MAROON.to_s) end # Deep mauve: #D473D4: (212, 115, 212) test("Deep mauve") do assert_equal("\#%02X%02X%02XFF" % [212, 115, 212], Cairo::Color::DEEP_MAUVE.to_s) end # Deep moss green: #355E3B: (53, 94, 59) test("Deep moss green") do assert_equal("\#%02X%02X%02XFF" % [53, 94, 59], Cairo::Color::DEEP_MOSS_GREEN.to_s) end # Deep peach: #FFCBA4: (255, 203, 164) test("Deep peach") do assert_equal("\#%02X%02X%02XFF" % [255, 203, 164], Cairo::Color::DEEP_PEACH.to_s) end # Deep pink: #FF1493: (255, 20, 147) test("Deep pink") do assert_equal("\#%02X%02X%02XFF" % [255, 20, 147], Cairo::Color::DEEP_PINK.to_s) end # Deep puce: #A95C68: (169, 92, 104) test("Deep puce") do assert_equal("\#%02X%02X%02XFF" % [169, 92, 104], Cairo::Color::DEEP_PUCE.to_s) end # Deep Red: #850101: (133, 1, 1) test("Deep Red") do assert_equal("\#%02X%02X%02XFF" % [133, 1, 1], Cairo::Color::DEEP_RED.to_s) end # Deep ruby: #843F5B: (132, 63, 91) test("Deep ruby") do assert_equal("\#%02X%02X%02XFF" % [132, 63, 91], Cairo::Color::DEEP_RUBY.to_s) end # Deep saffron: #FF9933: (255, 153, 51) test("Deep saffron") do assert_equal("\#%02X%02X%02XFF" % [255, 153, 51], Cairo::Color::DEEP_SAFFRON.to_s) end # Deep sky blue: #00BFFF: (0, 191, 255) test("Deep sky blue") do assert_equal("\#%02X%02X%02XFF" % [0, 191, 255], Cairo::Color::DEEP_SKY_BLUE.to_s) end # Deep Space Sparkle: #4A646C: (74, 100, 108) test("Deep Space Sparkle") do assert_equal("\#%02X%02X%02XFF" % [74, 100, 108], Cairo::Color::DEEP_SPACE_SPARKLE.to_s) end # Deep spring bud: #556B2F: (85, 107, 47) test("Deep spring bud") do assert_equal("\#%02X%02X%02XFF" % [85, 107, 47], Cairo::Color::DEEP_SPRING_BUD.to_s) end # Deep Taupe: #7E5E60: (126, 94, 96) test("Deep Taupe") do assert_equal("\#%02X%02X%02XFF" % [126, 94, 96], Cairo::Color::DEEP_TAUPE.to_s) end # Deep Tuscan red: #66424D: (102, 66, 77) test("Deep Tuscan red") do assert_equal("\#%02X%02X%02XFF" % [102, 66, 77], Cairo::Color::DEEP_TUSCAN_RED.to_s) end # Deep violet: #330066: (51, 0, 102) test("Deep violet") do assert_equal("\#%02X%02X%02XFF" % [51, 0, 102], Cairo::Color::DEEP_VIOLET.to_s) end # Deer: #BA8759: (186, 135, 89) test("Deer") do assert_equal("\#%02X%02X%02XFF" % [186, 135, 89], Cairo::Color::DEER.to_s) end # Denim: #1560BD: (21, 96, 189) test("Denim") do assert_equal("\#%02X%02X%02XFF" % [21, 96, 189], Cairo::Color::DENIM.to_s) end # Denim Blue: #2243B6: (34, 67, 182) test("Denim Blue") do assert_equal("\#%02X%02X%02XFF" % [34, 67, 182], Cairo::Color::DENIM_BLUE.to_s) end # Desaturated cyan: #669999: (102, 153, 153) test("Desaturated cyan") do assert_equal("\#%02X%02X%02XFF" % [102, 153, 153], Cairo::Color::DESATURATED_CYAN.to_s) end # Desert: #C19A6B: (193, 154, 107) test("Desert") do assert_equal("\#%02X%02X%02XFF" % [193, 154, 107], Cairo::Color::DESERT.to_s) end # Desert sand: #EDC9AF: (237, 201, 175) test("Desert sand") do assert_equal("\#%02X%02X%02XFF" % [237, 201, 175], Cairo::Color::DESERT_SAND.to_s) end # Desire: #EA3C53: (234, 60, 83) test("Desire") do assert_equal("\#%02X%02X%02XFF" % [234, 60, 83], Cairo::Color::DESIRE.to_s) end # Diamond: #B9F2FF: (185, 242, 255) test("Diamond") do assert_equal("\#%02X%02X%02XFF" % [185, 242, 255], Cairo::Color::DIAMOND.to_s) end # Dim gray: #696969: (105, 105, 105) test("Dim gray") do assert_equal("\#%02X%02X%02XFF" % [105, 105, 105], Cairo::Color::DIM_GRAY.to_s) end # Dingy Dungeon: #C53151: (197, 49, 81) test("Dingy Dungeon") do assert_equal("\#%02X%02X%02XFF" % [197, 49, 81], Cairo::Color::DINGY_DUNGEON.to_s) end # Dirt: #9B7653: (155, 118, 83) test("Dirt") do assert_equal("\#%02X%02X%02XFF" % [155, 118, 83], Cairo::Color::DIRT.to_s) end # Dirty brown: #B5651E: (181, 101, 30) test("Dirty brown") do assert_equal("\#%02X%02X%02XFF" % [181, 101, 30], Cairo::Color::DIRTY_BROWN.to_s) end # Dirty white: #E8E4C9: (232, 228, 201) test("Dirty white") do assert_equal("\#%02X%02X%02XFF" % [232, 228, 201], Cairo::Color::DIRTY_WHITE.to_s) end # Dodger blue: #1E90FF: (30, 144, 255) test("Dodger blue") do assert_equal("\#%02X%02X%02XFF" % [30, 144, 255], Cairo::Color::DODGER_BLUE.to_s) end # Dodie yellow: #FEF65B: (254, 246, 91) test("Dodie yellow") do assert_equal("\#%02X%02X%02XFF" % [254, 246, 91], Cairo::Color::DODIE_YELLOW.to_s) end # Dogwood rose: #D71868: (215, 24, 104) test("Dogwood rose") do assert_equal("\#%02X%02X%02XFF" % [215, 24, 104], Cairo::Color::DOGWOOD_ROSE.to_s) end # Dollar bill: #85BB65: (133, 187, 101) test("Dollar bill") do assert_equal("\#%02X%02X%02XFF" % [133, 187, 101], Cairo::Color::DOLLAR_BILL.to_s) end # Dolphin gray: #828E84: (130, 142, 132) test("Dolphin gray") do assert_equal("\#%02X%02X%02XFF" % [130, 142, 132], Cairo::Color::DOLPHIN_GRAY.to_s) end # Donkey brown: #664C28: (102, 76, 40) test("Donkey brown") do assert_equal("\#%02X%02X%02XFF" % [102, 76, 40], Cairo::Color::DONKEY_BROWN.to_s) end # Drab: #967117: (150, 113, 23) test("Drab") do assert_equal("\#%02X%02X%02XFF" % [150, 113, 23], Cairo::Color::DRAB.to_s) end # Duke blue: #00009C: (0, 0, 156) test("Duke blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 156], Cairo::Color::DUKE_BLUE.to_s) end # Dust storm: #E5CCC9: (229, 204, 201) test("Dust storm") do assert_equal("\#%02X%02X%02XFF" % [229, 204, 201], Cairo::Color::DUST_STORM.to_s) end # Dutch white: #EFDFBB: (239, 223, 187) test("Dutch white") do assert_equal("\#%02X%02X%02XFF" % [239, 223, 187], Cairo::Color::DUTCH_WHITE.to_s) end # Earthtone: #5D3A1A: (93, 58, 26) test("Earthtone") do assert_equal("\#%02X%02X%02XFF" % [93, 58, 26], Cairo::Color::EARTHTONE.to_s) end # Earth yellow: #E1A95F: (225, 169, 95) test("Earth yellow") do assert_equal("\#%02X%02X%02XFF" % [225, 169, 95], Cairo::Color::EARTH_YELLOW.to_s) end # Ebony: #555D50: (85, 93, 80) test("Ebony") do assert_equal("\#%02X%02X%02XFF" % [85, 93, 80], Cairo::Color::EBONY.to_s) end # Ecru: #C2B280: (194, 178, 128) test("Ecru") do assert_equal("\#%02X%02X%02XFF" % [194, 178, 128], Cairo::Color::ECRU.to_s) end # Eerie black: #1B1B1B: (27, 27, 27) test("Eerie black") do assert_equal("\#%02X%02X%02XFF" % [27, 27, 27], Cairo::Color::EERIE_BLACK.to_s) end # Eggplant: #614051: (97, 64, 81) test("Eggplant") do assert_equal("\#%02X%02X%02XFF" % [97, 64, 81], Cairo::Color::EGGPLANT.to_s) end # Eggshell: #F0EAD6: (240, 234, 214) test("Eggshell") do assert_equal("\#%02X%02X%02XFF" % [240, 234, 214], Cairo::Color::EGGSHELL.to_s) end # Egyptian blue: #1034A6: (16, 52, 166) test("Egyptian blue") do assert_equal("\#%02X%02X%02XFF" % [16, 52, 166], Cairo::Color::EGYPTIAN_BLUE.to_s) end # Electric blue: #7DF9FF: (125, 249, 255) test("Electric blue") do assert_equal("\#%02X%02X%02XFF" % [125, 249, 255], Cairo::Color::ELECTRIC_BLUE.to_s) end # Electric brown: #B56257: (181, 98, 87) test("Electric brown") do assert_equal("\#%02X%02X%02XFF" % [181, 98, 87], Cairo::Color::ELECTRIC_BROWN.to_s) end # Electric crimson: #FF003F: (255, 0, 63) test("Electric crimson") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 63], Cairo::Color::ELECTRIC_CRIMSON.to_s) end # Electric cyan: #00FFFF: (0, 255, 255) test("Electric cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 255], Cairo::Color::ELECTRIC_CYAN.to_s) end # Electric green: #00FF00: (0, 255, 0) test("Electric green") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 0], Cairo::Color::ELECTRIC_GREEN.to_s) end # Electric indigo: #6F00FF: (111, 0, 255) test("Electric indigo") do assert_equal("\#%02X%02X%02XFF" % [111, 0, 255], Cairo::Color::ELECTRIC_INDIGO.to_s) end # Electric lavender: #F4BBFF: (244, 187, 255) test("Electric lavender") do assert_equal("\#%02X%02X%02XFF" % [244, 187, 255], Cairo::Color::ELECTRIC_LAVENDER.to_s) end # Electric lime: #CCFF00: (204, 255, 0) test("Electric lime") do assert_equal("\#%02X%02X%02XFF" % [204, 255, 0], Cairo::Color::ELECTRIC_LIME.to_s) end # Electric orange: #FF3503: (255, 53, 3) test("Electric orange") do assert_equal("\#%02X%02X%02XFF" % [255, 53, 3], Cairo::Color::ELECTRIC_ORANGE.to_s) end # Electric pink: #F62681: (246, 38, 129) test("Electric pink") do assert_equal("\#%02X%02X%02XFF" % [246, 38, 129], Cairo::Color::ELECTRIC_PINK.to_s) end # Electric purple: #BF00FF: (191, 0, 255) test("Electric purple") do assert_equal("\#%02X%02X%02XFF" % [191, 0, 255], Cairo::Color::ELECTRIC_PURPLE.to_s) end # Electric red: #E60000: (230, 0, 0) test("Electric red") do assert_equal("\#%02X%02X%02XFF" % [230, 0, 0], Cairo::Color::ELECTRIC_RED.to_s) end # Electric ultramarine: #3F00FF: (63, 0, 255) test("Electric ultramarine") do assert_equal("\#%02X%02X%02XFF" % [63, 0, 255], Cairo::Color::ELECTRIC_ULTRAMARINE.to_s) end # Electric violet: #8F00FF: (143, 0, 255) test("Electric violet") do assert_equal("\#%02X%02X%02XFF" % [143, 0, 255], Cairo::Color::ELECTRIC_VIOLET.to_s) end # Electric yellow: #FFFF33: (255, 255, 51) test("Electric yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 51], Cairo::Color::ELECTRIC_YELLOW.to_s) end # Emerald: #50C878: (80, 200, 120) test("Emerald") do assert_equal("\#%02X%02X%02XFF" % [80, 200, 120], Cairo::Color::EMERALD.to_s) end # Emerald green: #046307: (4, 99, 7) test("Emerald green") do assert_equal("\#%02X%02X%02XFF" % [4, 99, 7], Cairo::Color::EMERALD_GREEN.to_s) end # Eminence: #6C3082: (108, 48, 130) test("Eminence") do assert_equal("\#%02X%02X%02XFF" % [108, 48, 130], Cairo::Color::EMINENCE.to_s) end # English green: #1B4D3E: (27, 77, 62) test("English green") do assert_equal("\#%02X%02X%02XFF" % [27, 77, 62], Cairo::Color::ENGLISH_GREEN.to_s) end # English lavender: #B48395: (180, 131, 149) test("English lavender") do assert_equal("\#%02X%02X%02XFF" % [180, 131, 149], Cairo::Color::ENGLISH_LAVENDER.to_s) end # English red: #AB4B52: (171, 75, 82) test("English red") do assert_equal("\#%02X%02X%02XFF" % [171, 75, 82], Cairo::Color::ENGLISH_RED.to_s) end # English vermillion: #CC474B: (204, 71, 75) test("English vermillion") do assert_equal("\#%02X%02X%02XFF" % [204, 71, 75], Cairo::Color::ENGLISH_VERMILLION.to_s) end # English violet: #563C5C: (86, 60, 92) test("English violet") do assert_equal("\#%02X%02X%02XFF" % [86, 60, 92], Cairo::Color::ENGLISH_VIOLET.to_s) end # Eton blue: #96C8A2: (150, 200, 162) test("Eton blue") do assert_equal("\#%02X%02X%02XFF" % [150, 200, 162], Cairo::Color::ETON_BLUE.to_s) end # Eucalyptus: #44D7A8: (68, 215, 168) test("Eucalyptus") do assert_equal("\#%02X%02X%02XFF" % [68, 215, 168], Cairo::Color::EUCALYPTUS.to_s) end # Facebook Blue: #39569C: (57, 86, 156) test("Facebook Blue") do assert_equal("\#%02X%02X%02XFF" % [57, 86, 156], Cairo::Color::FACEBOOK_BLUE.to_s) end # Fallow: #C19A6B: (193, 154, 107) test("Fallow") do assert_equal("\#%02X%02X%02XFF" % [193, 154, 107], Cairo::Color::FALLOW.to_s) end # Falu red: #801818: (128, 24, 24) test("Falu red") do assert_equal("\#%02X%02X%02XFF" % [128, 24, 24], Cairo::Color::FALU_RED.to_s) end # Fandango: #B53389: (181, 51, 137) test("Fandango") do assert_equal("\#%02X%02X%02XFF" % [181, 51, 137], Cairo::Color::FANDANGO.to_s) end # Fandango pink: #DE5285: (222, 82, 133) test("Fandango pink") do assert_equal("\#%02X%02X%02XFF" % [222, 82, 133], Cairo::Color::FANDANGO_PINK.to_s) end # Fashion fuchsia: #F400A1: (244, 0, 161) test("Fashion fuchsia") do assert_equal("\#%02X%02X%02XFF" % [244, 0, 161], Cairo::Color::FASHION_FUCHSIA.to_s) end # Fawn: #E5AA70: (229, 170, 112) test("Fawn") do assert_equal("\#%02X%02X%02XFF" % [229, 170, 112], Cairo::Color::FAWN.to_s) end # Feldgrau: #4D5D53: (77, 93, 83) test("Feldgrau") do assert_equal("\#%02X%02X%02XFF" % [77, 93, 83], Cairo::Color::FELDGRAU.to_s) end # Feldspar: #FDD5B1: (253, 213, 177) test("Feldspar") do assert_equal("\#%02X%02X%02XFF" % [253, 213, 177], Cairo::Color::FELDSPAR.to_s) end # Fern green: #4F7942: (79, 121, 66) test("Fern green") do assert_equal("\#%02X%02X%02XFF" % [79, 121, 66], Cairo::Color::FERN_GREEN.to_s) end # Ferrari red: #FF2800: (255, 40, 0) test("Ferrari red") do assert_equal("\#%02X%02X%02XFF" % [255, 40, 0], Cairo::Color::FERRARI_RED.to_s) end # Field drab: #6C541E: (108, 84, 30) test("Field drab") do assert_equal("\#%02X%02X%02XFF" % [108, 84, 30], Cairo::Color::FIELD_DRAB.to_s) end # Fiery rose: #FF5470: (255, 84, 112) test("Fiery rose") do assert_equal("\#%02X%02X%02XFF" % [255, 84, 112], Cairo::Color::FIERY_ROSE.to_s) end # Firebrick: #B22222: (178, 34, 34) test("Firebrick") do assert_equal("\#%02X%02X%02XFF" % [178, 34, 34], Cairo::Color::FIREBRICK.to_s) end # Fire engine red: #CE2029: (206, 32, 41) test("Fire engine red") do assert_equal("\#%02X%02X%02XFF" % [206, 32, 41], Cairo::Color::FIRE_ENGINE_RED.to_s) end # Fire opal: #E95C4B: (233, 92, 75) test("Fire opal") do assert_equal("\#%02X%02X%02XFF" % [233, 92, 75], Cairo::Color::FIRE_OPAL.to_s) end # Flame: #E25822: (226, 88, 34) test("Flame") do assert_equal("\#%02X%02X%02XFF" % [226, 88, 34], Cairo::Color::FLAME.to_s) end # Flamingo pink: #FC8EAC: (252, 142, 172) test("Flamingo pink") do assert_equal("\#%02X%02X%02XFF" % [252, 142, 172], Cairo::Color::FLAMINGO_PINK.to_s) end # Flattery: #6B4423: (107, 68, 35) test("Flattery") do assert_equal("\#%02X%02X%02XFF" % [107, 68, 35], Cairo::Color::FLATTERY.to_s) end # Flavescent: #F7E98E: (247, 233, 142) test("Flavescent") do assert_equal("\#%02X%02X%02XFF" % [247, 233, 142], Cairo::Color::FLAVESCENT.to_s) end # Flax: #EEDC82: (238, 220, 130) test("Flax") do assert_equal("\#%02X%02X%02XFF" % [238, 220, 130], Cairo::Color::FLAX.to_s) end # Flickr Blue: #216BD6: (33, 107, 214) test("Flickr Blue") do assert_equal("\#%02X%02X%02XFF" % [33, 107, 214], Cairo::Color::FLICKR_BLUE.to_s) end # Flickr Pink: #FB0081: (251, 0, 129) test("Flickr Pink") do assert_equal("\#%02X%02X%02XFF" % [251, 0, 129], Cairo::Color::FLICKR_PINK.to_s) end # Flirt: #A2006D: (162, 0, 109) test("Flirt") do assert_equal("\#%02X%02X%02XFF" % [162, 0, 109], Cairo::Color::FLIRT.to_s) end # Floral white: #FFFAF0: (255, 250, 240) test("Floral white") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 240], Cairo::Color::FLORAL_WHITE.to_s) end # Flower girl: #F498AD: (244, 152, 173) test("Flower girl") do assert_equal("\#%02X%02X%02XFF" % [244, 152, 173], Cairo::Color::FLOWER_GIRL.to_s) end # Fluorescent blue: #15F4EE: (21, 244, 238) test("Fluorescent blue") do assert_equal("\#%02X%02X%02XFF" % [21, 244, 238], Cairo::Color::FLUORESCENT_BLUE.to_s) end # Fluorescent orange: #FFBF00: (255, 191, 0) test("Fluorescent orange") do assert_equal("\#%02X%02X%02XFF" % [255, 191, 0], Cairo::Color::FLUORESCENT_ORANGE.to_s) end # Fluorescent pink: #FF1493: (255, 20, 147) test("Fluorescent pink") do assert_equal("\#%02X%02X%02XFF" % [255, 20, 147], Cairo::Color::FLUORESCENT_PINK.to_s) end # Fluorescent yellow: #CCFF00: (204, 255, 0) test("Fluorescent yellow") do assert_equal("\#%02X%02X%02XFF" % [204, 255, 0], Cairo::Color::FLUORESCENT_YELLOW.to_s) end # Folly: #FF004F: (255, 0, 79) test("Folly") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 79], Cairo::Color::FOLLY.to_s) end # Forest green (Crayola): #5FA777: (95, 167, 119) test("Forest green (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [95, 167, 119], Cairo::Color::FOREST_GREEN_CRAYOLA.to_s) end # Forest green (traditional): #014421: (1, 68, 33) test("Forest green (traditional)") do assert_equal("\#%02X%02X%02XFF" % [1, 68, 33], Cairo::Color::FOREST_GREEN_TRADITIONAL.to_s) end # Forest green (web): #228B22: (34, 139, 34) test("Forest green (web)") do assert_equal("\#%02X%02X%02XFF" % [34, 139, 34], Cairo::Color::FOREST_GREEN_WEB.to_s) end # French beige: #A67B5B: (166, 123, 91) test("French beige") do assert_equal("\#%02X%02X%02XFF" % [166, 123, 91], Cairo::Color::FRENCH_BEIGE.to_s) end # French bistre: #856D4D: (133, 109, 77) test("French bistre") do assert_equal("\#%02X%02X%02XFF" % [133, 109, 77], Cairo::Color::FRENCH_BISTRE.to_s) end # French blue: #0072BB: (0, 114, 187) test("French blue") do assert_equal("\#%02X%02X%02XFF" % [0, 114, 187], Cairo::Color::FRENCH_BLUE.to_s) end # French fuchsia: #FD3F92: (253, 63, 146) test("French fuchsia") do assert_equal("\#%02X%02X%02XFF" % [253, 63, 146], Cairo::Color::FRENCH_FUCHSIA.to_s) end # French lilac: #86608E: (134, 96, 142) test("French lilac") do assert_equal("\#%02X%02X%02XFF" % [134, 96, 142], Cairo::Color::FRENCH_LILAC.to_s) end # French lime: #9EFD38: (158, 253, 56) test("French lime") do assert_equal("\#%02X%02X%02XFF" % [158, 253, 56], Cairo::Color::FRENCH_LIME.to_s) end # French mauve: #D473D4: (212, 115, 212) test("French mauve") do assert_equal("\#%02X%02X%02XFF" % [212, 115, 212], Cairo::Color::FRENCH_MAUVE.to_s) end # French Middle Red Purple: #1C0218: (28, 2, 24) test("French Middle Red Purple") do assert_equal("\#%02X%02X%02XFF" % [28, 2, 24], Cairo::Color::FRENCH_MIDDLE_RED_PURPLE.to_s) end # French pink: #FD6C9E: (253, 108, 158) test("French pink") do assert_equal("\#%02X%02X%02XFF" % [253, 108, 158], Cairo::Color::FRENCH_PINK.to_s) end # French plum: #811453: (129, 20, 83) test("French plum") do assert_equal("\#%02X%02X%02XFF" % [129, 20, 83], Cairo::Color::FRENCH_PLUM.to_s) end # French puce: #4E1609: (78, 22, 9) test("French puce") do assert_equal("\#%02X%02X%02XFF" % [78, 22, 9], Cairo::Color::FRENCH_PUCE.to_s) end # French raspberry: #C72C48: (199, 44, 72) test("French raspberry") do assert_equal("\#%02X%02X%02XFF" % [199, 44, 72], Cairo::Color::FRENCH_RASPBERRY.to_s) end # French rose: #F64A8A: (246, 74, 138) test("French rose") do assert_equal("\#%02X%02X%02XFF" % [246, 74, 138], Cairo::Color::FRENCH_ROSE.to_s) end # French sky blue: #77B5FE: (119, 181, 254) test("French sky blue") do assert_equal("\#%02X%02X%02XFF" % [119, 181, 254], Cairo::Color::FRENCH_SKY_BLUE.to_s) end # French violet: #8806CE: (136, 6, 206) test("French violet") do assert_equal("\#%02X%02X%02XFF" % [136, 6, 206], Cairo::Color::FRENCH_VIOLET.to_s) end # French wine: #AC1E44: (172, 30, 68) test("French wine") do assert_equal("\#%02X%02X%02XFF" % [172, 30, 68], Cairo::Color::FRENCH_WINE.to_s) end # Fresh Air: #A6E7FF: (166, 231, 255) test("Fresh Air") do assert_equal("\#%02X%02X%02XFF" % [166, 231, 255], Cairo::Color::FRESH_AIR.to_s) end # Frostbite: #E936A7: (233, 54, 167) test("Frostbite") do assert_equal("\#%02X%02X%02XFF" % [233, 54, 167], Cairo::Color::FROSTBITE.to_s) end # Fuchsia: #FF00FF: (255, 0, 255) test("Fuchsia") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 255], Cairo::Color::FUCHSIA.to_s) end # Fuchsia (Crayola): #C154C1: (193, 84, 193) test("Fuchsia (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [193, 84, 193], Cairo::Color::FUCHSIA_CRAYOLA.to_s) end # Fuchsia pink: #FF77FF: (255, 119, 255) test("Fuchsia pink") do assert_equal("\#%02X%02X%02XFF" % [255, 119, 255], Cairo::Color::FUCHSIA_PINK.to_s) end # Fuchsia purple: #CC397B: (204, 57, 123) test("Fuchsia purple") do assert_equal("\#%02X%02X%02XFF" % [204, 57, 123], Cairo::Color::FUCHSIA_PURPLE.to_s) end # Fuchsia rose: #C74375: (199, 67, 117) test("Fuchsia rose") do assert_equal("\#%02X%02X%02XFF" % [199, 67, 117], Cairo::Color::FUCHSIA_ROSE.to_s) end # Fulvous: #E48400: (228, 132, 0) test("Fulvous") do assert_equal("\#%02X%02X%02XFF" % [228, 132, 0], Cairo::Color::FULVOUS.to_s) end # Fuzzy Wuzzy: #CC6666: (204, 102, 102) test("Fuzzy Wuzzy") do assert_equal("\#%02X%02X%02XFF" % [204, 102, 102], Cairo::Color::FUZZY_WUZZY.to_s) end # Gainsboro: #DCDCDC: (220, 220, 220) test("Gainsboro") do assert_equal("\#%02X%02X%02XFF" % [220, 220, 220], Cairo::Color::GAINSBORO.to_s) end # Gamboge: #E49B0F: (228, 155, 15) test("Gamboge") do assert_equal("\#%02X%02X%02XFF" % [228, 155, 15], Cairo::Color::GAMBOGE.to_s) end # Gamboge orange (brown): #996600: (152, 102, 0) test("Gamboge orange (brown)") do assert_equal("\#%02X%02X%02XFF" % [152, 102, 0], Cairo::Color::GAMBOGE_ORANGE_BROWN.to_s) end # Garnet: #733635: (115, 54, 53) test("Garnet") do assert_equal("\#%02X%02X%02XFF" % [115, 54, 53], Cairo::Color::GARNET.to_s) end # Gargoyle Gas: #FFDF46: (255, 223, 70) test("Gargoyle Gas") do assert_equal("\#%02X%02X%02XFF" % [255, 223, 70], Cairo::Color::GARGOYLE_GAS.to_s) end # Generic viridian: #007F66: (0, 127, 102) test("Generic viridian") do assert_equal("\#%02X%02X%02XFF" % [0, 127, 102], Cairo::Color::GENERIC_VIRIDIAN.to_s) end # Ghost white: #F8F8FF: (248, 248, 255) test("Ghost white") do assert_equal("\#%02X%02X%02XFF" % [248, 248, 255], Cairo::Color::GHOST_WHITE.to_s) end # Giant's Club: #B05C52: (176, 92, 82) test("Giant's Club") do assert_equal("\#%02X%02X%02XFF" % [176, 92, 82], Cairo::Color::GIANTS_CLUB.to_s) end # Giants orange: #FE5A1D: (254, 90, 29) test("Giants orange") do assert_equal("\#%02X%02X%02XFF" % [254, 90, 29], Cairo::Color::GIANTS_ORANGE.to_s) end # Gin: #D8E4BC: (216, 228, 188) test("Gin") do assert_equal("\#%02X%02X%02XFF" % [216, 228, 188], Cairo::Color::GIN.to_s) end # Glaucous: #6082B6: (96, 130, 182) test("Glaucous") do assert_equal("\#%02X%02X%02XFF" % [96, 130, 182], Cairo::Color::GLAUCOUS.to_s) end # Glossy grape: #AB92B3: (171, 146, 179) test("Glossy grape") do assert_equal("\#%02X%02X%02XFF" % [171, 146, 179], Cairo::Color::GLOSSY_GRAPE.to_s) end # GO green: #00AB66: (0, 171, 102) test("GO green") do assert_equal("\#%02X%02X%02XFF" % [0, 171, 102], Cairo::Color::GO_GREEN.to_s) end # Gold: #A57C00: (165, 124, 0) test("Gold") do assert_equal("\#%02X%02X%02XFF" % [165, 124, 0], Cairo::Color::GOLD.to_s) end # Gold (metallic): #D4AF37: (212, 175, 55) test("Gold (metallic)") do assert_equal("\#%02X%02X%02XFF" % [212, 175, 55], Cairo::Color::GOLD_METALLIC.to_s) end # Gold (web) (Golden): #FFD700: (255, 215, 0) test("Gold (web) (Golden)") do assert_equal("\#%02X%02X%02XFF" % [255, 215, 0], Cairo::Color::GOLD_WEB_GOLDEN.to_s) end # Gold (Crayola): #E6BE8A: (230, 190, 138) test("Gold (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [230, 190, 138], Cairo::Color::GOLD_CRAYOLA.to_s) end # Gold Fusion: #85754E: (133, 117, 78) test("Gold Fusion") do assert_equal("\#%02X%02X%02XFF" % [133, 117, 78], Cairo::Color::GOLD_FUSION.to_s) end # Gold foil: #BD9B16: (189, 155, 22) test("Gold foil") do assert_equal("\#%02X%02X%02XFF" % [189, 155, 22], Cairo::Color::GOLD_FOIL.to_s) end # Golden brown: #996515: (153, 101, 21) test("Golden brown") do assert_equal("\#%02X%02X%02XFF" % [153, 101, 21], Cairo::Color::GOLDEN_BROWN.to_s) end # Golden poppy: #FCC200: (252, 194, 0) test("Golden poppy") do assert_equal("\#%02X%02X%02XFF" % [252, 194, 0], Cairo::Color::GOLDEN_POPPY.to_s) end # Golden yellow: #FFDF00: (255, 223, 0) test("Golden yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 223, 0], Cairo::Color::GOLDEN_YELLOW.to_s) end # Goldenrod: #DAA520: (218, 165, 32) test("Goldenrod") do assert_equal("\#%02X%02X%02XFF" % [218, 165, 32], Cairo::Color::GOLDENROD.to_s) end # Google Chrome red: #DE5246: (222, 82, 70) test("Google Chrome red") do assert_equal("\#%02X%02X%02XFF" % [222, 82, 70], Cairo::Color::GOOGLE_CHROME_RED.to_s) end # Google Chrome blue: #4C8BF5: (76, 139, 245) test("Google Chrome blue") do assert_equal("\#%02X%02X%02XFF" % [76, 139, 245], Cairo::Color::GOOGLE_CHROME_BLUE.to_s) end # Google Chrome green: #1AA260: (26, 162, 96) test("Google Chrome green") do assert_equal("\#%02X%02X%02XFF" % [26, 162, 96], Cairo::Color::GOOGLE_CHROME_GREEN.to_s) end # Google Chrome yellow: #FFCE44: (255, 206, 68) test("Google Chrome yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 206, 68], Cairo::Color::GOOGLE_CHROME_YELLOW.to_s) end # Granite gray: #676767: (103, 103, 103) test("Granite gray") do assert_equal("\#%02X%02X%02XFF" % [103, 103, 103], Cairo::Color::GRANITE_GRAY.to_s) end # Granny Smith apple: #A8E4A0: (168, 228, 160) test("Granny Smith apple") do assert_equal("\#%02X%02X%02XFF" % [168, 228, 160], Cairo::Color::GRANNY_SMITH_APPLE.to_s) end # Grape: #6F2DA8: (111, 45, 168) test("Grape") do assert_equal("\#%02X%02X%02XFF" % [111, 45, 168], Cairo::Color::GRAPE.to_s) end # Gray (HTML/CSS gray): #808080: (128, 128, 128) test("Gray (HTML/CSS gray)") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 128], Cairo::Color::GRAY_HTML_CSS_GRAY.to_s) end # Gray (X11 gray): #BEBEBE: (190, 190, 190) test("Gray (X11 gray)") do assert_equal("\#%02X%02X%02XFF" % [190, 190, 190], Cairo::Color::GRAY_X11_GRAY.to_s) end # Gray-asparagus: #465945: (70, 89, 69) test("Gray-asparagus") do assert_equal("\#%02X%02X%02XFF" % [70, 89, 69], Cairo::Color::GRAY_ASPARAGUS.to_s) end # Gray-blue: #8C92AC: (140, 146, 172) test("Gray-blue") do assert_equal("\#%02X%02X%02XFF" % [140, 146, 172], Cairo::Color::GRAY_BLUE.to_s) end # Green: #008001: (0, 128, 1) test("Green") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 1], Cairo::Color::GREEN.to_s) end # Green (Color Wheel) (X11 green): #00FF00: (0, 255, 0) test("Green (Color Wheel) (X11 green)") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 0], Cairo::Color::GREEN_COLOR_WHEEL_X11_GREEN.to_s) end # Green (Crayola): #1CAC78: (28, 172, 120) test("Green (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [28, 172, 120], Cairo::Color::GREEN_CRAYOLA.to_s) end # Green (HTML/CSS color): #008000: (0, 128, 0) test("Green (HTML/CSS color)") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 0], Cairo::Color::GREEN_HTML_CSS_COLOR.to_s) end # Green (Munsell): #00A877: (0, 168, 119) test("Green (Munsell)") do assert_equal("\#%02X%02X%02XFF" % [0, 168, 119], Cairo::Color::GREEN_MUNSELL.to_s) end # Green (NCS): #009F6B: (0, 159, 107) test("Green (NCS)") do assert_equal("\#%02X%02X%02XFF" % [0, 159, 107], Cairo::Color::GREEN_NCS.to_s) end # Green (Pantone): #00AD43: (0, 173, 67) test("Green (Pantone)") do assert_equal("\#%02X%02X%02XFF" % [0, 173, 67], Cairo::Color::GREEN_PANTONE.to_s) end # Green (pigment): #00A550: (0, 165, 80) test("Green (pigment)") do assert_equal("\#%02X%02X%02XFF" % [0, 165, 80], Cairo::Color::GREEN_PIGMENT.to_s) end # Green (RYB): #66B032: (102, 176, 50) test("Green (RYB)") do assert_equal("\#%02X%02X%02XFF" % [102, 176, 50], Cairo::Color::GREEN_RYB.to_s) end # Green-blue: #1164B4: (17, 100, 180) test("Green-blue") do assert_equal("\#%02X%02X%02XFF" % [17, 100, 180], Cairo::Color::GREEN_BLUE.to_s) end # Green-blue (Crayola): #2887C8: (40, 135, 200) test("Green-blue (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [40, 135, 200], Cairo::Color::GREEN_BLUE_CRAYOLA.to_s) end # Green Cola: #4C721D: (76, 114, 29) test("Green Cola") do assert_equal("\#%02X%02X%02XFF" % [76, 114, 29], Cairo::Color::GREEN_COLA.to_s) end # Green-cyan: #009966: (0, 153, 102) test("Green-cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 153, 102], Cairo::Color::GREEN_CYAN.to_s) end # Green Lizard: #A7F432: (167, 244, 50) test("Green Lizard") do assert_equal("\#%02X%02X%02XFF" % [167, 244, 50], Cairo::Color::GREEN_LIZARD.to_s) end # Green Sheen: #6EAEA1: (110, 174, 161) test("Green Sheen") do assert_equal("\#%02X%02X%02XFF" % [110, 174, 161], Cairo::Color::GREEN_SHEEN.to_s) end # Green slime: #65FF00: (101, 255, 0) test("Green slime") do assert_equal("\#%02X%02X%02XFF" % [101, 255, 0], Cairo::Color::GREEN_SLIME.to_s) end # Green-yellow: #ADFF2F: (173, 255, 47) test("Green-yellow") do assert_equal("\#%02X%02X%02XFF" % [173, 255, 47], Cairo::Color::GREEN_YELLOW.to_s) end # Green-yellow (Crayola): #F0E891: (240, 232, 145) test("Green-yellow (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [240, 232, 145], Cairo::Color::GREEN_YELLOW_CRAYOLA.to_s) end # Grullo: #A99A86: (169, 154, 134) test("Grullo") do assert_equal("\#%02X%02X%02XFF" % [169, 154, 134], Cairo::Color::GRULLO.to_s) end # Guppie green: #00FF7F: (0, 255, 127) test("Guppie green") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 127], Cairo::Color::GUPPIE_GREEN.to_s) end # Gunmetal: #2a3439: (42, 52, 57) test("Gunmetal") do assert_equal("\#%02X%02X%02XFF" % [42, 52, 57], Cairo::Color::GUNMETAL.to_s) end # Guyabano: #F8F8F8: (248, 248, 248) test("Guyabano") do assert_equal("\#%02X%02X%02XFF" % [248, 248, 248], Cairo::Color::GUYABANO.to_s) end # Halayà úbe: #663854: (102, 55, 84) test("Halay\u00E0 \u00FAbe") do assert_equal("\#%02X%02X%02XFF" % [102, 55, 84], Cairo::Color::HALAYA_UBE.to_s) end # Halloween orange: #EB6123: (235, 97, 35) test("Halloween orange") do assert_equal("\#%02X%02X%02XFF" % [235, 97, 35], Cairo::Color::HALLOWEEN_ORANGE.to_s) end # Han blue: #446CCF: (68, 108, 207) test("Han blue") do assert_equal("\#%02X%02X%02XFF" % [68, 108, 207], Cairo::Color::HAN_BLUE.to_s) end # Han purple: #5218FA: (82, 24, 250) test("Han purple") do assert_equal("\#%02X%02X%02XFF" % [82, 24, 250], Cairo::Color::HAN_PURPLE.to_s) end # Hansa yellow: #E9D66B: (233, 214, 107) test("Hansa yellow") do assert_equal("\#%02X%02X%02XFF" % [233, 214, 107], Cairo::Color::HANSA_YELLOW.to_s) end # Harlequin: #3FFF00: (63, 255, 0) test("Harlequin") do assert_equal("\#%02X%02X%02XFF" % [63, 255, 0], Cairo::Color::HARLEQUIN.to_s) end # Harlequin green: #46CB18: (70, 203, 24) test("Harlequin green") do assert_equal("\#%02X%02X%02XFF" % [70, 203, 24], Cairo::Color::HARLEQUIN_GREEN.to_s) end # Harmonious rose: #F29CB7: (242, 156, 183) test("Harmonious rose") do assert_equal("\#%02X%02X%02XFF" % [242, 156, 183], Cairo::Color::HARMONIOUS_ROSE.to_s) end # Harvard crimson: #C90016: (201, 0, 22) test("Harvard crimson") do assert_equal("\#%02X%02X%02XFF" % [201, 0, 22], Cairo::Color::HARVARD_CRIMSON.to_s) end # Harvest gold: #DA9100: (218, 145, 0) test("Harvest gold") do assert_equal("\#%02X%02X%02XFF" % [218, 145, 0], Cairo::Color::HARVEST_GOLD.to_s) end # Heart gold: #808000: (128, 128, 0) test("Heart gold") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 0], Cairo::Color::HEART_GOLD.to_s) end # Heat Wave: #FF7A00: (255, 122, 0) test("Heat Wave") do assert_equal("\#%02X%02X%02XFF" % [255, 122, 0], Cairo::Color::HEAT_WAVE.to_s) end # Heidelberg red: #960018: (150, 0, 24) test("Heidelberg red") do assert_equal("\#%02X%02X%02XFF" % [150, 0, 24], Cairo::Color::HEIDELBERG_RED.to_s) end # Heliotrope: #DF73FF: (223, 115, 255) test("Heliotrope") do assert_equal("\#%02X%02X%02XFF" % [223, 115, 255], Cairo::Color::HELIOTROPE.to_s) end # Heliotrope gray: #AA98A9: (170, 152, 168) test("Heliotrope gray") do assert_equal("\#%02X%02X%02XFF" % [170, 152, 168], Cairo::Color::HELIOTROPE_GRAY.to_s) end # Heliotrope magenta: #AA00BB: (170, 0, 187) test("Heliotrope magenta") do assert_equal("\#%02X%02X%02XFF" % [170, 0, 187], Cairo::Color::HELIOTROPE_MAGENTA.to_s) end # Hollywood cerise: #F400A1: (244, 0, 161) test("Hollywood cerise") do assert_equal("\#%02X%02X%02XFF" % [244, 0, 161], Cairo::Color::HOLLYWOOD_CERISE.to_s) end # Honeydew: #F0FFF0: (240, 255, 240) test("Honeydew") do assert_equal("\#%02X%02X%02XFF" % [240, 255, 240], Cairo::Color::HONEYDEW.to_s) end # Honolulu blue: #006DB0: (0, 109, 176) test("Honolulu blue") do assert_equal("\#%02X%02X%02XFF" % [0, 109, 176], Cairo::Color::HONOLULU_BLUE.to_s) end # Hooker's green: #49796B: (73, 121, 107) test("Hooker's green") do assert_equal("\#%02X%02X%02XFF" % [73, 121, 107], Cairo::Color::HOOKERS_GREEN.to_s) end # Hot magenta: #FF1DCE: (255, 29, 206) test("Hot magenta") do assert_equal("\#%02X%02X%02XFF" % [255, 29, 206], Cairo::Color::HOT_MAGENTA.to_s) end # Hot pink: #FF69B4: (255, 105, 180) test("Hot pink") do assert_equal("\#%02X%02X%02XFF" % [255, 105, 180], Cairo::Color::HOT_PINK.to_s) end # Hunter green: #355E3B: (53, 94, 59) test("Hunter green") do assert_equal("\#%02X%02X%02XFF" % [53, 94, 59], Cairo::Color::HUNTER_GREEN.to_s) end # Iceberg: #71A6D2: (113, 166, 210) test("Iceberg") do assert_equal("\#%02X%02X%02XFF" % [113, 166, 210], Cairo::Color::ICEBERG.to_s) end # Iced tea: #923C01: (146, 60, 1) test("Iced tea") do assert_equal("\#%02X%02X%02XFF" % [146, 60, 1], Cairo::Color::ICED_TEA.to_s) end # Icterine: #FCF75E: (252, 247, 94) test("Icterine") do assert_equal("\#%02X%02X%02XFF" % [252, 247, 94], Cairo::Color::ICTERINE.to_s) end # Iguana green: #71BC78: (113, 188, 120) test("Iguana green") do assert_equal("\#%02X%02X%02XFF" % [113, 188, 120], Cairo::Color::IGUANA_GREEN.to_s) end # Illuminating emerald: #319177: (49, 145, 119) test("Illuminating emerald") do assert_equal("\#%02X%02X%02XFF" % [49, 145, 119], Cairo::Color::ILLUMINATING_EMERALD.to_s) end # Imperial: #602F6B: (96, 47, 107) test("Imperial") do assert_equal("\#%02X%02X%02XFF" % [96, 47, 107], Cairo::Color::IMPERIAL.to_s) end # Imperial blue: #002395: (0, 35, 149) test("Imperial blue") do assert_equal("\#%02X%02X%02XFF" % [0, 35, 149], Cairo::Color::IMPERIAL_BLUE.to_s) end # Imperial purple: #66023C: (102, 2, 60) test("Imperial purple") do assert_equal("\#%02X%02X%02XFF" % [102, 2, 60], Cairo::Color::IMPERIAL_PURPLE.to_s) end # Imperial red: #ED2939: (237, 41, 57) test("Imperial red") do assert_equal("\#%02X%02X%02XFF" % [237, 41, 57], Cairo::Color::IMPERIAL_RED.to_s) end # Inchworm: #B2EC5D: (178, 236, 93) test("Inchworm") do assert_equal("\#%02X%02X%02XFF" % [178, 236, 93], Cairo::Color::INCHWORM.to_s) end # Independence: #4C516D: (76, 81, 109) test("Independence") do assert_equal("\#%02X%02X%02XFF" % [76, 81, 109], Cairo::Color::INDEPENDENCE.to_s) end # India green: #138808: (19, 136, 8) test("India green") do assert_equal("\#%02X%02X%02XFF" % [19, 136, 8], Cairo::Color::INDIA_GREEN.to_s) end # Indian red: #CD5C5C: (205, 92, 92) test("Indian red") do assert_equal("\#%02X%02X%02XFF" % [205, 92, 92], Cairo::Color::INDIAN_RED.to_s) end # Indian yellow: #E3A857: (227, 168, 87) test("Indian yellow") do assert_equal("\#%02X%02X%02XFF" % [227, 168, 87], Cairo::Color::INDIAN_YELLOW.to_s) end # Indigo: #4B0082: (75, 0, 130) test("Indigo") do assert_equal("\#%02X%02X%02XFF" % [75, 0, 130], Cairo::Color::INDIGO.to_s) end # Indigo dye: #091F92: (9, 31, 146) test("Indigo dye") do assert_equal("\#%02X%02X%02XFF" % [9, 31, 146], Cairo::Color::INDIGO_DYE.to_s) end # Indigo (Crayola): #4F69C6: (79, 105, 198) test("Indigo (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [79, 105, 198], Cairo::Color::INDIGO_CRAYOLA.to_s) end # Indigo (Rainbow): #233067: (35, 48, 103) test("Indigo (Rainbow)") do assert_equal("\#%02X%02X%02XFF" % [35, 48, 103], Cairo::Color::INDIGO_RAINBOW.to_s) end # Indigo (web): #4B0082: (75, 0, 130) test("Indigo (web)") do assert_equal("\#%02X%02X%02XFF" % [75, 0, 130], Cairo::Color::INDIGO_WEB.to_s) end # Infra red: #FF496C: (255, 73, 108) test("Infra red") do assert_equal("\#%02X%02X%02XFF" % [255, 73, 108], Cairo::Color::INFRA_RED.to_s) end # Interdimensional blue: #360CCC: (54, 12, 204) test("Interdimensional blue") do assert_equal("\#%02X%02X%02XFF" % [54, 12, 204], Cairo::Color::INTERDIMENSIONAL_BLUE.to_s) end # International Klein Blue: #002FA7: (0, 47, 167) test("International Klein Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 47, 167], Cairo::Color::INTERNATIONAL_KLEIN_BLUE.to_s) end # International orange (aerospace): #FF4F00: (255, 79, 0) test("International orange (aerospace)") do assert_equal("\#%02X%02X%02XFF" % [255, 79, 0], Cairo::Color::INTERNATIONAL_ORANGE_AEROSPACE.to_s) end # International orange (engineering): #BA160C: (186, 22, 12) test("International orange (engineering)") do assert_equal("\#%02X%02X%02XFF" % [186, 22, 12], Cairo::Color::INTERNATIONAL_ORANGE_ENGINEERING.to_s) end # International orange (Golden Gate Bridge): #C0362C: (192, 54, 44) test("International orange (Golden Gate Bridge)") do assert_equal("\#%02X%02X%02XFF" % [192, 54, 44], Cairo::Color::INTERNATIONAL_ORANGE_GOLDEN_GATE_BRIDGE.to_s) end # Iris: #5A4FCF: (90, 79, 207) test("Iris") do assert_equal("\#%02X%02X%02XFF" % [90, 79, 207], Cairo::Color::IRIS.to_s) end # Iron: #A19D94: (161, 157, 148) test("Iron") do assert_equal("\#%02X%02X%02XFF" % [161, 157, 148], Cairo::Color::IRON.to_s) end # Irresistible: #B3446C: (179, 68, 108) test("Irresistible") do assert_equal("\#%02X%02X%02XFF" % [179, 68, 108], Cairo::Color::IRRESISTIBLE.to_s) end # Isabelline: #F4F0EC: (244, 240, 236) test("Isabelline") do assert_equal("\#%02X%02X%02XFF" % [244, 240, 236], Cairo::Color::ISABELLINE.to_s) end # Islamic green: #009000: (0, 144, 0) test("Islamic green") do assert_equal("\#%02X%02X%02XFF" % [0, 144, 0], Cairo::Color::ISLAMIC_GREEN.to_s) end # Italian sky blue: #B2FFFF: (178, 255, 255) test("Italian sky blue") do assert_equal("\#%02X%02X%02XFF" % [178, 255, 255], Cairo::Color::ITALIAN_SKY_BLUE.to_s) end # Ivory: #FFFFF0: (255, 255, 240) test("Ivory") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 240], Cairo::Color::IVORY.to_s) end # Jacarta: #3D325D: (61, 50, 93) test("Jacarta") do assert_equal("\#%02X%02X%02XFF" % [61, 50, 93], Cairo::Color::JACARTA.to_s) end # Jacko bean: #413628: (65, 54, 40) test("Jacko bean") do assert_equal("\#%02X%02X%02XFF" % [65, 54, 40], Cairo::Color::JACKO_BEAN.to_s) end # Jade: #00A86B: (0, 168, 107) test("Jade") do assert_equal("\#%02X%02X%02XFF" % [0, 168, 107], Cairo::Color::JADE.to_s) end # Japanese carmine: #9D2933: (157, 41, 51) test("Japanese carmine") do assert_equal("\#%02X%02X%02XFF" % [157, 41, 51], Cairo::Color::JAPANESE_CARMINE.to_s) end # Japanese indigo: #264348: (38, 67, 72) test("Japanese indigo") do assert_equal("\#%02X%02X%02XFF" % [38, 67, 72], Cairo::Color::JAPANESE_INDIGO.to_s) end # Japanese laurel: #2F7532: (47, 117, 50) test("Japanese laurel") do assert_equal("\#%02X%02X%02XFF" % [47, 117, 50], Cairo::Color::JAPANESE_LAUREL.to_s) end # Japanese violet: #5B3256: (91, 50, 86) test("Japanese violet") do assert_equal("\#%02X%02X%02XFF" % [91, 50, 86], Cairo::Color::JAPANESE_VIOLET.to_s) end # Jasmine: #F8DE7E: (248, 222, 126) test("Jasmine") do assert_equal("\#%02X%02X%02XFF" % [248, 222, 126], Cairo::Color::JASMINE.to_s) end # Jasper: #D73B3E: (215, 59, 62) test("Jasper") do assert_equal("\#%02X%02X%02XFF" % [215, 59, 62], Cairo::Color::JASPER.to_s) end # Jasper orange: #DE8F4E: (223, 145, 79) test("Jasper orange") do assert_equal("\#%02X%02X%02XFF" % [223, 145, 79], Cairo::Color::JASPER_ORANGE.to_s) end # Jazzberry jam: #A50B5E: (165, 11, 94) test("Jazzberry jam") do assert_equal("\#%02X%02X%02XFF" % [165, 11, 94], Cairo::Color::JAZZBERRY_JAM.to_s) end # Jelly bean: #DA614E: (218, 97, 78) test("Jelly bean") do assert_equal("\#%02X%02X%02XFF" % [218, 97, 78], Cairo::Color::JELLY_BEAN.to_s) end # Jelly bean blue: #44798E: (68, 121, 142) test("Jelly bean blue") do assert_equal("\#%02X%02X%02XFF" % [68, 121, 142], Cairo::Color::JELLY_BEAN_BLUE.to_s) end # Jet: #343434: (52, 52, 52) test("Jet") do assert_equal("\#%02X%02X%02XFF" % [52, 52, 52], Cairo::Color::JET.to_s) end # Jet stream: #BBD0C9: (187, 208, 201) test("Jet stream") do assert_equal("\#%02X%02X%02XFF" % [187, 208, 201], Cairo::Color::JET_STREAM.to_s) end # Jonquil: #F4CA16: (244, 202, 22) test("Jonquil") do assert_equal("\#%02X%02X%02XFF" % [244, 202, 22], Cairo::Color::JONQUIL.to_s) end # Jordy blue: #8AB9F1: (138, 185, 241) test("Jordy blue") do assert_equal("\#%02X%02X%02XFF" % [138, 185, 241], Cairo::Color::JORDY_BLUE.to_s) end # June bud: #BDDA57: (189, 218, 87) test("June bud") do assert_equal("\#%02X%02X%02XFF" % [189, 218, 87], Cairo::Color::JUNE_BUD.to_s) end # Jungle green: #29AB87: (41, 171, 135) test("Jungle green") do assert_equal("\#%02X%02X%02XFF" % [41, 171, 135], Cairo::Color::JUNGLE_GREEN.to_s) end # Kelly green: #4CBB17: (76, 187, 23) test("Kelly green") do assert_equal("\#%02X%02X%02XFF" % [76, 187, 23], Cairo::Color::KELLY_GREEN.to_s) end # Kenyan copper: #7C1C05: (124, 28, 5) test("Kenyan copper") do assert_equal("\#%02X%02X%02XFF" % [124, 28, 5], Cairo::Color::KENYAN_COPPER.to_s) end # Keppel: #3AB09E: (58, 176, 158) test("Keppel") do assert_equal("\#%02X%02X%02XFF" % [58, 176, 158], Cairo::Color::KEPPEL.to_s) end # Key lime: #E8F48C: (232, 244, 140) test("Key lime") do assert_equal("\#%02X%02X%02XFF" % [232, 244, 140], Cairo::Color::KEY_LIME.to_s) end # Khaki: #C3B091: (195, 176, 145) test("Khaki") do assert_equal("\#%02X%02X%02XFF" % [195, 176, 145], Cairo::Color::KHAKI.to_s) end # Khaki (X11): #F0E68C: (240, 230, 140) test("Khaki (X11)") do assert_equal("\#%02X%02X%02XFF" % [240, 230, 140], Cairo::Color::KHAKI_X11.to_s) end # Kiwi: #8EE53F: (142, 229, 63) test("Kiwi") do assert_equal("\#%02X%02X%02XFF" % [142, 229, 63], Cairo::Color::KIWI.to_s) end # Kobe: #882D17: (136, 45, 23) test("Kobe") do assert_equal("\#%02X%02X%02XFF" % [136, 45, 23], Cairo::Color::KOBE.to_s) end # Kobi: #E79FC4: (231, 159, 196) test("Kobi") do assert_equal("\#%02X%02X%02XFF" % [231, 159, 196], Cairo::Color::KOBI.to_s) end # Kobicha: #6B4423: (107, 68, 35) test("Kobicha") do assert_equal("\#%02X%02X%02XFF" % [107, 68, 35], Cairo::Color::KOBICHA.to_s) end # Kombu green: #354230: (53, 66, 48) test("Kombu green") do assert_equal("\#%02X%02X%02XFF" % [53, 66, 48], Cairo::Color::KOMBU_GREEN.to_s) end # KSU Purple: #512888: (79, 38, 131) test("KSU Purple") do assert_equal("\#%02X%02X%02XFF" % [79, 38, 131], Cairo::Color::KSU_PURPLE.to_s) end # KU Crimson: #E8000D: (232, 0, 13) test("KU Crimson") do assert_equal("\#%02X%02X%02XFF" % [232, 0, 13], Cairo::Color::KU_CRIMSON.to_s) end # La Salle green: #087830: (8, 120, 48) test("La Salle green") do assert_equal("\#%02X%02X%02XFF" % [8, 120, 48], Cairo::Color::LA_SALLE_GREEN.to_s) end # Languid lavender: #D6CADD: (214, 202, 221) test("Languid lavender") do assert_equal("\#%02X%02X%02XFF" % [214, 202, 221], Cairo::Color::LANGUID_LAVENDER.to_s) end # Lanzones: #E0BC5B: (224, 188, 91) test("Lanzones") do assert_equal("\#%02X%02X%02XFF" % [224, 188, 91], Cairo::Color::LANZONES.to_s) end # Lapis lazuli: #26619C: (38, 97, 156) test("Lapis lazuli") do assert_equal("\#%02X%02X%02XFF" % [38, 97, 156], Cairo::Color::LAPIS_LAZULI.to_s) end # Laser Lemon: #FFFF66: (255, 255, 102) test("Laser Lemon") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 102], Cairo::Color::LASER_LEMON.to_s) end # Laurel green: #A9BA9D: (169, 186, 157) test("Laurel green") do assert_equal("\#%02X%02X%02XFF" % [169, 186, 157], Cairo::Color::LAUREL_GREEN.to_s) end # Lava: #CF1020: (207, 16, 32) test("Lava") do assert_equal("\#%02X%02X%02XFF" % [207, 16, 32], Cairo::Color::LAVA.to_s) end # Lavender: #B57EDC: (181, 126, 220) test("Lavender") do assert_equal("\#%02X%02X%02XFF" % [181, 126, 220], Cairo::Color::LAVENDER.to_s) end # Lavender (web): #E6E6FA: (230, 230, 250) test("Lavender (web)") do assert_equal("\#%02X%02X%02XFF" % [230, 230, 250], Cairo::Color::LAVENDER_WEB.to_s) end # Lavender blue: #CCCCFF: (204, 204, 255) test("Lavender blue") do assert_equal("\#%02X%02X%02XFF" % [204, 204, 255], Cairo::Color::LAVENDER_BLUE.to_s) end # Lavender blush: #FFF0F5: (255, 240, 245) test("Lavender blush") do assert_equal("\#%02X%02X%02XFF" % [255, 240, 245], Cairo::Color::LAVENDER_BLUSH.to_s) end # Lavender gray: #C4C3D0: (196, 195, 208) test("Lavender gray") do assert_equal("\#%02X%02X%02XFF" % [196, 195, 208], Cairo::Color::LAVENDER_GRAY.to_s) end # Lavender indigo: #9457EB: (148, 87, 235) test("Lavender indigo") do assert_equal("\#%02X%02X%02XFF" % [148, 87, 235], Cairo::Color::LAVENDER_INDIGO.to_s) end # Lavender magenta: #EE82EE: (238, 130, 238) test("Lavender magenta") do assert_equal("\#%02X%02X%02XFF" % [238, 130, 238], Cairo::Color::LAVENDER_MAGENTA.to_s) end # Lavender mist: #E6E6FA: (230, 230, 250) test("Lavender mist") do assert_equal("\#%02X%02X%02XFF" % [230, 230, 250], Cairo::Color::LAVENDER_MIST.to_s) end # Lavender pink: #FBAED2: (251, 174, 210) test("Lavender pink") do assert_equal("\#%02X%02X%02XFF" % [251, 174, 210], Cairo::Color::LAVENDER_PINK.to_s) end # Lavender purple: #967BB6: (150, 123, 182) test("Lavender purple") do assert_equal("\#%02X%02X%02XFF" % [150, 123, 182], Cairo::Color::LAVENDER_PURPLE.to_s) end # Lavender rose: #FBA0E3: (251, 160, 227) test("Lavender rose") do assert_equal("\#%02X%02X%02XFF" % [251, 160, 227], Cairo::Color::LAVENDER_ROSE.to_s) end # Lawn green: #7CFC00: (124, 252, 0) test("Lawn green") do assert_equal("\#%02X%02X%02XFF" % [124, 252, 0], Cairo::Color::LAWN_GREEN.to_s) end # Lemon: #FFF700: (255, 247, 0) test("Lemon") do assert_equal("\#%02X%02X%02XFF" % [255, 247, 0], Cairo::Color::LEMON.to_s) end # Lemon chiffon: #FFFACD: (255, 250, 205) test("Lemon chiffon") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 205], Cairo::Color::LEMON_CHIFFON.to_s) end # Lemon curry: #CCA01D: (204, 160, 29) test("Lemon curry") do assert_equal("\#%02X%02X%02XFF" % [204, 160, 29], Cairo::Color::LEMON_CURRY.to_s) end # Lemon glacier: #FDFF00: (253, 255, 0) test("Lemon glacier") do assert_equal("\#%02X%02X%02XFF" % [253, 255, 0], Cairo::Color::LEMON_GLACIER.to_s) end # Lemon iced tea: #BD3000: (189, 48, 0) test("Lemon iced tea") do assert_equal("\#%02X%02X%02XFF" % [189, 48, 0], Cairo::Color::LEMON_ICED_TEA.to_s) end # Lemon lime: #E3FF00: (227, 255, 0) test("Lemon lime") do assert_equal("\#%02X%02X%02XFF" % [227, 255, 0], Cairo::Color::LEMON_LIME.to_s) end # Lemon meringue: #F6EABE: (246, 234, 190) test("Lemon meringue") do assert_equal("\#%02X%02X%02XFF" % [246, 234, 190], Cairo::Color::LEMON_MERINGUE.to_s) end # Lemon yellow: #FFF44F: (255, 244, 79) test("Lemon yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 244, 79], Cairo::Color::LEMON_YELLOW.to_s) end # Lemon yellow (Crayola): #FFFF9F: (255, 255, 159) test("Lemon yellow (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 159], Cairo::Color::LEMON_YELLOW_CRAYOLA.to_s) end # Lenurple: #BA93D8: (186, 147, 216) test("Lenurple") do assert_equal("\#%02X%02X%02XFF" % [186, 147, 216], Cairo::Color::LENURPLE.to_s) end # Liberty: #545AA7: (84, 90, 167) test("Liberty") do assert_equal("\#%02X%02X%02XFF" % [84, 90, 167], Cairo::Color::LIBERTY.to_s) end # Licorice: #1A1110: (26, 17, 16) test("Licorice") do assert_equal("\#%02X%02X%02XFF" % [26, 17, 16], Cairo::Color::LICORICE.to_s) end # Light apricot: #FDD5B1: (253, 213, 177) test("Light apricot") do assert_equal("\#%02X%02X%02XFF" % [253, 213, 177], Cairo::Color::LIGHT_APRICOT.to_s) end # Light blue: #ADD8E6: (173, 216, 230) test("Light blue") do assert_equal("\#%02X%02X%02XFF" % [173, 216, 230], Cairo::Color::LIGHT_BLUE.to_s) end # Light brown: #B5651D: (181, 101, 29) test("Light brown") do assert_equal("\#%02X%02X%02XFF" % [181, 101, 29], Cairo::Color::LIGHT_BROWN.to_s) end # Light carmine pink: #E66771: (230, 103, 113) test("Light carmine pink") do assert_equal("\#%02X%02X%02XFF" % [230, 103, 113], Cairo::Color::LIGHT_CARMINE_PINK.to_s) end # Light chocolate cosmos: #551F2F: (85, 31, 47) test("Light chocolate cosmos") do assert_equal("\#%02X%02X%02XFF" % [85, 31, 47], Cairo::Color::LIGHT_CHOCOLATE_COSMOS.to_s) end # Light cobalt blue: #88ACE0: (136, 172, 224) test("Light cobalt blue") do assert_equal("\#%02X%02X%02XFF" % [136, 172, 224], Cairo::Color::LIGHT_COBALT_BLUE.to_s) end # Light coral: #F08080: (240, 128, 128) test("Light coral") do assert_equal("\#%02X%02X%02XFF" % [240, 128, 128], Cairo::Color::LIGHT_CORAL.to_s) end # Light cornflower blue: #93CCEA: (147, 204, 234) test("Light cornflower blue") do assert_equal("\#%02X%02X%02XFF" % [147, 204, 234], Cairo::Color::LIGHT_CORNFLOWER_BLUE.to_s) end # Light crimson: #F56991: (245, 105, 145) test("Light crimson") do assert_equal("\#%02X%02X%02XFF" % [245, 105, 145], Cairo::Color::LIGHT_CRIMSON.to_s) end # Light cyan: #E0FFFF: (224, 255, 255) test("Light cyan") do assert_equal("\#%02X%02X%02XFF" % [224, 255, 255], Cairo::Color::LIGHT_CYAN.to_s) end # Light deep pink: #FF5CCD: (255, 92, 205) test("Light deep pink") do assert_equal("\#%02X%02X%02XFF" % [255, 92, 205], Cairo::Color::LIGHT_DEEP_PINK.to_s) end # Light French beige: #C8AD7F: (200, 173, 127) test("Light French beige") do assert_equal("\#%02X%02X%02XFF" % [200, 173, 127], Cairo::Color::LIGHT_FRENCH_BEIGE.to_s) end # Light fuchsia pink: #F984EF: (249, 132, 239) test("Light fuchsia pink") do assert_equal("\#%02X%02X%02XFF" % [249, 132, 239], Cairo::Color::LIGHT_FUCHSIA_PINK.to_s) end # Light gold: #B29700: (178, 151, 0) test("Light gold") do assert_equal("\#%02X%02X%02XFF" % [178, 151, 0], Cairo::Color::LIGHT_GOLD.to_s) end # Light goldenrod: #FFEC8B: (255, 236, 139) test("Light goldenrod") do assert_equal("\#%02X%02X%02XFF" % [255, 236, 139], Cairo::Color::LIGHT_GOLDENROD.to_s) end # Light goldenrod yellow: #FAFAD2: (250, 250, 210) test("Light goldenrod yellow") do assert_equal("\#%02X%02X%02XFF" % [250, 250, 210], Cairo::Color::LIGHT_GOLDENROD_YELLOW.to_s) end # Light gray: #D3D3D3: (211, 211, 211) test("Light gray") do assert_equal("\#%02X%02X%02XFF" % [211, 211, 211], Cairo::Color::LIGHT_GRAY.to_s) end # Light grayish magenta: #CC99CC: (204, 153, 204) test("Light grayish magenta") do assert_equal("\#%02X%02X%02XFF" % [204, 153, 204], Cairo::Color::LIGHT_GRAYISH_MAGENTA.to_s) end # Light green: #90EE90: (144, 238, 144) test("Light green") do assert_equal("\#%02X%02X%02XFF" % [144, 238, 144], Cairo::Color::LIGHT_GREEN.to_s) end # Light hot pink: #FFB3DE: (255, 179, 222) test("Light hot pink") do assert_equal("\#%02X%02X%02XFF" % [255, 179, 222], Cairo::Color::LIGHT_HOT_PINK.to_s) end # Light khaki: #F0E68C: (240, 230, 140) test("Light khaki") do assert_equal("\#%02X%02X%02XFF" % [240, 230, 140], Cairo::Color::LIGHT_KHAKI.to_s) end # Light medium orchid: #D39BCB: (211, 155, 203) test("Light medium orchid") do assert_equal("\#%02X%02X%02XFF" % [211, 155, 203], Cairo::Color::LIGHT_MEDIUM_ORCHID.to_s) end # Light moss green: #ADDFAD: (173, 223, 173) test("Light moss green") do assert_equal("\#%02X%02X%02XFF" % [173, 223, 173], Cairo::Color::LIGHT_MOSS_GREEN.to_s) end # Light mustard: #FF3333: (238, 221, 98) test("Light mustard") do assert_equal("\#%02X%02X%02XFF" % [238, 221, 98], Cairo::Color::LIGHT_MUSTARD.to_s) end # Light orange: #FED8B1: (254, 216, 177) test("Light orange") do assert_equal("\#%02X%02X%02XFF" % [254, 216, 177], Cairo::Color::LIGHT_ORANGE.to_s) end # Light orchid: #E6A8D7: (230, 168, 215) test("Light orchid") do assert_equal("\#%02X%02X%02XFF" % [230, 168, 215], Cairo::Color::LIGHT_ORCHID.to_s) end # Light pastel purple: #B19CD9: (177, 156, 217) test("Light pastel purple") do assert_equal("\#%02X%02X%02XFF" % [177, 156, 217], Cairo::Color::LIGHT_PASTEL_PURPLE.to_s) end # Light periwinkle: #C5CBE1: (197, 203, 225) test("Light periwinkle") do assert_equal("\#%02X%02X%02XFF" % [197, 203, 225], Cairo::Color::LIGHT_PERIWINKLE.to_s) end # Light pink: #FFB6C1: (255, 182, 193) test("Light pink") do assert_equal("\#%02X%02X%02XFF" % [255, 182, 193], Cairo::Color::LIGHT_PINK.to_s) end # Light red: #FF3333: (255, 51, 51) test("Light red") do assert_equal("\#%02X%02X%02XFF" % [255, 51, 51], Cairo::Color::LIGHT_RED.to_s) end # Light red ochre: #E97451: (233, 116, 81) test("Light red ochre") do assert_equal("\#%02X%02X%02XFF" % [233, 116, 81], Cairo::Color::LIGHT_RED_OCHRE.to_s) end # Light salmon: #FFA07A: (255, 160, 122) test("Light salmon") do assert_equal("\#%02X%02X%02XFF" % [255, 160, 122], Cairo::Color::LIGHT_SALMON.to_s) end # Light salmon pink: #FF9999: (255, 153, 153) test("Light salmon pink") do assert_equal("\#%02X%02X%02XFF" % [255, 153, 153], Cairo::Color::LIGHT_SALMON_PINK.to_s) end # Light sea green: #20B2AA: (32, 178, 170) test("Light sea green") do assert_equal("\#%02X%02X%02XFF" % [32, 178, 170], Cairo::Color::LIGHT_SEA_GREEN.to_s) end # Light silver: #D8D8D8: (216, 216, 216) test("Light silver") do assert_equal("\#%02X%02X%02XFF" % [216, 216, 216], Cairo::Color::LIGHT_SILVER.to_s) end # Light sky blue: #87CEFA: (135, 206, 250) test("Light sky blue") do assert_equal("\#%02X%02X%02XFF" % [135, 206, 250], Cairo::Color::LIGHT_SKY_BLUE.to_s) end # Light slate gray: #778899: (119, 136, 153) test("Light slate gray") do assert_equal("\#%02X%02X%02XFF" % [119, 136, 153], Cairo::Color::LIGHT_SLATE_GRAY.to_s) end # Light steel blue: #B0C4DE: (176, 196, 222) test("Light steel blue") do assert_equal("\#%02X%02X%02XFF" % [176, 196, 222], Cairo::Color::LIGHT_STEEL_BLUE.to_s) end # Light taupe: #B38B6D: (179, 139, 109) test("Light taupe") do assert_equal("\#%02X%02X%02XFF" % [179, 139, 109], Cairo::Color::LIGHT_TAUPE.to_s) end # Light Thulian pink: #E68FAC: (230, 143, 172) test("Light Thulian pink") do assert_equal("\#%02X%02X%02XFF" % [230, 143, 172], Cairo::Color::LIGHT_THULIAN_PINK.to_s) end # Light turquoise: #AFE4DE: (175, 228, 222) test("Light turquoise") do assert_equal("\#%02X%02X%02XFF" % [175, 228, 222], Cairo::Color::LIGHT_TURQUOISE.to_s) end # Light violet: #7A5299: (122, 82, 153) test("Light violet") do assert_equal("\#%02X%02X%02XFF" % [122, 82, 153], Cairo::Color::LIGHT_VIOLET.to_s) end # Light yellow: #FFFFE0: (255, 255, 224) test("Light yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 224], Cairo::Color::LIGHT_YELLOW.to_s) end # Lilac: #C8A2C8: (200, 162, 200) test("Lilac") do assert_equal("\#%02X%02X%02XFF" % [200, 162, 200], Cairo::Color::LILAC.to_s) end # Lilac Luster: #AE98AA: (174, 152, 170) test("Lilac Luster") do assert_equal("\#%02X%02X%02XFF" % [174, 152, 170], Cairo::Color::LILAC_LUSTER.to_s) end # Lime (color wheel): #BFFF00: (191, 255, 0) test("Lime (color wheel)") do assert_equal("\#%02X%02X%02XFF" % [191, 255, 0], Cairo::Color::LIME_COLOR_WHEEL.to_s) end # Lime (web) (X11 green): #00FF00: (0, 255, 0) test("Lime (web) (X11 green)") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 0], Cairo::Color::LIME_WEB_X11_GREEN.to_s) end # Lime green: #32CD32: (50, 205, 50) test("Lime green") do assert_equal("\#%02X%02X%02XFF" % [50, 205, 50], Cairo::Color::LIME_GREEN.to_s) end # Limerick: #9DC209: (157, 194, 9) test("Limerick") do assert_equal("\#%02X%02X%02XFF" % [157, 194, 9], Cairo::Color::LIMERICK.to_s) end # Lincoln green: #195905: (25, 89, 5) test("Lincoln green") do assert_equal("\#%02X%02X%02XFF" % [25, 89, 5], Cairo::Color::LINCOLN_GREEN.to_s) end # Linen: #FAF0E6: (250, 240, 230) test("Linen") do assert_equal("\#%02X%02X%02XFF" % [250, 240, 230], Cairo::Color::LINEN.to_s) end # Lion: #C19A6B: (193, 154, 107) test("Lion") do assert_equal("\#%02X%02X%02XFF" % [193, 154, 107], Cairo::Color::LION.to_s) end # Liseran purple: #DE6FA1: (222, 111, 161) test("Liseran purple") do assert_equal("\#%02X%02X%02XFF" % [222, 111, 161], Cairo::Color::LISERAN_PURPLE.to_s) end # Little boy blue: #6CA0DC: (108, 160, 220) test("Little boy blue") do assert_equal("\#%02X%02X%02XFF" % [108, 160, 220], Cairo::Color::LITTLE_BOY_BLUE.to_s) end # Little girl pink: #F8B9D4: (248, 185, 212) test("Little girl pink") do assert_equal("\#%02X%02X%02XFF" % [248, 185, 212], Cairo::Color::LITTLE_GIRL_PINK.to_s) end # Liver: #674C47: (103, 76, 71) test("Liver") do assert_equal("\#%02X%02X%02XFF" % [103, 76, 71], Cairo::Color::LIVER.to_s) end # Liver (dogs): #B86D29: (184, 109, 41) test("Liver (dogs)") do assert_equal("\#%02X%02X%02XFF" % [184, 109, 41], Cairo::Color::LIVER_DOGS.to_s) end # Liver (organ): #6C2E1F: (108, 46, 31) test("Liver (organ)") do assert_equal("\#%02X%02X%02XFF" % [108, 46, 31], Cairo::Color::LIVER_ORGAN.to_s) end # Liver chestnut: #987456: (152, 116, 86) test("Liver chestnut") do assert_equal("\#%02X%02X%02XFF" % [152, 116, 86], Cairo::Color::LIVER_CHESTNUT.to_s) end # Livid: #6699CC: (102, 153, 204) test("Livid") do assert_equal("\#%02X%02X%02XFF" % [102, 153, 204], Cairo::Color::LIVID.to_s) end # Lotion: #FEFDFA: (255, 254, 250) test("Lotion") do assert_equal("\#%02X%02X%02XFF" % [255, 254, 250], Cairo::Color::LOTION.to_s) end # Lotion blue: #15F2FD: (123, 154, 200) test("Lotion blue") do assert_equal("\#%02X%02X%02XFF" % [123, 154, 200], Cairo::Color::LOTION_BLUE.to_s) end # Lotion pink: #ECCFCF: (236, 207, 207) test("Lotion pink") do assert_equal("\#%02X%02X%02XFF" % [236, 207, 207], Cairo::Color::LOTION_PINK.to_s) end # Lumber: #FFE4CD: (255, 228, 205) test("Lumber") do assert_equal("\#%02X%02X%02XFF" % [255, 228, 205], Cairo::Color::LUMBER.to_s) end # Lust: #E62020: (230, 32, 32) test("Lust") do assert_equal("\#%02X%02X%02XFF" % [230, 32, 32], Cairo::Color::LUST.to_s) end # Maastricht Blue: #001C3D: (0, 28, 61) test("Maastricht Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 28, 61], Cairo::Color::MAASTRICHT_BLUE.to_s) end # Macaroni and Cheese: #FFBD88: (255, 189, 136) test("Macaroni and Cheese") do assert_equal("\#%02X%02X%02XFF" % [255, 189, 136], Cairo::Color::MACARONI_AND_CHEESE.to_s) end # Madder Lake: #CC3336: (204, 51, 54) test("Madder Lake") do assert_equal("\#%02X%02X%02XFF" % [204, 51, 54], Cairo::Color::MADDER_LAKE.to_s) end # Magenta: #FF00FF: (255, 0, 255) test("Magenta") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 255], Cairo::Color::MAGENTA.to_s) end # Mahogany: #C04000: (192, 64, 0) test("Mahogany") do assert_equal("\#%02X%02X%02XFF" % [192, 64, 0], Cairo::Color::MAHOGANY.to_s) end # Maize: #FBEC5D: (251, 236, 93) test("Maize") do assert_equal("\#%02X%02X%02XFF" % [251, 236, 93], Cairo::Color::MAIZE.to_s) end # Maize (Crayola): #F2C649: (242, 198, 73) test("Maize (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [242, 198, 73], Cairo::Color::MAIZE_CRAYOLA.to_s) end # Majorelle Blue: #6050DC: (96, 80, 220) test("Majorelle Blue") do assert_equal("\#%02X%02X%02XFF" % [96, 80, 220], Cairo::Color::MAJORELLE_BLUE.to_s) end # Malachite: #0BDA51: (11, 218, 81) test("Malachite") do assert_equal("\#%02X%02X%02XFF" % [11, 218, 81], Cairo::Color::MALACHITE.to_s) end # Manatee: #979AAA: (151, 154, 170) test("Manatee") do assert_equal("\#%02X%02X%02XFF" % [151, 154, 170], Cairo::Color::MANATEE.to_s) end # Mandarin: #F37A48: (243, 122, 72) test("Mandarin") do assert_equal("\#%02X%02X%02XFF" % [243, 122, 72], Cairo::Color::MANDARIN.to_s) end # Mango: #FDBE02: (253, 190, 2) test("Mango") do assert_equal("\#%02X%02X%02XFF" % [253, 190, 2], Cairo::Color::MANGO.to_s) end # Mango green: #96FF00: (150, 255, 0) test("Mango green") do assert_equal("\#%02X%02X%02XFF" % [150, 255, 0], Cairo::Color::MANGO_GREEN.to_s) end # Mango Tango: #FF8243: (255, 130, 67) test("Mango Tango") do assert_equal("\#%02X%02X%02XFF" % [255, 130, 67], Cairo::Color::MANGO_TANGO.to_s) end # Mantis: #74C365: (116, 195, 101) test("Mantis") do assert_equal("\#%02X%02X%02XFF" % [116, 195, 101], Cairo::Color::MANTIS.to_s) end # Mardi Gras: #880085: (136, 0, 133) test("Mardi Gras") do assert_equal("\#%02X%02X%02XFF" % [136, 0, 133], Cairo::Color::MARDI_GRAS.to_s) end # Marigold: #EAA221: (234, 162, 33) test("Marigold") do assert_equal("\#%02X%02X%02XFF" % [234, 162, 33], Cairo::Color::MARIGOLD.to_s) end # Maroon (Crayola): #C32148: (195, 33, 72) test("Maroon (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [195, 33, 72], Cairo::Color::MAROON_CRAYOLA.to_s) end # Maroon (HTML/CSS): #800000: (128, 0, 0) test("Maroon (HTML/CSS)") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 0], Cairo::Color::MAROON_HTML_CSS.to_s) end # Maroon (X11): #B03060: (176, 48, 96) test("Maroon (X11)") do assert_equal("\#%02X%02X%02XFF" % [176, 48, 96], Cairo::Color::MAROON_X11.to_s) end # Mauve: #E0B0FF: (224, 176, 255) test("Mauve") do assert_equal("\#%02X%02X%02XFF" % [224, 176, 255], Cairo::Color::MAUVE.to_s) end # Mauve taupe: #915F6D: (145, 95, 109) test("Mauve taupe") do assert_equal("\#%02X%02X%02XFF" % [145, 95, 109], Cairo::Color::MAUVE_TAUPE.to_s) end # Mauvelous: #EF98AA: (239, 152, 170) test("Mauvelous") do assert_equal("\#%02X%02X%02XFF" % [239, 152, 170], Cairo::Color::MAUVELOUS.to_s) end # Maximum Blue: #47ABCC: (71, 171, 204) test("Maximum Blue") do assert_equal("\#%02X%02X%02XFF" % [71, 171, 204], Cairo::Color::MAXIMUM_BLUE.to_s) end # Maximum Blue Green: #30BFBF: (48, 191, 191) test("Maximum Blue Green") do assert_equal("\#%02X%02X%02XFF" % [48, 191, 191], Cairo::Color::MAXIMUM_BLUE_GREEN.to_s) end # Maximum Blue Purple: #ACACE6: (172, 172, 230) test("Maximum Blue Purple") do assert_equal("\#%02X%02X%02XFF" % [172, 172, 230], Cairo::Color::MAXIMUM_BLUE_PURPLE.to_s) end # Maximum Green: #5E8C31: (94, 140, 49) test("Maximum Green") do assert_equal("\#%02X%02X%02XFF" % [94, 140, 49], Cairo::Color::MAXIMUM_GREEN.to_s) end # Maximum Green Yellow: #D9E650: (217, 230, 80) test("Maximum Green Yellow") do assert_equal("\#%02X%02X%02XFF" % [217, 230, 80], Cairo::Color::MAXIMUM_GREEN_YELLOW.to_s) end # Maximum orange: #FF5B00: (255, 91, 0) test("Maximum orange") do assert_equal("\#%02X%02X%02XFF" % [255, 91, 0], Cairo::Color::MAXIMUM_ORANGE.to_s) end # Maximum Purple: #733380: (115, 51, 128) test("Maximum Purple") do assert_equal("\#%02X%02X%02XFF" % [115, 51, 128], Cairo::Color::MAXIMUM_PURPLE.to_s) end # Maximum pink: #F6A5F2: (246, 165, 242) test("Maximum pink") do assert_equal("\#%02X%02X%02XFF" % [246, 165, 242], Cairo::Color::MAXIMUM_PINK.to_s) end # Maximum red: #D92121: (217, 33, 33) test("Maximum red") do assert_equal("\#%02X%02X%02XFF" % [217, 33, 33], Cairo::Color::MAXIMUM_RED.to_s) end # Maximum Red Purple: #A63A79: (166, 58, 121) test("Maximum Red Purple") do assert_equal("\#%02X%02X%02XFF" % [166, 58, 121], Cairo::Color::MAXIMUM_RED_PURPLE.to_s) end # Maximum violet: #892F77: (137, 47, 119) test("Maximum violet") do assert_equal("\#%02X%02X%02XFF" % [137, 47, 119], Cairo::Color::MAXIMUM_VIOLET.to_s) end # Maximum yellow: #FAFA37: (250, 250, 55) test("Maximum yellow") do assert_equal("\#%02X%02X%02XFF" % [250, 250, 55], Cairo::Color::MAXIMUM_YELLOW.to_s) end # Maximum yellow red: #F2BA49: (242, 186, 73) test("Maximum yellow red") do assert_equal("\#%02X%02X%02XFF" % [242, 186, 73], Cairo::Color::MAXIMUM_YELLOW_RED.to_s) end # May green: #4C9141: (76, 145, 65) test("May green") do assert_equal("\#%02X%02X%02XFF" % [76, 145, 65], Cairo::Color::MAY_GREEN.to_s) end # Maya blue: #73C2FB: (115, 194, 251) test("Maya blue") do assert_equal("\#%02X%02X%02XFF" % [115, 194, 251], Cairo::Color::MAYA_BLUE.to_s) end # Meat brown: #E5B73B: (229, 183, 59) test("Meat brown") do assert_equal("\#%02X%02X%02XFF" % [229, 183, 59], Cairo::Color::MEAT_BROWN.to_s) end # Medium aquamarine: #66DDAA: (102, 221, 170) test("Medium aquamarine") do assert_equal("\#%02X%02X%02XFF" % [102, 221, 170], Cairo::Color::MEDIUM_AQUAMARINE.to_s) end # Medium blue: #0000CD: (0, 0, 205) test("Medium blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 205], Cairo::Color::MEDIUM_BLUE.to_s) end # Medium candy apple red: #E2062C: (226, 6, 44) test("Medium candy apple red") do assert_equal("\#%02X%02X%02XFF" % [226, 6, 44], Cairo::Color::MEDIUM_CANDY_APPLE_RED.to_s) end # Medium carmine: #AF4035: (175, 64, 53) test("Medium carmine") do assert_equal("\#%02X%02X%02XFF" % [175, 64, 53], Cairo::Color::MEDIUM_CARMINE.to_s) end # Medium champagne: #F3E5AB: (243, 229, 171) test("Medium champagne") do assert_equal("\#%02X%02X%02XFF" % [243, 229, 171], Cairo::Color::MEDIUM_CHAMPAGNE.to_s) end # Medium electric blue: #035096: (3, 80, 150) test("Medium electric blue") do assert_equal("\#%02X%02X%02XFF" % [3, 80, 150], Cairo::Color::MEDIUM_ELECTRIC_BLUE.to_s) end # Medium green: #037949: (3, 121, 73) test("Medium green") do assert_equal("\#%02X%02X%02XFF" % [3, 121, 73], Cairo::Color::MEDIUM_GREEN.to_s) end # Medium jungle green: #1C352D: (28, 53, 45) test("Medium jungle green") do assert_equal("\#%02X%02X%02XFF" % [28, 53, 45], Cairo::Color::MEDIUM_JUNGLE_GREEN.to_s) end # Medium lavender magenta: #DDA0DD: (221, 160, 221) test("Medium lavender magenta") do assert_equal("\#%02X%02X%02XFF" % [221, 160, 221], Cairo::Color::MEDIUM_LAVENDER_MAGENTA.to_s) end # Medium orange: #FF7802: (255, 120, 2) test("Medium orange") do assert_equal("\#%02X%02X%02XFF" % [255, 120, 2], Cairo::Color::MEDIUM_ORANGE.to_s) end # Medium orchid: #BA55D3: (186, 85, 211) test("Medium orchid") do assert_equal("\#%02X%02X%02XFF" % [186, 85, 211], Cairo::Color::MEDIUM_ORCHID.to_s) end # Medium Persian blue: #0067A5: (0, 103, 165) test("Medium Persian blue") do assert_equal("\#%02X%02X%02XFF" % [0, 103, 165], Cairo::Color::MEDIUM_PERSIAN_BLUE.to_s) end # Medium pink: #FE6E9F: (254, 110, 159) test("Medium pink") do assert_equal("\#%02X%02X%02XFF" % [254, 110, 159], Cairo::Color::MEDIUM_PINK.to_s) end # Medium purple: #9370DB: (147, 112, 219) test("Medium purple") do assert_equal("\#%02X%02X%02XFF" % [147, 112, 219], Cairo::Color::MEDIUM_PURPLE.to_s) end # Medium red: #B10304: (177, 3, 4) test("Medium red") do assert_equal("\#%02X%02X%02XFF" % [177, 3, 4], Cairo::Color::MEDIUM_RED.to_s) end # Medium red-violet: #BB3385: (187, 51, 133) test("Medium red-violet") do assert_equal("\#%02X%02X%02XFF" % [187, 51, 133], Cairo::Color::MEDIUM_RED_VIOLET.to_s) end # Medium ruby: #AA4069: (170, 64, 105) test("Medium ruby") do assert_equal("\#%02X%02X%02XFF" % [170, 64, 105], Cairo::Color::MEDIUM_RUBY.to_s) end # Medium sea green: #3CB371: (60, 179, 113) test("Medium sea green") do assert_equal("\#%02X%02X%02XFF" % [60, 179, 113], Cairo::Color::MEDIUM_SEA_GREEN.to_s) end # Medium sky blue: #80DAEB: (128, 218, 235) test("Medium sky blue") do assert_equal("\#%02X%02X%02XFF" % [128, 218, 235], Cairo::Color::MEDIUM_SKY_BLUE.to_s) end # Medium slate blue: #7B68EE: (123, 104, 238) test("Medium slate blue") do assert_equal("\#%02X%02X%02XFF" % [123, 104, 238], Cairo::Color::MEDIUM_SLATE_BLUE.to_s) end # Medium spring bud: #C9DC87: (201, 220, 135) test("Medium spring bud") do assert_equal("\#%02X%02X%02XFF" % [201, 220, 135], Cairo::Color::MEDIUM_SPRING_BUD.to_s) end # Medium spring green: #00FA9A: (0, 250, 154) test("Medium spring green") do assert_equal("\#%02X%02X%02XFF" % [0, 250, 154], Cairo::Color::MEDIUM_SPRING_GREEN.to_s) end # Medium taupe: #674C47: (103, 76, 71) test("Medium taupe") do assert_equal("\#%02X%02X%02XFF" % [103, 76, 71], Cairo::Color::MEDIUM_TAUPE.to_s) end # Medium turquoise: #48D1CC: (72, 209, 204) test("Medium turquoise") do assert_equal("\#%02X%02X%02XFF" % [72, 209, 204], Cairo::Color::MEDIUM_TURQUOISE.to_s) end # Medium Tuscan red: #79443B: (121, 68, 59) test("Medium Tuscan red") do assert_equal("\#%02X%02X%02XFF" % [121, 68, 59], Cairo::Color::MEDIUM_TUSCAN_RED.to_s) end # Medium vermilion: #D9603B: (217, 96, 59) test("Medium vermilion") do assert_equal("\#%02X%02X%02XFF" % [217, 96, 59], Cairo::Color::MEDIUM_VERMILION.to_s) end # Medium violet: #65315F: (101, 49, 95) test("Medium violet") do assert_equal("\#%02X%02X%02XFF" % [101, 49, 95], Cairo::Color::MEDIUM_VIOLET.to_s) end # Medium violet-red: #C71585: (199, 21, 133) test("Medium violet-red") do assert_equal("\#%02X%02X%02XFF" % [199, 21, 133], Cairo::Color::MEDIUM_VIOLET_RED.to_s) end # Medium yellow: #FFE302: (255, 227, 2) test("Medium yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 227, 2], Cairo::Color::MEDIUM_YELLOW.to_s) end # Mellow apricot: #F8B878: (248, 184, 120) test("Mellow apricot") do assert_equal("\#%02X%02X%02XFF" % [248, 184, 120], Cairo::Color::MELLOW_APRICOT.to_s) end # Mellow yellow: #F8DE7E: (248, 222, 126) test("Mellow yellow") do assert_equal("\#%02X%02X%02XFF" % [248, 222, 126], Cairo::Color::MELLOW_YELLOW.to_s) end # Melon: #FDBCB4: (253, 188, 180) test("Melon") do assert_equal("\#%02X%02X%02XFF" % [253, 188, 180], Cairo::Color::MELON.to_s) end # Melon (Crayola): #FEBAAD: (254, 186, 173) test("Melon (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [254, 186, 173], Cairo::Color::MELON_CRAYOLA.to_s) end # Menthol: #C1F9A2: (193, 249, 162) test("Menthol") do assert_equal("\#%02X%02X%02XFF" % [193, 249, 162], Cairo::Color::MENTHOL.to_s) end # Metallic blue: #32527B: (50, 82, 123) test("Metallic blue") do assert_equal("\#%02X%02X%02XFF" % [50, 82, 123], Cairo::Color::METALLIC_BLUE.to_s) end # Metallic bronze: #A97142: (169, 113, 66) test("Metallic bronze") do assert_equal("\#%02X%02X%02XFF" % [169, 113, 66], Cairo::Color::METALLIC_BRONZE.to_s) end # Metallic brown: #AC4313: (172, 67, 19) test("Metallic brown") do assert_equal("\#%02X%02X%02XFF" % [172, 67, 19], Cairo::Color::METALLIC_BROWN.to_s) end # Metallic gold: #D3AF37: (211, 175, 55) test("Metallic gold") do assert_equal("\#%02X%02X%02XFF" % [211, 175, 55], Cairo::Color::METALLIC_GOLD.to_s) end # Metallic green: #296E01: (41, 110, 1) test("Metallic green") do assert_equal("\#%02X%02X%02XFF" % [41, 110, 1], Cairo::Color::METALLIC_GREEN.to_s) end # Metallic orange: #DA680F: (218, 104, 15) test("Metallic orange") do assert_equal("\#%02X%02X%02XFF" % [218, 104, 15], Cairo::Color::METALLIC_ORANGE.to_s) end # Metallic pink: #EDA6C4: (237, 166, 196) test("Metallic pink") do assert_equal("\#%02X%02X%02XFF" % [237, 166, 196], Cairo::Color::METALLIC_PINK.to_s) end # Metallic red: #A62C2B: (166, 44, 43) test("Metallic red") do assert_equal("\#%02X%02X%02XFF" % [166, 44, 43], Cairo::Color::METALLIC_RED.to_s) end # Metallic Seaweed: #0A7E8C: (10, 126, 140) test("Metallic Seaweed") do assert_equal("\#%02X%02X%02XFF" % [10, 126, 140], Cairo::Color::METALLIC_SEAWEED.to_s) end # Metallic silver: #A8A9AD: (168, 169, 173) test("Metallic silver") do assert_equal("\#%02X%02X%02XFF" % [168, 169, 173], Cairo::Color::METALLIC_SILVER.to_s) end # Metallic Sunburst: #9C7C38: (156, 124, 56) test("Metallic Sunburst") do assert_equal("\#%02X%02X%02XFF" % [156, 124, 56], Cairo::Color::METALLIC_SUNBURST.to_s) end # Metallic violet: #5B0A91: (90, 10, 145) test("Metallic violet") do assert_equal("\#%02X%02X%02XFF" % [90, 10, 145], Cairo::Color::METALLIC_VIOLET.to_s) end # Metallic yellow: #FDCC0D: (253, 204, 13) test("Metallic yellow") do assert_equal("\#%02X%02X%02XFF" % [253, 204, 13], Cairo::Color::METALLIC_YELLOW.to_s) end # Mexican pink: #E4007C: (228, 0, 124) test("Mexican pink") do assert_equal("\#%02X%02X%02XFF" % [228, 0, 124], Cairo::Color::MEXICAN_PINK.to_s) end # Microsoft blue: #00A2ED: (0, 162, 237) test("Microsoft blue") do assert_equal("\#%02X%02X%02XFF" % [0, 162, 237], Cairo::Color::MICROSOFT_BLUE.to_s) end # Microsoft Edge blue: #0078D7: (0, 120, 215) test("Microsoft Edge blue") do assert_equal("\#%02X%02X%02XFF" % [0, 120, 215], Cairo::Color::MICROSOFT_EDGE_BLUE.to_s) end # Microsoft green: #7DB700: (125, 183, 0) test("Microsoft green") do assert_equal("\#%02X%02X%02XFF" % [125, 183, 0], Cairo::Color::MICROSOFT_GREEN.to_s) end # Microsoft red: #F04E1F: (240, 78, 31) test("Microsoft red") do assert_equal("\#%02X%02X%02XFF" % [240, 78, 31], Cairo::Color::MICROSOFT_RED.to_s) end # Microsoft yellow: #FDB900: (253, 185, 0) test("Microsoft yellow") do assert_equal("\#%02X%02X%02XFF" % [253, 185, 0], Cairo::Color::MICROSOFT_YELLOW.to_s) end # Middle blue: #7ED4E6: (126, 212, 230) test("Middle blue") do assert_equal("\#%02X%02X%02XFF" % [126, 212, 230], Cairo::Color::MIDDLE_BLUE.to_s) end # Middle blue green: #8DD9CC: (141, 217, 204) test("Middle blue green") do assert_equal("\#%02X%02X%02XFF" % [141, 217, 204], Cairo::Color::MIDDLE_BLUE_GREEN.to_s) end # Middle blue purple: #8B72BE: (139, 114, 190) test("Middle blue purple") do assert_equal("\#%02X%02X%02XFF" % [139, 114, 190], Cairo::Color::MIDDLE_BLUE_PURPLE.to_s) end # Middle grey: #8B8680: (139, 134, 128) test("Middle grey") do assert_equal("\#%02X%02X%02XFF" % [139, 134, 128], Cairo::Color::MIDDLE_GREY.to_s) end # Middle green: #4D8C57: (77, 140, 87) test("Middle green") do assert_equal("\#%02X%02X%02XFF" % [77, 140, 87], Cairo::Color::MIDDLE_GREEN.to_s) end # Middle green yellow: #ACBF60: (172, 191, 96) test("Middle green yellow") do assert_equal("\#%02X%02X%02XFF" % [172, 191, 96], Cairo::Color::MIDDLE_GREEN_YELLOW.to_s) end # Middle purple: #D982B5: (217, 130, 181) test("Middle purple") do assert_equal("\#%02X%02X%02XFF" % [217, 130, 181], Cairo::Color::MIDDLE_PURPLE.to_s) end # Middle red: #E58E73: (229, 144, 115) test("Middle red") do assert_equal("\#%02X%02X%02XFF" % [229, 144, 115], Cairo::Color::MIDDLE_RED.to_s) end # Middle red purple: #A55353: (165, 83, 83) test("Middle red purple") do assert_equal("\#%02X%02X%02XFF" % [165, 83, 83], Cairo::Color::MIDDLE_RED_PURPLE.to_s) end # Middle yellow: #FFEB00: (255, 235, 0) test("Middle yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 235, 0], Cairo::Color::MIDDLE_YELLOW.to_s) end # Middle yellow red: #ECB176: (236, 177, 118) test("Middle yellow red") do assert_equal("\#%02X%02X%02XFF" % [236, 177, 118], Cairo::Color::MIDDLE_YELLOW_RED.to_s) end # Midnight: #702670: (112, 38, 112) test("Midnight") do assert_equal("\#%02X%02X%02XFF" % [112, 38, 112], Cairo::Color::MIDNIGHT.to_s) end # Midnight blue: #191970: (25, 25, 112) test("Midnight blue") do assert_equal("\#%02X%02X%02XFF" % [25, 25, 112], Cairo::Color::MIDNIGHT_BLUE.to_s) end # Midnight green (eagle green): #004953: (0, 73, 83) test("Midnight green (eagle green)") do assert_equal("\#%02X%02X%02XFF" % [0, 73, 83], Cairo::Color::MIDNIGHT_GREEN_EAGLE_GREEN.to_s) end # Mikado yellow: #FFC40C: (255, 196, 12) test("Mikado yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 196, 12], Cairo::Color::MIKADO_YELLOW.to_s) end # Milk: #FDFFF5: (253, 255, 245) test("Milk") do assert_equal("\#%02X%02X%02XFF" % [253, 255, 245], Cairo::Color::MILK.to_s) end # Milk chocolate: #84563C: (132, 86, 60) test("Milk chocolate") do assert_equal("\#%02X%02X%02XFF" % [132, 86, 60], Cairo::Color::MILK_CHOCOLATE.to_s) end # Mimi pink: #FFDAE9: (255, 218, 233) test("Mimi pink") do assert_equal("\#%02X%02X%02XFF" % [255, 218, 233], Cairo::Color::MIMI_PINK.to_s) end # Mindaro: #E3F988: (227, 249, 136) test("Mindaro") do assert_equal("\#%02X%02X%02XFF" % [227, 249, 136], Cairo::Color::MINDARO.to_s) end # Ming: #36747D: (54, 116, 125) test("Ming") do assert_equal("\#%02X%02X%02XFF" % [54, 116, 125], Cairo::Color::MING.to_s) end # Minion yellow: #F5E050: (245, 220, 80) test("Minion yellow") do assert_equal("\#%02X%02X%02XFF" % [245, 220, 80], Cairo::Color::MINION_YELLOW.to_s) end # Mint: #3EB489: (62, 180, 137) test("Mint") do assert_equal("\#%02X%02X%02XFF" % [62, 180, 137], Cairo::Color::MINT.to_s) end # Mint cream: #F5FFFA: (245, 255, 250) test("Mint cream") do assert_equal("\#%02X%02X%02XFF" % [245, 255, 250], Cairo::Color::MINT_CREAM.to_s) end # Mint green: #98FF98: (152, 255, 152) test("Mint green") do assert_equal("\#%02X%02X%02XFF" % [152, 255, 152], Cairo::Color::MINT_GREEN.to_s) end # Misty Moss: #BBB477: (187, 180, 119) test("Misty Moss") do assert_equal("\#%02X%02X%02XFF" % [187, 180, 119], Cairo::Color::MISTY_MOSS.to_s) end # Misty rose: #FFE4E1: (255, 228, 225) test("Misty rose") do assert_equal("\#%02X%02X%02XFF" % [255, 228, 225], Cairo::Color::MISTY_ROSE.to_s) end # Moccasin: #FAEBD7: (250, 235, 215) test("Moccasin") do assert_equal("\#%02X%02X%02XFF" % [250, 235, 215], Cairo::Color::MOCCASIN.to_s) end # Mocha: #BEA493: (190, 164, 147) test("Mocha") do assert_equal("\#%02X%02X%02XFF" % [190, 164, 147], Cairo::Color::MOCHA.to_s) end # Mode beige: #967117: (150, 113, 23) test("Mode beige") do assert_equal("\#%02X%02X%02XFF" % [150, 113, 23], Cairo::Color::MODE_BEIGE.to_s) end # Moonstone: #3AA8C1: (58, 168, 193) test("Moonstone") do assert_equal("\#%02X%02X%02XFF" % [58, 168, 193], Cairo::Color::MOONSTONE.to_s) end # Moonstone blue: #73A9C2: (115, 169, 194) test("Moonstone blue") do assert_equal("\#%02X%02X%02XFF" % [115, 169, 194], Cairo::Color::MOONSTONE_BLUE.to_s) end # Mordant red 19: #AE0C00: (174, 12, 0) test("Mordant red 19") do assert_equal("\#%02X%02X%02XFF" % [174, 12, 0], Cairo::Color::MORDANT_RED_19.to_s) end # Morning blue: #8DA399: (141, 163, 153) test("Morning blue") do assert_equal("\#%02X%02X%02XFF" % [141, 163, 153], Cairo::Color::MORNING_BLUE.to_s) end # Moss green: #8A9A5B: (138, 154, 91) test("Moss green") do assert_equal("\#%02X%02X%02XFF" % [138, 154, 91], Cairo::Color::MOSS_GREEN.to_s) end # Mountain Meadow: #30BA8F: (48, 186, 143) test("Mountain Meadow") do assert_equal("\#%02X%02X%02XFF" % [48, 186, 143], Cairo::Color::MOUNTAIN_MEADOW.to_s) end # Mountbatten pink: #997A8D: (153, 122, 141) test("Mountbatten pink") do assert_equal("\#%02X%02X%02XFF" % [153, 122, 141], Cairo::Color::MOUNTBATTEN_PINK.to_s) end # MSU green: #18453B: (24, 69, 59) test("MSU green") do assert_equal("\#%02X%02X%02XFF" % [24, 69, 59], Cairo::Color::MSU_GREEN.to_s) end # Mud: #70543E: (111, 83, 61) test("Mud") do assert_equal("\#%02X%02X%02XFF" % [111, 83, 61], Cairo::Color::MUD.to_s) end # Mughal green: #306030: (48, 96, 48) test("Mughal green") do assert_equal("\#%02X%02X%02XFF" % [48, 96, 48], Cairo::Color::MUGHAL_GREEN.to_s) end # Mulberry: #C54B8C: (197, 75, 140) test("Mulberry") do assert_equal("\#%02X%02X%02XFF" % [197, 75, 140], Cairo::Color::MULBERRY.to_s) end # Mulberry (Crayola): #C8509B: (200, 80, 155) test("Mulberry (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [200, 80, 155], Cairo::Color::MULBERRY_CRAYOLA.to_s) end # Mummy's Tomb: #828E84: (130, 142, 132) test("Mummy's Tomb") do assert_equal("\#%02X%02X%02XFF" % [130, 142, 132], Cairo::Color::MUMMYS_TOMB.to_s) end # Mustard: #FFDB58: (255, 219, 88) test("Mustard") do assert_equal("\#%02X%02X%02XFF" % [255, 219, 88], Cairo::Color::MUSTARD.to_s) end # Mustard brown: #CD7A00: (205, 122, 0) test("Mustard brown") do assert_equal("\#%02X%02X%02XFF" % [205, 122, 0], Cairo::Color::MUSTARD_BROWN.to_s) end # Mustard green: #6E6E30: (110, 110, 48) test("Mustard green") do assert_equal("\#%02X%02X%02XFF" % [110, 110, 48], Cairo::Color::MUSTARD_GREEN.to_s) end # Mustard yellow: #E1AD01: (255, 173, 1) test("Mustard yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 173, 1], Cairo::Color::MUSTARD_YELLOW.to_s) end # Myrtle green: #317873: (49, 120, 115) test("Myrtle green") do assert_equal("\#%02X%02X%02XFF" % [49, 120, 115], Cairo::Color::MYRTLE_GREEN.to_s) end # Mystic: #D65282: (214, 82, 130) test("Mystic") do assert_equal("\#%02X%02X%02XFF" % [214, 82, 130], Cairo::Color::MYSTIC.to_s) end # Mystic maroon: #AD4379: (173, 67, 121) test("Mystic maroon") do assert_equal("\#%02X%02X%02XFF" % [173, 67, 121], Cairo::Color::MYSTIC_MAROON.to_s) end # Mystic red: #FF5500: (255, 34, 0) test("Mystic red") do assert_equal("\#%02X%02X%02XFF" % [255, 34, 0], Cairo::Color::MYSTIC_RED.to_s) end # Nadeshiko pink: #F6ADC6: (246, 173, 198) test("Nadeshiko pink") do assert_equal("\#%02X%02X%02XFF" % [246, 173, 198], Cairo::Color::NADESHIKO_PINK.to_s) end # Napier green: #2A8000: (42, 128, 0) test("Napier green") do assert_equal("\#%02X%02X%02XFF" % [42, 128, 0], Cairo::Color::NAPIER_GREEN.to_s) end # Naples yellow: #FADA5E: (250, 218, 94) test("Naples yellow") do assert_equal("\#%02X%02X%02XFF" % [250, 218, 94], Cairo::Color::NAPLES_YELLOW.to_s) end # Navajo white: #FFDEAD: (255, 222, 173) test("Navajo white") do assert_equal("\#%02X%02X%02XFF" % [255, 222, 173], Cairo::Color::NAVAJO_WHITE.to_s) end # Navy blue: #000080: (0, 0, 128) test("Navy blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 128], Cairo::Color::NAVY_BLUE.to_s) end # Navy blue (Crayola): #1974D2: (25, 116, 210) test("Navy blue (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [25, 116, 210], Cairo::Color::NAVY_BLUE_CRAYOLA.to_s) end # Navy purple: #9457EB: (148, 87, 235) test("Navy purple") do assert_equal("\#%02X%02X%02XFF" % [148, 87, 235], Cairo::Color::NAVY_PURPLE.to_s) end # Neon blue: #1B03A3: (27, 3, 163) test("Neon blue") do assert_equal("\#%02X%02X%02XFF" % [27, 3, 163], Cairo::Color::NEON_BLUE.to_s) end # Neon brown: #C3732A: (195, 115, 42) test("Neon brown") do assert_equal("\#%02X%02X%02XFF" % [195, 115, 42], Cairo::Color::NEON_BROWN.to_s) end # Neon Carrot: #FFA343: (255, 163, 67) test("Neon Carrot") do assert_equal("\#%02X%02X%02XFF" % [255, 163, 67], Cairo::Color::NEON_CARROT.to_s) end # Neon cyan: #00FEFC: (0, 254, 252) test("Neon cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 254, 252], Cairo::Color::NEON_CYAN.to_s) end # Neon fuchsia: #FE4164: (254, 65, 100) test("Neon fuchsia") do assert_equal("\#%02X%02X%02XFF" % [254, 65, 100], Cairo::Color::NEON_FUCHSIA.to_s) end # Neon gold: #CFAA01: (207, 170, 1) test("Neon gold") do assert_equal("\#%02X%02X%02XFF" % [207, 170, 1], Cairo::Color::NEON_GOLD.to_s) end # Neon gray: #808080: (128, 128, 128) test("Neon gray") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 128], Cairo::Color::NEON_GRAY.to_s) end # Neon dark green: #008443: (0, 132, 67) test("Neon dark green") do assert_equal("\#%02X%02X%02XFF" % [0, 132, 67], Cairo::Color::NEON_DARK_GREEN.to_s) end # Neon green: #139B42: (19, 155, 66) test("Neon green") do assert_equal("\#%02X%02X%02XFF" % [19, 155, 66], Cairo::Color::NEON_GREEN.to_s) end # Neon pink: #FE347E: (254, 52, 126) test("Neon pink") do assert_equal("\#%02X%02X%02XFF" % [254, 52, 126], Cairo::Color::NEON_PINK.to_s) end # Neon purple: #9457EB: (148, 87, 235) test("Neon purple") do assert_equal("\#%02X%02X%02XFF" % [148, 87, 235], Cairo::Color::NEON_PURPLE.to_s) end # Neon red: #FF1818: (255, 24, 24) test("Neon red") do assert_equal("\#%02X%02X%02XFF" % [255, 24, 24], Cairo::Color::NEON_RED.to_s) end # Neon scarlet: #FF2603: (255, 38, 3) test("Neon scarlet") do assert_equal("\#%02X%02X%02XFF" % [255, 38, 3], Cairo::Color::NEON_SCARLET.to_s) end # Neon silver: #CCCCCC: (204, 204, 204) test("Neon silver") do assert_equal("\#%02X%02X%02XFF" % [204, 204, 204], Cairo::Color::NEON_SILVER.to_s) end # Neon tangerine: #F6890A: (246, 137, 10) test("Neon tangerine") do assert_equal("\#%02X%02X%02XFF" % [246, 137, 10], Cairo::Color::NEON_TANGERINE.to_s) end # Neon yellow: #FFF700: (255, 247, 0) test("Neon yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 247, 0], Cairo::Color::NEON_YELLOW.to_s) end # New Car: #214FC6: (33, 79, 198) test("New Car") do assert_equal("\#%02X%02X%02XFF" % [33, 79, 198], Cairo::Color::NEW_CAR.to_s) end # New York pink: #D7837F: (215, 131, 127) test("New York pink") do assert_equal("\#%02X%02X%02XFF" % [215, 131, 127], Cairo::Color::NEW_YORK_PINK.to_s) end # Nickel: #727472: (114, 116, 114) test("Nickel") do assert_equal("\#%02X%02X%02XFF" % [114, 116, 114], Cairo::Color::NICKEL.to_s) end # Nintendo red: #E4000F: (228, 0, 15) test("Nintendo red") do assert_equal("\#%02X%02X%02XFF" % [228, 0, 15], Cairo::Color::NINTENDO_RED.to_s) end # Non-photo blue: #A4DDED: (164, 221, 237) test("Non-photo blue") do assert_equal("\#%02X%02X%02XFF" % [164, 221, 237], Cairo::Color::NON_PHOTO_BLUE.to_s) end # Nyanza: #E9FFDB: (233, 255, 219) test("Nyanza") do assert_equal("\#%02X%02X%02XFF" % [233, 255, 219], Cairo::Color::NYANZA.to_s) end # Ocean blue: #4F42B5: (79, 66, 181) test("Ocean blue") do assert_equal("\#%02X%02X%02XFF" % [79, 66, 181], Cairo::Color::OCEAN_BLUE.to_s) end # Ocean boat blue: #0077BE: (0, 119, 190) test("Ocean boat blue") do assert_equal("\#%02X%02X%02XFF" % [0, 119, 190], Cairo::Color::OCEAN_BOAT_BLUE.to_s) end # Ocean green: #48BF91: (72, 191, 145) test("Ocean green") do assert_equal("\#%02X%02X%02XFF" % [72, 191, 145], Cairo::Color::OCEAN_GREEN.to_s) end # Ochre: #CC7722: (204, 119, 34) test("Ochre") do assert_equal("\#%02X%02X%02XFF" % [204, 119, 34], Cairo::Color::OCHRE.to_s) end # Office green: #008000: (0, 128, 0) test("Office green") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 0], Cairo::Color::OFFICE_GREEN.to_s) end # Ogre Odor: #FD5240: (253, 82, 64) test("Ogre Odor") do assert_equal("\#%02X%02X%02XFF" % [253, 82, 64], Cairo::Color::OGRE_ODOR.to_s) end # Old burgundy: #43302E: (67, 48, 46) test("Old burgundy") do assert_equal("\#%02X%02X%02XFF" % [67, 48, 46], Cairo::Color::OLD_BURGUNDY.to_s) end # Old gold: #CFB53B: (207, 181, 59) test("Old gold") do assert_equal("\#%02X%02X%02XFF" % [207, 181, 59], Cairo::Color::OLD_GOLD.to_s) end # Old heliotrope: #563C5C: (86, 60, 92) test("Old heliotrope") do assert_equal("\#%02X%02X%02XFF" % [86, 60, 92], Cairo::Color::OLD_HELIOTROPE.to_s) end # Old lace: #FDF5E6: (253, 245, 230) test("Old lace") do assert_equal("\#%02X%02X%02XFF" % [253, 245, 230], Cairo::Color::OLD_LACE.to_s) end # Old lavender: #796878: (121, 104, 120) test("Old lavender") do assert_equal("\#%02X%02X%02XFF" % [121, 104, 120], Cairo::Color::OLD_LAVENDER.to_s) end # Old mauve: #673147: (103, 49, 71) test("Old mauve") do assert_equal("\#%02X%02X%02XFF" % [103, 49, 71], Cairo::Color::OLD_MAUVE.to_s) end # Old moss green: #867E36: (134, 126, 54) test("Old moss green") do assert_equal("\#%02X%02X%02XFF" % [134, 126, 54], Cairo::Color::OLD_MOSS_GREEN.to_s) end # Old rose: #C08081: (192, 128, 129) test("Old rose") do assert_equal("\#%02X%02X%02XFF" % [192, 128, 129], Cairo::Color::OLD_ROSE.to_s) end # Old silver: #848482: (132, 132, 130) test("Old silver") do assert_equal("\#%02X%02X%02XFF" % [132, 132, 130], Cairo::Color::OLD_SILVER.to_s) end # Olive: #808000: (128, 128, 0) test("Olive") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 0], Cairo::Color::OLIVE.to_s) end # Olive drab (#3): #6B8E23: (107, 142, 35) test("Olive drab (#3)") do assert_equal("\#%02X%02X%02XFF" % [107, 142, 35], Cairo::Color::OLIVE_DRAB3.to_s) end # Olive drab #7: #3C341F: (60, 52, 31) test("Olive drab #7") do assert_equal("\#%02X%02X%02XFF" % [60, 52, 31], Cairo::Color::OLIVE_DRAB7.to_s) end # Olive green: #B5B35C: (181, 179, 92) test("Olive green") do assert_equal("\#%02X%02X%02XFF" % [181, 179, 92], Cairo::Color::OLIVE_GREEN.to_s) end # Olivine: #9AB973: (154, 185, 115) test("Olivine") do assert_equal("\#%02X%02X%02XFF" % [154, 185, 115], Cairo::Color::OLIVINE.to_s) end # Onyx: #353839: (53, 56, 57) test("Onyx") do assert_equal("\#%02X%02X%02XFF" % [53, 56, 57], Cairo::Color::ONYX.to_s) end # Opal: #A8C3BC: (168, 195, 188) test("Opal") do assert_equal("\#%02X%02X%02XFF" % [168, 195, 188], Cairo::Color::OPAL.to_s) end # Opera mauve: #B784A7: (183, 132, 167) test("Opera mauve") do assert_equal("\#%02X%02X%02XFF" % [183, 132, 167], Cairo::Color::OPERA_MAUVE.to_s) end # Orange: #FF6600: (255, 102, 0) test("Orange") do assert_equal("\#%02X%02X%02XFF" % [255, 102, 0], Cairo::Color::ORANGE.to_s) end # Orange (color wheel): #FF7F00: (255, 127, 0) test("Orange (color wheel)") do assert_equal("\#%02X%02X%02XFF" % [255, 127, 0], Cairo::Color::ORANGE_COLOR_WHEEL.to_s) end # Orange (Crayola): #FF7538: (255, 117, 56) test("Orange (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 117, 56], Cairo::Color::ORANGE_CRAYOLA.to_s) end # Orange (Pantone): #FF5800: (255, 88, 0) test("Orange (Pantone)") do assert_equal("\#%02X%02X%02XFF" % [255, 88, 0], Cairo::Color::ORANGE_PANTONE.to_s) end # Orange (RYB): #FB9902: (251, 153, 2) test("Orange (RYB)") do assert_equal("\#%02X%02X%02XFF" % [251, 153, 2], Cairo::Color::ORANGE_RYB.to_s) end # Orange (web): #FFA500: (255, 165, 0) test("Orange (web)") do assert_equal("\#%02X%02X%02XFF" % [255, 165, 0], Cairo::Color::ORANGE_WEB.to_s) end # Orange iced tea: #FF6700: (255, 103, 0) test("Orange iced tea") do assert_equal("\#%02X%02X%02XFF" % [255, 103, 0], Cairo::Color::ORANGE_ICED_TEA.to_s) end # Orange peel: #FF9F00: (255, 159, 0) test("Orange peel") do assert_equal("\#%02X%02X%02XFF" % [255, 159, 0], Cairo::Color::ORANGE_PEEL.to_s) end # Orange-red: #FF681F: (255, 104, 31) test("Orange-red") do assert_equal("\#%02X%02X%02XFF" % [255, 104, 31], Cairo::Color::ORANGE_RED.to_s) end # Orange-red (Crayola): #FF5349: (255, 83, 73) test("Orange-red (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 83, 73], Cairo::Color::ORANGE_RED_CRAYOLA.to_s) end # Orange soda: #E74E14: (231, 78, 20) test("Orange soda") do assert_equal("\#%02X%02X%02XFF" % [231, 78, 20], Cairo::Color::ORANGE_SODA.to_s) end # Orange-yellow: #F5BD1F: (245, 189, 31) test("Orange-yellow") do assert_equal("\#%02X%02X%02XFF" % [245, 189, 31], Cairo::Color::ORANGE_YELLOW.to_s) end # Orange-yellow (Crayola): #F8D568: (248, 213, 104) test("Orange-yellow (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [248, 213, 104], Cairo::Color::ORANGE_YELLOW_CRAYOLA.to_s) end # Orchid: #DA70D6: (218, 112, 214) test("Orchid") do assert_equal("\#%02X%02X%02XFF" % [218, 112, 214], Cairo::Color::ORCHID.to_s) end # Orchid pink: #F2BDCD: (242, 189, 205) test("Orchid pink") do assert_equal("\#%02X%02X%02XFF" % [242, 189, 205], Cairo::Color::ORCHID_PINK.to_s) end # Orchid (Crayola): #E29CD2: (226, 156, 210) test("Orchid (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [226, 156, 210], Cairo::Color::ORCHID_CRAYOLA.to_s) end # Orioles orange: #FB4F14: (251, 79, 20) test("Orioles orange") do assert_equal("\#%02X%02X%02XFF" % [251, 79, 20], Cairo::Color::ORIOLES_ORANGE.to_s) end # Otter brown: #654321: (101, 67, 33) test("Otter brown") do assert_equal("\#%02X%02X%02XFF" % [101, 67, 33], Cairo::Color::OTTER_BROWN.to_s) end # Outer Space: #414A4C: (65, 74, 76) test("Outer Space") do assert_equal("\#%02X%02X%02XFF" % [65, 74, 76], Cairo::Color::OUTER_SPACE.to_s) end # Outer space (Crayola): #2D383A: (45, 56, 58) test("Outer space (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [45, 56, 58], Cairo::Color::OUTER_SPACE_CRAYOLA.to_s) end # Outrageous Orange: #FF6E4A: (255, 110, 74) test("Outrageous Orange") do assert_equal("\#%02X%02X%02XFF" % [255, 110, 74], Cairo::Color::OUTRAGEOUS_ORANGE.to_s) end # Oxblood: #800020: (128, 0, 32) test("Oxblood") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 32], Cairo::Color::OXBLOOD.to_s) end # Oxford blue: #002147: (0, 33, 71) test("Oxford blue") do assert_equal("\#%02X%02X%02XFF" % [0, 33, 71], Cairo::Color::OXFORD_BLUE.to_s) end # Oxley: #6D9A79: (109, 154, 121) test("Oxley") do assert_equal("\#%02X%02X%02XFF" % [109, 154, 121], Cairo::Color::OXLEY.to_s) end # OU Crimson red: #990000: (153, 0, 0) test("OU Crimson red") do assert_equal("\#%02X%02X%02XFF" % [153, 0, 0], Cairo::Color::OU_CRIMSON_RED.to_s) end # Pacific Blue: #1CA9C9: (28, 169, 201) test("Pacific Blue") do assert_equal("\#%02X%02X%02XFF" % [28, 169, 201], Cairo::Color::PACIFIC_BLUE.to_s) end # Pakistan green: #006600: (0, 102, 0) test("Pakistan green") do assert_equal("\#%02X%02X%02XFF" % [0, 102, 0], Cairo::Color::PAKISTAN_GREEN.to_s) end # Palatinate blue: #273BE2: (39, 59, 226) test("Palatinate blue") do assert_equal("\#%02X%02X%02XFF" % [39, 59, 226], Cairo::Color::PALATINATE_BLUE.to_s) end # Palatinate purple: #682860: (104, 40, 96) test("Palatinate purple") do assert_equal("\#%02X%02X%02XFF" % [104, 40, 96], Cairo::Color::PALATINATE_PURPLE.to_s) end # Pale aqua: #BCD4E6: (188, 212, 230) test("Pale aqua") do assert_equal("\#%02X%02X%02XFF" % [188, 212, 230], Cairo::Color::PALE_AQUA.to_s) end # Pale blue: #AFEEEE: (175, 238, 238) test("Pale blue") do assert_equal("\#%02X%02X%02XFF" % [175, 238, 238], Cairo::Color::PALE_BLUE.to_s) end # Pale brown: #987654: (152, 118, 84) test("Pale brown") do assert_equal("\#%02X%02X%02XFF" % [152, 118, 84], Cairo::Color::PALE_BROWN.to_s) end # Pale carmine: #AF4035: (175, 64, 53) test("Pale carmine") do assert_equal("\#%02X%02X%02XFF" % [175, 64, 53], Cairo::Color::PALE_CARMINE.to_s) end # Pale cerulean: #9BC4E2: (155, 196, 226) test("Pale cerulean") do assert_equal("\#%02X%02X%02XFF" % [155, 196, 226], Cairo::Color::PALE_CERULEAN.to_s) end # Pale chestnut: #DDADAF: (221, 173, 175) test("Pale chestnut") do assert_equal("\#%02X%02X%02XFF" % [221, 173, 175], Cairo::Color::PALE_CHESTNUT.to_s) end # Pale copper: #DA8A67: (218, 138, 103) test("Pale copper") do assert_equal("\#%02X%02X%02XFF" % [218, 138, 103], Cairo::Color::PALE_COPPER.to_s) end # Pale cornflower blue: #ABCDEF: (171, 205, 239) test("Pale cornflower blue") do assert_equal("\#%02X%02X%02XFF" % [171, 205, 239], Cairo::Color::PALE_CORNFLOWER_BLUE.to_s) end # Pale cyan: #87D3F8: (135, 211, 248) test("Pale cyan") do assert_equal("\#%02X%02X%02XFF" % [135, 211, 248], Cairo::Color::PALE_CYAN.to_s) end # Pale gold: #E6BE8A: (230, 190, 138) test("Pale gold") do assert_equal("\#%02X%02X%02XFF" % [230, 190, 138], Cairo::Color::PALE_GOLD.to_s) end # Pale goldenrod: #EEE8AA: (238, 232, 170) test("Pale goldenrod") do assert_equal("\#%02X%02X%02XFF" % [238, 232, 170], Cairo::Color::PALE_GOLDENROD.to_s) end # Pale green: #98FB98: (152, 251, 152) test("Pale green") do assert_equal("\#%02X%02X%02XFF" % [152, 251, 152], Cairo::Color::PALE_GREEN.to_s) end # Pale lavender: #DCD0FF: (220, 208, 255) test("Pale lavender") do assert_equal("\#%02X%02X%02XFF" % [220, 208, 255], Cairo::Color::PALE_LAVENDER.to_s) end # Pale magenta: #F984E5: (249, 132, 229) test("Pale magenta") do assert_equal("\#%02X%02X%02XFF" % [249, 132, 229], Cairo::Color::PALE_MAGENTA.to_s) end # Pale magenta-pink: #FF99CC: (255, 153, 204) test("Pale magenta-pink") do assert_equal("\#%02X%02X%02XFF" % [255, 153, 204], Cairo::Color::PALE_MAGENTA_PINK.to_s) end # Pale pink: #FADADD: (250, 218, 221) test("Pale pink") do assert_equal("\#%02X%02X%02XFF" % [250, 218, 221], Cairo::Color::PALE_PINK.to_s) end # Pale plum: #DDA0DD: (221, 160, 221) test("Pale plum") do assert_equal("\#%02X%02X%02XFF" % [221, 160, 221], Cairo::Color::PALE_PLUM.to_s) end # Pale red-violet: #DB7093: (219, 112, 147) test("Pale red-violet") do assert_equal("\#%02X%02X%02XFF" % [219, 112, 147], Cairo::Color::PALE_RED_VIOLET.to_s) end # Pale robin egg blue: #96DED1: (150, 222, 209) test("Pale robin egg blue") do assert_equal("\#%02X%02X%02XFF" % [150, 222, 209], Cairo::Color::PALE_ROBIN_EGG_BLUE.to_s) end # Pale silver: #C9C0BB: (201, 192, 187) test("Pale silver") do assert_equal("\#%02X%02X%02XFF" % [201, 192, 187], Cairo::Color::PALE_SILVER.to_s) end # Pale spring bud: #ECEBBD: (236, 235, 189) test("Pale spring bud") do assert_equal("\#%02X%02X%02XFF" % [236, 235, 189], Cairo::Color::PALE_SPRING_BUD.to_s) end # Pale taupe: #BC987E: (188, 152, 126) test("Pale taupe") do assert_equal("\#%02X%02X%02XFF" % [188, 152, 126], Cairo::Color::PALE_TAUPE.to_s) end # Pale turquoise: #AFEEEE: (175, 238, 238) test("Pale turquoise") do assert_equal("\#%02X%02X%02XFF" % [175, 238, 238], Cairo::Color::PALE_TURQUOISE.to_s) end # Pale violet: #CC99FF: (204, 153, 255) test("Pale violet") do assert_equal("\#%02X%02X%02XFF" % [204, 153, 255], Cairo::Color::PALE_VIOLET.to_s) end # Pale violet-red: #DB7093: (219, 112, 147) test("Pale violet-red") do assert_equal("\#%02X%02X%02XFF" % [219, 112, 147], Cairo::Color::PALE_VIOLET_RED.to_s) end # Palm Leaf: #6F9940: (111, 153, 64) test("Palm Leaf") do assert_equal("\#%02X%02X%02XFF" % [111, 153, 64], Cairo::Color::PALM_LEAF.to_s) end # Pansy purple: #78184A: (120, 24, 74) test("Pansy purple") do assert_equal("\#%02X%02X%02XFF" % [120, 24, 74], Cairo::Color::PANSY_PURPLE.to_s) end # Paolo Veronese green: #009B7D: (0, 155, 125) test("Paolo Veronese green") do assert_equal("\#%02X%02X%02XFF" % [0, 155, 125], Cairo::Color::PAOLO_VERONESE_GREEN.to_s) end # Papaya whip: #FFEFD5: (255, 239, 213) test("Papaya whip") do assert_equal("\#%02X%02X%02XFF" % [255, 239, 213], Cairo::Color::PAPAYA_WHIP.to_s) end # Paradise pink: #E63E62: (230, 62, 98) test("Paradise pink") do assert_equal("\#%02X%02X%02XFF" % [230, 62, 98], Cairo::Color::PARADISE_PINK.to_s) end # Paris Green: #50C878: (80, 200, 120) test("Paris Green") do assert_equal("\#%02X%02X%02XFF" % [80, 200, 120], Cairo::Color::PARIS_GREEN.to_s) end # Parrot Pink: #D998A0: (217, 152, 160) test("Parrot Pink") do assert_equal("\#%02X%02X%02XFF" % [217, 152, 160], Cairo::Color::PARROT_PINK.to_s) end # Pastel blue: #AEC6CF: (174, 198, 207) test("Pastel blue") do assert_equal("\#%02X%02X%02XFF" % [174, 198, 207], Cairo::Color::PASTEL_BLUE.to_s) end # Pastel brown: #836953: (130, 105, 83) test("Pastel brown") do assert_equal("\#%02X%02X%02XFF" % [130, 105, 83], Cairo::Color::PASTEL_BROWN.to_s) end # Pastel gray: #CFCFC4: (207, 207, 196) test("Pastel gray") do assert_equal("\#%02X%02X%02XFF" % [207, 207, 196], Cairo::Color::PASTEL_GRAY.to_s) end # Pastel green: #77DD77: (119, 221, 119) test("Pastel green") do assert_equal("\#%02X%02X%02XFF" % [119, 221, 119], Cairo::Color::PASTEL_GREEN.to_s) end # Pastel magenta: #F49AC2: (244, 154, 194) test("Pastel magenta") do assert_equal("\#%02X%02X%02XFF" % [244, 154, 194], Cairo::Color::PASTEL_MAGENTA.to_s) end # Pastel orange: #FFB347: (255, 179, 71) test("Pastel orange") do assert_equal("\#%02X%02X%02XFF" % [255, 179, 71], Cairo::Color::PASTEL_ORANGE.to_s) end # Pastel pink: #DEA5A4: (222, 165, 164) test("Pastel pink") do assert_equal("\#%02X%02X%02XFF" % [222, 165, 164], Cairo::Color::PASTEL_PINK.to_s) end # Pastel purple: #B39EB5: (179, 158, 181) test("Pastel purple") do assert_equal("\#%02X%02X%02XFF" % [179, 158, 181], Cairo::Color::PASTEL_PURPLE.to_s) end # Pastel red: #FF6961: (255, 105, 97) test("Pastel red") do assert_equal("\#%02X%02X%02XFF" % [255, 105, 97], Cairo::Color::PASTEL_RED.to_s) end # Pastel violet: #CB99C9: (203, 153, 201) test("Pastel violet") do assert_equal("\#%02X%02X%02XFF" % [203, 153, 201], Cairo::Color::PASTEL_VIOLET.to_s) end # Pastel yellow: #FDFD96: (253, 253, 150) test("Pastel yellow") do assert_equal("\#%02X%02X%02XFF" % [253, 253, 150], Cairo::Color::PASTEL_YELLOW.to_s) end # Patriarch: #800080: (128, 0, 128) test("Patriarch") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 128], Cairo::Color::PATRIARCH.to_s) end # Payne's grey: #536878: (83, 104, 120) test("Payne's grey") do assert_equal("\#%02X%02X%02XFF" % [83, 104, 120], Cairo::Color::PAYNES_GREY.to_s) end # Peach: #FFE5B4: (255, 229, 180) test("Peach") do assert_equal("\#%02X%02X%02XFF" % [255, 229, 180], Cairo::Color::PEACH.to_s) end # Peach (Crayola): #FFCBA4: (255, 203, 164) test("Peach (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 203, 164], Cairo::Color::PEACH_CRAYOLA.to_s) end # Peach-orange: #FFCC99: (255, 204, 153) test("Peach-orange") do assert_equal("\#%02X%02X%02XFF" % [255, 204, 153], Cairo::Color::PEACH_ORANGE.to_s) end # Peach puff: #FFDAB9: (255, 218, 185) test("Peach puff") do assert_equal("\#%02X%02X%02XFF" % [255, 218, 185], Cairo::Color::PEACH_PUFF.to_s) end # Peach-yellow: #FADFAD: (250, 223, 173) test("Peach-yellow") do assert_equal("\#%02X%02X%02XFF" % [250, 223, 173], Cairo::Color::PEACH_YELLOW.to_s) end # Pear: #D1E231: (209, 226, 49) test("Pear") do assert_equal("\#%02X%02X%02XFF" % [209, 226, 49], Cairo::Color::PEAR.to_s) end # Pearl: #EAE0C8: (234, 224, 200) test("Pearl") do assert_equal("\#%02X%02X%02XFF" % [234, 224, 200], Cairo::Color::PEARL.to_s) end # Pearl Aqua: #88D8C0: (136, 216, 192) test("Pearl Aqua") do assert_equal("\#%02X%02X%02XFF" % [136, 216, 192], Cairo::Color::PEARL_AQUA.to_s) end # Pearly purple: #B768A2: (183, 104, 162) test("Pearly purple") do assert_equal("\#%02X%02X%02XFF" % [183, 104, 162], Cairo::Color::PEARLY_PURPLE.to_s) end # Peridot: #E6E200: (230, 226, 0) test("Peridot") do assert_equal("\#%02X%02X%02XFF" % [230, 226, 0], Cairo::Color::PERIDOT.to_s) end # Periwinkle: #CCCCFF: (204, 204, 255) test("Periwinkle") do assert_equal("\#%02X%02X%02XFF" % [204, 204, 255], Cairo::Color::PERIWINKLE.to_s) end # Periwinkle (Crayola): #C3CDE6: (195, 205, 230) test("Periwinkle (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [195, 205, 230], Cairo::Color::PERIWINKLE_CRAYOLA.to_s) end # Permanent Geranium Lake: #E12C2C: (225, 44, 44) test("Permanent Geranium Lake") do assert_equal("\#%02X%02X%02XFF" % [225, 44, 44], Cairo::Color::PERMANENT_GERANIUM_LAKE.to_s) end # Persian blue: #1C39BB: (28, 57, 187) test("Persian blue") do assert_equal("\#%02X%02X%02XFF" % [28, 57, 187], Cairo::Color::PERSIAN_BLUE.to_s) end # Persian green: #00A693: (0, 166, 147) test("Persian green") do assert_equal("\#%02X%02X%02XFF" % [0, 166, 147], Cairo::Color::PERSIAN_GREEN.to_s) end # Persian indigo: #32127A: (50, 18, 122) test("Persian indigo") do assert_equal("\#%02X%02X%02XFF" % [50, 18, 122], Cairo::Color::PERSIAN_INDIGO.to_s) end # Persian orange: #D99058: (217, 144, 88) test("Persian orange") do assert_equal("\#%02X%02X%02XFF" % [217, 144, 88], Cairo::Color::PERSIAN_ORANGE.to_s) end # Persian pink: #F77FBE: (247, 127, 190) test("Persian pink") do assert_equal("\#%02X%02X%02XFF" % [247, 127, 190], Cairo::Color::PERSIAN_PINK.to_s) end # Persian plum: #701C1C: (112, 28, 28) test("Persian plum") do assert_equal("\#%02X%02X%02XFF" % [112, 28, 28], Cairo::Color::PERSIAN_PLUM.to_s) end # Persian red: #CC3333: (204, 51, 51) test("Persian red") do assert_equal("\#%02X%02X%02XFF" % [204, 51, 51], Cairo::Color::PERSIAN_RED.to_s) end # Persian rose: #FE28A2: (254, 40, 162) test("Persian rose") do assert_equal("\#%02X%02X%02XFF" % [254, 40, 162], Cairo::Color::PERSIAN_ROSE.to_s) end # Persimmon: #EC5800: (236, 88, 0) test("Persimmon") do assert_equal("\#%02X%02X%02XFF" % [236, 88, 0], Cairo::Color::PERSIMMON.to_s) end # Peru: #CD853F: (205, 133, 63) test("Peru") do assert_equal("\#%02X%02X%02XFF" % [205, 133, 63], Cairo::Color::PERU.to_s) end # Pewter Blue: #8BA8B7: (139, 168, 183) test("Pewter Blue") do assert_equal("\#%02X%02X%02XFF" % [139, 168, 183], Cairo::Color::PEWTER_BLUE.to_s) end # Philippine blue: #0038A7: (0, 56, 167) test("Philippine blue") do assert_equal("\#%02X%02X%02XFF" % [0, 56, 167], Cairo::Color::PHILIPPINE_BLUE.to_s) end # Philippine bronze: #6E3A07: (110, 58, 7) test("Philippine bronze") do assert_equal("\#%02X%02X%02XFF" % [110, 58, 7], Cairo::Color::PHILIPPINE_BRONZE.to_s) end # Philippine brown: #5D1916: (93, 25, 22) test("Philippine brown") do assert_equal("\#%02X%02X%02XFF" % [93, 25, 22], Cairo::Color::PHILIPPINE_BROWN.to_s) end # Philippine gold: #B17304: (177, 115, 4) test("Philippine gold") do assert_equal("\#%02X%02X%02XFF" % [177, 115, 4], Cairo::Color::PHILIPPINE_GOLD.to_s) end # Philippine golden yellow: #FFDF00: (253, 223, 22) test("Philippine golden yellow") do assert_equal("\#%02X%02X%02XFF" % [253, 223, 22], Cairo::Color::PHILIPPINE_GOLDEN_YELLOW.to_s) end # Philippine gray: #8C8C8C: (140, 140, 140) test("Philippine gray") do assert_equal("\#%02X%02X%02XFF" % [140, 140, 140], Cairo::Color::PHILIPPINE_GRAY.to_s) end # Philippine green: #008543: (0, 133, 67) test("Philippine green") do assert_equal("\#%02X%02X%02XFF" % [0, 133, 67], Cairo::Color::PHILIPPINE_GREEN.to_s) end # Philippine indigo: #00416A: (0, 65, 106) test("Philippine indigo") do assert_equal("\#%02X%02X%02XFF" % [0, 65, 106], Cairo::Color::PHILIPPINE_INDIGO.to_s) end # Philippine orange: #FF7300: (255, 115, 0) test("Philippine orange") do assert_equal("\#%02X%02X%02XFF" % [255, 115, 0], Cairo::Color::PHILIPPINE_ORANGE.to_s) end # Philippine pink: #FA1A8E: (255, 26, 142) test("Philippine pink") do assert_equal("\#%02X%02X%02XFF" % [255, 26, 142], Cairo::Color::PHILIPPINE_PINK.to_s) end # Philippine red: #CE1127: (206, 17, 39) test("Philippine red") do assert_equal("\#%02X%02X%02XFF" % [206, 17, 39], Cairo::Color::PHILIPPINE_RED.to_s) end # Philippine silver: #B3B3B3: (179, 179, 179) test("Philippine silver") do assert_equal("\#%02X%02X%02XFF" % [179, 179, 179], Cairo::Color::PHILIPPINE_SILVER.to_s) end # Philippine sky blue: #0066FF: (0, 102, 255) test("Philippine sky blue") do assert_equal("\#%02X%02X%02XFF" % [0, 102, 255], Cairo::Color::PHILIPPINE_SKY_BLUE.to_s) end # Philippine violet: #81007F: (129, 0, 127) test("Philippine violet") do assert_equal("\#%02X%02X%02XFF" % [129, 0, 127], Cairo::Color::PHILIPPINE_VIOLET.to_s) end # Philippine yellow: #FECB00: (254, 203, 0) test("Philippine yellow") do assert_equal("\#%02X%02X%02XFF" % [254, 203, 0], Cairo::Color::PHILIPPINE_YELLOW.to_s) end # Phlox: #DF00FF: (223, 0, 255) test("Phlox") do assert_equal("\#%02X%02X%02XFF" % [223, 0, 255], Cairo::Color::PHLOX.to_s) end # Phthalo blue: #000F89: (0, 15, 137) test("Phthalo blue") do assert_equal("\#%02X%02X%02XFF" % [0, 15, 137], Cairo::Color::PHTHALO_BLUE.to_s) end # Phthalo green: #123524: (18, 53, 36) test("Phthalo green") do assert_equal("\#%02X%02X%02XFF" % [18, 53, 36], Cairo::Color::PHTHALO_GREEN.to_s) end # Picton blue: #45B1E8: (69, 177, 232) test("Picton blue") do assert_equal("\#%02X%02X%02XFF" % [69, 177, 232], Cairo::Color::PICTON_BLUE.to_s) end # Pictorial carmine: #C30B4E: (195, 11, 78) test("Pictorial carmine") do assert_equal("\#%02X%02X%02XFF" % [195, 11, 78], Cairo::Color::PICTORIAL_CARMINE.to_s) end # Piggy pink: #FDDDE6: (253, 221, 230) test("Piggy pink") do assert_equal("\#%02X%02X%02XFF" % [253, 221, 230], Cairo::Color::PIGGY_PINK.to_s) end # Pine green: #01796F: (1, 121, 111) test("Pine green") do assert_equal("\#%02X%02X%02XFF" % [1, 121, 111], Cairo::Color::PINE_GREEN.to_s) end # Pine tree: #2A2F23: (42, 47, 35) test("Pine tree") do assert_equal("\#%02X%02X%02XFF" % [42, 47, 35], Cairo::Color::PINE_TREE.to_s) end # Pineapple: #563C0D: (86, 60, 13) test("Pineapple") do assert_equal("\#%02X%02X%02XFF" % [86, 60, 13], Cairo::Color::PINEAPPLE.to_s) end # Pink: #FFC0CB: (255, 192, 203) test("Pink") do assert_equal("\#%02X%02X%02XFF" % [255, 192, 203], Cairo::Color::PINK.to_s) end # Pink (Pantone): #D74894: (215, 72, 148) test("Pink (Pantone)") do assert_equal("\#%02X%02X%02XFF" % [215, 72, 148], Cairo::Color::PINK_PANTONE.to_s) end # Pink Diamond (Ace Hardware Color): #F6D6DE: (246, 214, 222) test("Pink Diamond (Ace Hardware Color)") do assert_equal("\#%02X%02X%02XFF" % [246, 214, 222], Cairo::Color::PINK_DIAMOND_ACE_HARDWARE_COLOR.to_s) end # Pink Diamond (Independent Retailers Colors): #F0D3DC: (240, 211, 220) test("Pink Diamond (Independent Retailers Colors)") do assert_equal("\#%02X%02X%02XFF" % [240, 211, 220], Cairo::Color::PINK_DIAMOND_INDEPENDENT_RETAILERS_COLORS.to_s) end # Pink flamingo: #FC74FD: (252, 116, 253) test("Pink flamingo") do assert_equal("\#%02X%02X%02XFF" % [252, 116, 253], Cairo::Color::PINK_FLAMINGO.to_s) end # Pink lace: #FFDDF4: (255, 221, 244) test("Pink lace") do assert_equal("\#%02X%02X%02XFF" % [255, 221, 244], Cairo::Color::PINK_LACE.to_s) end # Pink lavender: #D8B2D1: (216, 178, 209) test("Pink lavender") do assert_equal("\#%02X%02X%02XFF" % [216, 178, 209], Cairo::Color::PINK_LAVENDER.to_s) end # Pink-orange: #FF9966: (255, 153, 102) test("Pink-orange") do assert_equal("\#%02X%02X%02XFF" % [255, 153, 102], Cairo::Color::PINK_ORANGE.to_s) end # Pink pearl: #E7ACCF: (231, 172, 207) test("Pink pearl") do assert_equal("\#%02X%02X%02XFF" % [231, 172, 207], Cairo::Color::PINK_PEARL.to_s) end # Pink raspberry: #980036: (152, 0, 54) test("Pink raspberry") do assert_equal("\#%02X%02X%02XFF" % [152, 0, 54], Cairo::Color::PINK_RASPBERRY.to_s) end # Pink Sherbet: #F78FA7: (247, 143, 167) test("Pink Sherbet") do assert_equal("\#%02X%02X%02XFF" % [247, 143, 167], Cairo::Color::PINK_SHERBET.to_s) end # Pistachio: #93C572: (147, 197, 114) test("Pistachio") do assert_equal("\#%02X%02X%02XFF" % [147, 197, 114], Cairo::Color::PISTACHIO.to_s) end # Pixie Powder: #391285: (57, 18, 133) test("Pixie Powder") do assert_equal("\#%02X%02X%02XFF" % [57, 18, 133], Cairo::Color::PIXIE_POWDER.to_s) end # Platinum: #E5E4E2: (229, 228, 226) test("Platinum") do assert_equal("\#%02X%02X%02XFF" % [229, 228, 226], Cairo::Color::PLATINUM.to_s) end # Plum: #8E4585: (142, 69, 133) test("Plum") do assert_equal("\#%02X%02X%02XFF" % [142, 69, 133], Cairo::Color::PLUM.to_s) end # Plum (web): #DDA0DD: (221, 160, 221) test("Plum (web)") do assert_equal("\#%02X%02X%02XFF" % [221, 160, 221], Cairo::Color::PLUM_WEB.to_s) end # Plump Purple: #5946B2: (89, 70, 178) test("Plump Purple") do assert_equal("\#%02X%02X%02XFF" % [89, 70, 178], Cairo::Color::PLUMP_PURPLE.to_s) end # Police blue: #374F6B: (55, 79, 107) test("Police blue") do assert_equal("\#%02X%02X%02XFF" % [55, 79, 107], Cairo::Color::POLICE_BLUE.to_s) end # Polished Pine: #5DA493: (93, 164, 147) test("Polished Pine") do assert_equal("\#%02X%02X%02XFF" % [93, 164, 147], Cairo::Color::POLISHED_PINE.to_s) end # Pomp and Power: #86608E: (134, 96, 142) test("Pomp and Power") do assert_equal("\#%02X%02X%02XFF" % [134, 96, 142], Cairo::Color::POMP_AND_POWER.to_s) end # Popstar: #BE4F62: (190, 79, 98) test("Popstar") do assert_equal("\#%02X%02X%02XFF" % [190, 79, 98], Cairo::Color::POPSTAR.to_s) end # Portland Orange: #FF5A36: (255, 90, 54) test("Portland Orange") do assert_equal("\#%02X%02X%02XFF" % [255, 90, 54], Cairo::Color::PORTLAND_ORANGE.to_s) end # Powder blue: #B0E0E6: (176, 224, 230) test("Powder blue") do assert_equal("\#%02X%02X%02XFF" % [176, 224, 230], Cairo::Color::POWDER_BLUE.to_s) end # Prilly blue: #329CC3: (50, 156, 195) test("Prilly blue") do assert_equal("\#%02X%02X%02XFF" % [50, 156, 195], Cairo::Color::PRILLY_BLUE.to_s) end # Prilly pink: #FF40A0: (255, 64, 160) test("Prilly pink") do assert_equal("\#%02X%02X%02XFF" % [255, 64, 160], Cairo::Color::PRILLY_PINK.to_s) end # Prilly red: #FF0040: (255, 0, 64) test("Prilly red") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 64], Cairo::Color::PRILLY_RED.to_s) end # Princess Perfume: #FF85CF: (255, 133, 207) test("Princess Perfume") do assert_equal("\#%02X%02X%02XFF" % [255, 133, 207], Cairo::Color::PRINCESS_PERFUME.to_s) end # Princeton orange: #F58025: (245, 128, 37) test("Princeton orange") do assert_equal("\#%02X%02X%02XFF" % [245, 128, 37], Cairo::Color::PRINCETON_ORANGE.to_s) end # Prune: #701C1C: (112, 28, 28) test("Prune") do assert_equal("\#%02X%02X%02XFF" % [112, 28, 28], Cairo::Color::PRUNE.to_s) end # Prussian blue: #003153: (0, 49, 83) test("Prussian blue") do assert_equal("\#%02X%02X%02XFF" % [0, 49, 83], Cairo::Color::PRUSSIAN_BLUE.to_s) end # Psychedelic purple: #DF00FF: (223, 0, 255) test("Psychedelic purple") do assert_equal("\#%02X%02X%02XFF" % [223, 0, 255], Cairo::Color::PSYCHEDELIC_PURPLE.to_s) end # Puce: #CC8899: (204, 136, 153) test("Puce") do assert_equal("\#%02X%02X%02XFF" % [204, 136, 153], Cairo::Color::PUCE.to_s) end # Puce red: #722F37: (114, 47, 55) test("Puce red") do assert_equal("\#%02X%02X%02XFF" % [114, 47, 55], Cairo::Color::PUCE_RED.to_s) end # Pullman Brown (UPS Brown): #644117: (100, 65, 23) test("Pullman Brown (UPS Brown)") do assert_equal("\#%02X%02X%02XFF" % [100, 65, 23], Cairo::Color::PULLMAN_BROWN_UPS_BROWN.to_s) end # Pullman Green: #3B331C: (59, 51, 28) test("Pullman Green") do assert_equal("\#%02X%02X%02XFF" % [59, 51, 28], Cairo::Color::PULLMAN_GREEN.to_s) end # Pumpkin: #FF7518: (255, 117, 24) test("Pumpkin") do assert_equal("\#%02X%02X%02XFF" % [255, 117, 24], Cairo::Color::PUMPKIN.to_s) end # Purple (HTML): #800080: (128, 0, 128) test("Purple (HTML)") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 128], Cairo::Color::PURPLE_HTML.to_s) end # Purple (Munsell): #9F00C5: (159, 0, 197) test("Purple (Munsell)") do assert_equal("\#%02X%02X%02XFF" % [159, 0, 197], Cairo::Color::PURPLE_MUNSELL.to_s) end # Purple (X11): #A020F0: (160, 32, 240) test("Purple (X11)") do assert_equal("\#%02X%02X%02XFF" % [160, 32, 240], Cairo::Color::PURPLE_X11.to_s) end # Purple Heart: #69359C: (105, 53, 156) test("Purple Heart") do assert_equal("\#%02X%02X%02XFF" % [105, 53, 156], Cairo::Color::PURPLE_HEART.to_s) end # Purple mountain majesty: #9678B6: (150, 120, 182) test("Purple mountain majesty") do assert_equal("\#%02X%02X%02XFF" % [150, 120, 182], Cairo::Color::PURPLE_MOUNTAIN_MAJESTY.to_s) end # Purple navy: #4E5180: (78, 81, 128) test("Purple navy") do assert_equal("\#%02X%02X%02XFF" % [78, 81, 128], Cairo::Color::PURPLE_NAVY.to_s) end # Purple pizzazz: #FE4EDA: (254, 78, 218) test("Purple pizzazz") do assert_equal("\#%02X%02X%02XFF" % [254, 78, 218], Cairo::Color::PURPLE_PIZZAZZ.to_s) end # Purple Plum: #9C51B6: (156, 81, 182) test("Purple Plum") do assert_equal("\#%02X%02X%02XFF" % [156, 81, 182], Cairo::Color::PURPLE_PLUM.to_s) end # Purple taupe: #50404D: (80, 64, 77) test("Purple taupe") do assert_equal("\#%02X%02X%02XFF" % [80, 64, 77], Cairo::Color::PURPLE_TAUPE.to_s) end # Purpureus: #9A4EAE: (154, 78, 174) test("Purpureus") do assert_equal("\#%02X%02X%02XFF" % [154, 78, 174], Cairo::Color::PURPUREUS.to_s) end # Quartz: #51484F: (81, 72, 79) test("Quartz") do assert_equal("\#%02X%02X%02XFF" % [81, 72, 79], Cairo::Color::QUARTZ.to_s) end # Queen blue: #436B95: (67, 107, 149) test("Queen blue") do assert_equal("\#%02X%02X%02XFF" % [67, 107, 149], Cairo::Color::QUEEN_BLUE.to_s) end # Queen pink: #E8CCD7: (232, 204, 215) test("Queen pink") do assert_equal("\#%02X%02X%02XFF" % [232, 204, 215], Cairo::Color::QUEEN_PINK.to_s) end # Quick Silver: #A6A6A6: (166, 166, 166) test("Quick Silver") do assert_equal("\#%02X%02X%02XFF" % [166, 166, 166], Cairo::Color::QUICK_SILVER.to_s) end # Quinacridone magenta: #8E3A59: (142, 58, 89) test("Quinacridone magenta") do assert_equal("\#%02X%02X%02XFF" % [142, 58, 89], Cairo::Color::QUINACRIDONE_MAGENTA.to_s) end # Quincy: #6A5445: (106, 84, 69) test("Quincy") do assert_equal("\#%02X%02X%02XFF" % [106, 84, 69], Cairo::Color::QUINCY.to_s) end # Rackley: #5D8AA8: (93, 138, 168) test("Rackley") do assert_equal("\#%02X%02X%02XFF" % [93, 138, 168], Cairo::Color::RACKLEY.to_s) end # Radical Red: #FF355E: (255, 53, 94) test("Radical Red") do assert_equal("\#%02X%02X%02XFF" % [255, 53, 94], Cairo::Color::RADICAL_RED.to_s) end # Raisin black: #242124: (36, 33, 36) test("Raisin black") do assert_equal("\#%02X%02X%02XFF" % [36, 33, 36], Cairo::Color::RAISIN_BLACK.to_s) end # Rajah: #FBAB60: (251, 171, 96) test("Rajah") do assert_equal("\#%02X%02X%02XFF" % [251, 171, 96], Cairo::Color::RAJAH.to_s) end # Raspberry: #E30B5D: (227, 11, 92) test("Raspberry") do assert_equal("\#%02X%02X%02XFF" % [227, 11, 92], Cairo::Color::RASPBERRY.to_s) end # Raspberry glace: #915F6D: (145, 95, 109) test("Raspberry glace") do assert_equal("\#%02X%02X%02XFF" % [145, 95, 109], Cairo::Color::RASPBERRY_GLACE.to_s) end # Raspberry pink: #E25098: (226, 80, 152) test("Raspberry pink") do assert_equal("\#%02X%02X%02XFF" % [226, 80, 152], Cairo::Color::RASPBERRY_PINK.to_s) end # Raspberry rose: #B3446C: (179, 68, 108) test("Raspberry rose") do assert_equal("\#%02X%02X%02XFF" % [179, 68, 108], Cairo::Color::RASPBERRY_ROSE.to_s) end # Raw Sienna: #D68A59: (214, 138, 89) test("Raw Sienna") do assert_equal("\#%02X%02X%02XFF" % [214, 138, 89], Cairo::Color::RAW_SIENNA.to_s) end # Raw umber: #826644: (130, 102, 68) test("Raw umber") do assert_equal("\#%02X%02X%02XFF" % [130, 102, 68], Cairo::Color::RAW_UMBER.to_s) end # Razzle dazzle rose: #FF33CC: (255, 51, 204) test("Razzle dazzle rose") do assert_equal("\#%02X%02X%02XFF" % [255, 51, 204], Cairo::Color::RAZZLE_DAZZLE_ROSE.to_s) end # Razzmatazz: #E3256B: (227, 37, 107) test("Razzmatazz") do assert_equal("\#%02X%02X%02XFF" % [227, 37, 107], Cairo::Color::RAZZMATAZZ.to_s) end # Razzmic Berry: #8D4E85: (141, 78, 133) test("Razzmic Berry") do assert_equal("\#%02X%02X%02XFF" % [141, 78, 133], Cairo::Color::RAZZMIC_BERRY.to_s) end # Rebecca Purple: #663399: (102, 52, 153) test("Rebecca Purple") do assert_equal("\#%02X%02X%02XFF" % [102, 52, 153], Cairo::Color::REBECCA_PURPLE.to_s) end # Red: #FF0000: (255, 0, 0) test("Red") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 0], Cairo::Color::RED.to_s) end # Red (Crayola): #EE204D: (238, 32, 77) test("Red (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [238, 32, 77], Cairo::Color::RED_CRAYOLA.to_s) end # Red (Munsell): #F2003C: (242, 0, 60) test("Red (Munsell)") do assert_equal("\#%02X%02X%02XFF" % [242, 0, 60], Cairo::Color::RED_MUNSELL.to_s) end # Red (NCS): #C40233: (196, 2, 51) test("Red (NCS)") do assert_equal("\#%02X%02X%02XFF" % [196, 2, 51], Cairo::Color::RED_NCS.to_s) end # Red (Pantone): #ED2939: (237, 41, 57) test("Red (Pantone)") do assert_equal("\#%02X%02X%02XFF" % [237, 41, 57], Cairo::Color::RED_PANTONE.to_s) end # Red (pigment): #ED1C24: (237, 28, 36) test("Red (pigment)") do assert_equal("\#%02X%02X%02XFF" % [237, 28, 36], Cairo::Color::RED_PIGMENT.to_s) end # Red (RYB): #FE2712: (254, 39, 18) test("Red (RYB)") do assert_equal("\#%02X%02X%02XFF" % [254, 39, 18], Cairo::Color::RED_RYB.to_s) end # Red-brown: #A52A2A: (165, 42, 42) test("Red-brown") do assert_equal("\#%02X%02X%02XFF" % [165, 42, 42], Cairo::Color::RED_BROWN.to_s) end # Red cola: #DF0118: (223, 1, 24) test("Red cola") do assert_equal("\#%02X%02X%02XFF" % [223, 1, 24], Cairo::Color::RED_COLA.to_s) end # Red devil: #860111: (134, 1, 17) test("Red devil") do assert_equal("\#%02X%02X%02XFF" % [134, 1, 17], Cairo::Color::RED_DEVIL.to_s) end # Red-orange: #FF5349: (255, 83, 73) test("Red-orange") do assert_equal("\#%02X%02X%02XFF" % [255, 83, 73], Cairo::Color::RED_ORANGE.to_s) end # Red-orange (Crayola): #FF681F: (255, 104, 31) test("Red-orange (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 104, 31], Cairo::Color::RED_ORANGE_CRAYOLA.to_s) end # Red-orange (Color wheel): #FF4500: (255, 69, 0) test("Red-orange (Color wheel)") do assert_equal("\#%02X%02X%02XFF" % [255, 69, 0], Cairo::Color::RED_ORANGE_COLOR_WHEEL.to_s) end # Red-purple: #E40078: (228, 0, 120) test("Red-purple") do assert_equal("\#%02X%02X%02XFF" % [228, 0, 120], Cairo::Color::RED_PURPLE.to_s) end # Red rum: #973A4A: (151, 58, 74) test("Red rum") do assert_equal("\#%02X%02X%02XFF" % [151, 58, 74], Cairo::Color::RED_RUM.to_s) end # Red Salsa: #FD3A4A: (253, 58, 74) test("Red Salsa") do assert_equal("\#%02X%02X%02XFF" % [253, 58, 74], Cairo::Color::RED_SALSA.to_s) end # Red strawberry: #EC0304: (236, 3, 1) test("Red strawberry") do assert_equal("\#%02X%02X%02XFF" % [236, 3, 1], Cairo::Color::RED_STRAWBERRY.to_s) end # Red-violet: #C71585: (199, 21, 133) test("Red-violet") do assert_equal("\#%02X%02X%02XFF" % [199, 21, 133], Cairo::Color::RED_VIOLET.to_s) end # Red-violet (Crayola): #C0448F: (192, 68, 143) test("Red-violet (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [192, 68, 143], Cairo::Color::RED_VIOLET_CRAYOLA.to_s) end # Red-violet (Color wheel): #922B3E: (146, 43, 62) test("Red-violet (Color wheel)") do assert_equal("\#%02X%02X%02XFF" % [146, 43, 62], Cairo::Color::RED_VIOLET_COLOR_WHEEL.to_s) end # Redwood: #A45A52: (164, 90, 82) test("Redwood") do assert_equal("\#%02X%02X%02XFF" % [164, 90, 82], Cairo::Color::REDWOOD.to_s) end # Registration black: #000000: (0, 0, 0) test("Registration black") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 0], Cairo::Color::REGISTRATION_BLACK.to_s) end # Resolution blue: #002387: (0, 35, 135) test("Resolution blue") do assert_equal("\#%02X%02X%02XFF" % [0, 35, 135], Cairo::Color::RESOLUTION_BLUE.to_s) end # Rhythm: #777696: (119, 118, 150) test("Rhythm") do assert_equal("\#%02X%02X%02XFF" % [119, 118, 150], Cairo::Color::RHYTHM.to_s) end # Rich brilliant lavender: #F1A7FE: (241, 167, 254) test("Rich brilliant lavender") do assert_equal("\#%02X%02X%02XFF" % [241, 167, 254], Cairo::Color::RICH_BRILLIANT_LAVENDER.to_s) end # Rich electric blue: #0892D0: (8, 146, 208) test("Rich electric blue") do assert_equal("\#%02X%02X%02XFF" % [8, 146, 208], Cairo::Color::RICH_ELECTRIC_BLUE.to_s) end # Rich lavender: #A76BCF: (167, 107, 207) test("Rich lavender") do assert_equal("\#%02X%02X%02XFF" % [167, 107, 207], Cairo::Color::RICH_LAVENDER.to_s) end # Rich lilac: #B666D2: (182, 102, 210) test("Rich lilac") do assert_equal("\#%02X%02X%02XFF" % [182, 102, 210], Cairo::Color::RICH_LILAC.to_s) end # Rich maroon: #B03060: (176, 48, 96) test("Rich maroon") do assert_equal("\#%02X%02X%02XFF" % [176, 48, 96], Cairo::Color::RICH_MAROON.to_s) end # Rifle green: #444C38: (68, 76, 56) test("Rifle green") do assert_equal("\#%02X%02X%02XFF" % [68, 76, 56], Cairo::Color::RIFLE_GREEN.to_s) end # Ripe mango: #FFC324: (255, 195, 36) test("Ripe mango") do assert_equal("\#%02X%02X%02XFF" % [255, 195, 36], Cairo::Color::RIPE_MANGO.to_s) end # Roast coffee: #704241: (112, 66, 65) test("Roast coffee") do assert_equal("\#%02X%02X%02XFF" % [112, 66, 65], Cairo::Color::ROAST_COFFEE.to_s) end # Robin egg blue: #00CCCC: (0, 204, 204) test("Robin egg blue") do assert_equal("\#%02X%02X%02XFF" % [0, 204, 204], Cairo::Color::ROBIN_EGG_BLUE.to_s) end # Rocket metallic: #8A7F80: (138, 127, 128) test("Rocket metallic") do assert_equal("\#%02X%02X%02XFF" % [138, 127, 128], Cairo::Color::ROCKET_METALLIC.to_s) end # Roman silver: #838996: (131, 137, 150) test("Roman silver") do assert_equal("\#%02X%02X%02XFF" % [131, 137, 150], Cairo::Color::ROMAN_SILVER.to_s) end # Root beer: #290E05: (41, 14, 5) test("Root beer") do assert_equal("\#%02X%02X%02XFF" % [41, 14, 5], Cairo::Color::ROOT_BEER.to_s) end # Rose: #FF007F: (255, 0, 127) test("Rose") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 127], Cairo::Color::ROSE.to_s) end # Rose bonbon: #F9429E: (249, 66, 158) test("Rose bonbon") do assert_equal("\#%02X%02X%02XFF" % [249, 66, 158], Cairo::Color::ROSE_BONBON.to_s) end # Rose Dust: #9E5E6F: (158, 94, 111) test("Rose Dust") do assert_equal("\#%02X%02X%02XFF" % [158, 94, 111], Cairo::Color::ROSE_DUST.to_s) end # Rose ebony: #674846: (103, 72, 70) test("Rose ebony") do assert_equal("\#%02X%02X%02XFF" % [103, 72, 70], Cairo::Color::ROSE_EBONY.to_s) end # Rose garnet: #960145: (150, 1, 69) test("Rose garnet") do assert_equal("\#%02X%02X%02XFF" % [150, 1, 69], Cairo::Color::ROSE_GARNET.to_s) end # Rose gold: #B76E79: (183, 110, 121) test("Rose gold") do assert_equal("\#%02X%02X%02XFF" % [183, 110, 121], Cairo::Color::ROSE_GOLD.to_s) end # Rose madder: #E32636: (227, 38, 54) test("Rose madder") do assert_equal("\#%02X%02X%02XFF" % [227, 38, 54], Cairo::Color::ROSE_MADDER.to_s) end # Rose pink: #FF66CC: (255, 102, 204) test("Rose pink") do assert_equal("\#%02X%02X%02XFF" % [255, 102, 204], Cairo::Color::ROSE_PINK.to_s) end # Rose quartz: #AA98A9: (170, 152, 169) test("Rose quartz") do assert_equal("\#%02X%02X%02XFF" % [170, 152, 169], Cairo::Color::ROSE_QUARTZ.to_s) end # Rose quartz pink: #BD559C: (189, 85, 156) test("Rose quartz pink") do assert_equal("\#%02X%02X%02XFF" % [189, 85, 156], Cairo::Color::ROSE_QUARTZ_PINK.to_s) end # Rose red: #C21E56: (194, 30, 86) test("Rose red") do assert_equal("\#%02X%02X%02XFF" % [194, 30, 86], Cairo::Color::ROSE_RED.to_s) end # Rose taupe: #905D5D: (144, 93, 93) test("Rose taupe") do assert_equal("\#%02X%02X%02XFF" % [144, 93, 93], Cairo::Color::ROSE_TAUPE.to_s) end # Rose vale: #AB4E52: (171, 78, 82) test("Rose vale") do assert_equal("\#%02X%02X%02XFF" % [171, 78, 82], Cairo::Color::ROSE_VALE.to_s) end # Rosewood: #65000B: (101, 0, 11) test("Rosewood") do assert_equal("\#%02X%02X%02XFF" % [101, 0, 11], Cairo::Color::ROSEWOOD.to_s) end # Rosy brown: #BC8F8F: (188, 143, 143) test("Rosy brown") do assert_equal("\#%02X%02X%02XFF" % [188, 143, 143], Cairo::Color::ROSY_BROWN.to_s) end # Royal azure: #0038A8: (0, 56, 168) test("Royal azure") do assert_equal("\#%02X%02X%02XFF" % [0, 56, 168], Cairo::Color::ROYAL_AZURE.to_s) end # Royal blue: #002366: (0, 35, 102) test("Royal blue") do assert_equal("\#%02X%02X%02XFF" % [0, 35, 102], Cairo::Color::ROYAL_BLUE.to_s) end # Royal brown: #523B35: (82, 59, 53) test("Royal brown") do assert_equal("\#%02X%02X%02XFF" % [82, 59, 53], Cairo::Color::ROYAL_BROWN.to_s) end # Royal fuchsia: #CA2C92: (202, 44, 146) test("Royal fuchsia") do assert_equal("\#%02X%02X%02XFF" % [202, 44, 146], Cairo::Color::ROYAL_FUCHSIA.to_s) end # Royal green: #136207: (19, 98, 7) test("Royal green") do assert_equal("\#%02X%02X%02XFF" % [19, 98, 7], Cairo::Color::ROYAL_GREEN.to_s) end # Royal orange: #F99245: (249, 146, 69) test("Royal orange") do assert_equal("\#%02X%02X%02XFF" % [249, 146, 69], Cairo::Color::ROYAL_ORANGE.to_s) end # Royal pink: #E73895: (231, 56, 149) test("Royal pink") do assert_equal("\#%02X%02X%02XFF" % [231, 56, 149], Cairo::Color::ROYAL_PINK.to_s) end # Royal red: #9B1C31: (155, 28, 49) test("Royal red") do assert_equal("\#%02X%02X%02XFF" % [155, 28, 49], Cairo::Color::ROYAL_RED.to_s) end # Royal purple: #7851A9: (120, 81, 169) test("Royal purple") do assert_equal("\#%02X%02X%02XFF" % [120, 81, 169], Cairo::Color::ROYAL_PURPLE.to_s) end # Royal yellow: #FADA5E: (250, 218, 94) test("Royal yellow") do assert_equal("\#%02X%02X%02XFF" % [250, 218, 94], Cairo::Color::ROYAL_YELLOW.to_s) end # Ruber: #CE4676: (206, 70, 118) test("Ruber") do assert_equal("\#%02X%02X%02XFF" % [206, 70, 118], Cairo::Color::RUBER.to_s) end # Rubine red: #D10056: (209, 0, 86) test("Rubine red") do assert_equal("\#%02X%02X%02XFF" % [209, 0, 86], Cairo::Color::RUBINE_RED.to_s) end # Ruby: #E0115F: (224, 17, 95) test("Ruby") do assert_equal("\#%02X%02X%02XFF" % [224, 17, 95], Cairo::Color::RUBY.to_s) end # Ruby red: #9B111E: (155, 17, 30) test("Ruby red") do assert_equal("\#%02X%02X%02XFF" % [155, 17, 30], Cairo::Color::RUBY_RED.to_s) end # Rufous: #A81C07: (168, 28, 7) test("Rufous") do assert_equal("\#%02X%02X%02XFF" % [168, 28, 7], Cairo::Color::RUFOUS.to_s) end # Rum: #9A4E40: (154, 78, 64) test("Rum") do assert_equal("\#%02X%02X%02XFF" % [154, 78, 64], Cairo::Color::RUM.to_s) end # Russet: #80461B: (128, 70, 27) test("Russet") do assert_equal("\#%02X%02X%02XFF" % [128, 70, 27], Cairo::Color::RUSSET.to_s) end # Russian green: #679267: (103, 146, 103) test("Russian green") do assert_equal("\#%02X%02X%02XFF" % [103, 146, 103], Cairo::Color::RUSSIAN_GREEN.to_s) end # Russian violet: #32174D: (50, 23, 77) test("Russian violet") do assert_equal("\#%02X%02X%02XFF" % [50, 23, 77], Cairo::Color::RUSSIAN_VIOLET.to_s) end # Rust: #B7410E: (183, 65, 14) test("Rust") do assert_equal("\#%02X%02X%02XFF" % [183, 65, 14], Cairo::Color::RUST.to_s) end # Rusty red: #DA2C43: (218, 44, 67) test("Rusty red") do assert_equal("\#%02X%02X%02XFF" % [218, 44, 67], Cairo::Color::RUSTY_RED.to_s) end # Sacramento State green: #043927: (4, 57, 39) test("Sacramento State green") do assert_equal("\#%02X%02X%02XFF" % [4, 57, 39], Cairo::Color::SACRAMENTO_STATE_GREEN.to_s) end # Saddle brown: #8B4513: (139, 69, 19) test("Saddle brown") do assert_equal("\#%02X%02X%02XFF" % [139, 69, 19], Cairo::Color::SADDLE_BROWN.to_s) end # Safety orange: #FF7800: (255, 120, 0) test("Safety orange") do assert_equal("\#%02X%02X%02XFF" % [255, 120, 0], Cairo::Color::SAFETY_ORANGE.to_s) end # Safety orange (blaze orange): #FF6700: (255, 103, 0) test("Safety orange (blaze orange)") do assert_equal("\#%02X%02X%02XFF" % [255, 103, 0], Cairo::Color::SAFETY_ORANGE_BLAZE_ORANGE.to_s) end # Safety yellow: #EED202: (238, 210, 2) test("Safety yellow") do assert_equal("\#%02X%02X%02XFF" % [238, 210, 2], Cairo::Color::SAFETY_YELLOW.to_s) end # Saffron: #F4C430: (244, 196, 48) test("Saffron") do assert_equal("\#%02X%02X%02XFF" % [244, 196, 48], Cairo::Color::SAFFRON.to_s) end # Sage: #BCB88A: (188, 184, 138) test("Sage") do assert_equal("\#%02X%02X%02XFF" % [188, 184, 138], Cairo::Color::SAGE.to_s) end # St. Patrick's blue: #23297A: (35, 41, 122) test("St. Patrick's blue") do assert_equal("\#%02X%02X%02XFF" % [35, 41, 122], Cairo::Color::ST_PATRICKS_BLUE.to_s) end # Salem: #177B4D: (23, 123, 77) test("Salem") do assert_equal("\#%02X%02X%02XFF" % [23, 123, 77], Cairo::Color::SALEM.to_s) end # Salmon: #FA8072: (250, 128, 114) test("Salmon") do assert_equal("\#%02X%02X%02XFF" % [250, 128, 114], Cairo::Color::SALMON.to_s) end # Salmon Rose: #E7968B: (231, 150, 139) test("Salmon Rose") do assert_equal("\#%02X%02X%02XFF" % [231, 150, 139], Cairo::Color::SALMON_ROSE.to_s) end # Salmon pink: #FF91A4: (255, 145, 164) test("Salmon pink") do assert_equal("\#%02X%02X%02XFF" % [255, 145, 164], Cairo::Color::SALMON_PINK.to_s) end # Samsung blue: #12279E: (18, 39, 158) test("Samsung blue") do assert_equal("\#%02X%02X%02XFF" % [18, 39, 158], Cairo::Color::SAMSUNG_BLUE.to_s) end # Sand: #C2B280: (194, 178, 128) test("Sand") do assert_equal("\#%02X%02X%02XFF" % [194, 178, 128], Cairo::Color::SAND.to_s) end # Sand dune: #967117: (150, 113, 23) test("Sand dune") do assert_equal("\#%02X%02X%02XFF" % [150, 113, 23], Cairo::Color::SAND_DUNE.to_s) end # Sandstorm: #ECD540: (236, 213, 64) test("Sandstorm") do assert_equal("\#%02X%02X%02XFF" % [236, 213, 64], Cairo::Color::SANDSTORM.to_s) end # Sandy brown: #F4A460: (244, 164, 96) test("Sandy brown") do assert_equal("\#%02X%02X%02XFF" % [244, 164, 96], Cairo::Color::SANDY_BROWN.to_s) end # Sandy Tan: #FDD9B5: (253, 217, 181) test("Sandy Tan") do assert_equal("\#%02X%02X%02XFF" % [253, 217, 181], Cairo::Color::SANDY_TAN.to_s) end # Sandy taupe: #967117: (150, 113, 23) test("Sandy taupe") do assert_equal("\#%02X%02X%02XFF" % [150, 113, 23], Cairo::Color::SANDY_TAUPE.to_s) end # Sap green: #507D2A: (80, 125, 42) test("Sap green") do assert_equal("\#%02X%02X%02XFF" % [80, 125, 42], Cairo::Color::SAP_GREEN.to_s) end # Sapphire: #0F52BA: (15, 82, 186) test("Sapphire") do assert_equal("\#%02X%02X%02XFF" % [15, 82, 186], Cairo::Color::SAPPHIRE.to_s) end # Sapphire blue: #0067A5: (0, 103, 165) test("Sapphire blue") do assert_equal("\#%02X%02X%02XFF" % [0, 103, 165], Cairo::Color::SAPPHIRE_BLUE.to_s) end # Sasquatch Socks: #FF4681: (255, 70, 129) test("Sasquatch Socks") do assert_equal("\#%02X%02X%02XFF" % [255, 70, 129], Cairo::Color::SASQUATCH_SOCKS.to_s) end # Satin sheen gold: #CBA135: (203, 161, 53) test("Satin sheen gold") do assert_equal("\#%02X%02X%02XFF" % [203, 161, 53], Cairo::Color::SATIN_SHEEN_GOLD.to_s) end # Scarlet: #FF2400: (255, 36, 0) test("Scarlet") do assert_equal("\#%02X%02X%02XFF" % [255, 36, 0], Cairo::Color::SCARLET.to_s) end # Schauss pink: #FF91AF: (255, 145, 175) test("Schauss pink") do assert_equal("\#%02X%02X%02XFF" % [255, 145, 175], Cairo::Color::SCHAUSS_PINK.to_s) end # School bus yellow: #FFD800: (255, 216, 0) test("School bus yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 216, 0], Cairo::Color::SCHOOL_BUS_YELLOW.to_s) end # Screamin' Green: #66FF66: (102, 255, 102) test("Screamin' Green") do assert_equal("\#%02X%02X%02XFF" % [102, 255, 102], Cairo::Color::SCREAMIN_GREEN.to_s) end # Sea blue: #006994: (0, 105, 148) test("Sea blue") do assert_equal("\#%02X%02X%02XFF" % [0, 105, 148], Cairo::Color::SEA_BLUE.to_s) end # Sea Foam Green: #9FE2BF: (195, 226, 191) test("Sea Foam Green") do assert_equal("\#%02X%02X%02XFF" % [195, 226, 191], Cairo::Color::SEA_FOAM_GREEN.to_s) end # Sea green: #2E8B57: (46, 139, 87) test("Sea green") do assert_equal("\#%02X%02X%02XFF" % [46, 139, 87], Cairo::Color::SEA_GREEN.to_s) end # Sea green (Crayola): #00FFCD: (1, 255, 205) test("Sea green (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [1, 255, 205], Cairo::Color::SEA_GREEN_CRAYOLA.to_s) end # Sea Serpent: #4BC7CF: (75, 199, 207) test("Sea Serpent") do assert_equal("\#%02X%02X%02XFF" % [75, 199, 207], Cairo::Color::SEA_SERPENT.to_s) end # Seal brown: #59260B: (50, 20, 20) test("Seal brown") do assert_equal("\#%02X%02X%02XFF" % [50, 20, 20], Cairo::Color::SEAL_BROWN.to_s) end # Seashell: #FFF5EE: (255, 245, 238) test("Seashell") do assert_equal("\#%02X%02X%02XFF" % [255, 245, 238], Cairo::Color::SEASHELL.to_s) end # Selective yellow: #FFBA00: (255, 186, 0) test("Selective yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 186, 0], Cairo::Color::SELECTIVE_YELLOW.to_s) end # Sepia: #704214: (112, 66, 20) test("Sepia") do assert_equal("\#%02X%02X%02XFF" % [112, 66, 20], Cairo::Color::SEPIA.to_s) end # Shadow: #8A795D: (138, 121, 93) test("Shadow") do assert_equal("\#%02X%02X%02XFF" % [138, 121, 93], Cairo::Color::SHADOW.to_s) end # Shadow blue: #778BA5: (119, 139, 165) test("Shadow blue") do assert_equal("\#%02X%02X%02XFF" % [119, 139, 165], Cairo::Color::SHADOW_BLUE.to_s) end # Shampoo: #FFCFF1: (255, 207, 241) test("Shampoo") do assert_equal("\#%02X%02X%02XFF" % [255, 207, 241], Cairo::Color::SHAMPOO.to_s) end # Shamrock green: #009E60: (0, 158, 96) test("Shamrock green") do assert_equal("\#%02X%02X%02XFF" % [0, 158, 96], Cairo::Color::SHAMROCK_GREEN.to_s) end # Shandy: #FFE670: (255, 230, 112) test("Shandy") do assert_equal("\#%02X%02X%02XFF" % [255, 230, 112], Cairo::Color::SHANDY.to_s) end # Sheen green: #8FD400: (143, 212, 0) test("Sheen green") do assert_equal("\#%02X%02X%02XFF" % [143, 212, 0], Cairo::Color::SHEEN_GREEN.to_s) end # Shimmering Blush: #D98695: (217, 134, 149) test("Shimmering Blush") do assert_equal("\#%02X%02X%02XFF" % [217, 134, 149], Cairo::Color::SHIMMERING_BLUSH.to_s) end # Shiny Shamrock: #5FA778: (95, 167, 120) test("Shiny Shamrock") do assert_equal("\#%02X%02X%02XFF" % [95, 167, 120], Cairo::Color::SHINY_SHAMROCK.to_s) end # Shocking pink: #FC0FC0: (252, 15, 192) test("Shocking pink") do assert_equal("\#%02X%02X%02XFF" % [252, 15, 192], Cairo::Color::SHOCKING_PINK.to_s) end # Shocking pink (Crayola): #FF6FFF: (255, 111, 255) test("Shocking pink (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [255, 111, 255], Cairo::Color::SHOCKING_PINK_CRAYOLA.to_s) end # Sienna: #882D17: (136, 45, 23) test("Sienna") do assert_equal("\#%02X%02X%02XFF" % [136, 45, 23], Cairo::Color::SIENNA.to_s) end # Silver: #C0C0C0: (192, 192, 192) test("Silver") do assert_equal("\#%02X%02X%02XFF" % [192, 192, 192], Cairo::Color::SILVER.to_s) end # Silver (Crayola): #C9C0BB: (201, 192, 187) test("Silver (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [201, 192, 187], Cairo::Color::SILVER_CRAYOLA.to_s) end # Silver (Metallic): #AAA9AD: (170, 169, 173) test("Silver (Metallic)") do assert_equal("\#%02X%02X%02XFF" % [170, 169, 173], Cairo::Color::SILVER_METALLIC.to_s) end # Silver chalice: #ACACAC: (172, 172, 172) test("Silver chalice") do assert_equal("\#%02X%02X%02XFF" % [172, 172, 172], Cairo::Color::SILVER_CHALICE.to_s) end # Silver foil: #AFB1AE: (175, 177, 174) test("Silver foil") do assert_equal("\#%02X%02X%02XFF" % [175, 177, 174], Cairo::Color::SILVER_FOIL.to_s) end # Silver Lake blue: #5D89BA: (93, 137, 186) test("Silver Lake blue") do assert_equal("\#%02X%02X%02XFF" % [93, 137, 186], Cairo::Color::SILVER_LAKE_BLUE.to_s) end # Silver pink: #C4AEAD: (196, 174, 173) test("Silver pink") do assert_equal("\#%02X%02X%02XFF" % [196, 174, 173], Cairo::Color::SILVER_PINK.to_s) end # Silver sand: #BFC1C2: (191, 193, 194) test("Silver sand") do assert_equal("\#%02X%02X%02XFF" % [191, 193, 194], Cairo::Color::SILVER_SAND.to_s) end # Sinopia: #CB410B: (203, 65, 11) test("Sinopia") do assert_equal("\#%02X%02X%02XFF" % [203, 65, 11], Cairo::Color::SINOPIA.to_s) end # Sizzling Red: #FF3855: (255, 56, 85) test("Sizzling Red") do assert_equal("\#%02X%02X%02XFF" % [255, 56, 85], Cairo::Color::SIZZLING_RED.to_s) end # Sizzling Sunrise: #FFDB00: (255, 219, 0) test("Sizzling Sunrise") do assert_equal("\#%02X%02X%02XFF" % [255, 219, 0], Cairo::Color::SIZZLING_SUNRISE.to_s) end # Skobeloff: #007474: (0, 116, 116) test("Skobeloff") do assert_equal("\#%02X%02X%02XFF" % [0, 116, 116], Cairo::Color::SKOBELOFF.to_s) end # Sky blue: #87CEEB: (135, 206, 235) test("Sky blue") do assert_equal("\#%02X%02X%02XFF" % [135, 206, 235], Cairo::Color::SKY_BLUE.to_s) end # Sky blue (Crayola): #76D7EA: (118, 215, 234) test("Sky blue (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [118, 215, 234], Cairo::Color::SKY_BLUE_CRAYOLA.to_s) end # Sky magenta: #CF71AF: (207, 113, 175) test("Sky magenta") do assert_equal("\#%02X%02X%02XFF" % [207, 113, 175], Cairo::Color::SKY_MAGENTA.to_s) end # Slate blue: #6A5ACD: (106, 90, 205) test("Slate blue") do assert_equal("\#%02X%02X%02XFF" % [106, 90, 205], Cairo::Color::SLATE_BLUE.to_s) end # Slate gray: #708090: (112, 128, 144) test("Slate gray") do assert_equal("\#%02X%02X%02XFF" % [112, 128, 144], Cairo::Color::SLATE_GRAY.to_s) end # Slimy green: #299617: (41, 150, 23) test("Slimy green") do assert_equal("\#%02X%02X%02XFF" % [41, 150, 23], Cairo::Color::SLIMY_GREEN.to_s) end # Smalt (Dark powder blue): #003399: (0, 51, 153) test("Smalt (Dark powder blue)") do assert_equal("\#%02X%02X%02XFF" % [0, 51, 153], Cairo::Color::SMALT_DARK_POWDER_BLUE.to_s) end # Smashed Pumpkin: #FF6D3A: (255, 109, 58) test("Smashed Pumpkin") do assert_equal("\#%02X%02X%02XFF" % [255, 109, 58], Cairo::Color::SMASHED_PUMPKIN.to_s) end # Smitten: #C84186: (200, 65, 134) test("Smitten") do assert_equal("\#%02X%02X%02XFF" % [200, 65, 134], Cairo::Color::SMITTEN.to_s) end # Smoke: #738276: (115, 130, 118) test("Smoke") do assert_equal("\#%02X%02X%02XFF" % [115, 130, 118], Cairo::Color::SMOKE.to_s) end # Smokey Topaz: #832A0D: (131, 42, 34) test("Smokey Topaz") do assert_equal("\#%02X%02X%02XFF" % [131, 42, 34], Cairo::Color::SMOKEY_TOPAZ.to_s) end # Smoky black: #100C08: (16, 12, 8) test("Smoky black") do assert_equal("\#%02X%02X%02XFF" % [16, 12, 8], Cairo::Color::SMOKY_BLACK.to_s) end # Snow: #FFFAFA: (255, 250, 250) test("Snow") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 250], Cairo::Color::SNOW.to_s) end # Soap: #CEC8EF: (206, 200, 239) test("Soap") do assert_equal("\#%02X%02X%02XFF" % [206, 200, 239], Cairo::Color::SOAP.to_s) end # Solid pink: #893843: (137, 56, 67) test("Solid pink") do assert_equal("\#%02X%02X%02XFF" % [137, 56, 67], Cairo::Color::SOLID_PINK.to_s) end # Sonic silver: #757575: (117, 117, 117) test("Sonic silver") do assert_equal("\#%02X%02X%02XFF" % [117, 117, 117], Cairo::Color::SONIC_SILVER.to_s) end # Spartan Crimson: #9E1316: (158, 19, 22) test("Spartan Crimson") do assert_equal("\#%02X%02X%02XFF" % [158, 19, 22], Cairo::Color::SPARTAN_CRIMSON.to_s) end # Space cadet: #1D2951: (29, 41, 81) test("Space cadet") do assert_equal("\#%02X%02X%02XFF" % [29, 41, 81], Cairo::Color::SPACE_CADET.to_s) end # Spanish bistre: #807532: (128, 117, 50) test("Spanish bistre") do assert_equal("\#%02X%02X%02XFF" % [128, 117, 50], Cairo::Color::SPANISH_BISTRE.to_s) end # Spanish blue: #0070B8: (0, 112, 184) test("Spanish blue") do assert_equal("\#%02X%02X%02XFF" % [0, 112, 184], Cairo::Color::SPANISH_BLUE.to_s) end # Spanish carmine: #D10047: (209, 0, 71) test("Spanish carmine") do assert_equal("\#%02X%02X%02XFF" % [209, 0, 71], Cairo::Color::SPANISH_CARMINE.to_s) end # Spanish crimson: #E51A4C: (229, 26, 76) test("Spanish crimson") do assert_equal("\#%02X%02X%02XFF" % [229, 26, 76], Cairo::Color::SPANISH_CRIMSON.to_s) end # Spanish gray: #989898: (152, 152, 152) test("Spanish gray") do assert_equal("\#%02X%02X%02XFF" % [152, 152, 152], Cairo::Color::SPANISH_GRAY.to_s) end # Spanish green: #009150: (0, 145, 80) test("Spanish green") do assert_equal("\#%02X%02X%02XFF" % [0, 145, 80], Cairo::Color::SPANISH_GREEN.to_s) end # Spanish orange: #E86100: (232, 97, 0) test("Spanish orange") do assert_equal("\#%02X%02X%02XFF" % [232, 97, 0], Cairo::Color::SPANISH_ORANGE.to_s) end # Spanish pink: #F7BFBE: (247, 191, 190) test("Spanish pink") do assert_equal("\#%02X%02X%02XFF" % [247, 191, 190], Cairo::Color::SPANISH_PINK.to_s) end # Spanish purple: #66033C: (102, 3, 60) test("Spanish purple") do assert_equal("\#%02X%02X%02XFF" % [102, 3, 60], Cairo::Color::SPANISH_PURPLE.to_s) end # Spanish red: #E60026: (230, 0, 38) test("Spanish red") do assert_equal("\#%02X%02X%02XFF" % [230, 0, 38], Cairo::Color::SPANISH_RED.to_s) end # Spanish sky blue: #00FFFF: (0, 255, 255) test("Spanish sky blue") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 255], Cairo::Color::SPANISH_SKY_BLUE.to_s) end # Spanish violet: #4C2882: (76, 40, 130) test("Spanish violet") do assert_equal("\#%02X%02X%02XFF" % [76, 40, 130], Cairo::Color::SPANISH_VIOLET.to_s) end # Spanish viridian: #007F5C: (0, 127, 92) test("Spanish viridian") do assert_equal("\#%02X%02X%02XFF" % [0, 127, 92], Cairo::Color::SPANISH_VIRIDIAN.to_s) end # Spanish yellow: #F6B511: (246, 181, 17) test("Spanish yellow") do assert_equal("\#%02X%02X%02XFF" % [246, 181, 17], Cairo::Color::SPANISH_YELLOW.to_s) end # Spicy mix: #8B5f4D: (139, 95, 77) test("Spicy mix") do assert_equal("\#%02X%02X%02XFF" % [139, 95, 77], Cairo::Color::SPICY_MIX.to_s) end # Spiro Disco Ball: #0FC0FC: (15, 192, 252) test("Spiro Disco Ball") do assert_equal("\#%02X%02X%02XFF" % [15, 192, 252], Cairo::Color::SPIRO_DISCO_BALL.to_s) end # Spring bud: #A7FC00: (167, 252, 0) test("Spring bud") do assert_equal("\#%02X%02X%02XFF" % [167, 252, 0], Cairo::Color::SPRING_BUD.to_s) end # Spring Frost: #87FF2A: (135, 255, 42) test("Spring Frost") do assert_equal("\#%02X%02X%02XFF" % [135, 255, 42], Cairo::Color::SPRING_FROST.to_s) end # Spring green: #00FF7F: (0, 255, 127) test("Spring green") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 127], Cairo::Color::SPRING_GREEN.to_s) end # Spring green (Crayola): #ECEBBD: (236, 235, 189) test("Spring green (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [236, 235, 189], Cairo::Color::SPRING_GREEN_CRAYOLA.to_s) end # Star command blue: #007BB8: (0, 123, 184) test("Star command blue") do assert_equal("\#%02X%02X%02XFF" % [0, 123, 184], Cairo::Color::STAR_COMMAND_BLUE.to_s) end # Steel blue: #4682B4: (70, 130, 180) test("Steel blue") do assert_equal("\#%02X%02X%02XFF" % [70, 130, 180], Cairo::Color::STEEL_BLUE.to_s) end # Steel pink: #CC33CC: (204, 51, 204) test("Steel pink") do assert_equal("\#%02X%02X%02XFF" % [204, 51, 204], Cairo::Color::STEEL_PINK.to_s) end # Steel Teal: #5F8A8B: (95, 138, 139) test("Steel Teal") do assert_equal("\#%02X%02X%02XFF" % [95, 138, 139], Cairo::Color::STEEL_TEAL.to_s) end # Stil de grain yellow: #FADA5E: (250, 218, 94) test("Stil de grain yellow") do assert_equal("\#%02X%02X%02XFF" % [250, 218, 94], Cairo::Color::STIL_DE_GRAIN_YELLOW.to_s) end # Straw: #E4D96F: (228, 217, 111) test("Straw") do assert_equal("\#%02X%02X%02XFF" % [228, 217, 111], Cairo::Color::STRAW.to_s) end # Strawberry: #FC5A8D: (252, 90, 141) test("Strawberry") do assert_equal("\#%02X%02X%02XFF" % [252, 90, 141], Cairo::Color::STRAWBERRY.to_s) end # Stop red: #CF142B: (207, 20, 43) test("Stop red") do assert_equal("\#%02X%02X%02XFF" % [207, 20, 43], Cairo::Color::STOP_RED.to_s) end # Strawberry iced tea: #FC5A8D: (252, 90, 141) test("Strawberry iced tea") do assert_equal("\#%02X%02X%02XFF" % [252, 90, 141], Cairo::Color::STRAWBERRY_ICED_TEA.to_s) end # Strawberry red: #C83F49: (200, 63, 73) test("Strawberry red") do assert_equal("\#%02X%02X%02XFF" % [200, 63, 73], Cairo::Color::STRAWBERRY_RED.to_s) end # Sugar Plum: #914E75: (145, 78, 117) test("Sugar Plum") do assert_equal("\#%02X%02X%02XFF" % [145, 78, 117], Cairo::Color::SUGAR_PLUM.to_s) end # Sunburnt Cyclops: #FF404C: (255, 64, 76) test("Sunburnt Cyclops") do assert_equal("\#%02X%02X%02XFF" % [255, 64, 76], Cairo::Color::SUNBURNT_CYCLOPS.to_s) end # Sunglow: #FFCC33: (255, 204, 51) test("Sunglow") do assert_equal("\#%02X%02X%02XFF" % [255, 204, 51], Cairo::Color::SUNGLOW.to_s) end # Sunny: #F2F27A: (242, 242, 122) test("Sunny") do assert_equal("\#%02X%02X%02XFF" % [242, 242, 122], Cairo::Color::SUNNY.to_s) end # Sunray: #E3AB57: (227, 171, 87) test("Sunray") do assert_equal("\#%02X%02X%02XFF" % [227, 171, 87], Cairo::Color::SUNRAY.to_s) end # Sunset: #FAD6A5: (250, 214, 165) test("Sunset") do assert_equal("\#%02X%02X%02XFF" % [250, 214, 165], Cairo::Color::SUNSET.to_s) end # Sunset orange: #FD5E53: (253, 94, 83) test("Sunset orange") do assert_equal("\#%02X%02X%02XFF" % [253, 94, 83], Cairo::Color::SUNSET_ORANGE.to_s) end # Super pink: #CF6BA9: (207, 107, 169) test("Super pink") do assert_equal("\#%02X%02X%02XFF" % [207, 107, 169], Cairo::Color::SUPER_PINK.to_s) end # Sweet Brown: #A83731: (168, 55, 49) test("Sweet Brown") do assert_equal("\#%02X%02X%02XFF" % [168, 55, 49], Cairo::Color::SWEET_BROWN.to_s) end # Tan: #D2B48C: (210, 180, 140) test("Tan") do assert_equal("\#%02X%02X%02XFF" % [210, 180, 140], Cairo::Color::TAN.to_s) end # Tan (Crayola): #D99A6C: (217, 154, 108) test("Tan (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [217, 154, 108], Cairo::Color::TAN_CRAYOLA.to_s) end # Tangelo: #F94D00: (249, 77, 0) test("Tangelo") do assert_equal("\#%02X%02X%02XFF" % [249, 77, 0], Cairo::Color::TANGELO.to_s) end # Tangerine: #F28500: (242, 133, 0) test("Tangerine") do assert_equal("\#%02X%02X%02XFF" % [242, 133, 0], Cairo::Color::TANGERINE.to_s) end # Tangerine yellow: #FFCC00: (255, 204, 0) test("Tangerine yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 204, 0], Cairo::Color::TANGERINE_YELLOW.to_s) end # Tango pink: #E4717A: (228, 113, 122) test("Tango pink") do assert_equal("\#%02X%02X%02XFF" % [228, 113, 122], Cairo::Color::TANGO_PINK.to_s) end # Tart Orange: #FB4D46: (251, 77, 70) test("Tart Orange") do assert_equal("\#%02X%02X%02XFF" % [251, 77, 70], Cairo::Color::TART_ORANGE.to_s) end # Taupe: #483C32: (72, 60, 50) test("Taupe") do assert_equal("\#%02X%02X%02XFF" % [72, 60, 50], Cairo::Color::TAUPE.to_s) end # Taupe gray: #8B8589: (139, 133, 137) test("Taupe gray") do assert_equal("\#%02X%02X%02XFF" % [139, 133, 137], Cairo::Color::TAUPE_GRAY.to_s) end # Tea green: #D0F0C0: (208, 240, 192) test("Tea green") do assert_equal("\#%02X%02X%02XFF" % [208, 240, 192], Cairo::Color::TEA_GREEN.to_s) end # Tea rose: #F88379: (248, 131, 121) test("Tea rose") do assert_equal("\#%02X%02X%02XFF" % [248, 131, 121], Cairo::Color::TEA_ROSE.to_s) end # Teal: #008080: (0, 128, 128) test("Teal") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 128], Cairo::Color::TEAL.to_s) end # Teal blue: #367588: (54, 117, 136) test("Teal blue") do assert_equal("\#%02X%02X%02XFF" % [54, 117, 136], Cairo::Color::TEAL_BLUE.to_s) end # Teal deer: #99E6B3: (153, 230, 179) test("Teal deer") do assert_equal("\#%02X%02X%02XFF" % [153, 230, 179], Cairo::Color::TEAL_DEER.to_s) end # Teal green: #00827F: (0, 130, 127) test("Teal green") do assert_equal("\#%02X%02X%02XFF" % [0, 130, 127], Cairo::Color::TEAL_GREEN.to_s) end # Telemagenta: #CF3476: (207, 52, 118) test("Telemagenta") do assert_equal("\#%02X%02X%02XFF" % [207, 52, 118], Cairo::Color::TELEMAGENTA.to_s) end # Temptress: #3C2126: (60, 33, 38) test("Temptress") do assert_equal("\#%02X%02X%02XFF" % [60, 33, 38], Cairo::Color::TEMPTRESS.to_s) end # Tenné (tawny): #CD5700: (205, 87, 0) test("Tenn\u00E9 (tawny)") do assert_equal("\#%02X%02X%02XFF" % [205, 87, 0], Cairo::Color::TAWNY.to_s) end # Terra cotta: #E2725B: (226, 114, 91) test("Terra cotta") do assert_equal("\#%02X%02X%02XFF" % [226, 114, 91], Cairo::Color::TERRA_COTTA.to_s) end # Thistle: #D8BFD8: (216, 191, 216) test("Thistle") do assert_equal("\#%02X%02X%02XFF" % [216, 191, 216], Cairo::Color::THISTLE.to_s) end # Thistle (Crayola): #EBB0D7: (235, 176, 215) test("Thistle (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [235, 176, 215], Cairo::Color::THISTLE_CRAYOLA.to_s) end # Thulian pink: #DE6FA1: (222, 111, 161) test("Thulian pink") do assert_equal("\#%02X%02X%02XFF" % [222, 111, 161], Cairo::Color::THULIAN_PINK.to_s) end # Tickle Me Pink: #FC89AC: (252, 137, 172) test("Tickle Me Pink") do assert_equal("\#%02X%02X%02XFF" % [252, 137, 172], Cairo::Color::TICKLE_ME_PINK.to_s) end # Tiffany Blue: #0ABAB5: (10, 186, 181) test("Tiffany Blue") do assert_equal("\#%02X%02X%02XFF" % [10, 186, 181], Cairo::Color::TIFFANY_BLUE.to_s) end # Tiger's eye: #E08D3C: (224, 141, 60) test("Tiger's eye") do assert_equal("\#%02X%02X%02XFF" % [224, 141, 60], Cairo::Color::TIGERS_EYE.to_s) end # Timberwolf: #DBD7D2: (219, 215, 210) test("Timberwolf") do assert_equal("\#%02X%02X%02XFF" % [219, 215, 210], Cairo::Color::TIMBERWOLF.to_s) end # Titanium: #878681: (135, 134, 129) test("Titanium") do assert_equal("\#%02X%02X%02XFF" % [135, 134, 129], Cairo::Color::TITANIUM.to_s) end # Titanium yellow: #EEE600: (238, 230, 0) test("Titanium yellow") do assert_equal("\#%02X%02X%02XFF" % [238, 230, 0], Cairo::Color::TITANIUM_YELLOW.to_s) end # Tomato: #FF6347: (255, 99, 71) test("Tomato") do assert_equal("\#%02X%02X%02XFF" % [255, 99, 71], Cairo::Color::TOMATO.to_s) end # Tomato sauce: #B21807: (178, 24, 7) test("Tomato sauce") do assert_equal("\#%02X%02X%02XFF" % [178, 24, 7], Cairo::Color::TOMATO_SAUCE.to_s) end # Toolbox: #746CC0: (116, 108, 192) test("Toolbox") do assert_equal("\#%02X%02X%02XFF" % [116, 108, 192], Cairo::Color::TOOLBOX.to_s) end # Tooth: #FFFAFA: (255, 250, 250) test("Tooth") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 250], Cairo::Color::TOOTH.to_s) end # Topaz: #FFC87C: (255, 200, 124) test("Topaz") do assert_equal("\#%02X%02X%02XFF" % [255, 200, 124], Cairo::Color::TOPAZ.to_s) end # Tractor red: #FD0E35: (253, 14, 53) test("Tractor red") do assert_equal("\#%02X%02X%02XFF" % [253, 14, 53], Cairo::Color::TRACTOR_RED.to_s) end # Trolley grey: #808080: (128, 128, 128) test("Trolley grey") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 128], Cairo::Color::TROLLEY_GREY.to_s) end # Tropical rain forest: #00755E: (0, 117, 94) test("Tropical rain forest") do assert_equal("\#%02X%02X%02XFF" % [0, 117, 94], Cairo::Color::TROPICAL_RAIN_FOREST.to_s) end # Tropical violet: #CDA4DE: (205, 164, 222) test("Tropical violet") do assert_equal("\#%02X%02X%02XFF" % [205, 164, 222], Cairo::Color::TROPICAL_VIOLET.to_s) end # True blue: #0073CF: (0, 115, 207) test("True blue") do assert_equal("\#%02X%02X%02XFF" % [0, 115, 207], Cairo::Color::TRUE_BLUE.to_s) end # Tufts blue: #3E8EDE: (62, 142, 222) test("Tufts blue") do assert_equal("\#%02X%02X%02XFF" % [62, 142, 222], Cairo::Color::TUFTS_BLUE.to_s) end # Tulip: #FF878D: (255, 135, 141) test("Tulip") do assert_equal("\#%02X%02X%02XFF" % [255, 135, 141], Cairo::Color::TULIP.to_s) end # Tumbleweed: #DEAA88: (222, 170, 136) test("Tumbleweed") do assert_equal("\#%02X%02X%02XFF" % [222, 170, 136], Cairo::Color::TUMBLEWEED.to_s) end # Turkish rose: #B57281: (181, 114, 129) test("Turkish rose") do assert_equal("\#%02X%02X%02XFF" % [181, 114, 129], Cairo::Color::TURKISH_ROSE.to_s) end # Turquoise: #40E0D0: (64, 224, 208) test("Turquoise") do assert_equal("\#%02X%02X%02XFF" % [64, 224, 208], Cairo::Color::TURQUOISE.to_s) end # Turquoise blue: #00FFEF: (0, 255, 239) test("Turquoise blue") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 239], Cairo::Color::TURQUOISE_BLUE.to_s) end # Turquoise green: #A0D6B4: (160, 214, 180) test("Turquoise green") do assert_equal("\#%02X%02X%02XFF" % [160, 214, 180], Cairo::Color::TURQUOISE_GREEN.to_s) end # Turquoise Surf: #00C5CD: (0, 197, 205) test("Turquoise Surf") do assert_equal("\#%02X%02X%02XFF" % [0, 197, 205], Cairo::Color::TURQUOISE_SURF.to_s) end # Turtle green: #8A9A5B: (138, 154, 91) test("Turtle green") do assert_equal("\#%02X%02X%02XFF" % [138, 154, 91], Cairo::Color::TURTLE_GREEN.to_s) end # Tuscan: #FAD6A5: (250, 214, 165) test("Tuscan") do assert_equal("\#%02X%02X%02XFF" % [250, 214, 165], Cairo::Color::TUSCAN.to_s) end # Tuscan brown: #6F4E37: (111, 78, 55) test("Tuscan brown") do assert_equal("\#%02X%02X%02XFF" % [111, 78, 55], Cairo::Color::TUSCAN_BROWN.to_s) end # Tuscan red: #7C4848: (124, 72, 72) test("Tuscan red") do assert_equal("\#%02X%02X%02XFF" % [124, 72, 72], Cairo::Color::TUSCAN_RED.to_s) end # Tuscan tan: #A67B5B: (166, 123, 91) test("Tuscan tan") do assert_equal("\#%02X%02X%02XFF" % [166, 123, 91], Cairo::Color::TUSCAN_TAN.to_s) end # Tuscany: #C09999: (192, 153, 153) test("Tuscany") do assert_equal("\#%02X%02X%02XFF" % [192, 153, 153], Cairo::Color::TUSCANY.to_s) end # Twilight lavender: #8A496B: (138, 73, 107) test("Twilight lavender") do assert_equal("\#%02X%02X%02XFF" % [138, 73, 107], Cairo::Color::TWILIGHT_LAVENDER.to_s) end # Twitter blue: #26A7DE: (38, 167, 222) test("Twitter blue") do assert_equal("\#%02X%02X%02XFF" % [38, 167, 222], Cairo::Color::TWITTER_BLUE.to_s) end # Tyrian purple: #66023C: (102, 2, 60) test("Tyrian purple") do assert_equal("\#%02X%02X%02XFF" % [102, 2, 60], Cairo::Color::TYRIAN_PURPLE.to_s) end # Ultramarine: #3F00FF: (18, 10, 143) test("Ultramarine") do assert_equal("\#%02X%02X%02XFF" % [18, 10, 143], Cairo::Color::ULTRAMARINE.to_s) end # Ultramarine blue: #4166F5: (65, 102, 245) test("Ultramarine blue") do assert_equal("\#%02X%02X%02XFF" % [65, 102, 245], Cairo::Color::ULTRAMARINE_BLUE.to_s) end # Ultramarine blue (Caran d'Ache): #2111EF: (33, 17, 239) test("Ultramarine blue (Caran d'Ache)") do assert_equal("\#%02X%02X%02XFF" % [33, 17, 239], Cairo::Color::ULTRAMARINE_BLUE_CARAN_DACHE.to_s) end # Ultra pink: #FF6FFF: (255, 111, 255) test("Ultra pink") do assert_equal("\#%02X%02X%02XFF" % [255, 111, 255], Cairo::Color::ULTRA_PINK.to_s) end # Ultra red: #FC6C85: (252, 108, 133) test("Ultra red") do assert_equal("\#%02X%02X%02XFF" % [252, 108, 133], Cairo::Color::ULTRA_RED.to_s) end # Umber: #635147: (99, 81, 71) test("Umber") do assert_equal("\#%02X%02X%02XFF" % [99, 81, 71], Cairo::Color::UMBER.to_s) end # Unbleached silk: #FFDDCA: (255, 221, 202) test("Unbleached silk") do assert_equal("\#%02X%02X%02XFF" % [255, 221, 202], Cairo::Color::UNBLEACHED_SILK.to_s) end # United Nations blue: #5B92E5: (91, 146, 229) test("United Nations blue") do assert_equal("\#%02X%02X%02XFF" % [91, 146, 229], Cairo::Color::UNITED_NATIONS_BLUE.to_s) end # Unmellow yellow: #FFFF66: (255, 255, 102) test("Unmellow yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 102], Cairo::Color::UNMELLOW_YELLOW.to_s) end # UP maroon: #7B1113: (123, 17, 19) test("UP maroon") do assert_equal("\#%02X%02X%02XFF" % [123, 17, 19], Cairo::Color::UP_MAROON.to_s) end # Upsdell red: #AE2029: (174, 32, 41) test("Upsdell red") do assert_equal("\#%02X%02X%02XFF" % [174, 32, 41], Cairo::Color::UPSDELL_RED.to_s) end # Urobilin: #E1AD21: (225, 173, 33) test("Urobilin") do assert_equal("\#%02X%02X%02XFF" % [225, 173, 33], Cairo::Color::UROBILIN.to_s) end # Vampire black: #080808: (8, 8, 8) test("Vampire black") do assert_equal("\#%02X%02X%02XFF" % [8, 8, 8], Cairo::Color::VAMPIRE_BLACK.to_s) end # Van Dyke brown: #664228: (102, 66, 40) test("Van Dyke brown") do assert_equal("\#%02X%02X%02XFF" % [102, 66, 40], Cairo::Color::VAN_DYKE_BROWN.to_s) end # Vanilla: #F3E5AB: (243, 229, 171) test("Vanilla") do assert_equal("\#%02X%02X%02XFF" % [243, 229, 171], Cairo::Color::VANILLA.to_s) end # Vanilla ice: #F38FA9: (243, 143, 169) test("Vanilla ice") do assert_equal("\#%02X%02X%02XFF" % [243, 143, 169], Cairo::Color::VANILLA_ICE.to_s) end # Vegas gold: #C5B358: (197, 179, 88) test("Vegas gold") do assert_equal("\#%02X%02X%02XFF" % [197, 179, 88], Cairo::Color::VEGAS_GOLD.to_s) end # Venetian red: #C80815: (200, 8, 21) test("Venetian red") do assert_equal("\#%02X%02X%02XFF" % [200, 8, 21], Cairo::Color::VENETIAN_RED.to_s) end # Verdigris: #43B3AE: (67, 179, 174) test("Verdigris") do assert_equal("\#%02X%02X%02XFF" % [67, 179, 174], Cairo::Color::VERDIGRIS.to_s) end # Vermilion: #E34234: (227, 66, 52) test("Vermilion") do assert_equal("\#%02X%02X%02XFF" % [227, 66, 52], Cairo::Color::VERMILION.to_s) end # Veronica: #A020F0: (160, 32, 240) test("Veronica") do assert_equal("\#%02X%02X%02XFF" % [160, 32, 240], Cairo::Color::VERONICA.to_s) end # Verse green: #18880d: (24, 136, 13) test("Verse green") do assert_equal("\#%02X%02X%02XFF" % [24, 136, 13], Cairo::Color::VERSE_GREEN.to_s) end # Very light azure: #74BBFB: (116, 187, 251) test("Very light azure") do assert_equal("\#%02X%02X%02XFF" % [116, 187, 251], Cairo::Color::VERY_LIGHT_AZURE.to_s) end # Very light blue: #6666FF: (102, 102, 255) test("Very light blue") do assert_equal("\#%02X%02X%02XFF" % [102, 102, 255], Cairo::Color::VERY_LIGHT_BLUE.to_s) end # Very light malachite green: #64E986: (100, 233, 134) test("Very light malachite green") do assert_equal("\#%02X%02X%02XFF" % [100, 233, 134], Cairo::Color::VERY_LIGHT_MALACHITE_GREEN.to_s) end # Very light tangelo: #FFB077: (255, 176, 119) test("Very light tangelo") do assert_equal("\#%02X%02X%02XFF" % [255, 176, 119], Cairo::Color::VERY_LIGHT_TANGELO.to_s) end # Very pale orange: #FFDFBF: (255, 223, 191) test("Very pale orange") do assert_equal("\#%02X%02X%02XFF" % [255, 223, 191], Cairo::Color::VERY_PALE_ORANGE.to_s) end # Very pale yellow: #FFFFBF: (255, 255, 191) test("Very pale yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 191], Cairo::Color::VERY_PALE_YELLOW.to_s) end # Vine Green: #164010: (22, 64, 16) test("Vine Green") do assert_equal("\#%02X%02X%02XFF" % [22, 64, 16], Cairo::Color::VINE_GREEN.to_s) end # Violet: #8F00FF: (143, 0, 255) test("Violet") do assert_equal("\#%02X%02X%02XFF" % [143, 0, 255], Cairo::Color::VIOLET.to_s) end # Violet (Caran d'Ache): #6E00C0: (110, 0, 192) test("Violet (Caran d'Ache)") do assert_equal("\#%02X%02X%02XFF" % [110, 0, 192], Cairo::Color::VIOLET_CARAN_DACHE.to_s) end # Violet (color wheel): #7F00FF: (127, 0, 255) test("Violet (color wheel)") do assert_equal("\#%02X%02X%02XFF" % [127, 0, 255], Cairo::Color::VIOLET_COLOR_WHEEL.to_s) end # Violet (crayola): #963D7F: (150, 61, 127) test("Violet (crayola)") do assert_equal("\#%02X%02X%02XFF" % [150, 61, 127], Cairo::Color::VIOLET_CRAYOLA.to_s) end # Violet (RYB): #8601AF: (134, 1, 175) test("Violet (RYB)") do assert_equal("\#%02X%02X%02XFF" % [134, 1, 175], Cairo::Color::VIOLET_RYB.to_s) end # Violet (web): #EE82EE: (238, 130, 238) test("Violet (web)") do assert_equal("\#%02X%02X%02XFF" % [238, 130, 238], Cairo::Color::VIOLET_WEB.to_s) end # Violet-blue: #324AB2: (50, 74, 178) test("Violet-blue") do assert_equal("\#%02X%02X%02XFF" % [50, 74, 178], Cairo::Color::VIOLET_BLUE.to_s) end # Violet-blue (Crayola): #766EC8: (118, 110, 200) test("Violet-blue (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [118, 110, 200], Cairo::Color::VIOLET_BLUE_CRAYOLA.to_s) end # Violet-red: #F75394: (247, 83, 148) test("Violet-red") do assert_equal("\#%02X%02X%02XFF" % [247, 83, 148], Cairo::Color::VIOLET_RED.to_s) end # Violin Brown: #674403: (103, 68, 3) test("Violin Brown") do assert_equal("\#%02X%02X%02XFF" % [103, 68, 3], Cairo::Color::VIOLIN_BROWN.to_s) end # Viridian: #40826D: (64, 130, 109) test("Viridian") do assert_equal("\#%02X%02X%02XFF" % [64, 130, 109], Cairo::Color::VIRIDIAN.to_s) end # Viridian green: #009698: (0, 150, 152) test("Viridian green") do assert_equal("\#%02X%02X%02XFF" % [0, 150, 152], Cairo::Color::VIRIDIAN_GREEN.to_s) end # Vista blue: #7C9ED9: (124, 158, 217) test("Vista blue") do assert_equal("\#%02X%02X%02XFF" % [124, 158, 217], Cairo::Color::VISTA_BLUE.to_s) end # Vivid amber: #cc9900: (204, 153, 0) test("Vivid amber") do assert_equal("\#%02X%02X%02XFF" % [204, 153, 0], Cairo::Color::VIVID_AMBER.to_s) end # Vivid auburn: #922724: (146, 39, 36) test("Vivid auburn") do assert_equal("\#%02X%02X%02XFF" % [146, 39, 36], Cairo::Color::VIVID_AUBURN.to_s) end # Vivid burgundy: #9F1D35: (159, 29, 53) test("Vivid burgundy") do assert_equal("\#%02X%02X%02XFF" % [159, 29, 53], Cairo::Color::VIVID_BURGUNDY.to_s) end # Vivid cerise: #DA1D81: (218, 29, 129) test("Vivid cerise") do assert_equal("\#%02X%02X%02XFF" % [218, 29, 129], Cairo::Color::VIVID_CERISE.to_s) end # Vivid cerulean: #00AAEE: (0, 170, 238) test("Vivid cerulean") do assert_equal("\#%02X%02X%02XFF" % [0, 170, 238], Cairo::Color::VIVID_CERULEAN.to_s) end # Vivid crimson: #CC0033: (204, 0, 51) test("Vivid crimson") do assert_equal("\#%02X%02X%02XFF" % [204, 0, 51], Cairo::Color::VIVID_CRIMSON.to_s) end # Vivid gamboge: #FF9900: (255, 153, 0) test("Vivid gamboge") do assert_equal("\#%02X%02X%02XFF" % [255, 153, 0], Cairo::Color::VIVID_GAMBOGE.to_s) end # Vivid lime green: #a6d608: (166, 214, 8) test("Vivid lime green") do assert_equal("\#%02X%02X%02XFF" % [166, 214, 8], Cairo::Color::VIVID_LIME_GREEN.to_s) end # Vivid malachite: #00cc33: (0, 204, 51) test("Vivid malachite") do assert_equal("\#%02X%02X%02XFF" % [0, 204, 51], Cairo::Color::VIVID_MALACHITE.to_s) end # Vivid mulberry: #B80CE3: (184, 12, 227) test("Vivid mulberry") do assert_equal("\#%02X%02X%02XFF" % [184, 12, 227], Cairo::Color::VIVID_MULBERRY.to_s) end # Vivid orange: #FF5F00: (255, 95, 0) test("Vivid orange") do assert_equal("\#%02X%02X%02XFF" % [255, 95, 0], Cairo::Color::VIVID_ORANGE.to_s) end # Vivid orange peel: #FFA000: (255, 160, 0) test("Vivid orange peel") do assert_equal("\#%02X%02X%02XFF" % [255, 160, 0], Cairo::Color::VIVID_ORANGE_PEEL.to_s) end # Vivid orchid: #CC00FF: (204, 0, 255) test("Vivid orchid") do assert_equal("\#%02X%02X%02XFF" % [204, 0, 255], Cairo::Color::VIVID_ORCHID.to_s) end # Vivid raspberry: #FF006C: (255, 0, 108) test("Vivid raspberry") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 108], Cairo::Color::VIVID_RASPBERRY.to_s) end # Vivid red: #F70D1A: (247, 13, 26) test("Vivid red") do assert_equal("\#%02X%02X%02XFF" % [247, 13, 26], Cairo::Color::VIVID_RED.to_s) end # Vivid red-tangelo: #DF6124: (223, 97, 36) test("Vivid red-tangelo") do assert_equal("\#%02X%02X%02XFF" % [223, 97, 36], Cairo::Color::VIVID_RED_TANGELO.to_s) end # Vivid sky blue: #00CCFF: (0, 204, 255) test("Vivid sky blue") do assert_equal("\#%02X%02X%02XFF" % [0, 204, 255], Cairo::Color::VIVID_SKY_BLUE.to_s) end # Vivid tangelo: #F07427: (240, 116, 39) test("Vivid tangelo") do assert_equal("\#%02X%02X%02XFF" % [240, 116, 39], Cairo::Color::VIVID_TANGELO.to_s) end # Vivid tangerine: #FFA089: (255, 160, 137) test("Vivid tangerine") do assert_equal("\#%02X%02X%02XFF" % [255, 160, 137], Cairo::Color::VIVID_TANGERINE.to_s) end # Vivid vermilion: #e56024: (229, 96, 36) test("Vivid vermilion") do assert_equal("\#%02X%02X%02XFF" % [229, 96, 36], Cairo::Color::VIVID_VERMILION.to_s) end # Vivid violet: #9F00FF: (159, 0, 255) test("Vivid violet") do assert_equal("\#%02X%02X%02XFF" % [159, 0, 255], Cairo::Color::VIVID_VIOLET.to_s) end # Vivid yellow: #FFE302: (255, 227, 2) test("Vivid yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 227, 2], Cairo::Color::VIVID_YELLOW.to_s) end # Water: #D4F1F9: (212, 241, 249) test("Water") do assert_equal("\#%02X%02X%02XFF" % [212, 241, 249], Cairo::Color::WATER.to_s) end # Watermelon: #F05C85: (240, 92, 133) test("Watermelon") do assert_equal("\#%02X%02X%02XFF" % [240, 92, 133], Cairo::Color::WATERMELON.to_s) end # Watermelon red: #BF4147: (190, 65, 71) test("Watermelon red") do assert_equal("\#%02X%02X%02XFF" % [190, 65, 71], Cairo::Color::WATERMELON_RED.to_s) end # Watermelon Yellow: #EEFF1B: (238, 255, 27) test("Watermelon Yellow") do assert_equal("\#%02X%02X%02XFF" % [238, 255, 27], Cairo::Color::WATERMELON_YELLOW.to_s) end # Waterspout: #A4F4F9: (164, 244, 249) test("Waterspout") do assert_equal("\#%02X%02X%02XFF" % [164, 244, 249], Cairo::Color::WATERSPOUT.to_s) end # Weldon Blue: #7C98AB: (124, 152, 171) test("Weldon Blue") do assert_equal("\#%02X%02X%02XFF" % [124, 152, 171], Cairo::Color::WELDON_BLUE.to_s) end # Wenge: #645452: (100, 84, 82) test("Wenge") do assert_equal("\#%02X%02X%02XFF" % [100, 84, 82], Cairo::Color::WENGE.to_s) end # Wheat: #F5DEB3: (245, 222, 179) test("Wheat") do assert_equal("\#%02X%02X%02XFF" % [245, 222, 179], Cairo::Color::WHEAT.to_s) end # White: #FFFFFF: (255, 255, 255) test("White") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 255], Cairo::Color::WHITE.to_s) end # White chocolate: #EDE6D6: (237, 230, 214) test("White chocolate") do assert_equal("\#%02X%02X%02XFF" % [237, 230, 214], Cairo::Color::WHITE_CHOCOLATE.to_s) end # White coffee: #E6E0D4: (230, 224, 212) test("White coffee") do assert_equal("\#%02X%02X%02XFF" % [230, 224, 212], Cairo::Color::WHITE_COFFEE.to_s) end # White smoke: #F5F5F5: (245, 245, 245) test("White smoke") do assert_equal("\#%02X%02X%02XFF" % [245, 245, 245], Cairo::Color::WHITE_SMOKE.to_s) end # Wild orchid: #D470A2: (212, 112, 162) test("Wild orchid") do assert_equal("\#%02X%02X%02XFF" % [212, 112, 162], Cairo::Color::WILD_ORCHID.to_s) end # Wild Strawberry: #FF43A4: (255, 67, 164) test("Wild Strawberry") do assert_equal("\#%02X%02X%02XFF" % [255, 67, 164], Cairo::Color::WILD_STRAWBERRY.to_s) end # Wild watermelon: #FC6C85: (252, 108, 133) test("Wild watermelon") do assert_equal("\#%02X%02X%02XFF" % [252, 108, 133], Cairo::Color::WILD_WATERMELON.to_s) end # Willpower orange: #FD5800: (253, 88, 0) test("Willpower orange") do assert_equal("\#%02X%02X%02XFF" % [253, 88, 0], Cairo::Color::WILLPOWER_ORANGE.to_s) end # Windsor tan: #A75502: (167, 85, 2) test("Windsor tan") do assert_equal("\#%02X%02X%02XFF" % [167, 85, 2], Cairo::Color::WINDSOR_TAN.to_s) end # Wine: #722F37: (114, 47, 55) test("Wine") do assert_equal("\#%02X%02X%02XFF" % [114, 47, 55], Cairo::Color::WINE.to_s) end # Wine dregs: #673147: (103, 49, 71) test("Wine dregs") do assert_equal("\#%02X%02X%02XFF" % [103, 49, 71], Cairo::Color::WINE_DREGS.to_s) end # Wine red: #B11226: (177, 18, 38) test("Wine red") do assert_equal("\#%02X%02X%02XFF" % [177, 18, 38], Cairo::Color::WINE_RED.to_s) end # Winter Sky: #FF007C: (255, 0, 124) test("Winter Sky") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 124], Cairo::Color::WINTER_SKY.to_s) end # Winter Wizard: #A0E6FF: (160, 230, 255) test("Winter Wizard") do assert_equal("\#%02X%02X%02XFF" % [160, 230, 255], Cairo::Color::WINTER_WIZARD.to_s) end # Wintergreen Dream: #56887D: (86, 136, 125) test("Wintergreen Dream") do assert_equal("\#%02X%02X%02XFF" % [86, 136, 125], Cairo::Color::WINTERGREEN_DREAM.to_s) end # Wisteria: #C9A0DC: (201, 160, 220) test("Wisteria") do assert_equal("\#%02X%02X%02XFF" % [201, 160, 220], Cairo::Color::WISTERIA.to_s) end # Wood brown: #C19A6B: (193, 154, 107) test("Wood brown") do assert_equal("\#%02X%02X%02XFF" % [193, 154, 107], Cairo::Color::WOOD_BROWN.to_s) end # Xanadu: #738678: (115, 134, 120) test("Xanadu") do assert_equal("\#%02X%02X%02XFF" % [115, 134, 120], Cairo::Color::XANADU.to_s) end # Yellow: #FFFF00: (255, 255, 0) test("Yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 0], Cairo::Color::YELLOW.to_s) end # Yellow (Crayola): #FCE883: (252, 232, 131) test("Yellow (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [252, 232, 131], Cairo::Color::YELLOW_CRAYOLA.to_s) end # Yellow (Munsell): #EFCC00: (239, 204, 0) test("Yellow (Munsell)") do assert_equal("\#%02X%02X%02XFF" % [239, 204, 0], Cairo::Color::YELLOW_MUNSELL.to_s) end # Yellow (NCS): #FFD300: (255, 211, 0) test("Yellow (NCS)") do assert_equal("\#%02X%02X%02XFF" % [255, 211, 0], Cairo::Color::YELLOW_NCS.to_s) end # Yellow (Pantone): #FEDF00: (254, 223, 0) test("Yellow (Pantone)") do assert_equal("\#%02X%02X%02XFF" % [254, 223, 0], Cairo::Color::YELLOW_PANTONE.to_s) end # Yellow (process): #FFEF00: (255, 239, 0) test("Yellow (process)") do assert_equal("\#%02X%02X%02XFF" % [255, 239, 0], Cairo::Color::YELLOW_PROCESS.to_s) end # Yellow (RYB): #FEFE33: (254, 254, 51) test("Yellow (RYB)") do assert_equal("\#%02X%02X%02XFF" % [254, 254, 51], Cairo::Color::YELLOW_RYB.to_s) end # Yellow-green: #9ACD32: (154, 205, 50) test("Yellow-green") do assert_equal("\#%02X%02X%02XFF" % [154, 205, 50], Cairo::Color::YELLOW_GREEN.to_s) end # Yellow-green (Crayola): #C5E384: (197, 227, 132) test("Yellow-green (Crayola)") do assert_equal("\#%02X%02X%02XFF" % [197, 227, 132], Cairo::Color::YELLOW_GREEN_CRAYOLA.to_s) end # Yellow Orange: #FFAE42: (255, 174, 66) test("Yellow Orange") do assert_equal("\#%02X%02X%02XFF" % [255, 174, 66], Cairo::Color::YELLOW_ORANGE.to_s) end # Yellow Orange (Color Wheel): #FF9505: (255, 149, 5) test("Yellow Orange (Color Wheel)") do assert_equal("\#%02X%02X%02XFF" % [255, 149, 5], Cairo::Color::YELLOW_ORANGE_COLOR_WHEEL.to_s) end # Yellow rose: #FFF000: (255, 240, 0) test("Yellow rose") do assert_equal("\#%02X%02X%02XFF" % [255, 240, 0], Cairo::Color::YELLOW_ROSE.to_s) end # Yellow Sunshine: #FFF700: (255, 247, 0) test("Yellow Sunshine") do assert_equal("\#%02X%02X%02XFF" % [255, 247, 0], Cairo::Color::YELLOW_SUNSHINE.to_s) end # YInMn Blue: #2E5090: (46, 80, 144) test("YInMn Blue") do assert_equal("\#%02X%02X%02XFF" % [46, 80, 144], Cairo::Color::YINMN_BLUE.to_s) end # Zaffre: #0014A8: (0, 20, 168) test("Zaffre") do assert_equal("\#%02X%02X%02XFF" % [0, 20, 168], Cairo::Color::ZAFFRE.to_s) end # Zebra White: #F5F5F5: (245, 245, 245) test("Zebra White") do assert_equal("\#%02X%02X%02XFF" % [245, 245, 245], Cairo::Color::ZEBRA_WHITE.to_s) end # Zinnwaldite: #2C1608: (44, 22, 8) test("Zinnwaldite") do assert_equal("\#%02X%02X%02XFF" % [44, 22, 8], Cairo::Color::ZINNWALDITE.to_s) end class X11Test < self # Alice Blue: #F0F8FF: (240, 248, 255) test("Alice Blue") do assert_equal("\#%02X%02X%02XFF" % [240, 248, 255], Cairo::Color::X11::ALICE_BLUE.to_s) end # Antique White: #FAEBD7: (250, 235, 215) test("Antique White") do assert_equal("\#%02X%02X%02XFF" % [250, 235, 215], Cairo::Color::X11::ANTIQUE_WHITE.to_s) end # Aqua: #00FFFF: (0, 255, 255) test("Aqua") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 255], Cairo::Color::X11::AQUA.to_s) end # Aquamarine: #7FFFD4: (127, 255, 212) test("Aquamarine") do assert_equal("\#%02X%02X%02XFF" % [127, 255, 212], Cairo::Color::X11::AQUAMARINE.to_s) end # Azure: #F0FFFF: (240, 255, 255) test("Azure") do assert_equal("\#%02X%02X%02XFF" % [240, 255, 255], Cairo::Color::X11::AZURE.to_s) end # Beige: #F5F5DC: (245, 245, 220) test("Beige") do assert_equal("\#%02X%02X%02XFF" % [245, 245, 220], Cairo::Color::X11::BEIGE.to_s) end # Bisque: #FFE4C4: (255, 228, 196) test("Bisque") do assert_equal("\#%02X%02X%02XFF" % [255, 228, 196], Cairo::Color::X11::BISQUE.to_s) end # Black: #000000: (0, 0, 0) test("Black") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 0], Cairo::Color::X11::BLACK.to_s) end # Blanched Almond: #FFEBCD: (255, 235, 205) test("Blanched Almond") do assert_equal("\#%02X%02X%02XFF" % [255, 235, 205], Cairo::Color::X11::BLANCHED_ALMOND.to_s) end # Blue: #0000FF: (0, 0, 255) test("Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 255], Cairo::Color::X11::BLUE.to_s) end # Blue Violet: #8A2BE2: (138, 43, 226) test("Blue Violet") do assert_equal("\#%02X%02X%02XFF" % [138, 43, 226], Cairo::Color::X11::BLUE_VIOLET.to_s) end # Brown: #A52A2A: (165, 42, 42) test("Brown") do assert_equal("\#%02X%02X%02XFF" % [165, 42, 42], Cairo::Color::X11::BROWN.to_s) end # Burlywood: #DEB887: (222, 184, 135) test("Burlywood") do assert_equal("\#%02X%02X%02XFF" % [222, 184, 135], Cairo::Color::X11::BURLYWOOD.to_s) end # Cadet Blue: #5F9EA0: (95, 158, 160) test("Cadet Blue") do assert_equal("\#%02X%02X%02XFF" % [95, 158, 160], Cairo::Color::X11::CADET_BLUE.to_s) end # Chartreuse: #7FFF00: (127, 255, 0) test("Chartreuse") do assert_equal("\#%02X%02X%02XFF" % [127, 255, 0], Cairo::Color::X11::CHARTREUSE.to_s) end # Chocolate: #D2691E: (210, 105, 30) test("Chocolate") do assert_equal("\#%02X%02X%02XFF" % [210, 105, 30], Cairo::Color::X11::CHOCOLATE.to_s) end # Coral: #FF7F50: (255, 127, 80) test("Coral") do assert_equal("\#%02X%02X%02XFF" % [255, 127, 80], Cairo::Color::X11::CORAL.to_s) end # Cornflower Blue: #6495ED: (100, 149, 237) test("Cornflower Blue") do assert_equal("\#%02X%02X%02XFF" % [100, 149, 237], Cairo::Color::X11::CORNFLOWER_BLUE.to_s) end # Cornsilk: #FFF8DC: (255, 248, 220) test("Cornsilk") do assert_equal("\#%02X%02X%02XFF" % [255, 248, 220], Cairo::Color::X11::CORNSILK.to_s) end # Crimson: #DC143C: (220, 20, 60) test("Crimson") do assert_equal("\#%02X%02X%02XFF" % [220, 20, 60], Cairo::Color::X11::CRIMSON.to_s) end # Cyan: #00FFFF: (0, 255, 255) test("Cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 255], Cairo::Color::X11::CYAN.to_s) end # Dark Blue: #00008B: (0, 0, 139) test("Dark Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 139], Cairo::Color::X11::DARK_BLUE.to_s) end # Dark Cyan: #008B8B: (0, 139, 139) test("Dark Cyan") do assert_equal("\#%02X%02X%02XFF" % [0, 139, 139], Cairo::Color::X11::DARK_CYAN.to_s) end # Dark Goldenrod: #B8860B: (184, 134, 11) test("Dark Goldenrod") do assert_equal("\#%02X%02X%02XFF" % [184, 134, 11], Cairo::Color::X11::DARK_GOLDENROD.to_s) end # Dark Gray: #A9A9A9: (169, 169, 169) test("Dark Gray") do assert_equal("\#%02X%02X%02XFF" % [169, 169, 169], Cairo::Color::X11::DARK_GRAY.to_s) end # Dark Green: #006400: (0, 100, 0) test("Dark Green") do assert_equal("\#%02X%02X%02XFF" % [0, 100, 0], Cairo::Color::X11::DARK_GREEN.to_s) end # Dark Khaki: #BDB76B: (189, 183, 107) test("Dark Khaki") do assert_equal("\#%02X%02X%02XFF" % [189, 183, 107], Cairo::Color::X11::DARK_KHAKI.to_s) end # Dark Magenta: #8B008B: (139, 0, 139) test("Dark Magenta") do assert_equal("\#%02X%02X%02XFF" % [139, 0, 139], Cairo::Color::X11::DARK_MAGENTA.to_s) end # Dark Olive Green: #556B2F: (85, 107, 47) test("Dark Olive Green") do assert_equal("\#%02X%02X%02XFF" % [85, 107, 47], Cairo::Color::X11::DARK_OLIVE_GREEN.to_s) end # Dark Orange: #FF8C00: (255, 140, 0) test("Dark Orange") do assert_equal("\#%02X%02X%02XFF" % [255, 140, 0], Cairo::Color::X11::DARK_ORANGE.to_s) end # Dark Orchid: #9932CC: (153, 50, 204) test("Dark Orchid") do assert_equal("\#%02X%02X%02XFF" % [153, 50, 204], Cairo::Color::X11::DARK_ORCHID.to_s) end # Dark Red: #8B0000: (139, 0, 0) test("Dark Red") do assert_equal("\#%02X%02X%02XFF" % [139, 0, 0], Cairo::Color::X11::DARK_RED.to_s) end # Dark Salmon: #E9967A: (233, 150, 122) test("Dark Salmon") do assert_equal("\#%02X%02X%02XFF" % [233, 150, 122], Cairo::Color::X11::DARK_SALMON.to_s) end # Dark Sea Green: #8FBC8F: (143, 188, 143) test("Dark Sea Green") do assert_equal("\#%02X%02X%02XFF" % [143, 188, 143], Cairo::Color::X11::DARK_SEA_GREEN.to_s) end # Dark Slate Blue: #483D8B: (72, 61, 139) test("Dark Slate Blue") do assert_equal("\#%02X%02X%02XFF" % [72, 61, 139], Cairo::Color::X11::DARK_SLATE_BLUE.to_s) end # Dark Slate Gray: #2F4F4F: (47, 79, 79) test("Dark Slate Gray") do assert_equal("\#%02X%02X%02XFF" % [47, 79, 79], Cairo::Color::X11::DARK_SLATE_GRAY.to_s) end # Dark Turquoise: #00CED1: (0, 206, 209) test("Dark Turquoise") do assert_equal("\#%02X%02X%02XFF" % [0, 206, 209], Cairo::Color::X11::DARK_TURQUOISE.to_s) end # Dark Violet: #9400D3: (148, 0, 211) test("Dark Violet") do assert_equal("\#%02X%02X%02XFF" % [148, 0, 211], Cairo::Color::X11::DARK_VIOLET.to_s) end # Deep Pink: #FF1493: (255, 20, 147) test("Deep Pink") do assert_equal("\#%02X%02X%02XFF" % [255, 20, 147], Cairo::Color::X11::DEEP_PINK.to_s) end # Deep Sky Blue: #00BFFF: (0, 191, 255) test("Deep Sky Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 191, 255], Cairo::Color::X11::DEEP_SKY_BLUE.to_s) end # Dim Gray: #696969: (105, 105, 105) test("Dim Gray") do assert_equal("\#%02X%02X%02XFF" % [105, 105, 105], Cairo::Color::X11::DIM_GRAY.to_s) end # Dodger Blue: #1E90FF: (30, 144, 255) test("Dodger Blue") do assert_equal("\#%02X%02X%02XFF" % [30, 144, 255], Cairo::Color::X11::DODGER_BLUE.to_s) end # Firebrick: #B22222: (178, 34, 34) test("Firebrick") do assert_equal("\#%02X%02X%02XFF" % [178, 34, 34], Cairo::Color::X11::FIREBRICK.to_s) end # Floral White: #FFFAF0: (255, 250, 240) test("Floral White") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 240], Cairo::Color::X11::FLORAL_WHITE.to_s) end # Forest Green: #228B22: (34, 139, 34) test("Forest Green") do assert_equal("\#%02X%02X%02XFF" % [34, 139, 34], Cairo::Color::X11::FOREST_GREEN.to_s) end # Fuchsia: #FF00FF: (255, 0, 255) test("Fuchsia") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 255], Cairo::Color::X11::FUCHSIA.to_s) end # Gainsboro: #DCDCDC: (220, 220, 220) test("Gainsboro") do assert_equal("\#%02X%02X%02XFF" % [220, 220, 220], Cairo::Color::X11::GAINSBORO.to_s) end # Ghost White: #F8F8FF: (248, 248, 255) test("Ghost White") do assert_equal("\#%02X%02X%02XFF" % [248, 248, 255], Cairo::Color::X11::GHOST_WHITE.to_s) end # Gold: #FFD700: (255, 215, 0) test("Gold") do assert_equal("\#%02X%02X%02XFF" % [255, 215, 0], Cairo::Color::X11::GOLD.to_s) end # Goldenrod: #DAA520: (218, 165, 32) test("Goldenrod") do assert_equal("\#%02X%02X%02XFF" % [218, 165, 32], Cairo::Color::X11::GOLDENROD.to_s) end # Gray: #BEBEBE: (190, 190, 190) test("Gray") do assert_equal("\#%02X%02X%02XFF" % [190, 190, 190], Cairo::Color::X11::GRAY.to_s) end # Web Gray: #808080: (128, 128, 128) test("Web Gray") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 128], Cairo::Color::X11::WEB_GRAY.to_s) end # Green: #00FF00: (0, 255, 0) test("Green") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 0], Cairo::Color::X11::GREEN.to_s) end # Web Green: #008000: (0, 128, 0) test("Web Green") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 0], Cairo::Color::X11::WEB_GREEN.to_s) end # Green Yellow: #ADFF2F: (173, 255, 47) test("Green Yellow") do assert_equal("\#%02X%02X%02XFF" % [173, 255, 47], Cairo::Color::X11::GREEN_YELLOW.to_s) end # Honeydew: #F0FFF0: (240, 255, 240) test("Honeydew") do assert_equal("\#%02X%02X%02XFF" % [240, 255, 240], Cairo::Color::X11::HONEYDEW.to_s) end # Hot Pink: #FF69B4: (255, 105, 180) test("Hot Pink") do assert_equal("\#%02X%02X%02XFF" % [255, 105, 180], Cairo::Color::X11::HOT_PINK.to_s) end # Indian Red: #CD5C5C: (205, 92, 92) test("Indian Red") do assert_equal("\#%02X%02X%02XFF" % [205, 92, 92], Cairo::Color::X11::INDIAN_RED.to_s) end # Indigo: #4B0082: (75, 0, 130) test("Indigo") do assert_equal("\#%02X%02X%02XFF" % [75, 0, 130], Cairo::Color::X11::INDIGO.to_s) end # Ivory: #FFFFF0: (255, 255, 240) test("Ivory") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 240], Cairo::Color::X11::IVORY.to_s) end # Khaki: #F0E68C: (240, 230, 140) test("Khaki") do assert_equal("\#%02X%02X%02XFF" % [240, 230, 140], Cairo::Color::X11::KHAKI.to_s) end # Lavender: #E6E6FA: (230, 230, 250) test("Lavender") do assert_equal("\#%02X%02X%02XFF" % [230, 230, 250], Cairo::Color::X11::LAVENDER.to_s) end # Lavender Blush: #FFF0F5: (255, 240, 245) test("Lavender Blush") do assert_equal("\#%02X%02X%02XFF" % [255, 240, 245], Cairo::Color::X11::LAVENDER_BLUSH.to_s) end # Lawn Green: #7CFC00: (124, 252, 0) test("Lawn Green") do assert_equal("\#%02X%02X%02XFF" % [124, 252, 0], Cairo::Color::X11::LAWN_GREEN.to_s) end # Lemon Chiffon: #FFFACD: (255, 250, 205) test("Lemon Chiffon") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 205], Cairo::Color::X11::LEMON_CHIFFON.to_s) end # Light Blue: #ADD8E6: (173, 216, 230) test("Light Blue") do assert_equal("\#%02X%02X%02XFF" % [173, 216, 230], Cairo::Color::X11::LIGHT_BLUE.to_s) end # Light Coral: #F08080: (240, 128, 128) test("Light Coral") do assert_equal("\#%02X%02X%02XFF" % [240, 128, 128], Cairo::Color::X11::LIGHT_CORAL.to_s) end # Light Cyan: #E0FFFF: (224, 255, 255) test("Light Cyan") do assert_equal("\#%02X%02X%02XFF" % [224, 255, 255], Cairo::Color::X11::LIGHT_CYAN.to_s) end # Light Goldenrod: #FAFAD2: (250, 250, 210) test("Light Goldenrod") do assert_equal("\#%02X%02X%02XFF" % [250, 250, 210], Cairo::Color::X11::LIGHT_GOLDENROD.to_s) end # Light Gray: #D3D3D3: (211, 211, 211) test("Light Gray") do assert_equal("\#%02X%02X%02XFF" % [211, 211, 211], Cairo::Color::X11::LIGHT_GRAY.to_s) end # Light Green: #90EE90: (144, 238, 144) test("Light Green") do assert_equal("\#%02X%02X%02XFF" % [144, 238, 144], Cairo::Color::X11::LIGHT_GREEN.to_s) end # Light Pink: #FFB6C1: (255, 182, 193) test("Light Pink") do assert_equal("\#%02X%02X%02XFF" % [255, 182, 193], Cairo::Color::X11::LIGHT_PINK.to_s) end # Light Salmon: #FFA07A: (255, 160, 122) test("Light Salmon") do assert_equal("\#%02X%02X%02XFF" % [255, 160, 122], Cairo::Color::X11::LIGHT_SALMON.to_s) end # Light Sea Green: #20B2AA: (32, 178, 170) test("Light Sea Green") do assert_equal("\#%02X%02X%02XFF" % [32, 178, 170], Cairo::Color::X11::LIGHT_SEA_GREEN.to_s) end # Light Sky Blue: #87CEFA: (135, 206, 250) test("Light Sky Blue") do assert_equal("\#%02X%02X%02XFF" % [135, 206, 250], Cairo::Color::X11::LIGHT_SKY_BLUE.to_s) end # Light Slate Gray: #778899: (119, 136, 153) test("Light Slate Gray") do assert_equal("\#%02X%02X%02XFF" % [119, 136, 153], Cairo::Color::X11::LIGHT_SLATE_GRAY.to_s) end # Light Steel Blue: #B0C4DE: (176, 196, 222) test("Light Steel Blue") do assert_equal("\#%02X%02X%02XFF" % [176, 196, 222], Cairo::Color::X11::LIGHT_STEEL_BLUE.to_s) end # Light Yellow: #FFFFE0: (255, 255, 224) test("Light Yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 224], Cairo::Color::X11::LIGHT_YELLOW.to_s) end # Lime: #00FF00: (0, 255, 0) test("Lime") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 0], Cairo::Color::X11::LIME.to_s) end # Lime Green: #32CD32: (50, 205, 50) test("Lime Green") do assert_equal("\#%02X%02X%02XFF" % [50, 205, 50], Cairo::Color::X11::LIME_GREEN.to_s) end # Linen: #FAF0E6: (250, 240, 230) test("Linen") do assert_equal("\#%02X%02X%02XFF" % [250, 240, 230], Cairo::Color::X11::LINEN.to_s) end # Magenta: #FF00FF: (255, 0, 255) test("Magenta") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 255], Cairo::Color::X11::MAGENTA.to_s) end # Maroon: #B03060: (176, 48, 96) test("Maroon") do assert_equal("\#%02X%02X%02XFF" % [176, 48, 96], Cairo::Color::X11::MAROON.to_s) end # Web Maroon: #800000: (128, 0, 0) test("Web Maroon") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 0], Cairo::Color::X11::WEB_MAROON.to_s) end # Medium Aquamarine: #66CDAA: (102, 205, 170) test("Medium Aquamarine") do assert_equal("\#%02X%02X%02XFF" % [102, 205, 170], Cairo::Color::X11::MEDIUM_AQUAMARINE.to_s) end # Medium Blue: #0000CD: (0, 0, 205) test("Medium Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 205], Cairo::Color::X11::MEDIUM_BLUE.to_s) end # Medium Orchid: #BA55D3: (186, 85, 211) test("Medium Orchid") do assert_equal("\#%02X%02X%02XFF" % [186, 85, 211], Cairo::Color::X11::MEDIUM_ORCHID.to_s) end # Medium Purple: #9370DB: (147, 112, 219) test("Medium Purple") do assert_equal("\#%02X%02X%02XFF" % [147, 112, 219], Cairo::Color::X11::MEDIUM_PURPLE.to_s) end # Medium Sea Green: #3CB371: (60, 179, 113) test("Medium Sea Green") do assert_equal("\#%02X%02X%02XFF" % [60, 179, 113], Cairo::Color::X11::MEDIUM_SEA_GREEN.to_s) end # Medium Slate Blue: #7B68EE: (123, 104, 238) test("Medium Slate Blue") do assert_equal("\#%02X%02X%02XFF" % [123, 104, 238], Cairo::Color::X11::MEDIUM_SLATE_BLUE.to_s) end # Medium Spring Green: #00FA9A: (0, 250, 154) test("Medium Spring Green") do assert_equal("\#%02X%02X%02XFF" % [0, 250, 154], Cairo::Color::X11::MEDIUM_SPRING_GREEN.to_s) end # Medium Turquoise: #48D1CC: (72, 209, 204) test("Medium Turquoise") do assert_equal("\#%02X%02X%02XFF" % [72, 209, 204], Cairo::Color::X11::MEDIUM_TURQUOISE.to_s) end # Medium Violet Red: #C71585: (199, 21, 133) test("Medium Violet Red") do assert_equal("\#%02X%02X%02XFF" % [199, 21, 133], Cairo::Color::X11::MEDIUM_VIOLET_RED.to_s) end # Midnight Blue: #191970: (25, 25, 112) test("Midnight Blue") do assert_equal("\#%02X%02X%02XFF" % [25, 25, 112], Cairo::Color::X11::MIDNIGHT_BLUE.to_s) end # Mint Cream: #F5FFFA: (245, 255, 250) test("Mint Cream") do assert_equal("\#%02X%02X%02XFF" % [245, 255, 250], Cairo::Color::X11::MINT_CREAM.to_s) end # Misty Rose: #FFE4E1: (255, 228, 225) test("Misty Rose") do assert_equal("\#%02X%02X%02XFF" % [255, 228, 225], Cairo::Color::X11::MISTY_ROSE.to_s) end # Moccasin: #FFE4B5: (255, 228, 181) test("Moccasin") do assert_equal("\#%02X%02X%02XFF" % [255, 228, 181], Cairo::Color::X11::MOCCASIN.to_s) end # Navajo White: #FFDEAD: (255, 222, 173) test("Navajo White") do assert_equal("\#%02X%02X%02XFF" % [255, 222, 173], Cairo::Color::X11::NAVAJO_WHITE.to_s) end # Navy Blue: #000080: (0, 0, 128) test("Navy Blue") do assert_equal("\#%02X%02X%02XFF" % [0, 0, 128], Cairo::Color::X11::NAVY_BLUE.to_s) end # Old Lace: #FDF5E6: (253, 245, 230) test("Old Lace") do assert_equal("\#%02X%02X%02XFF" % [253, 245, 230], Cairo::Color::X11::OLD_LACE.to_s) end # Olive: #808000: (128, 128, 0) test("Olive") do assert_equal("\#%02X%02X%02XFF" % [128, 128, 0], Cairo::Color::X11::OLIVE.to_s) end # Olive Drab: #6B8E23: (107, 142, 35) test("Olive Drab") do assert_equal("\#%02X%02X%02XFF" % [107, 142, 35], Cairo::Color::X11::OLIVE_DRAB.to_s) end # Orange: #FFA500: (255, 165, 0) test("Orange") do assert_equal("\#%02X%02X%02XFF" % [255, 165, 0], Cairo::Color::X11::ORANGE.to_s) end # Orange Red: #FF4500: (255, 69, 0) test("Orange Red") do assert_equal("\#%02X%02X%02XFF" % [255, 69, 0], Cairo::Color::X11::ORANGE_RED.to_s) end # Orchid: #DA70D6: (218, 112, 214) test("Orchid") do assert_equal("\#%02X%02X%02XFF" % [218, 112, 214], Cairo::Color::X11::ORCHID.to_s) end # Pale Goldenrod: #EEE8AA: (238, 232, 170) test("Pale Goldenrod") do assert_equal("\#%02X%02X%02XFF" % [238, 232, 170], Cairo::Color::X11::PALE_GOLDENROD.to_s) end # Pale Green: #98FB98: (152, 251, 152) test("Pale Green") do assert_equal("\#%02X%02X%02XFF" % [152, 251, 152], Cairo::Color::X11::PALE_GREEN.to_s) end # Pale Turquoise: #AFEEEE: (175, 238, 238) test("Pale Turquoise") do assert_equal("\#%02X%02X%02XFF" % [175, 238, 238], Cairo::Color::X11::PALE_TURQUOISE.to_s) end # Pale Violet Red: #DB7093: (219, 112, 147) test("Pale Violet Red") do assert_equal("\#%02X%02X%02XFF" % [219, 112, 147], Cairo::Color::X11::PALE_VIOLET_RED.to_s) end # Papaya Whip: #FFEFD5: (255, 239, 213) test("Papaya Whip") do assert_equal("\#%02X%02X%02XFF" % [255, 239, 213], Cairo::Color::X11::PAPAYA_WHIP.to_s) end # Peach Puff: #FFDAB9: (255, 218, 185) test("Peach Puff") do assert_equal("\#%02X%02X%02XFF" % [255, 218, 185], Cairo::Color::X11::PEACH_PUFF.to_s) end # Peru: #CD853F: (205, 133, 63) test("Peru") do assert_equal("\#%02X%02X%02XFF" % [205, 133, 63], Cairo::Color::X11::PERU.to_s) end # Pink: #FFC0CB: (255, 192, 203) test("Pink") do assert_equal("\#%02X%02X%02XFF" % [255, 192, 203], Cairo::Color::X11::PINK.to_s) end # Plum: #DDA0DD: (221, 160, 221) test("Plum") do assert_equal("\#%02X%02X%02XFF" % [221, 160, 221], Cairo::Color::X11::PLUM.to_s) end # Powder Blue: #B0E0E6: (176, 224, 230) test("Powder Blue") do assert_equal("\#%02X%02X%02XFF" % [176, 224, 230], Cairo::Color::X11::POWDER_BLUE.to_s) end # Purple: #A020F0: (160, 32, 240) test("Purple") do assert_equal("\#%02X%02X%02XFF" % [160, 32, 240], Cairo::Color::X11::PURPLE.to_s) end # Web Purple: #800080: (128, 0, 128) test("Web Purple") do assert_equal("\#%02X%02X%02XFF" % [128, 0, 128], Cairo::Color::X11::WEB_PURPLE.to_s) end # Rebecca Purple: #663399: (102, 51, 153) test("Rebecca Purple") do assert_equal("\#%02X%02X%02XFF" % [102, 51, 153], Cairo::Color::X11::REBECCA_PURPLE.to_s) end # Red: #FF0000: (255, 0, 0) test("Red") do assert_equal("\#%02X%02X%02XFF" % [255, 0, 0], Cairo::Color::X11::RED.to_s) end # Rosy Brown: #BC8F8F: (188, 143, 143) test("Rosy Brown") do assert_equal("\#%02X%02X%02XFF" % [188, 143, 143], Cairo::Color::X11::ROSY_BROWN.to_s) end # Royal Blue: #4169E1: (65, 105, 225) test("Royal Blue") do assert_equal("\#%02X%02X%02XFF" % [65, 105, 225], Cairo::Color::X11::ROYAL_BLUE.to_s) end # Saddle Brown: #8B4513: (139, 69, 19) test("Saddle Brown") do assert_equal("\#%02X%02X%02XFF" % [139, 69, 19], Cairo::Color::X11::SADDLE_BROWN.to_s) end # Salmon: #FA8072: (250, 128, 114) test("Salmon") do assert_equal("\#%02X%02X%02XFF" % [250, 128, 114], Cairo::Color::X11::SALMON.to_s) end # Sandy Brown: #F4A460: (244, 164, 96) test("Sandy Brown") do assert_equal("\#%02X%02X%02XFF" % [244, 164, 96], Cairo::Color::X11::SANDY_BROWN.to_s) end # Sea Green: #2E8B57: (46, 139, 87) test("Sea Green") do assert_equal("\#%02X%02X%02XFF" % [46, 139, 87], Cairo::Color::X11::SEA_GREEN.to_s) end # Seashell: #FFF5EE: (255, 245, 238) test("Seashell") do assert_equal("\#%02X%02X%02XFF" % [255, 245, 238], Cairo::Color::X11::SEASHELL.to_s) end # Sienna: #A0522D: (160, 82, 45) test("Sienna") do assert_equal("\#%02X%02X%02XFF" % [160, 82, 45], Cairo::Color::X11::SIENNA.to_s) end # Silver: #C0C0C0: (192, 192, 192) test("Silver") do assert_equal("\#%02X%02X%02XFF" % [192, 192, 192], Cairo::Color::X11::SILVER.to_s) end # Sky Blue: #87CEEB: (135, 206, 235) test("Sky Blue") do assert_equal("\#%02X%02X%02XFF" % [135, 206, 235], Cairo::Color::X11::SKY_BLUE.to_s) end # Slate Blue: #6A5ACD: (106, 90, 205) test("Slate Blue") do assert_equal("\#%02X%02X%02XFF" % [106, 90, 205], Cairo::Color::X11::SLATE_BLUE.to_s) end # Slate Gray: #708090: (112, 128, 144) test("Slate Gray") do assert_equal("\#%02X%02X%02XFF" % [112, 128, 144], Cairo::Color::X11::SLATE_GRAY.to_s) end # Snow: #FFFAFA: (255, 250, 250) test("Snow") do assert_equal("\#%02X%02X%02XFF" % [255, 250, 250], Cairo::Color::X11::SNOW.to_s) end # Spring Green: #00FF7F: (0, 255, 127) test("Spring Green") do assert_equal("\#%02X%02X%02XFF" % [0, 255, 127], Cairo::Color::X11::SPRING_GREEN.to_s) end # Steel Blue: #4682B4: (70, 130, 180) test("Steel Blue") do assert_equal("\#%02X%02X%02XFF" % [70, 130, 180], Cairo::Color::X11::STEEL_BLUE.to_s) end # Tan: #D2B48C: (210, 180, 140) test("Tan") do assert_equal("\#%02X%02X%02XFF" % [210, 180, 140], Cairo::Color::X11::TAN.to_s) end # Teal: #008080: (0, 128, 128) test("Teal") do assert_equal("\#%02X%02X%02XFF" % [0, 128, 128], Cairo::Color::X11::TEAL.to_s) end # Thistle: #D8BFD8: (216, 191, 216) test("Thistle") do assert_equal("\#%02X%02X%02XFF" % [216, 191, 216], Cairo::Color::X11::THISTLE.to_s) end # Tomato: #FF6347: (255, 99, 71) test("Tomato") do assert_equal("\#%02X%02X%02XFF" % [255, 99, 71], Cairo::Color::X11::TOMATO.to_s) end # Turquoise: #40E0D0: (64, 224, 208) test("Turquoise") do assert_equal("\#%02X%02X%02XFF" % [64, 224, 208], Cairo::Color::X11::TURQUOISE.to_s) end # Violet: #EE82EE: (238, 130, 238) test("Violet") do assert_equal("\#%02X%02X%02XFF" % [238, 130, 238], Cairo::Color::X11::VIOLET.to_s) end # Wheat: #F5DEB3: (245, 222, 179) test("Wheat") do assert_equal("\#%02X%02X%02XFF" % [245, 222, 179], Cairo::Color::X11::WHEAT.to_s) end # White: #FFFFFF: (255, 255, 255) test("White") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 255], Cairo::Color::X11::WHITE.to_s) end # White Smoke: #F5F5F5: (245, 245, 245) test("White Smoke") do assert_equal("\#%02X%02X%02XFF" % [245, 245, 245], Cairo::Color::X11::WHITE_SMOKE.to_s) end # Yellow: #FFFF00: (255, 255, 0) test("Yellow") do assert_equal("\#%02X%02X%02XFF" % [255, 255, 0], Cairo::Color::X11::YELLOW.to_s) end # Yellow Green: #9ACD32: (154, 205, 50) test("Yellow Green") do assert_equal("\#%02X%02X%02XFF" % [154, 205, 50], Cairo::Color::X11::YELLOW_GREEN.to_s) end end end rcairo-1.16.6/test/test_constants.rb000066400000000000000000000013661370612400100174430ustar00rootroot00000000000000require 'cairo' class ConstantsTest < Test::Unit::TestCase def test_text_cluster_flags constant_name = "TextClusterFlag" unless Cairo.satisfied_version?(1, 7, 6) assert_false(Cairo.const_defined?(constant_name)) return end assert_true(Cairo.const_defined?(constant_name)) assert_equal((0..1).to_a, [0, Cairo::TextClusterFlag::BACKWARD]) end def test_new_constants_since_1_14_0 if Cairo.satisfied_version?(1, 14, 0) assertion = :assert_const_defined else assertion = :assert_not_const_defined end send(assertion, Cairo::MimeType, :JBIG2) send(assertion, Cairo::MimeType, :JBIG2_GLOBAL) send(assertion, Cairo::MimeType, :JBIG2_GLOBAL_ID) end end rcairo-1.16.6/test/test_context.rb000066400000000000000000000072551370612400100171160ustar00rootroot00000000000000class ContextTest < Test::Unit::TestCase include Helper def setup @output = StringIO.new @surface = Cairo::PDFSurface.new(@output, 10, 10) end def test_new_and_destroy context = Cairo::Context.new(@surface) @surface.destroy assert_not_equal("%%EOF\n", @output.string[-6..-1]) assert {not context.destroyed?} context.destroy assert {context.destroyed?} assert_equal("%%EOF\n", @output.string[-6..-1]) end def test_create_with_block Cairo::Context.create(@surface) do |context| @surface.destroy assert_not_equal("%%EOF\n", @output.string[-6..-1]) end assert_equal("%%EOF\n", @output.string[-6..-1]) end def test_create_with_block_and_destroy assert_nothing_raised do Cairo::Context.create(@surface) do |context| context.destroy end end end def test_font_face only_cairo_version(1, 7, 2) context = Cairo::Context.new(@surface) assert_kind_of(Cairo::FontFace, context.font_face) face = Cairo::ToyFontFace.new("serif") context.font_face = face assert_equal("serif", context.font_face.family) face = Cairo::ToyFontFace.new("sans") context.font_face = face assert_equal("sans", context.font_face.family) end def test_text_to_glyphs only_cairo_version(1, 7, 2) surface = Cairo::PDFSurface.new(StringIO.new, 10, 10) context = Cairo::Context.new(surface) scaled_font = Cairo::ScaledFont.new(context.font_face, Cairo::Matrix.identity, Cairo::Matrix.identity, Cairo::FontOptions.new) utf8 = "text" glyphs, clusters, backward = scaled_font.text_to_glyphs(0, 0, utf8) assert_nothing_raised do context.show_text_glyphs(utf8, glyphs, clusters, backward) end end def test_select_font_face only_cairo_version(1, 7, 2) context = Cairo::Context.new(@surface) face = context.font_face default_font_family = "" default_font_family = "Helvetica" if quartz? default_font_family = "Arial" if windows? assert_equal([default_font_family, Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL], [face.family, face.slant, face.weight]) context.select_font_face face = context.font_face assert_equal([default_font_family, Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL], [face.family, face.slant, face.weight]) context.select_font_face(:serif, :italic, :bold) face = context.font_face assert_equal(["serif", Cairo::FONT_SLANT_ITALIC, Cairo::FONT_WEIGHT_BOLD], [face.family, face.slant, face.weight]) end def test_select_font_face_with_invalid_family_name context = Cairo::Context.new(@surface) exception = assert_raise(ArgumentError) do context.select_font_face([999]) end assert_equal("family name should be nil, String or Symbol: [999]", exception.message) end sub_test_case("#tag") do setup do only_cairo_version(1, 15, 4) end test("LINK") do Cairo::Context.create(@surface) do |context| context.tag(Cairo::Tag::LINK, "uri='http://localhost/'") do context.show_text("localhost") end @surface.finish end document = Poppler::Document.new(@output.string) uris = document[0].link_mapping.collect do |mapping| mapping.action.uri end assert_equal(["http://localhost/"], uris) end end def test_raw_address context = Cairo::Context.new(@surface) assert do context.raw_address > 0 end end end rcairo-1.16.6/test/test_exception.rb000066400000000000000000000015711370612400100174230ustar00rootroot00000000000000require 'cairo' class ExceptionTest < Test::Unit::TestCase def test_new_symbols_since_1_7_2 if Cairo.satisfied_version?(1, 7, 2) assertion = :assert_defined else assertion = :assert_not_defined end send(assertion, "FontTypeMismatch") send(assertion, "UserFontImmutable") send(assertion, "UserFontError") send(assertion, "NegativeCount") send(assertion, "InvalidClusters") send(assertion, "InvalidSlant") send(assertion, "InvalidWeight") end def test_new_symbols_since_1_14_0 if Cairo.satisfied_version?(1, 14, 0) assertion = :assert_defined else assertion = :assert_not_defined end send(assertion, "JBIG2GlobalMissing") end private def assert_defined(name) assert_true(Cairo.const_defined?(name)) end def assert_not_defined(name) assert_false(Cairo.const_defined?(name)) end end rcairo-1.16.6/test/test_font_extents.rb000066400000000000000000000020541370612400100201420ustar00rootroot00000000000000require 'cairo' class FontExtentsTest < Test::Unit::TestCase include Helper def test_new extents = Cairo::FontExtents.new assert_equal([1.0, 0.0, 1.0, 1.0, 0.0], [extents.ascent, extents.descent, extents.height, extents.max_x_advance, extents.max_y_advance]) end def test_accessor extents = Cairo::FontExtents.new extents.ascent = 0.1 extents.descent = 0.2 extents.height = 0.3 extents.max_x_advance = 0.4 extents.max_y_advance = 0.5 assert_equal([0.1, 0.2, 0.3, 0.4, 0.5], [extents.ascent, extents.descent, extents.height, extents.max_x_advance, extents.max_y_advance]) end def test_to_s extents = Cairo::FontExtents.new extents.ascent = 0.1 extents.descent = 0.2 extents.height = 0.3 extents.max_x_advance = 0.4 extents.max_y_advance = 0.5 assert_equal("#", extents.to_s) end end rcairo-1.16.6/test/test_font_face.rb000066400000000000000000000243311370612400100173500ustar00rootroot00000000000000require 'cairo' class FontFaceTest < Test::Unit::TestCase include Helper sub_test_case("FreeTypeFontFace") do setup do omit("Need FreeType support") unless Cairo::FontFace.freetype_supported? end sub_test_case("initialize") do test("valid") do assert_nothing_raised do Cairo::FreeTypeFontFace.new(fixture_path("a.otf")) end end sub_test_case("invalid") do setup do if Cairo.const_defined?(:FreeTypeError) @error_class = Cairo::FreeTypeError else @error_class = Cairo::Error end end test("broken") do path = __FILE__ message = "failed to open FreeType font: " message << "FT_Err_Unknown_File_Format[2]: " message << "unknown file format: " message << path.inspect assert_raise(@error_class.new(message)) do Cairo::FreeTypeFontFace.new(path) end end test("nonexistent") do path = fixture_path("nonexistent.otf") message = "failed to open FreeType font: " message << "FT_Err_Cannot_Open_Resource[1]: " message << "cannot open resource: " message << path.inspect assert_raise(@error_class.new(message)) do Cairo::FreeTypeFontFace.new(path) end end end end end def test_toy_font_face_new only_cairo_version(1, 7, 2) face = Cairo::ToyFontFace.new default_font_family = "" default_font_family = "Helvetica" if quartz? default_font_family = "Arial" if windows? assert_equal([default_font_family, Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL], [face.family, face.slant, face.weight]) face = Cairo::ToyFontFace.new("serif") assert_equal(["serif", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL], [face.family, face.slant, face.weight]) face = Cairo::ToyFontFace.new(:serif) assert_equal(["serif", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_NORMAL], [face.family, face.slant, face.weight]) face = Cairo::ToyFontFace.new("serif", :oblique) assert_equal(["serif", Cairo::FONT_SLANT_OBLIQUE, Cairo::FONT_WEIGHT_NORMAL], [face.family, face.slant, face.weight]) face = Cairo::ToyFontFace.new("serif", nil, :bold) assert_equal(["serif", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD], [face.family, face.slant, face.weight]) face = Cairo::ToyFontFace.new("serif", :italic, :bold) assert_equal(["serif", Cairo::FONT_SLANT_ITALIC, Cairo::FONT_WEIGHT_BOLD], [face.family, face.slant, face.weight]) end def test_toy_font_face_new_with_invalid_family_name only_cairo_version(1, 7, 2) exception = assert_raise(ArgumentError) do Cairo::ToyFontFace.new(999) end assert_equal("family name should be nil, String or Symbol: 999", exception.message) end def test_user_font_face_empty only_cairo_version(1, 7, 2) face = Cairo::UserFontFace.new scaled_font = Cairo::ScaledFont.new(face, Cairo::Matrix.identity, Cairo::Matrix.identity, Cairo::FontOptions.new) assert_equal([[], [], 0], scaled_font.text_to_glyphs(0, 0, "text")) end def test_user_font_face_callback only_cairo_version(1, 7, 2) face = Cairo::UserFontFace.new init_args = [] face.on_init do |*args| init_args << args end render_glyph_args = [] face.on_render_glyph do |*args| render_glyph_args << args end text_to_glyphs_args = [] face.on_text_to_glyphs do |*args| text_to_glyphs_args << args scaled_font, utf8, data = args data.cluster_flags = :backward end unicode_to_glyph_args = [] face.on_unicode_to_glyph do |*args| unicode_to_glyph_args << args scaled_font, unicode = args unicode end scaled_font = Cairo::ScaledFont.new(face, Cairo::Matrix.identity, Cairo::Matrix.identity, Cairo::FontOptions.new) result = scaled_font.text_to_glyphs(0, 0, "text") assert_equal([[[Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]], [[Cairo::ScaledFont, codepoint("t"), Cairo::Context, Cairo::TextExtents], [Cairo::ScaledFont, codepoint("e"), Cairo::Context, Cairo::TextExtents], [Cairo::ScaledFont, codepoint("x"), Cairo::Context, Cairo::TextExtents]], [[Cairo::ScaledFont, "text", Cairo::UserFontFace::TextToGlyphsData]], [[Cairo::ScaledFont, codepoint("t")], [Cairo::ScaledFont, codepoint("e")], [Cairo::ScaledFont, codepoint("x")], [Cairo::ScaledFont, codepoint("t")]], [[], [], Cairo::TextClusterFlag::BACKWARD]], [classify_cairo_object(init_args), classify_cairo_object(render_glyph_args), classify_cairo_object(text_to_glyphs_args), classify_cairo_object(unicode_to_glyph_args), result]) end if Cairo.satisfied_version?(1, 7, 2) class CustomUserFontFace < Cairo::UserFontFace attr_reader :init_args, :render_glyph_args attr_reader :text_to_glyphs_args, :unicode_to_glyph_args def initialize super @init_args = [] @render_glyph_args = [] @text_to_glyphs_args = [] @unicode_to_glyph_args = [] end def init(*args) @init_args << args end def render_glyph(*args) @render_glyph_args << args end def text_to_glyphs(*args) @text_to_glyphs_args << args scaled_font, utf8, data = args data.cluster_flags = :backward end def unicode_to_glyph(*args) @unicode_to_glyph_args << args scaled_font, unicode = args unicode end end end def test_user_font_face_class only_cairo_version(1, 7, 2) face = CustomUserFontFace.new scaled_font = Cairo::ScaledFont.new(face, Cairo::Matrix.identity, Cairo::Matrix.identity, Cairo::FontOptions.new) result = scaled_font.text_to_glyphs(0, 0, "text") assert_equal([[[Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]], [[Cairo::ScaledFont, codepoint("t"), Cairo::Context, Cairo::TextExtents], [Cairo::ScaledFont, codepoint("e"), Cairo::Context, Cairo::TextExtents], [Cairo::ScaledFont, codepoint("x"), Cairo::Context, Cairo::TextExtents]], [[Cairo::ScaledFont, "text", Cairo::UserFontFace::TextToGlyphsData]], [[Cairo::ScaledFont, codepoint("t")], [Cairo::ScaledFont, codepoint("e")], [Cairo::ScaledFont, codepoint("x")], [Cairo::ScaledFont, codepoint("t")]], [[], [], Cairo::TextClusterFlag::BACKWARD]], [classify_cairo_object(face.init_args), classify_cairo_object(face.render_glyph_args), classify_cairo_object(face.text_to_glyphs_args), classify_cairo_object(face.unicode_to_glyph_args), result]) end def test_user_font_face_class_and_callback only_cairo_version(1, 7, 2) face = CustomUserFontFace.new init_args = [] face.on_init do |*args| init_args << args end render_glyph_args = [] face.on_render_glyph do |*args| render_glyph_args << args end text_to_glyphs_args = [] face.on_text_to_glyphs do |*args| text_to_glyphs_args << args scaled_font, utf8, data = args data.cluster_flags = :backward end unicode_to_glyph_args = [] face.on_unicode_to_glyph do |*args| unicode_to_glyph_args << args scaled_font, unicode = args unicode end scaled_font = Cairo::ScaledFont.new(face, Cairo::Matrix.identity, Cairo::Matrix.identity, Cairo::FontOptions.new) result = scaled_font.text_to_glyphs(0, 0, "text") assert_equal([[[Cairo::ScaledFont, Cairo::Context, Cairo::FontExtents]], [[Cairo::ScaledFont, codepoint("t"), Cairo::Context, Cairo::TextExtents], [Cairo::ScaledFont, codepoint("e"), Cairo::Context, Cairo::TextExtents], [Cairo::ScaledFont, codepoint("x"), Cairo::Context, Cairo::TextExtents]], [[Cairo::ScaledFont, "text", Cairo::UserFontFace::TextToGlyphsData]], [[Cairo::ScaledFont, codepoint("t")], [Cairo::ScaledFont, codepoint("e")], [Cairo::ScaledFont, codepoint("x")], [Cairo::ScaledFont, codepoint("t")]], [], [], [], [], [[], [], Cairo::TextClusterFlag::BACKWARD]], [classify_cairo_object(init_args), classify_cairo_object(render_glyph_args), classify_cairo_object(text_to_glyphs_args), classify_cairo_object(unicode_to_glyph_args), classify_cairo_object(face.init_args), classify_cairo_object(face.render_glyph_args), classify_cairo_object(face.text_to_glyphs_args), classify_cairo_object(face.unicode_to_glyph_args), result]) end def classify_cairo_object(object) if object.is_a?(Array) object.collect {|obj| classify_cairo_object(obj)} elsif /\ACairo::/ =~ object.class.name object.class else object end end def codepoint(character) character.unpack("U")[0] end end rcairo-1.16.6/test/test_font_options.rb000066400000000000000000000022711370612400100201440ustar00rootroot00000000000000require 'cairo' class FontOptionsTest < Test::Unit::TestCase include Helper def setup @options = Cairo::FontOptions.new end sub_test_case "#==" do test "not FontOptions" do assert do !(@options == nil) end end test "same object" do assert do @options == @options end end test "same content" do assert do @options == @options.dup end end end sub_test_case "#eql? and #hash" do test "not FontOptions" do object = Object.new options = @options object.singleton_class.__send__(:define_method, :hash) do options.hash end hash = { object => :value, } assert_nil(hash[@options]) end test "same object" do hash = { @options => :value, } assert_equal(:value, hash[@options]) end test "same content" do hash = { @options => :value, } assert_equal(:value, hash[@options.dup]) end end test "variations" do only_cairo_version(1, 15, 12) assert_nil(@options.variations) @options.variations = "wdth=200" assert_equal("wdth=200", @options.variations) end end rcairo-1.16.6/test/test_image_surface.rb000066400000000000000000000013651370612400100202200ustar00rootroot00000000000000require 'cairo' class ImageSurfaceTest < Test::Unit::TestCase include Helper def test_cloned_data width = 10 height = 10 original_surface = Cairo::ImageSurface.new(:a1, width, height) original_data = original_surface.data cloned_data = original_data.clone cloned_surface = Cairo::ImageSurface.new(cloned_data, :a1, width, height, original_surface.stride) Cairo::Context.create(cloned_surface) do |context| context.set_source_rgb(255, 255, 255) context.scale(width, height) context.move_to(0, 0) context.line_to(1, 1) context.stroke end assert_not_equal(original_data, cloned_data) end end rcairo-1.16.6/test/test_paper.rb000066400000000000000000000044041370612400100165320ustar00rootroot00000000000000require 'cairo' class PaperTest < Test::Unit::TestCase def test_parse_paper a4 = Cairo::Paper::A4 assert_parse(a4, a4) end def test_parse_name assert_parse(:A4, "A4") assert_parse(:A4_LANDSCAPE, "A4 landscape") assert_parse(:A4, :A4) assert_parse(:A4, :a4) assert_parse(:JAPANESE_POSTCARD, :japanese_postcard) assert_parse(:JAPANESE_POSTCARD, "japanese-postcard") assert_parse(:JAPANESE_POSTCARD, "Japanese postcard") exception = assert_raise(Cairo::Paper::UnknownPaperName) do Cairo::Paper.parse(:nonexistence) end assert_equal(:nonexistence, exception.name) end def test_parse_size assert_parse(paper(100, 200), "100x200") assert_parse(paper(283.46456664, 566.929134), "100mmx200mm") assert_parse(paper(284.88188952, 200.9), "100.5mmx200.9") assert_parse(paper(72, 612.0), "1inx8.5inch") assert_parse(paper(28.346456664, 24094.488168), "1cmx8.5m") assert_parse(paper(100, 200), [100, 200]) exception = assert_raise(Cairo::Paper::UnknownUnit) do Cairo::Paper.parse("100kmx100") end assert_equal("km", exception.unit) end def test_parse_size_with_name assert_parse(paper(28.346456664, 24094.488168, nil, "Name"), "1cmx8.5m#Name") end def test_unrecognized_input assert_nothing_raised do Cairo::Paper.parse({}) end exception = assert_raise(Cairo::Paper::UnrecognizedPaperDescription) do Cairo::Paper.parse({}, true) end assert_equal({}, exception.description) end def test_unit paper = parse("1cmx8.5m") assert_nil(paper.unit) assert_in_delta(28.346456664, 0.01, paper.width) assert_in_delta(24094.488168, 0.01, paper.height) paper.unit = "inch" assert_equal("inch", paper.unit) assert_in_delta(0.393700787, 0.01, paper.width) assert_in_delta(334.645669, 0.01, paper.height) end private def paper(width, height, *rest) Cairo::Paper.new(width, height, *rest) end def parse(paper_description) Cairo::Paper.parse(paper_description) end def assert_parse(expected, paper_description, message=nil) expected = Cairo::Paper.const_get(expected) if expected.is_a?(Symbol) actual_paper = parse(paper_description) assert_equal(expected, actual_paper, message) end end rcairo-1.16.6/test/test_pdf_surface.rb000066400000000000000000000103301370612400100176770ustar00rootroot00000000000000class PDFSurfaceTest < Test::Unit::TestCase include Helper def create_pdf pdf = StringIO.new surface = Cairo::PDFSurface.new(pdf, 10, 20) yield(surface) surface.finish Poppler::Document.new(pdf.string) end def test_new_with_nil_target surface = Cairo::PDFSurface.new(nil, 10, 20) surface.finish end sub_test_case "#add_outline" do def test_sub_outline only_cairo_version(1, 15, 4) surface = Cairo::PDFSurface.new(nil, 10, 20) context = Cairo::Context.new(surface) context.tag(Cairo::Tag::DEST, "name='destination'") do context.show_text("Destination") end id = surface.add_outline(Cairo::PDFOutline::ROOT, "top-level", "dest='destination'", Cairo::PDFOutlineFlags::OPEN) sub_id = surface.add_outline(sub_id, "sub", "dest='destination'", Cairo::PDFOutlineFlags::OPEN) assert_equal(2, sub_id) end end sub_test_case "#set_metadata" do test "title" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::TITLE, "Hello") end assert_equal("Hello", pdf.title) end test "author" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::AUTHOR, "Alice") end assert_equal("Alice", pdf.author) end test "subject" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::SUBJECT, "This is world.") end assert_equal("This is world.", pdf.subject) end test "keywords" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::KEYWORDS, "hello, alice") end assert_equal("hello, alice", pdf.keywords) end test "creator" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::CREATOR, "cairo") end assert_equal("cairo", pdf.creator) end sub_test_case "create date" do test "string" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::CREATE_DATE, "2017-01-04T02:17:01+09:00") end assert_equal(Time.parse("2017-01-04T02:17:01+09:00"), Time.at(pdf.creation_date)) end test "time" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::CREATE_DATE, Time.parse("2017-01-04T02:17:01+09:00")) end assert_equal(Time.parse("2017-01-04T02:17:01+09:00"), Time.at(pdf.creation_date)) end end sub_test_case "modified date" do test "string" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::MOD_DATE, "2017-01-04T02:17:01+09:00") end assert_equal(Time.parse("2017-01-04T02:17:01+09:00"), Time.at(pdf.mod_date)) end test "time" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_metadata(Cairo::PDFMetadata::MOD_DATE, Time.parse("2017-01-04T02:17:01+09:00")) end assert_equal(Time.parse("2017-01-04T02:17:01+09:00"), Time.at(pdf.mod_date)) end end end test "#page_label=" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.page_label = "Hello" end assert_equal("Hello", pdf[0].label) end test "#set_thumbnail_size" do only_cairo_version(1, 15, 4) pdf = create_pdf do |surface| surface.set_thumbnail_size(5, 10) end thumbnail_size = pdf[0].thumbnail_size # TODO: Workaround for poppler gem 3.2.1 thumbnail_size.shift if thumbnail_size.size == 3 assert_equal([5, 10], thumbnail_size) end end rcairo-1.16.6/test/test_quartz_image_surface.rb000066400000000000000000000005151370612400100216220ustar00rootroot00000000000000class QuartzImageSurfaceTest < Test::Unit::TestCase include Helper def setup only_surface("QuartzImage") end def test_quartz_image_surface surface = Cairo::ImageSurface.new(100, 100) quartz_surface = Cairo::QuartzImageSurface.new(surface) assert_kind_of(Cairo::QuartzImageSurface, quartz_surface) end end rcairo-1.16.6/test/test_raster_source_pattern.rb000066400000000000000000000111231370612400100220340ustar00rootroot00000000000000require "cairo" require "tempfile" class RasterSourcePatternTest < Test::Unit::TestCase include Helper def setup only_pattern("RasterSource") end def test_acquire_and_release Cairo::ImageSurface.create(100, 100) do |surface| Cairo::Context.create(surface) do |context| context.set_source(1, 1, 1) context.paint called = [] red_pattern = Cairo::RasterSourcePattern.new(100, 100) red_pattern.acquire do |pattern, target, extents| called << :acquire red_image = target.create_similar_image(extents.width, extents.height) red_image.set_device_offset(extents.x, extents.y) Cairo::Context.create(red_image) do |red_image_context| red_image_context.set_source(1, 0, 0) red_image_context.paint end red_image end red_pattern.release do |pattern, surface| called << :release surface.finish end context.set_source(red_pattern) context.rectangle(40, 40, 20, 20) context.fill assert_equal([:acquire, :release], called) end show_result(surface) end end class SnapshotTest < self def setup super only_surface("Recording") end def test_success Cairo::RecordingSurface.create(0, 0, 100, 100) do |surface| Cairo::Context.create(surface) do |context| called = [] raster_source = Cairo::RasterSourcePattern.new(100, 100) raster_source.snapshot do |pattern| called << :snapshot end context.set_source(raster_source) context.rectangle(40, 40, 20, 20) context.fill assert_equal([:snapshot], called) end show_result(surface) end end def test_error Cairo::RecordingSurface.create(0, 0, 100, 100) do |surface| Cairo::Context.create(surface) do |context| called = [] raster_source = Cairo::RasterSourcePattern.new(100, 100) raster_source.snapshot do |pattern| called << :snapshot raise NoMemoryError end context.set_source(raster_source) context.rectangle(40, 40, 20, 20) assert_raise(NoMemoryError) do context.fill end assert_equal([:snapshot], called) end show_result(surface) end end end class CopyTest < self def setup super only_surface("Script") end def test_success output = StringIO.new device = Cairo::ScriptDevice.new(output) Cairo::ScriptSurface.create(device, 100, 200) do |surface| Cairo::Context.create(surface) do |context| called = [] raster_source = Cairo::RasterSourcePattern.new(100, 100) raster_source.acquire do |pattern, target, extents| called << :acquire red_image = target.create_similar_image(extents.width, extents.height) red_image.set_device_offset(extents.x, extents.y) Cairo::Context.create(red_image) do |red_image_context| red_image_context.set_source(1, 0, 0) red_image_context.paint end red_image end raster_source.release do |pattern, surface| called << :release surface.finish end raster_source.copy do |pattern| called << :copy end context.set_source(raster_source) context.rectangle(40, 40, 20, 20) context.fill assert_equal([:copy, :acquire, :release], called) end show_result(surface) end end def test_error output = StringIO.new device = Cairo::ScriptDevice.new(output) Cairo::ScriptSurface.create(device, 100, 200) do |surface| Cairo::Context.create(surface) do |context| called = [] raster_source = Cairo::RasterSourcePattern.new(100, 100) raster_source.copy do |pattern| called << :copy raise NoMemoryError end context.set_source(raster_source) context.rectangle(40, 40, 20, 20) assert_raise(NoMemoryError) do context.fill end assert_equal([:copy], called) end show_result(surface) end end end private def show_result(image_surface) return if ENV["RCAIRO_TEST_SHOW_RESULT"] != "yes" result = Tempfile.new("result") image_surface.write_to_png(result.path) system("display", result.path) end end rcairo-1.16.6/test/test_recording_surface.rb000066400000000000000000000012021370612400100211000ustar00rootroot00000000000000class RecordingSurfaceTest < Test::Unit::TestCase include Helper def setup only_surface("Recording") end def test_new only_not_windows only_cairo_version(1, 12, 0) surface = Cairo::RecordingSurface.new(10, 20, 300, 400) assert_equal([0.0, 0.0, 0.0, 0.0], surface.ink_extents) Cairo::Context.create(surface) do |context| context.move_to(15, 30) context.line_to(80, 100) context.stroke end if Cairo.satisfied_version?(1, 15) assert_equal([14.0, 29.0, 67.0, 72.0], surface.ink_extents) else assert_equal([10.0, 20.0, 61.0, 61.0], surface.ink_extents) end end end rcairo-1.16.6/test/test_region.rb000066400000000000000000000071011370612400100167030ustar00rootroot00000000000000class RegionTest < Test::Unit::TestCase include Helper def setup only_cairo_version(1, 10, 0) end def test_new_empty region = Cairo::Region.new assert_predicate(region, :empty?) end def test_new_rectangle region = Cairo::Region.new([0, 0, 10, 10]) assert_not_predicate(region, :empty?) end def test_num_rectangles region = Cairo::Region.new assert_equal(0, region.num_rectangles) end def test_get_rectangle region = Cairo::Region.new([0, 0, 10, 10]) assert_equal([0, 0, 10, 10], region[0]) end def test_each_rectangle region = Cairo::Region.new region.union!([0, 0, 10, 10]) region.union!([20, 20, 40, 40]) rectangles = [] region.each_rectangle do |rectangle| rectangles << rectangle end assert_equal([ [0, 0, 10, 10], [20, 20, 40, 40], ], rectangles) end def test_rectangles region = Cairo::Region.new region.union!([0, 0, 10, 10]) region.union!([20, 20, 40, 40]) assert_equal([ [0, 0, 10, 10], [20, 20, 40, 40], ], region.rectangles) end def test_dup region = Cairo::Region.new([0, 0, 10, 10]) region.dup.subtract!([5, 5, 5, 5]) assert_equal([0, 0, 10, 10], region.extents) end def test_equal assert_equal(Cairo::Region.new([0, 0, 10, 10]), Cairo::Region.new([0, 0, 10, 10])) assert_not_equal(Cairo::Region.new([0, 0, 10, 10]), Cairo::Region.new([0, 0, 100, 100])) end def test_extents region = Cairo::Region.new assert_equal([0, 0, 0, 0], region.extents) region.union!([0, 0, 10, 10]) assert_equal([0, 0, 10, 10], region.extents) end def test_contains_rectangle region = Cairo::Region.new([0, 0, 10, 10]) assert_equal(Cairo::RegionOverlap::IN, region.contains_rectangle([2, 2, 2, 2])) assert_equal(Cairo::RegionOverlap::OUT, region.contains_rectangle([10, 10, 1, 1])) assert_equal(Cairo::RegionOverlap::PART, region.contains_rectangle([2, 2, 10, 10])) end def test_contains_point region = Cairo::Region.new([0, 0, 10, 10]) assert_equal(true, region.contains_point?(5, 5)) assert_equal(false, region.contains_point?(10, 10)) end def test_translate region = Cairo::Region.new([0, 0, 10, 10]) assert_equal(true, region.contains_point?(5, 5)) region.translate!(6, 6) assert_equal(false, region.contains_point?(5, 5)) end def test_subtract region = Cairo::Region.new([0, 0, 10, 10]) assert_equal(true, region.contains_point?(5, 5)) region.subtract!([5, 5, 2, 2]) assert_equal(false, region.contains_point?(5, 5)) end def test_intersect region = Cairo::Region.new([0, 0, 10, 10]) assert_equal(true, region.contains_point?(5, 5)) assert_equal(true, region.contains_point?(7, 7)) region.intersect!([5, 5, 2, 2]) assert_equal(true, region.contains_point?(5, 5)) assert_equal(false, region.contains_point?(7, 7)) end def test_union region = Cairo::Region.new([0, 0, 4, 4]) assert_equal(false, region.contains_point?(5, 5)) region.union!([5, 5, 5, 5]) assert_equal(true, region.contains_point?(5, 5)) end def test_xor region = Cairo::Region.new([0, 0, 5, 5]) assert_equal(true, region.contains_point?(4, 4)) assert_equal(false, region.contains_point?(7, 7)) region.xor!([3, 3, 5, 5]) assert_equal(false, region.contains_point?(4, 4)) assert_equal(true, region.contains_point?(7, 7)) end end rcairo-1.16.6/test/test_scaled_font.rb000066400000000000000000000020661370612400100177060ustar00rootroot00000000000000require 'cairo' require 'stringio' class ScaledFontTest < Test::Unit::TestCase include Helper def test_scale_matrix only_cairo_version(1, 7, 2) surface = Cairo::ImageSurface.new(100, 100) context = Cairo::Context.new(surface) scaled_font = context.scaled_font assert_equal(Cairo::Matrix.new(10.0, 0.0, 0.0, 10.0, 0.0, 0.0), scaled_font.scale_matrix) end def test_text_to_glyphs only_cairo_version(1, 7, 6) surface = Cairo::PDFSurface.new(StringIO.new, 10, 10) context = Cairo::Context.new(surface) scaled_font = Cairo::ScaledFont.new(context.font_face, Cairo::Matrix.identity, Cairo::Matrix.identity, Cairo::FontOptions.new) expected_glyphs = [] expected_clusters = [] expected_cluster_flags = 0 assert_equal([expected_glyphs, expected_clusters, expected_cluster_flags], scaled_font.text_to_glyphs(0, 0, "text")) end end rcairo-1.16.6/test/test_script_device.rb000066400000000000000000000020751370612400100202500ustar00rootroot00000000000000require 'cairo' require 'stringio' class ScriptDeviceTest < Test::Unit::TestCase include Helper def setup only_device("Script") end def test_new output = StringIO.new device = Cairo::ScriptDevice.new(output) assert_equal("%!CairoScript\n", output.string) device.finish assert_equal("%!CairoScript\n", output.string) end def test_new_with_block output = StringIO.new string = nil Cairo::ScriptDevice.new(output) do |device| string = output.string end assert_equal("%!CairoScript\n", string) end def test_write_comment output = StringIO.new Cairo::ScriptDevice.new(output) do |device| device.write_comment("Hello!") end assert_equal("%!CairoScript\n" + "% Hello!\n", output.string) end def test_mode output = StringIO.new Cairo::ScriptDevice.new(output) do |device| assert_equal(Cairo::ScriptMode::ASCII, device.mode) device.mode = Cairo::ScriptMode::BINARY assert_equal(Cairo::ScriptMode::BINARY, device.mode) end end end rcairo-1.16.6/test/test_script_surface.rb000066400000000000000000000004631370612400100204400ustar00rootroot00000000000000class ScriptSurfaceTest < Test::Unit::TestCase include Helper def setup only_surface("Script") end def test_device device = Cairo::ScriptDevice.new(StringIO.new) surface = Cairo::ScriptSurface.new(device, 100, 100) assert_equal(Cairo::ScriptDevice, surface.device.class) end end rcairo-1.16.6/test/test_surface.rb000066400000000000000000000031171370612400100170530ustar00rootroot00000000000000require 'cairo' require 'stringio' class SurfaceTest < Test::Unit::TestCase include Helper def test_new output = StringIO.new surface = Cairo::PDFSurface.new(output, 10, 10) assert_not_equal("%%EOF\n", output.string[-6..-1]) surface.finish assert_equal("%%EOF\n", output.string[-6..-1]) end def test_create_with_block output = StringIO.new Cairo::PDFSurface.create(output, 10, 10) do |surface| assert_not_equal("%%EOF\n", output.string[-6..-1]) end assert_equal("%%EOF\n", output.string[-6..-1]) end def test_create_with_block_and_finish assert_nothing_raised do Cairo::PDFSurface.create(StringIO.new, 10, 10) do |surface| surface.finish end end end def test_device_scale only_cairo_version(1, 14, 0) surface = Cairo::ImageSurface.new(100, 100) assert_equal([1.0, 1.0], surface.device_scale) surface.set_device_scale(3.0, 4.0) assert_equal([3.0, 4.0], surface.device_scale) end def test_fallback_resolution only_cairo_version(1, 7, 2) surface = Cairo::ImageSurface.new(100, 100) assert_equal([300.0, 300.0], surface.fallback_resolution) surface.set_fallback_resolution(95, 95) assert_equal([95.0, 95.0], surface.fallback_resolution) end def test_mime_data only_cairo_version(1, 10, 0) output = StringIO.new surface = Cairo::PDFSurface.new(output, 100, 100) surface.set_mime_data(Cairo::MimeType::URI, "http://cairo.rubyforge.org/") assert_equal("http://cairo.rubyforge.org/", surface.get_mime_data(Cairo::MimeType::URI)) end end rcairo-1.16.6/test/test_svg_surface.rb000066400000000000000000000007311370612400100177310ustar00rootroot00000000000000class SVGSurfaceTest < Test::Unit::TestCase include Helper def test_new_with_nil_target surface = Cairo::SVGSurface.new(nil, 10, 20) surface.finish end def test_unit only_cairo_version(1, 15, 10) output = StringIO.new surface = Cairo::SVGSurface.new(output, 10, 20) assert_equal(Cairo::SVGUnit::PT, surface.document_unit) surface.document_unit = Cairo::SVGUnit::CM assert_equal(Cairo::SVGUnit::CM, surface.document_unit) end end rcairo-1.16.6/test/test_tee_surface.rb000066400000000000000000000015031370612400100177050ustar00rootroot00000000000000class TeeSurfaceTest < Test::Unit::TestCase include Helper def setup only_surface("Tee") only_surface("Script") end def test_new output1 = StringIO.new device1 = Cairo::ScriptDevice.new(output1) surface1 = Cairo::ScriptSurface.new(device1, 100, 200) output2 = StringIO.new device2 = Cairo::ScriptDevice.new(output2) surface2 = Cairo::ScriptSurface.new(device2, 100, 200) surface = Cairo::TeeSurface.new(surface1) surface << surface2 Cairo::Context.create(surface) do |context| context.move_to(15, 30) context.line_to(80, 100) context.stroke end assert_equal(<<-EOS, output1.string) %!CairoScript << /content //COLOR_ALPHA /width 100 /height 200 >> surface context n 15 30 m 80 100 l stroke+ EOS assert_equal(output1.string, output2.string) end end rcairo-1.16.6/test/test_text_cluster.rb000066400000000000000000000015021370612400100201440ustar00rootroot00000000000000require 'cairo' class TextClusterTest < Test::Unit::TestCase include Helper def test_new only_cairo_version(1, 7, 2) cluster = Cairo::TextCluster.new(2, 3) assert_equal([2, 3], [cluster.num_bytes, cluster.num_glyphs]) assert_equal("#", cluster.to_s) end def test_accessor only_cairo_version(1, 7, 2) cluster = Cairo::TextCluster.new(5, 7) assert_equal([5, 7], [cluster.num_bytes, cluster.num_glyphs]) cluster.num_bytes = 1 cluster.num_glyphs = 2 assert_equal([1, 2], [cluster.num_bytes, cluster.num_glyphs]) end def test_to_s only_cairo_version(1, 7, 2) cluster = Cairo::TextCluster.new(9, 1) assert_equal("#", cluster.to_s) end end rcairo-1.16.6/test/test_text_extents.rb000066400000000000000000000022451370612400100201620ustar00rootroot00000000000000require 'cairo' class TextExtentsTest < Test::Unit::TestCase include Helper def test_new extents = Cairo::TextExtents.new assert_equal([0.0, -1.0, 0.0, 1.0, 1.0, 0.0], [extents.x_bearing, extents.y_bearing, extents.width, extents.height, extents.x_advance, extents.y_advance]) end def test_accessor extents = Cairo::TextExtents.new extents.x_bearing = 0.1 extents.y_bearing = 0.2 extents.width = 0.3 extents.height = 0.4 extents.x_advance = 0.5 extents.y_advance = 0.6 assert_equal([0.1, 0.2, 0.3, 0.4, 0.5, 0.6], [extents.x_bearing, extents.y_bearing, extents.width, extents.height, extents.x_advance, extents.y_advance]) end def test_to_s extents = Cairo::TextExtents.new extents.x_bearing = 0.1 extents.y_bearing = 0.2 extents.width = 0.3 extents.height = 0.4 extents.x_advance = 0.5 extents.y_advance = 0.6 assert_equal("#", extents.to_s) end end rcairo-1.16.6/test/test_text_to_glyphs_data.rb000066400000000000000000000033461370612400100214740ustar00rootroot00000000000000require 'cairo' class TextToGlyphsDataTest < Test::Unit::TestCase include Helper def test_new only_cairo_version(1, 7, 6) data = Cairo::UserFontFace::TextToGlyphsData.new(false, false, false) assert_equal([false, false, false], [data.need_glyphs?, data.need_clusters?, data.need_cluster_flags?]) data = Cairo::UserFontFace::TextToGlyphsData.new(true, false, false) assert_equal([true, false, false], [data.need_glyphs?, data.need_clusters?, data.need_cluster_flags?]) data = Cairo::UserFontFace::TextToGlyphsData.new(false, true, false) assert_equal([false, true, false], [data.need_glyphs?, data.need_clusters?, data.need_cluster_flags?]) data = Cairo::UserFontFace::TextToGlyphsData.new(false, false, true) assert_equal([false, false, true], [data.need_glyphs?, data.need_clusters?, data.need_cluster_flags?]) end def test_accessor only_cairo_version(1, 7, 6) data = Cairo::UserFontFace::TextToGlyphsData.new(true, true, true) assert_equal([nil, nil, 0], [data.glyphs, data.clusters, data.cluster_flags]) glyph = Cairo::Glyph.new(0, 5, 10) data.glyphs = [glyph] assert_equal([[glyph], nil, 0], [data.glyphs, data.clusters, data.cluster_flags]) cluster = Cairo::TextCluster.new(0, 1) data.clusters = [cluster] assert_equal([[glyph], [cluster], 0], [data.glyphs, data.clusters, data.cluster_flags]) data.cluster_flags = :backward assert_equal([[glyph], [cluster], Cairo::TextClusterFlag::BACKWARD], [data.glyphs, data.clusters, data.cluster_flags]) end end rcairo-1.16.6/test/test_xml_device.rb000066400000000000000000000006431370612400100175430ustar00rootroot00000000000000class XMLDeviceTest < Test::Unit::TestCase include Helper def setup only_device("XML") end def test_new output = StringIO.new device = Cairo::XMLDevice.new(output) assert_equal("", output.string) end def test_new_with_block output = StringIO.new string = nil Cairo::XMLDevice.new(output) do |device| string = output.string end assert_equal("", string) end end rcairo-1.16.6/test/test_xml_surface.rb000066400000000000000000000014561370612400100177370ustar00rootroot00000000000000class XMLSurfaceTest < Test::Unit::TestCase include Helper def setup only_surface("XML") end def test_new only_cairo_version(1, 12, 0) output = StringIO.new device = Cairo::XMLDevice.new(output) surface = Cairo::XMLSurface.new(device, 100, 200) Cairo::Context.create(surface) do |context| context.move_to(15, 30) context.line_to(80, 100) context.stroke end assert_equal(<<-EOX, output.string) OVER 2 10 LINE_CAP_BUTT LINE_JOIN_MITER 0 0 0 1 15 30 m 80 100 l 0.1 DEFAULT EOX end end