~ubuntu-branches/ubuntu/saucy/gnudatalanguage/saucy-proposed

« back to all changes in this revision

Viewing changes to src/pro/write_gif.pro

  • Committer: Package Import Robot
  • Author(s): Axel Beckert
  • Date: 2013-05-15 02:23:58 UTC
  • mfrom: (15.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130515022358-rziznpf225zn9lv9
Tags: 0.9.3-2
* Upload to unstable.
* Revamp debian/rules
  - Allow parallel builds
  - Use debian/manpages instead of dh_installman parameter
  - Switch to dh7 style debian/rules file
* Bump debhelper compatibility to 9
  - Update versioned debhelper build-dependency
* Bump Standards-Version to 3.9.4 (no changes)
* Apply wrap-and-sort

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;+
 
2
;
 
3
; NAME: WRITE_GIF
 
4
;
 
5
; PURPOSE: write a image from memory to a GIF
 
6
;
 
7
; CATEGORY: Images (IO)
 
8
;
 
9
; CALLING SEQUENCE: 
 
10
;    WRITE_GIF, filename, image, Red, Green, Blue, $
 
11
;               background_color=background_color, close=close, $
 
12
;               delay_time=delay_time, disposal_method=disposal_method, $
 
13
;               multiple=multiple, repeat_count=repeat_count, $
 
14
;               transparent=transparent, user_input=user_input,                
 
15
;               test=test, help=help, debug=debug
 
16
;
 
17
; KEYWORD PARAMETERS:
 
18
;      Except very basic output, nothing is supported now, please contribute !
 
19
;
 
20
; OPTIONAL INPUTS: For pseudocolor only
 
21
;        red  : the Red colormap vector (for PseudoColor images)
 
22
;        green: the Green colormap vector (for PseudoColor images)
 
23
;        blue : the Blue colormap vector (for PseudoColor images)
 
24
;
 
25
; RESTRICTIONS:
 
26
;         Requires ImageMagick (tested)
 
27
;         Most Keywords are not operational now.
 
28
;
 
29
; PROCEDURE:
 
30
;         Use ImageMagick to write the data as requested
 
31
;
 
32
; EXAMPLE:
 
33
;   READ_JPEG, 'testsuite/Saturn.jpg', image
 
34
;   WRITE_GIF, 'Saturn2.gif', image
 
35
;
 
36
; MODIFICATION HISTORY:
 
37
;  Written by: Alain Coulais 2011-11-30
 
38
;  Derived work from WRITE_JPEG by: Christopher Lee 2004-05-17
 
39
;-
 
40
; LICENCE:
 
41
; Copyright (C) 2011
 
42
; This program is free software; you can redistribute it and/or modify  
 
43
; it under the terms of the GNU General Public License as published by  
 
44
; the Free Software Foundation; either version 2 of the License, or     
 
45
; (at your option) any later version.                                   
 
46
;
 
47
;-
 
48
;
 
49
pro GIF_MESSAGE, mot_clef
 
50
MESSAGE, /Continue, 'This Keyword '+STRUPCASE(mot_clef)+' is not operational'
 
51
MESSAGE, /Continue, 'Please contribute !!'
 
52
end
 
53
;
 
54
pro WRITE_GIF, filename, image, Red, Green, Blue, $
 
55
               background_color=background_color, close=close, $
 
56
               delay_time=delay_time, disposal_method=disposal_method, $
 
57
               multiple=multiple, repeat_count=repeat_count, $
 
58
               transparent=transparent, user_input=user_input, $
 
59
               test=test, help=help, debug=debug
 
60
;
 
61
if ~KEYWORD_SET(debug) then ON_ERROR, 2
 
62
;
 
63
if KEYWORD_SET(help) then begin
 
64
   print, 'pro WRITE_GIF, filename, image, Red, Green, Blue, $'
 
65
   print, '               background_color=background_color, close=close, $'
 
66
   print, '               delay_time=delay_time, disposal_method=disposal_method, $'
 
67
   print, '               multiple=multiple, repeat_count=repeat_count, $'
 
68
   print, '               transparent=transparent, user_input=user_input, $'
 
69
   print, '               help=help, test=test, debug=debug'
 
70
   return
 
71
endif
 
72
;
 
73
; Do we have access to ImageMagick functionnalities ??
 
74
;
 
75
if (MAGICK_EXISTS() EQ 0) then begin
 
76
   MESSAGE, /continue, "GDL was compiled without ImageMagick support."
 
77
   MESSAGE, "You must have ImageMagick support to use this functionaly."
 
78
endif
 
79
;
 
80
if KEYWORD_SET(background_color) then GIF_MESSAGE, 'background_color'
 
81
if KEYWORD_SET(close) then GIF_MESSAGE, 'close'
 
82
if KEYWORD_SET(delay_time) then GIF_MESSAGE, 'delay_time'
 
83
if KEYWORD_SET(disposal_method) then GIF_MESSAGE, 'disposal_method'
 
84
if KEYWORD_SET(multiple) then GIF_MESSAGE, 'multiple'
 
85
if KEYWORD_SET(user_input) then GIF_MESSAGE, 'user_input'
 
86
if KEYWORD_SET(transparent) then GIF_MESSAGE, 'transparent'
 
87
if KEYWORD_SET( user_input) then GIF_MESSAGE, ' user_input'
 
88
;
 
89
MESSAGE, /continue, 'This is a very preliminary procedure, please report problems'
 
90
MESSAGE, /continue, '(if possible with link to the input image/test case)'
 
91
;
 
92
n=SIZE(image, /n_dimensions)
 
93
s=SIZE(image, /dimensions)
 
94
;
 
95
if KEYWORD_SET(test) then STOP
 
96
;
 
97
if (n LT 2) then begin
 
98
   MESSAGE, 'Image must be 2D or 3D'
 
99
endif
 
100
;
 
101
if (n GT 3) then begin
 
102
   MESSAGE, 'We don''t know how to manage a >3D image, please contribute'
 
103
endif
 
104
;
 
105
if n EQ 2 then mid=MAGICK_CREATE(s[0],s[1])
 
106
if n EQ 3 then mid=MAGICK_CREATE(s[1],s[2])
 
107
;
 
108
;TVLCT,r,g,b,/GET
 
109
rgb=1
 
110
MAGICK_WRITE, mid, image, rgb=rgb
 
111
MAGICK_WRITEFILE, mid, filename,"GIF"
 
112
MAGICK_CLOSE, mid
 
113
;
 
114
if KEYWORD_SET(test) then STOP
 
115
;
 
116
end
 
117
 
 
118
 
 
119
 
 
120