-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better image loading and saving support for non Windows OS.
More examples. Remove images used to test.
- Loading branch information
Showing
16 changed files
with
68 additions
and
32 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,11 +1,27 @@ | ||
using TavernAICardLib; | ||
using System.Drawing; | ||
using TavernAICardLib; | ||
|
||
TavernAiCard? card = TavernAiCard.Load("main_Walter White_tavern.png"); | ||
// Load the character, this can be .json, .png, .webp, .jpeg or .jpg. If the file format is not supported an exception will be thrown. | ||
TavernAiCard card = TavernAiCard.Load("character.json"); | ||
|
||
if (card != null) | ||
// Example: Load the character from a png card. | ||
// TavernAiCard? card = TavernAiCard.Load("character.png"); | ||
|
||
// Example: Print the name of the loaded character. | ||
Console.WriteLine(card.Name); | ||
|
||
// Example: Set a new name | ||
card.Name = "New name"; | ||
|
||
// Example: Saving, you can save in .json, .png, .webp, .jpeg or .jpg. The saving format used depends on the file extension. | ||
card.Save("character_saved.json"); | ||
|
||
// Example: Creating a new image for the character, supported on Windows only. | ||
// Check if full image support is available to create a custom bitmap (only on Windows, on other OS's only image paths are supported.) | ||
if (TavernAiCard.ImageFullySupported()) | ||
{ | ||
Console.WriteLine(card.Name); | ||
card.Name = "Waltuh White"; | ||
card.Save("Waltuh White.json"); | ||
card.Save("Waltuh White.png"); | ||
// Create a transparent bitmap | ||
card.Image = new Bitmap(400, 600); | ||
// Save the card as an character card | ||
card.Save("character_saved.png"); | ||
} |
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
TavernAICardLibTest/bin/Debug/net6.0/TavernAICardLibTest.dll
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
TavernAICardLibTest/bin/Debug/net6.0/TavernAICardLibTest.pdb
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
TavernAICardLibTest/obj/Debug/net6.0/TavernAICardLibTest.csproj.AssemblyReference.cache
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
TavernAICardLibTest/obj/Debug/net6.0/TavernAICardLibTest.dll
Binary file not shown.
Binary file modified
BIN
+28 Bytes
(100%)
TavernAICardLibTest/obj/Debug/net6.0/TavernAICardLibTest.pdb
Binary file not shown.