root / ImageMagick / trunk / utilities / display.c

Revision 10625, 5.7 kB (checked in by cristy, 4 months ago)
Line 
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%               DDDD   IIIII  SSSSS  PPPP   L       AAA   Y   Y               %
7%               D   D    I    SS     P   P  L      A   A   Y Y                %
8%               D   D    I     SSS   PPPP   L      AAAAA    Y                 %
9%               D   D    I       SS  P      L      A   A    Y                 %
10%               DDDD   IIIII  SSSSS  P      LLLLL  A   A    Y                 %
11%                                                                             %
12%                                                                             %
13%                       Interactively Display an Image.                       %
14%                                                                             %
15%                             Software Design                                 %
16%                               John Cristy                                   %
17%                                July 1992                                    %
18%                                                                             %
19%                                                                             %
20%  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization      %
21%  dedicated to making software imaging solutions freely available.           %
22%                                                                             %
23%  You may not use this file except in compliance with the License.  You may  %
24%  obtain a copy of the License at                                            %
25%                                                                             %
26%    http://www.imagemagick.org/script/license.php                            %
27%                                                                             %
28%  Unless required by applicable law or agreed to in writing, software        %
29%  distributed under the License is distributed on an "AS IS" BASIS,          %
30%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
31%  See the License for the specific language governing permissions and        %
32%  limitations under the License.                                             %
33%                                                                             %
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36%  Display is a machine architecture independent image processing
37%  and display program.  It can display any image in the MIFF format on
38%  any workstation display running X.  Display first determines the
39%  hardware capabilities of the workstation.  If the number of unique
40%  colors in the image is less than or equal to the number the workstation
41%  can support, the image is displayed in an X window.  Otherwise the
42%  number of colors in the image is first reduced to match the color
43%  resolution of the workstation before it is displayed.
44%
45%  This means that a continuous-tone 24 bits-per-pixel image can display on a
46%  8 bit pseudo-color device or monochrome device.  In most instances the
47%  reduced color image closely resembles the original.  Alternatively, a
48%  monochrome or pseudo-color image can display on a continuous-tone 24
49%  bits-per-pixel device.
50%
51%
52%
53*/
54
55/*
56  Include declarations.
57*/
58#include <stdio.h>
59#include <stdlib.h>
60#include <string.h>
61#include <time.h>
62#include "wand/MagickWand.h"
63#if defined(__WINDOWS__)
64#include <windows.h>
65#endif
66
67/*
68%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69%                                                                             %
70%                                                                             %
71%                                                                             %
72%    M a i n                                                                  %
73%                                                                             %
74%                                                                             %
75%                                                                             %
76%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77%
78%
79*/
80
81#if defined(__WINDOWS__)
82int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
83{
84  char
85    **argv;
86
87  int
88    argc,
89    main(int,char **);
90
91  argv=StringToArgv(command,&argc);
92  return(main(argc,argv));
93}
94#endif
95
96int main(int argc,char **argv)
97{
98  char
99    *option;
100
101  ExceptionInfo
102    *exception;
103
104  ImageInfo
105    *image_info;
106
107  MagickBooleanType
108    regard_warnings,
109    status;
110
111  register long
112    i;
113
114  MagickCoreGenesis(*argv,MagickTrue);
115  exception=AcquireExceptionInfo();
116  regard_warnings=MagickFalse;
117  for (i=1; i < (long) argc; i++)
118  {
119    option=argv[i];
120    if ((strlen(option) == 1) || ((*option != '-') && (*option != '+')))
121      continue;
122    if (LocaleCompare("debug",option+1) == 0)
123      (void) SetLogEventMask(argv[++i]);
124    if (LocaleCompare("regard-warnings",option+1) == 0)
125      regard_warnings=MagickTrue;
126  }
127  image_info=AcquireImageInfo();
128  status=DisplayImageCommand(image_info,argc,argv,(char **) NULL,exception);
129  if (exception->severity != UndefinedException)
130    {
131      if ((exception->severity > ErrorException) ||
132          (regard_warnings != MagickFalse))
133        status=MagickTrue;
134      CatchException(exception);
135    }
136  image_info=DestroyImageInfo(image_info);
137  exception=DestroyExceptionInfo(exception);
138  MagickCoreTerminus();
139  return(status == MagickFalse ? 0 : 1);
140}
Note: See TracBrowser for help on using the browser.