Home | History | Annotate | Download | only in MagickCore
      1 /*
      2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      3 %                                                                             %
      4 %                                                                             %
      5 %                                                                             %
      6 %               M   M   OOO   N   N  IIIII  TTTTT   OOO   RRRR                %
      7 %               MM MM  O   O  NN  N    I      T    O   O  R   R               %
      8 %               M M M  O   O  N N N    I      T    O   O  RRRR                %
      9 %               M   M  O   O  N  NN    I      T    O   O  R R                 %
     10 %               M   M   OOO   N   N  IIIII    T     OOO   R  R                %
     11 %                                                                             %
     12 %                                                                             %
     13 %                     MagickCore Progress Monitor Methods                     %
     14 %                                                                             %
     15 %                              Software Design                                %
     16 %                                   Cristy                                    %
     17 %                               December 1995                                 %
     18 %                                                                             %
     19 %                                                                             %
     20 %  Copyright 1999-2016 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 %
     37 %
     38 */
     39 
     40 /*
     42   Include declarations.
     43 */
     44 #include "MagickCore/studio.h"
     45 #include "MagickCore/image.h"
     46 #include "MagickCore/log.h"
     47 #include "MagickCore/monitor.h"
     48 
     49 /*
     51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     52 %                                                                             %
     53 %                                                                             %
     54 %                                                                             %
     55 %   S e t I m a g e P r o g r e s s M o n i t o r                             %
     56 %                                                                             %
     57 %                                                                             %
     58 %                                                                             %
     59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     60 %
     61 %  SetImageProgressMonitor() sets the image progress monitor to the specified
     62 %  method and returns the previous progress monitor if any.  The progress
     63 %  monitor method looks like this:
     64 %
     65 %    MagickBooleanType MagickProgressMonitor(const char *text,
     66 %      const MagickOffsetType offset,const MagickSizeType extent,
     67 %      void *client_data)
     68 %
     69 %  If the progress monitor returns MagickFalse, the current operation is
     70 %  interrupted.
     71 %
     72 %  The format of the SetImageProgressMonitor method is:
     73 %
     74 %      MagickProgressMonitor SetImageProgressMonitor(Image *image,
     75 %        const MagickProgressMonitor progress_monitor,void *client_data)
     76 %
     77 %  A description of each parameter follows:
     78 %
     79 %    o image: the image.
     80 %
     81 %    o progress_monitor: Specifies a pointer to a method to monitor progress of
     82 %      an image operation.
     83 %
     84 %    o client_data: Specifies a pointer to any client data.
     85 %
     86 */
     87 MagickExport MagickProgressMonitor SetImageProgressMonitor(Image *image,
     88   const MagickProgressMonitor progress_monitor,void *client_data)
     89 {
     90   MagickProgressMonitor
     91     previous_monitor;
     92 
     93   previous_monitor=image->progress_monitor;
     94   image->progress_monitor=progress_monitor;
     95   image->client_data=client_data;
     96   return(previous_monitor);
     97 }
     98 
     99 /*
    101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    102 %                                                                             %
    103 %                                                                             %
    104 %                                                                             %
    105 %   S e t I m a g e I n f o P r o g r e s s M o n i t o r                     %
    106 %                                                                             %
    107 %                                                                             %
    108 %                                                                             %
    109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    110 %
    111 %  SetImageInfoProgressMonitor() sets the image_info progress monitor to the
    112 %  specified method and returns the previous progress monitor if any.  The
    113 %  progress monitor method looks like this:
    114 %
    115 %    MagickBooleanType MagickProgressMonitor(const char *text,
    116 %      const MagickOffsetType offset,const MagickSizeType extent,
    117 %      void *client_data)
    118 %
    119 %  If the progress monitor returns MagickFalse, the current operation is
    120 %  interrupted.
    121 %
    122 %  The format of the SetImageInfoProgressMonitor method is:
    123 %
    124 %      MagickProgressMonitor SetImageInfoProgressMonitor(ImageInfo *image_info,
    125 %        const MagickProgressMonitor progress_monitor,void *client_data)
    126 %
    127 %  A description of each parameter follows:
    128 %
    129 %    o image_info: the image info.
    130 %
    131 %    o progress_monitor: Specifies a pointer to a method to monitor progress of
    132 %      an image operation.
    133 %
    134 %    o client_data: Specifies a pointer to any client data.
    135 %
    136 */
    137 MagickExport MagickProgressMonitor SetImageInfoProgressMonitor(
    138   ImageInfo *image_info,const MagickProgressMonitor progress_monitor,
    139   void *client_data)
    140 {
    141   MagickProgressMonitor
    142     previous_monitor;
    143 
    144   previous_monitor=image_info->progress_monitor;
    145   image_info->progress_monitor=progress_monitor;
    146   image_info->client_data=client_data;
    147   return(previous_monitor);
    148 }
    149