def testStruct(self):
     v = Quartz.CGAffineTransform()
     self.assertTrue(hasattr(v, "a"))
     self.assertTrue(hasattr(v, "b"))
     self.assertTrue(hasattr(v, "c"))
     self.assertTrue(hasattr(v, "d"))
     self.assertTrue(hasattr(v, "tx"))
     self.assertTrue(hasattr(v, "ty"))
示例#2
0
def showFlippedTextAtPoint(c, x, y, text, textLen):
    t = Quartz.CGAffineTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0)
    # Get the existing text matrix.
    s = Quartz.CGContextGetTextMatrix(c)
    # Set the text matrix to the one that flips in y.
    Quartz.CGContextSetTextMatrix(c, t)
    # Draw the text at the point.
    Quartz.CGContextShowTextAtPoint(c, x, y, text, textLen)
    # Get the updated text position.
    p = Quartz.CGContextGetTextPosition(c)
    # Update the saved text matrix to reflect the updated
    # text position.
    s.tx = p.x ; s.ty = p.y
    # Reset to the text matrix in effect when this
    # routine was called but with the text position updated.
    Quartz.CGContextSetTextMatrix(c, s)