def draw_on_image(self, img): """ Draw the plate highlight to the image. """ image = Image(img) # If the overlay has not expired, draw on the plate highlight and/or the status message if not self.has_expired(): self._plate.draw_plate(image, Color.Blue()) self._plate.draw_pins(image, self._options)
def get_marked_image(self, options): image = self.get_image() geo = self.geometry if options.image_puck.value(): geo.draw_plate(image, Color.Blue()) if options.image_pins.value(): self._draw_pins(image, geo, options) if options.image_crop.value(): geo.crop_image(image) return image
def CIRCLES_DEMO(): """ Draw a set of axes and a random set of circles. Perform a series of random transformations on the circles. """ # Create a set of random circles points = [] for i in range(10): X = (random.random()) * 200 Y = (random.random()) * 200 points.append(Point(X, Y)) for i in range(10): # Create random transformation angle = random.random() * 2 * math.pi scale = random.random() * 3 delX = (random.random() - 0.5) * 200 delY = (random.random() - 0.5) * 200 translate = Point(delX, delY) trs = Transform(translate, angle, scale) # Display on image image = Image.blank(1000, 800) image.draw_offset = IMG_CENTER draw_axes(image, 300) # Draw the circles and transformed circles on the image radius = 10 for p in points: circle = Circle(p, radius) trans_circle = Circle(trs.transform(p), radius * trs.zoom) image.draw_circle(circle, Color.Red()) image.draw_circle(trans_circle, Color.Blue()) # Write the transformation on the image image.draw_text(trs.__str__(), Point(-450, 350), Color.White(), centered=False, scale=0.5, thickness=1) # Show the image image.popup()
def test_Blue_is_0000ff(self): self.assertEqual(Color.Blue().to_hex(), "#0000ff")