vcBitmap
vcBitmap represents an image file used in the application, for example as material textures.
Properties
Name | Type | Access | Description |
Format | Enumeration | R | Gets the format of bitmap.
See Bitmap Constants for more information. |
Height | Integer | R | Gets the height (in pixels) of bitmap. |
Name | String | RW | Defines the name of bitmap. |
URI | String | R | Gets the filename of source file. |
Width | Integer | R | Gets the width (in pixels) of bitmap. |
Examples
Example. Create and edit bitmap property
from vcScript import * app = getApplication() comp = getComponent() prop = comp.getProperty("BmpProp") if not prop: prop = comp.createProperty(VC_BITMAP_PROPERTY, "BmpProp") bmPath = "" def OnReset(): pass def OnRun(): global prop, bmPath if bmPath != r"C:\Temp\picture1.jpg": bmPath = r"C:\Temp\picture1.jpg" else: bmPath = r"C:\Temp\picture2.jpg" print "path:", bmPath prop.Value = app.loadBitmap(bmPath); |
Example. Load and save bitmap to different image types
from vcScript import * #options for using vcApplication.saveBitmap() app = getApplication() uri = "file:///C:\\temp\\" bmp = app.loadBitmap(uri+"test.png") app.saveBitmap(bmp, uri + "test1.bmp") app.saveBitmap(bmp, uri + "test2.png", "rpng") app.saveBitmap(bmp, uri + "test3.bmp", "rbmp") app.saveBitmap(bmp, uri + "test4.jpeg", "rjpegstd") app.saveBitmap(bmp, uri + "test5.jpeg", "rjpegnstd") app.saveBitmap(bmp, uri + "test6.tga", "rtargareader") |
Example. Save view of 3D world to different image types
from vcScript import * #options for using saveBitmap command _app = getApplication() width = 500 cmd = _app.findCommand("saveBitmap") cmd.execute("file:///C:\\temp\\test1.png", "png",width, width) cmd.execute("file:///C:\\temp\\test2.bmp", "bmp",width, width) cmd.execute("file:///C:\\temp\\test3.png", "rpng",width, width) cmd.execute("file:///C:\\temp\\test4.bmp", "rbmp",width, width) cmd.execute("file:///C:\\temp\\test5.tga", "tga",width, width) cmd.execute("file:///C:\\temp\\test6.tga", "rtargareader",width, width) cmd.execute("file:///C:\\temp\\test7.jpeg", "jpeg",width, width) cmd.execute("file:///C:\\temp\\test8.jpeg", "rjpegstd",width, width) cmd.execute("file:///C:\\temp\\test9.jpeg", "rjpegnstd",width, width) |