Magick++ 6.9.13
Loading...
Searching...
No Matches
Montage.cpp
1// This may look like C code, but it is really -*- C++ -*-
2//
3// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4//
5// Implementation of Montage
6//
7
8#define MAGICKCORE_IMPLEMENTATION 1
9#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
10
11#include "Magick++/Include.h"
12#include <string>
13#include <string.h>
14
15#include "Magick++/Montage.h"
16#include "Magick++/Functions.h"
17
18Magick::Montage::Montage(void)
19 : _backgroundColor("#ffffff"),
20 _compose(OverCompositeOp),
21 _fileName(),
22 _fill("#000000ff"),
23 _font(),
24 _geometry("120x120+4+3>"),
25 _gravity(CenterGravity),
26 _label(),
27 _pointSize(12),
28 _shadow(false),
29 _stroke(),
30 _texture(),
31 _tile("6x4"),
32 _title(),
33 _transparentColor()
34{
35}
36
37Magick::Montage::~Montage(void)
38{
39}
40
41void Magick::Montage::updateMontageInfo(MontageInfo &montageInfo_) const
42{
43 (void) memset(&montageInfo_,0,sizeof(montageInfo_));
44
45 // background_color
46 montageInfo_.background_color=_backgroundColor;
47 // border_color
48 montageInfo_.border_color=Color();
49 // border_width
50 montageInfo_.border_width=0;
51 // filename
52 if (_fileName.length() != 0)
53 {
54 _fileName.copy(montageInfo_.filename,MaxTextExtent-1);
55 montageInfo_.filename[_fileName.length()]=0; // null terminate
56 }
57 // fill
58 montageInfo_.fill=_fill;
59 // font
60 if (_font.length() != 0)
61 Magick::CloneString(&montageInfo_.font,_font);
62 // geometry
63 if (_geometry.isValid())
64 Magick::CloneString(&montageInfo_.geometry,_geometry);
65 // gravity
66 montageInfo_.gravity=_gravity;
67 // matte_color
68 montageInfo_.matte_color=Color();
69 // pointsize
70 montageInfo_.pointsize=_pointSize;
71 // shadow
72 montageInfo_.shadow=static_cast<MagickBooleanType>(_shadow ? MagickTrue :
73 MagickFalse);
74 // signature (validity stamp)
75 montageInfo_.signature=MagickSignature;
76 // stroke
77 montageInfo_.stroke=_stroke;
78 // texture
79 if (_texture.length() != 0)
80 Magick::CloneString(&montageInfo_.texture,_texture);
81 // tile
82 if (_tile.isValid())
83 Magick::CloneString( &montageInfo_.tile, _tile );
84 // title
85 if (_title.length() != 0)
86 Magick::CloneString(&montageInfo_.title,_title);
87}
88
89//
90// Implementation of MontageFramed
91//
92
93Magick::MontageFramed::MontageFramed(void)
94 : _borderColor("#dfdfdf"),
95 _borderWidth(0),
96 _frame(),
97 _matteColor("#bdbdbd")
98{
99}
100
101Magick::MontageFramed::~MontageFramed(void)
102{
103}
104
105void Magick::MontageFramed::updateMontageInfo(MontageInfo &montageInfo_) const
106{
107 // Do base updates
108 Montage::updateMontageInfo(montageInfo_);
109
110 // border_color
111 montageInfo_.border_color=_borderColor;
112 // border_width
113 montageInfo_.border_width=_borderWidth;
114 // frame
115 if (_frame.isValid())
116 Magick::CloneString(&montageInfo_.frame,_frame);
117 // matte_color
118 montageInfo_.matte_color=_matteColor;
119}