# python

import k3d
import testing

doc = k3d.new_document()

axes = k3d.plugin.create("Axes", doc)
axes.xyplane = False

material = k3d.plugin.create("RenderManMaterial", doc)

torus = k3d.plugin.create("Torus", doc)
torus.material = material

camera = testing.create_camera(doc)
render_engine = testing.create_opengl_engine(doc)

camera_to_bitmap = k3d.plugin.create("WGLCameraToBitmap", doc)
camera_to_bitmap.camera = camera
camera_to_bitmap.render_engine = render_engine

testing.require_similar_bitmap(
    doc, camera_to_bitmap.get_property("output_bitmap"), "offscreen.WGLCameraToBitmap", 0.009
)
#python

import testing
setup = testing.setup_bitmap_reader_test("BitmapReader", "test_rgb_8.bmp")
testing.require_similar_bitmap(setup.document, setup.source.get_property("output_bitmap"), "BitmapReader.bmp", 0)

#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapColorMonochrome")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/bitmaps/" + "test_rgb_8.png")

testing.require_similar_bitmap(setup.document, setup.modifier.get_property("output_bitmap"), "BitmapColorMonochrome", 0)
#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapMatteColorDiff")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/bitmaps/" + "test_rgb_8_alpha.png")
setup.modifier.threshold = 0.95

testing.require_similar_bitmap(setup.document, setup.modifier.get_property("output_bitmap"), "BitmapMatteColorDiff", 0)
#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapSubtract")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/bitmaps/" + "test_rgb_8.png")
setup.modifier.value = 0.5

testing.require_similar_bitmap(setup.document, setup.modifier.get_property("output_bitmap"), "BitmapSubtract", 0.001)
#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapThreshold")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/bitmaps/" + "test_rgb_8_alpha.png")
setup.modifier.red_threshold = 0.5 
setup.modifier.blue_threshold = 0.5 
setup.modifier.alpha_threshold = 0.5 

testing.require_similar_bitmap(setup.document, setup.modifier.get_property("output_bitmap"), "BitmapThreshold", 0)
#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader",
                                           "BitmapColorMonochrome")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() +
                                                "/bitmaps/" + "test_rgb_8.png")

testing.require_similar_bitmap(setup.document,
                               setup.modifier.get_property("output_bitmap"),
                               "BitmapColorMonochrome", 0)
Example #8
0
#python

import k3d
import testing

doc = k3d.new_document()

axes = k3d.plugin.create("Axes", doc)
axes.xyplane = False

material = k3d.plugin.create("RenderManMaterial", doc)

torus = k3d.plugin.create("Torus", doc)
torus.material = material

mesh_instance = k3d.plugin.create("MeshInstance", doc)
mesh_instance.gl_painter = k3d.plugin.create("OpenGLTorusPainter", doc)
k3d.property.connect(doc, torus.get_property("output_mesh"),
                     mesh_instance.get_property("input_mesh"))

camera = testing.create_camera(doc)
render_engine = testing.create_opengl_engine(doc)

camera_to_bitmap = k3d.plugin.create("VirtualCameraToBitmap", doc)
camera_to_bitmap.camera = camera
camera_to_bitmap.render_engine = render_engine

testing.require_similar_bitmap(doc,
                               camera_to_bitmap.get_property("output_bitmap"),
                               "offscreen.VirtualCameraToBitmap", 0.009)
#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader",
                                           "BitmapMatteColorDiff")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() +
                                                "/bitmaps/" +
                                                "test_rgb_8_alpha.png")
setup.modifier.threshold = 0.95

testing.require_similar_bitmap(setup.document,
                               setup.modifier.get_property("output_bitmap"),
                               "BitmapMatteColorDiff", 0)
#python

import testing
setup = testing.setup_bitmap_reader_test("BitmapReader", "test_rgb_8.tif")
testing.require_similar_bitmap(setup.document, setup.source.get_property("output_bitmap"), "BitmapReader.tiff", 0)

Example #11
0
#python

import k3d
import testing

setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapMultiply")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() +
                                                "/bitmaps/" + "test_rgb_8.png")
setup.modifier.value = 0.7

testing.require_similar_bitmap(setup.document,
                               setup.modifier.get_property("output_bitmap"),
                               "BitmapMultiply", 0)
#python

import testing
setup = testing.setup_bitmap_reader_test("JPEGBitmapReader", "test_rgb_8.jpg")
testing.require_similar_bitmap(setup.document, setup.source.get_property("output_bitmap"), "JPEGBitmapReader", 0.09)

Example #13
0
#python

import k3d
import testing

setup = testing.setup_bitmap_source_test("BitmapSourceScript")
testing.require_similar_bitmap(setup.document,
                               setup.source.get_property("output_bitmap"),
                               "BitmapSourceScript", 0)
Example #14
0
#python

import k3d
import testing

doc = k3d.new_document()

axes = k3d.plugin.create("Axes", doc)
axes.xyplane = False

material = k3d.plugin.create("RenderManMaterial", doc)

torus = k3d.plugin.create("Torus", doc)
torus.material = material

camera = testing.create_camera(doc)
render_engine = testing.create_opengl_engine(doc)

camera_to_bitmap = k3d.plugin.create("OpenGLFramebufferCameraToBitmap", doc)
camera_to_bitmap.camera = camera
camera_to_bitmap.render_engine = render_engine

testing.require_similar_bitmap(doc,
                               camera_to_bitmap.get_property("output_bitmap"),
                               "offscreen.OpenGLFramebufferCameraToBitmap",
                               0.009)
#python

import k3d
import testing

setup = testing.setup_bitmap_source_test("BitmapSourceScript")
testing.require_similar_bitmap(setup.document, setup.source.get_property("output_bitmap"), "BitmapSourceScript", 0)