MCPcopy Create free account
hub / github.com/scanny/python-pptx / _LineSegment

Class _LineSegment

src/pptx/shapes/freeform.py:299–318  ·  view source on GitHub ↗

Specifies a straight line segment ending at the specified point.

Source from the content-addressed store, hash-verified

297
298
299class _LineSegment(_BaseDrawingOperation):
300 """Specifies a straight line segment ending at the specified point."""
301
302 @classmethod
303 def new(cls, freeform_builder: FreeformBuilder, x: float, y: float) -> _LineSegment:
304 """Return a new _LineSegment object ending at point *(x, y)*.
305
306 Both `x` and `y` are rounded to the nearest integer before use.
307 """
308 return cls(freeform_builder, Emu(int(round(x))), Emu(int(round(y))))
309
310 def apply_operation_to(self, path: CT_Path2D) -> CT_Path2DLineTo:
311 """Add `a:lnTo` element to `path` for this line segment.
312
313 Returns the `a:lnTo` element newly added to the path.
314 """
315 return path.add_lnTo(
316 Emu(self._x - self._freeform_builder.shape_offset_x),
317 Emu(self._y - self._freeform_builder.shape_offset_y),
318 )
319
320
321class _MoveTo(_BaseDrawingOperation):

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…