View Javadoc
1 /*****************************************************************************
2 * Virtual Mockup for Machine Vision
3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr.,
4 * Carlos S. Santos.
5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP
6 *
7 * Permission is granted to redistribute and/or modify this
8 * software under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html)
16 * for more details.
17 *
18 *****************************************************************************/
19
20 package> camera3d.action;
21
22
23
24 import camera3d.Viewport;
25 import camera3d.AvatarManager;
26
27 /***
28 * Action for saving a JPEG image file from the view shown by a given viewport.
29 *
30 * @author Fábio Roberto de Miranda
31 * @version 1.0
32 */
33
34 public class JPGSaveAction extends GUIAction {
35
36 private String filename;
37 private Viewport viewport;
38 private int width;
39 private int height;
40 private int option;
41
42 public JPGSaveAction(Viewport viewport, String filename) {
43 this.viewport = viewport;
44 this.filename = filename;
45 option = 0;
46 }
47
48 public JPGSaveAction(Viewport viewport, String filename, int width, int height) {
49 this( viewport, filename);
50 this.width = width;
51 this.height = height;
52 option = 1;
53 }
54
55
56 public void doAction(ActionExecutor executor) {
57 AvatarManager.getAvatarManager().hideAllAvatars();
58 if (option == 0){
59 viewport.saveJPGFile(filename);
60 } else if (option == 1){
61 viewport.saveJPGFile(filename, width, height);
62 }
63 AvatarManager.getAvatarManager().showAllAvatars();
64 }
65 }
This page was automatically generated by Maven