Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

setRadius() for AutoShape #854

Open
nils-krause opened this issue Feb 16, 2025 · 2 comments
Open

setRadius() for AutoShape #854

nils-krause opened this issue Feb 16, 2025 · 2 comments

Comments

@nils-krause
Copy link

Currently, the AutoShape class in PHPPresentation does not provide a direct method to set the corner radius for shapes that support rounded corners. This feature is especially useful when creating rounded rectangles or other shapes with rounded corners, as it would allow users to define the corner radius dynamically.

@Progi1984
Copy link
Member

@nils-krause Hi,

Have you got a sample file and a screenshot of the feature ?

Thanks

@nils-krause
Copy link
Author

Here is an example of an AutoShape, generated with this code:

$autoShape = new AutoShape();
$autoShape->setType(AutoShape::TYPE_ROUNDED_RECTANGLE)
->setWidthAndHeight(100)
->setOffsetX(100)
->setOffsetY(100);
$autoShape->getFill()
->setFillType(Fill::FILL_SOLID)
->setStartColor(new Color($colorHex));
$slide->addShape($autoShape);

Image

Currently, the radius of the rectangle is determined automatically, adding a function to set a value would be very helpful:

$autoShape->setType(AutoShape::TYPE_ROUNDED_RECTANGLE)
->setWidthAndHeight(100)
->setOffsetX(100)
->setOffsetY(100);
->setRadius(XY);

Image

In PowerPoint's XML the radius of a rounded rectangle is controlled by the adj attribute within the <a:prstGeom> tag.

<p:sp>
<p:nvSpPr>
<p:cNvPr id="2" name="Rounded Rectangle"/>
<p:cNvSpPr/>
<p:nvPr/>
</p:nvSpPr>
<p:spPr>
<a:xfrm>
<a:off x="1000000" y="1000000"/>
<a:ext cx="5000000" cy="3000000"/>
</a:xfrm>
<a:prstGeom prst="roundRect">
<a:avLst>
<a:gd name="adj" f="20000"/>
</a:avLst>
</a:prstGeom>
<a:solidFill>
<a:srgbClr val="FF0000"/>
</a:solidFill>
<a:ln>
<a:solidFill>
<a:srgbClr val="000000"/>
</a:solidFill>
</a:ln>
</p:spPr>
</p:sp>

# for free to join this conversation on GitHub. Already have an account? # to comment
Development

No branches or pull requests

2 participants