Part 1 Foundations 1
1 Overview of graphics 3
1.1 Perl and graphics 4
1.2 The bits and pieces in graphics programming 5
1.3 Color spaces and palettes 7
RGB 7 ✦ CMY and CMYK 8 ✦ HSV and HLS 9
YUV, YIQ and YCbCr 12 ✦ Grayscale 12
Color distance 13 ✦ Reducing the number of
colors in an image 13
1.4 Summary 14
#!/usr/local/bin/perl -w
use strict;
use OpenGL qw(:all :old);
require "OpenGLTools.pl";
sub triangle
{
glBegin (GL_TRIANGLES);
glColor3f (0.0, 0.0, 0.0);
glVertex2f(0.0, 0.0);
glColor3f (0.5, 0.5, 0.5);
glVertex2f(30.0, 0.0);
glColor3f (1.0, 1.0, 1.0);
glVertex2f(0.0, 30.0);
glEnd ();
}
glpOpenWindow (width => 250, height => 250);
glLoadIdentity();
gluOrtho2D (0.0, 30.0, 0.0, 30.0);
glClearColor (1.0, 1.0, 1.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
triangle();
gltIMCapture("OpenGLcap1.png", 50, 50, 100, 100);
gltIMCapture("OpenGLcap2.png");
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |