Add drawLine method and refactor crop outline rendering in machine_1

- Introduce `drawLine` method in `dynamicimages_image_t` for drawing lines with customizable styles (color, thickness, dash patterns).
- Update `drawCropOutLine` in `machine_1` to use a dynamic configuration for rendering top, left, right, and bottom crop outlines.
- Refactor crop outline logic for better readability and maintainability.
This commit is contained in:
Jeppe Bundgaard
2026-01-29 15:48:18 +01:00
parent 9e58370e94
commit 71e2519e8b
2 changed files with 99 additions and 5 deletions
@@ -81,12 +81,75 @@ class machine_1 extends dynamicimages_image
public function drawCropOutLine(): void
{
$x1 = 0;
$y1 = 3750;
$x2 = 6000;
$y2 = 3750;
$line_template = [
'x' => [
'from' => 0,
'to' => 6000
],
'y' => [
'from' => 0,
'to' => 0
],
];
// Define top crop line
$top_line = [
'x' => [
'from' => 0,
'to' => 6000
],
'y' => [
'from' => 260,
'to' => 260
],
];
// Define the left crop line
$left_line = [
'x' => [
'from' => 193,
'to' => 193
],
'y' => [
'from' => 0,
'to' => 4500
],
];
// Define the right crop line
$right_line = [
'x' => [
'from' => 5765,
'to' => 5765
],
'y' => [
'from' => 0,
'to' => 4500
],
];
// Define the bottom crop line
$bottom_line = [
'x' => [
'from' => 0,
'to' => 6000
],
'y' => [
'from' => 4160,
'to' => 4160
],
];
$lines = [
$top_line,
$left_line,
$right_line,
$bottom_line
];
$this->drawLine($x1, $y1, $x2, $y2, self::IMAGE_CROP_LINE);
// Draw the crop outline
foreach ($lines as $line) {
$x1 = (int)$line['x']['from'];;
$y1 = (int)$line['y']['from'];;
$x2 = (int)$line['x']['to'];;
$y2 = (int)$line['y']['to'];;
$this->drawLine($x1, $y1, $x2, $y2, 'rgba(255,0,0,0.75)', 1);
}
}
public function getHighlightedAssetName(): string