-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80eb698
commit 93cc9f6
Showing
6 changed files
with
113 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 24 additions & 24 deletions
48
src/Cropper.Blazor/Client/Pages/Crop/Examples/CropPolygonImage_ScriptCode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
<div class="mud-codeblock"> | ||
<div class="html"> | ||
<pre> | ||
<div class="html"> | ||
<pre> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">script</span><span class="htmlTagDelimiter">></span> | ||
window.getPolygonImage = (sourceCanvas, path) => { | ||
const canvas = document.createElement('canvas'); | ||
const context = canvas.getContext('2d'); | ||
const width = sourceCanvas.width, | ||
height = sourceCanvas.height; | ||
window.getPolygonImage = (sourceCanvas, path) => { | ||
const canvas = document.createElement('canvas'); | ||
const context = canvas.getContext('2d'); | ||
const width = sourceCanvas.width, | ||
height = sourceCanvas.height; | ||
|
||
canvas.width = width; | ||
canvas.height = height; | ||
context.imageSmoothingEnabled = true; | ||
canvas.width = width; | ||
canvas.height = height; | ||
context.imageSmoothingEnabled = true; | ||
|
||
context.beginPath(); | ||
context.moveTo(path[0] * width / 100, path[1] * height / 100); | ||
context.fillStyle = "rgba(255, 255, 255, 0)"; | ||
context.beginPath(); | ||
context.moveTo(path[0] * width / 100, path[1] * height / 100); | ||
context.fillStyle = "rgba(255, 255, 255, 0)"; | ||
|
||
for (let i = 2; i < path.length; i += 2) { | ||
context.lineTo(path[i] * width / 100, path[i + 1] * height / 100); | ||
} | ||
for (let i = 2; i < path.length; i += 2) { | ||
context.lineTo(path[i] * width / 100, path[i + 1] * height / 100); | ||
} | ||
|
||
context.closePath(); | ||
context.clip(); | ||
context.fill(); | ||
context.globalCompositeOperation = 'lighter'; | ||
context.drawImage(sourceCanvas, 0, 0, width, height); | ||
context.closePath(); | ||
context.clip(); | ||
context.fill(); | ||
context.globalCompositeOperation = 'lighter'; | ||
context.drawImage(sourceCanvas, 0, 0, width, height); | ||
|
||
return canvas.toDataURL("image/png", 1); | ||
} | ||
return canvas.toDataURL("image/png", 1); | ||
} | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">script</span> <span class="htmlTagDelimiter">></span> | ||
</pre> | ||
</div> | ||
</div> | ||
</div> |
36 changes: 18 additions & 18 deletions
36
src/Cropper.Blazor/Client/Pages/Crop/Examples/CropRoundImage_ScriptCode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<div class="mud-codeblock"> | ||
<div class="html"> | ||
<pre> | ||
<div class="html"> | ||
<pre> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">script</span><span class="htmlTagDelimiter">></span> | ||
window.getEllipseImage = (sourceCanvas) => { | ||
const createdCanvas = document.createElement('canvas'); | ||
const contextCanvas = createdCanvas.getContext('2d'); | ||
const widthCanvas = sourceCanvas.width, | ||
heightCanvas = sourceCanvas.height; | ||
window.getEllipseImage = (sourceCanvas) => { | ||
const createdCanvas = document.createElement('canvas'); | ||
const contextCanvas = createdCanvas.getContext('2d'); | ||
const widthCanvas = sourceCanvas.width, | ||
heightCanvas = sourceCanvas.height; | ||
|
||
createdCanvas.width = widthCanvas; | ||
createdCanvas.height = heightCanvas; | ||
contextCanvas.imageSmoothingEnabled = true; | ||
createdCanvas.width = widthCanvas; | ||
createdCanvas.height = heightCanvas; | ||
contextCanvas.imageSmoothingEnabled = true; | ||
|
||
contextCanvas.drawImage(sourceCanvas, 0, 0, widthCanvas, heightCanvas); | ||
contextCanvas.globalCompositeOperation = 'destination-in'; | ||
contextCanvas.beginPath(); | ||
contextCanvas.ellipse(widthCanvas / 2, heightCanvas / 2, widthCanvas / 2, heightCanvas / 2, 0 * Math.PI, 0, 180 * Math.PI, true); | ||
contextCanvas.fill(); | ||
contextCanvas.drawImage(sourceCanvas, 0, 0, widthCanvas, heightCanvas); | ||
contextCanvas.globalCompositeOperation = 'destination-in'; | ||
contextCanvas.beginPath(); | ||
contextCanvas.ellipse(widthCanvas / 2, heightCanvas / 2, widthCanvas / 2, heightCanvas / 2, 0 * Math.PI, 0, 180 * Math.PI, true); | ||
contextCanvas.fill(); | ||
|
||
return createdCanvas.toDataURL("image/png", 1); | ||
} | ||
return createdCanvas.toDataURL("image/png", 1); | ||
} | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">script</span> <span class="htmlTagDelimiter">></span> | ||
</pre> | ||
</div> | ||
</div> | ||
</div> |
4 changes: 2 additions & 2 deletions
4
src/Cropper.Blazor/Client/Pages/ManualMarkdown/InstallScriptManualCode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<div class="mud-codeblock"> | ||
<div class="html"> | ||
<div class="html"> | ||
<pre> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">script</span> <span class="htmlAttributeName">src</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue">_content/Cropper.Blazor/cropper.min.js</span><span class="quot">"</span><span class="htmlTagDelimiter">></span><span class="htmlTagDelimiter"><</span><span class="htmlElementName">/script</span><span class="htmlTagDelimiter">></span> | ||
</pre> | ||
</div> | ||
</div> | ||
</div> |
6 changes: 3 additions & 3 deletions
6
src/Cropper.Blazor/Client/Pages/ManualMarkdown/InstallServicesManualCode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<div class="mud-codeblock"> | ||
<div class="csharp"> | ||
<pre> | ||
<div class="csharp"> | ||
<pre> | ||
<span class="keyword">using</span> Cropper.Blazor.Extensions; | ||
|
||
<span class="localVar">builder</span>.Services.<span class="function">AddCropper</span>(); | ||
|
||
</pre> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters