File: Montage.cpp

package info (click to toggle)
imagemagick 6:6.0.6.2-2.9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 33,284 kB
  • ctags: 14,844
  • sloc: ansic: 190,790; cpp: 17,203; sh: 8,740; perl: 4,190; makefile: 1,740; tcl: 459
file content (134 lines) | stat: -rw-r--r-- 3,393 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
//
// Implementation of Montage
//

#define MAGICK_IMPLEMENTATION

#include "Magick++/Include.h"
#include <string>
#include <string.h>

#include "Magick++/Montage.h"
#include "Magick++/Functions.h"

Magick::Montage::Montage ( void )
  : _backgroundColor("#ffffff"),
    _compose(OverCompositeOp),
    _fileName(),
    _fill("#000000ff"),
    _font(),
    _geometry("120x120+4+3>"),
    _gravity(CenterGravity),
    _label(),
    _pointSize(12),
    _shadow(false),
    _stroke(),
    _texture(),
    _tile("6x4"),
    _title(),
    _transparentColor()
{
}

Magick::Montage::~Montage( void )
{
  // Nothing to do
}

Magick::MontageFramed::MontageFramed ( void )
  : _borderColor("#dfdfdf"),
    _borderWidth(0),
    _frame(),
    _matteColor("#bdbdbd")
{
}

/* virtual */ Magick::MontageFramed::~MontageFramed ( void )
{
  // Nothing to do
}

void Magick::Montage::updateMontageInfo ( MontageInfo &montageInfo_ ) const
{

  memset(&montageInfo_,0,sizeof(MontageInfo));

  // background_color
  montageInfo_.background_color = _backgroundColor;
  // border_color
  montageInfo_.border_color = Color();
  // border_width
  montageInfo_.border_width = 0;
  // filename
  _fileName.copy( montageInfo_.filename, MaxTextExtent - 1 );
  montageInfo_.filename[ _fileName.length() ] = 0; // null terminate
  // fill
  montageInfo_.fill = _fill;
  // font
  if ( _font.length() != 0 )
    Magick::CloneString( &montageInfo_.font, _font );
  else
    montageInfo_.font=(char *) RelinquishMagickMemory(montageInfo_.font);
  // frame
  montageInfo_.frame=(char *) montageInfo_.frame;
  // geometry
  if ( _geometry.isValid() )
    Magick::CloneString( &montageInfo_.geometry, _geometry );
  else
    montageInfo_.geometry=(char *)
      RelinquishMagickMemory(montageInfo_.geometry);
  // gravity
  montageInfo_.gravity = _gravity;
  // matte_color
  montageInfo_.matte_color = Color();
  // pointsize
  montageInfo_.pointsize = _pointSize;
  // shadow
  montageInfo_.shadow = static_cast<MagickBooleanType>
    (_shadow ? MagickTrue : MagickFalse);
  // signature (validity stamp)
  montageInfo_.signature = MagickSignature;
  // stroke
  montageInfo_.stroke = _stroke;
  // texture
  if ( _texture.length() != 0 )
    Magick::CloneString( &montageInfo_.texture, _texture );
  else
    montageInfo_.texture=(char *) RelinquishMagickMemory(montageInfo_.texture);
  // tile
  if ( _tile.isValid() )
    Magick::CloneString( &montageInfo_.tile, _tile );
  else
    montageInfo_.tile=(char *) RelinquishMagickMemory(montageInfo_.tile);
  // title
  if ( _title.length() != 0 )
    Magick::CloneString( &montageInfo_.title, _title );
  else
    montageInfo_.title=(char *) RelinquishMagickMemory(montageInfo_.title);
}

//
// Implementation of MontageFramed
//

/* virtual */ void
Magick::MontageFramed::updateMontageInfo ( MontageInfo &montageInfo_ ) const
{
  // Do base updates
  Montage::updateMontageInfo ( montageInfo_ );

  // border_color
  montageInfo_.border_color = _borderColor;
  // border_width
  montageInfo_.border_width = _borderWidth;
  // frame
  if ( _frame.isValid() )
    Magick::CloneString( &montageInfo_.frame, _frame );
  else
    montageInfo_.frame=(char *) RelinquishMagickMemory(montageInfo_.frame);
  // matte_color
  montageInfo_.matte_color = _matteColor;
}