Exemple #1
0
    def test_not_implemented(self):
        """ fix me: Currently not implemented, so we just ensure that
            any call to it throws an exception.
        """

        gc = GraphicsContextArray((1, 1), pix_format="rgb24")
        gc.rotate_ctm(1.0)
    def test_not_implemented(self):
        """ fix me: Currently not implemented, so we just ensure that
            any call to it throws an exception.
        """

        gc = GraphicsContextArray((1,1), pix_format="rgb24")
        gc.rotate_ctm(1.0)
Exemple #3
0
    def test_clip_to_rect_rotated(self):
        # FIXME: test skipped
        #   This test raises an exception currently because the
        #   underlying library doesn't handle clipping to a rotated
        #   rectangle.  For now, we catch the the case with an
        #   exception, so that people can't screw up.  In the future,
        #   we should actually support this functionality.

        gc = GraphicsContextArray((1, 1), pix_format="rgb24")
        gc.rotate_ctm(1.0)

        self.assertRaises(NotImplementedError, gc.clip_to_rect, 0, 0, 1, 1)
    def test_clip_to_rect_rotated(self):
        # FIXME: test skipped
        #   This test raises an exception currently because the
        #   underlying library doesn't handle clipping to a rotated
        #   rectangle.  For now, we catch the the case with an
        #   exception, so that people can't screw up.  In the future,
        #   we should actually support this functionality.
        raise nose.SkipTest

        gc = GraphicsContextArray((1,1), pix_format="rgb24")
        gc.rotate_ctm(1.0)

        self.assertRaises(NotImplementedError,
                              gc.clip_to_rect, 0, 0, 1, 1)
Exemple #5
0
gc = GraphicsContextArray((200,200))

font = Font(family=MODERN)
#print font.size
font.size=8
gc.set_font(font)


t1 = time.clock()

# consecutive printing of text.
with gc:
    gc.set_antialias(False)
    gc.set_fill_color((0,1,0))
    gc.translate_ctm(50,50)
    gc.rotate_ctm(3.1416/4)
    gc.show_text("hello")
    gc.translate_ctm(-50,-50)
    gc.set_text_matrix(AffineMatrix())
    gc.set_fill_color((0,1,1))
    gc.show_text("hello")

t2 = time.clock()
print('aliased:', t2 - t1)
gc.save("text_aliased.bmp")

gc = GraphicsContextArray((200,200))

font = Font(family=MODERN)
#print font.size
font.size=8