1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
21 #include "Shapes_Ast_decls.h"
23 #include "pdfstructure.h"
38 Gray( double gr
) : gr_( gr
) { }
40 void setStroking( std::ostream
& os
) const;
41 void setNonStroking( std::ostream
& os
) const;
42 RefCountPtr
< SimplePDF::PDF_Vector
> componentVector( ) const;
44 Concrete::Gray
add( const Concrete::Gray
& col2
, const Ast::SourceLocation
& callLoc
) const;
45 Concrete::Gray
mul( double factor
, const Ast::SourceLocation
& factorLoc
) const;
46 Concrete::Gray
addNoCheck( const Concrete::Gray
& col2
) const
48 return Concrete::Gray( gr_
+ col2
.gr_
);
50 Concrete::Gray
mulNoCheck( double factor
) const
52 return Concrete::Gray( factor
* gr_
);
62 RGB( double r
, double g
, double b
) : r_( r
), g_( g
), b_( b
) { }
64 void setStroking( std::ostream
& os
) const;
65 void setNonStroking( std::ostream
& os
) const;
66 RefCountPtr
< SimplePDF::PDF_Vector
> componentVector( ) const;
68 Concrete::RGB
add( const Concrete::RGB
& col2
, const Ast::SourceLocation
& callLoc
) const;
69 Concrete::RGB
mul( double factor
, const Ast::SourceLocation
& factorLoc
) const;
70 Concrete::RGB
addNoCheck( const Concrete::RGB
& col2
) const
72 return Concrete::RGB( r_
+ col2
.r_
, g_
+ col2
.g_
, b_
+ col2
.b_
);
74 Concrete::RGB
mulNoCheck( double factor
) const
76 return Concrete::RGB( factor
* r_
, factor
* g_
, factor
* b_
);
79 double mean( ) const { return (1./3) * ( r_
+ g_
+ b_
); }
89 CMYK( double c
, double m
, double y
, double k
) : c_( c
), m_( m
), y_( y
), k_( k
) { }
91 void setStroking( std::ostream
& os
) const;
92 void setNonStroking( std::ostream
& os
) const;
93 RefCountPtr
< SimplePDF::PDF_Vector
> componentVector( ) const;
95 CMYK
add( const CMYK
& col2
, const Ast::SourceLocation
& callLoc
) const;
96 CMYK
mul( double factor
, const Ast::SourceLocation
& factorLoc
) const;
97 CMYK
addNoCheck( const CMYK
& col2
) const
99 return CMYK( c_
+ col2
.c_
, m_
+ col2
.m_
, y_
+ col2
.y_
, k_
+ col2
.k_
);
101 CMYK
mulNoCheck( double factor
) const
103 return CMYK( factor
* c_
, factor
* m_
, factor
* y_
, factor
* k_
);