Changeset 3436 for pkpgcounter/trunk/tests/runcolors.py
- Timestamp:
- 10/06/08 00:22:07 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/tests/runcolors.py
r564 r3436 1 1 #! /usr/bin/env python 2 # -*- coding: UTF-8 -*-2 # -*- coding: utf-8 -*- 3 3 # 4 4 # pkpgcounter : a generic Page Description Language parser … … 9 9 # the Free Software Foundation, either version 3 of the License, or 10 10 # (at your option) any later version. 11 # 11 # 12 12 # This program is distributed in the hope that it will be useful, 13 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 15 # GNU General Public License for more details. 16 # 16 # 17 17 # You should have received a copy of the GNU General Public License 18 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. … … 52 52 pkpgcounter --colorspace $cspace colors.pdf ; 53 53 echo ; 54 done 54 done 55 55 56 56 Please report any problem to : alet@librelogiciel.com … … 115 115 from reportlab.lib.units import cm 116 116 from reportlab.pdfgen import canvas 117 except ImportError : 117 except ImportError : 118 118 sys.stderr.write("Please download and install ReportLab\n\tfrom http://www.reportlab.org\n") 119 119 sys.exit(-1) … … 124 124 xbase = 2*cm 125 125 ybase = height - 2*cm 126 126 127 127 # First we output the explanations on the first page. 128 128 canv.setFont("Courier", 14) … … 131 131 ybase -= 18 132 132 canv.showPage() 133 133 134 134 # Then we output each page 135 135 for color in (colors.Color(1, 0, 0), # Red 136 136 colors.Color(0, 1, 0), # Green 137 137 colors.Color(0, 0, 1)) : # Blue 138 canv.setStrokeColorRGB(*color.rgb()) 139 canv.setFillColorRGB(*color.rgb()) 138 canv.setStrokeColorRGB(*color.rgb()) 139 canv.setFillColorRGB(*color.rgb()) 140 140 canv.rect(0, 0, width, height, fill=1) 141 141 canv.showPage() 142 142 143 143 for color in (colors.CMYKColor(1, 0, 0, 0), # Cyan 144 144 colors.CMYKColor(0, 1, 0, 0), # Magenta … … 146 146 colors.CMYKColor(0, 0, 0, 1), # Black 147 147 colors.CMYKColor(0, 0, 0, 0)) : # White 148 canv.setStrokeColorCMYK(*color.cmyk()) 149 canv.setFillColorCMYK(*color.cmyk()) 148 canv.setStrokeColorCMYK(*color.cmyk()) 149 canv.setFillColorCMYK(*color.cmyk()) 150 150 canv.rect(0, 0, width, height, fill=1) 151 151 canv.showPage() 152 152 153 153 # Finally outputs the expected results. 154 154 canv.setFont("Helvetica-Bold", 16) … … 160 160 ybase -= 14 161 161 canv.showPage() 162 163 canv.save() 162 163 canv.save()