Skip to content

Commit 1dcab18

Browse files
committed
rename ::fromScratch to ::newCanvas and ->create to ->resetCanvas
1 parent 6c7f11d commit 1dcab18

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use \DantSu\PHPImageEditor\Image;
2525

2626
\header('Content-type: image/png');
2727

28-
$image = Image::fromScratch(500, 500)
28+
$image = Image::newCanvas(500, 500)
2929
->drawRectangle(0, 0, 500, 500, '#444')
3030
->drawRectangle(0, 350, 500, 500, '#FF8800')
3131
->writeText('I got the power !', __DIR__ . '/resources/font.ttf', 40, '#FFFFFF', Image::ALIGN_CENTER, 310)

docs/classes/DantSu/PHPImageEditor/Image.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ DantSu\PHPImageEditor\Image is PHP library to easily edit image with GD extensio
3131
- [getType](#-gettype)
3232
- [getImage](#-getimage)
3333
- [isImageDefined](#-isimagedefined)
34-
- *(static)* [fromScratch](#fromscratch)
35-
- [create](#-create)
34+
- *(static)* [newCanvas](#newcanvas)
35+
- [resetCanvas](#-resetcanvas)
3636
- *(static)* [fromPath](#frompath)
3737
- [path](#-path)
3838
- *(static)* [fromForm](#fromform)
@@ -173,7 +173,7 @@ Return true if image is initialized
173173

174174

175175
---
176-
### ::fromScratch
176+
### ::newCanvas
177177

178178
(Static method) Create a new image with transparent background
179179

@@ -199,7 +199,7 @@ Return true if image is initialized
199199

200200

201201
---
202-
### ->create
202+
### ->resetCanvas
203203

204204
Create a new image with transparent background
205205

src/Image.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public function isImageDefined(): bool
9999
* @param int $height Pixel height of the image
100100
* @return Image Return Image instance
101101
*/
102-
public static function fromScratch(int $width, int $height): Image
102+
public static function newCanvas(int $width, int $height): Image
103103
{
104-
return (new Image)->create($width, $height);
104+
return (new Image)->resetCanvas($width, $height);
105105
}
106106

107107
/**
@@ -111,7 +111,7 @@ public static function fromScratch(int $width, int $height): Image
111111
* @param int $height Pixel height of the image
112112
* @return $this Fluent interface
113113
*/
114-
public function create(int $width, int $height): Image
114+
public function resetCanvas(int $width, int $height): Image
115115
{
116116
if (($this->image = \imagecreatetruecolor($width, $height)) === false) {
117117
$this->resetFields();

src/samples/sample1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
\header('Content-type: image/png');
99

10-
$image = Image::fromScratch(500, 500)
10+
$image = Image::newCanvas(500, 500)
1111
->drawRectangle(0, 0, 500, 500, '#444')
1212
->drawRectangle(0, 350, 500, 500, '#FF8800')
1313
->writeText('I got the power !', __DIR__ . '/resources/font.ttf', 40, '#FFFFFF', Image::ALIGN_CENTER, 310)

0 commit comments

Comments
 (0)