/[escript]/trunk/doc/examples/pyvisi/logo.py
ViewVC logotype

Contents of /trunk/doc/examples/pyvisi/logo.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1108 - (show annotations)
Thu Apr 19 04:02:11 2007 UTC (12 years, 5 months ago) by jongui
File MIME type: text/x-python
File size: 892 byte(s)
Added modules that allows logos (i.e. access logo) to be inserted together with the rendered object. An example on how to use the 'Logo' class has also been provided.

1 # Import the necessary modules.
2 from esys.pyvisi import Scene, ImageReader, Logo
3 from esys.pyvisi import LocalPosition
4 from esys.pyvisi.constant import *
5
6 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes/"
7 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images/"
8 X_SIZE = 600
9 Y_SIZE = 300
10
11 LOAD_LOGO_NAME = "access_logo.jpg"
12 SAVE_IMAGE_NAME = "logo.jpg"
13 JPG_RENDERER = Renderer.ONLINE_JPG
14
15 # Create a Scene.
16 s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
17 y_size = Y_SIZE)
18
19 # Create an ImageReader (in place of DataCollector).
20 ir = ImageReader(ImageFormat.JPG)
21 ir.setImageName(image_name = PYVISI_EXAMPLE_MESHES_PATH + LOAD_LOGO_NAME)
22
23 # Create an Image.
24 l = Logo(scene = s, image_reader = ir, viewport = Viewport.SOUTH_WEST)
25 l.setPosition(position = LocalPosition(10,10))
26 l.setSize(size = 0.7)
27
28 # Render the object.
29 s.render(PYVISI_EXAMPLE_IMAGES_PATH + SAVE_IMAGE_NAME)
30

  ViewVC Help
Powered by ViewVC 1.1.26