-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from akai-org/ts
initial ts setup
Showing
3 changed files
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f4f4f4; | ||
margin: 0; | ||
padding: 20px; | ||
text-align: center; | ||
} | ||
|
||
.container { | ||
max-width: 800px; | ||
margin: 0 auto; | ||
background-color: white; | ||
padding: 20px; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
h1 { | ||
color: #333; | ||
} | ||
|
||
input[type="file"] { | ||
margin-bottom: 20px; | ||
} | ||
|
||
button { | ||
background-color: #007bff; | ||
color: white; | ||
padding: 10px 20px; | ||
border: none; | ||
cursor: pointer; | ||
border-radius: 5px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
.image-container { | ||
margin-top: 20px; | ||
} | ||
|
||
img, canvas { | ||
max-width: 100%; | ||
height: auto; | ||
border: 1px solid #ddd; | ||
border-radius: 8px; | ||
margin-top: 10px; | ||
} | ||
|
||
h3 { | ||
color: #555; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Image Upload and Grayscale</title> | ||
<link rel="stylesheet" href="index.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Image Uploader and Grayscale Converter</h1> | ||
|
||
<input type="file" id="imageUpload" accept="image/*"> | ||
<button id="convertGrayscale">Convert to Grayscale</button> | ||
|
||
<div class="image-container"> | ||
<h3>Original Image:</h3> | ||
<img id="uploadedImage" alt="Uploaded Image" /> | ||
</div> | ||
|
||
<div class="image-container"> | ||
<h3>Grayscale Image:</h3> | ||
<canvas id="grayscaleImage"></canvas> | ||
</div> | ||
</div> | ||
|
||
<script src="index.js"></script> | ||
</body> | ||
</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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//Zadanie należy wykonać w typescript i skompilować później na javascript | ||
|
||
// Zadanie 1: Wybierz niezbędne elementy DOM | ||
// Przykład: Musisz uzyskać odniesienia do elementów takich jak input pliku, przycisk, img i canvas. | ||
// Wskazówka: Użyj document.getElementById lub podobnych metod, aby uzyskać elementy po ich ID. | ||
|
||
// Zadanie 2: Dodaj nasłuchiwacz zdarzeń dla przesyłania obrazu | ||
// Kiedy użytkownik wybierze obraz, wyświetl go w elemencie <img>. | ||
// Wskazówka: Możesz użyć API FileReader, aby odczytać plik jako URL danych. | ||
|
||
// Zadanie 3: Dodaj nasłuchiwacz zdarzeń do przycisku „Konwertuj na odcienie szarości” | ||
// Po kliknięciu, skonwertuj wyświetlany obraz na odcienie szarości i pokaż go w elemencie <canvas>. | ||
// Wskazówka: Musisz użyć elementu canvas i jego kontekstu (2D) oraz zmodyfikować dane pikseli. | ||
|
||
// Zadanie 4: Narysuj przesłany obraz na canvasie | ||
// Wskazówka: Użyj drawImage() w kontekście canvasa, aby narysować obraz. Upewnij się, że rozmiar canvasa odpowiada rozmiarowi obrazu. | ||
|
||
// Zadanie 5: Skonwertuj obraz na odcienie szarości poprzez manipulowanie danymi pikseli | ||
// Wskazówka: Użyj getImageData() do pobrania danych pikseli, zastosuj formułę dla odcieni szarości, a następnie użyj putImageData(), aby zaktualizować canvas. | ||
|
||
// Zadanie opcjonalne: Zastanów się, co się stanie, jeśli nie zostanie przesłany żaden obraz, a przycisk odcieni szarości zostanie kliknięty. | ||
// Wskazówka: Możesz sprawdzić, czy obraz został przesłany, zanim zastosujesz filtr odcieni szarości. |