Esempio n. 1
0
    def test_get_rgba2(self):
        img1 = ImageRGBA(200, 200)
        img1.set_pixel(25, 25, 45, 85, 95, 125)
        v1 = Vector4(0, 0, 0, 0)
        
        code = """
v1 = get_rgba(img, 25, 25)
        """
        props = {'img': img1, 'v1': v1}
        bs = BasicShader(code, props)
        runtime = Runtime()
        bs.prepare([runtime])
        #print (bs.shader._code)

        bs.execute()
        val = bs.shader.get_value('v1')

        self.assertAlmostEqual(val.x, 45 * 0.0039, places=5)
        self.assertAlmostEqual(val.y, 85 * 0.0039, places=5)
        self.assertAlmostEqual(val.z, 95 * 0.0039, places=5)
        self.assertAlmostEqual(val.w, 125 * 0.0039, places=5)
Esempio n. 2
0
    def test_get_rgba2(self):
        img1 = ImageRGBA(200, 200)
        img1.set_pixel(25, 25, 45, 85, 95, 125)
        v1 = Vector4(0, 0, 0, 0)

        code = """
v1 = get_rgba(img, 25, 25)
        """
        props = {'img': img1, 'v1': v1}
        bs = BasicShader(code, props)
        runtime = Runtime()
        bs.prepare([runtime])
        #print (bs.shader._code)

        bs.execute()
        val = bs.shader.get_value('v1')

        self.assertAlmostEqual(val.x, 45 * 0.0039, places=5)
        self.assertAlmostEqual(val.y, 85 * 0.0039, places=5)
        self.assertAlmostEqual(val.z, 95 * 0.0039, places=5)
        self.assertAlmostEqual(val.w, 125 * 0.0039, places=5)
Esempio n. 3
0
import time
from renmas3.base import ImagePRGBA, ImageRGBA
from renmas3.utils import blt_prgba_to_rgba, blt_rgba_to_prgba

from renmas3.base import load_image
from renmas3.win32 import show_image_in_window
from renmas3.renderer import generate_samples

#img = load_image('Koala.jpg')
img = load_image('G:/light_probes/grace_probe.hdr')
print(img)

width, height = img.size()

start = time.clock()
samples = generate_samples(img, 10)
elapsed = time.clock() - start
print("Generation of samples took ", elapsed)
for sample in samples:
    pass
    #print (sample.vec)
    #print (sample.pdf)

#img2 = ImagePRGBA(width, height)
#blt_rgba_to_prgba(img, img2)

img3 = ImageRGBA(width, height)
blt_prgba_to_rgba(img, img3)

#show_image_in_window(img3)
Esempio n. 4
0
from renmas3.base import GraphicsPRGBA, RGBSpectrum, ImagePRGBA, ImageRGBA
from renmas3.utils import blt_prgba_to_rgba
from renmas3.win32 import show_image_in_window

img = ImagePRGBA(400, 400)
gr = GraphicsPRGBA()
gr.draw_rect(img, 20, 20, 80, 50, RGBSpectrum(0.6, 0.0, 0.0))

width, height = img.size()
img2 = ImageRGBA(width, height)
blt_prgba_to_rgba(img, img2)

show_image_in_window(img2)

Esempio n. 5
0
from renmas3.base import ImageRGBA, GraphicsRGBA, RGBSpectrum
from renmas3.win32 import show_image_in_window

img = ImageRGBA(400, 400)
gr = GraphicsRGBA()
gr.draw_rect(img, 20, 20, 50, 50, RGBSpectrum(0.6, 0.1, 0.1))
show_image_in_window(img)


Esempio n. 6
0
from renmas3.base import GraphicsRGBA, RGBSpectrum, ImagePRGBA, ImageRGBA
from renmas3.utils import blt_prgba_to_rgba, blt_rgba_to_prgba
from renmas3.win32 import show_image_in_window

img = ImageRGBA(400, 400)
gr = GraphicsRGBA()
gr.draw_rect(img, 20, 20, 80, 50, RGBSpectrum(0.6, 0.2, 0.4))

width, height = img.size()
img2 = ImagePRGBA(width, height)
blt_rgba_to_prgba(img, img2)

img3 = ImageRGBA(width, height)
blt_prgba_to_rgba(img2, img3)

print (img.get_pixel(25,25))
print (img2.get_pixel(25,25))
print (img3.get_pixel(25,25))
show_image_in_window(img3)