Skip to content

Commit b9d4d79

Browse files
committed
docs: add migration guide to 0.11.0
1 parent 8a9bbc1 commit b9d4d79

File tree

1 file changed

+65
-14
lines changed

1 file changed

+65
-14
lines changed

README.md

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,71 @@ using var stream = File.OpenWrite("qrcode.png");
9595
QRCodeImageBuilder.SavePng("Your content here", stream, ECCLevel.M, size: 512);
9696
```
9797

98-
## Migration from 0.8.0 to 0.9.0 and higher
98+
## Migration
9999

100-
v0.9.0 introduces significant performance improvements and API changes. Here's what you need to know to upgrade:
100+
- v0.11.0 introduces further improvements to Icon handling. See the IconData section below.
101+
- v0.9.0 introduces significant performance improvements and API changes. Here's what you need to know to upgrade:
101102

102-
### 🔄 Primary API Change: `QrCode``QRCodeImageBuilder`
103+
### from 0.10.0 to 0.11.0 and higher
104+
105+
Take advantage of new capabilities:
106+
107+
- **Logo customization** - Now you can customize center placed logos. Library offers icons with both images and text.
108+
109+
For complete migration details and examples, see [Release 0.11.0](https://github.com/guitarrapc/SkiaSharp.QrCode/releases/tag/0.11.0).
110+
111+
#### ⚠️ IconData.Data changed Icon from SKBitmap to IconShape
112+
113+
**Before (0.10.0):**
114+
115+
```csharp
116+
using var bitmap = SKBitmap.Decode(File.ReadAllBytes(iconPath));
117+
118+
// Old code
119+
var icon = new IconData
120+
{
121+
Icon = bitmap;
122+
IconSizePercent = 15,
123+
IconBorderWidth = 10
124+
};
125+
```
126+
127+
**After (0.11.0):**
128+
129+
```csharp
130+
using var bitmap = SKBitmap.Decode(File.ReadAllBytes(iconPath));
131+
132+
// New code Image only (Short hand)
133+
var icon = IconData.FromImage(bitmap, iconSizePercent: 15, iconBorderWidth: 18);
134+
135+
// New code Image only
136+
var icon = new IconData
137+
{
138+
Icon = new ImageIconShape(bitmap),
139+
IconSizePercent = 15,
140+
IconBorderWidth = 10
141+
};
142+
143+
// New approach with text
144+
var icon = new IconData
145+
{
146+
Icon = new ImageTextIconShape(bitmap, "Text", SKColors.Black, font),
147+
IconSizePercent = 15,
148+
IconBorderWidth = 10
149+
};
150+
```
151+
152+
### from 0.8.0 to 0.9.0 and higher
153+
154+
Take advantage of new capabilities:
155+
156+
- **Gradient colors** - Create eye-catching QR codes with color gradients
157+
- **Enhanced customization** - More control over module shapes and colors
158+
- **Better performance** - Dramatically faster generation with lower memory usage
159+
160+
For complete migration details and examples, see [Release 0.9.0](https://github.com/guitarrapc/SkiaSharp.QrCode/releases/tag/0.9.0).
161+
162+
#### 🔄 Primary API Change: `QrCode``QRCodeImageBuilder`
103163

104164
The `QrCode` class is now **obsolete**. Replace it with `QRCodeImageBuilder`:
105165

@@ -127,7 +187,7 @@ new QRCodeImageBuilder(content)
127187
.SaveTo(stream);
128188
```
129189

130-
### 🗑️ Remove `using` Statements
190+
#### 🗑️ Remove `using` Statements
131191

132192
`QRCodeData` and `QRCodeRenderer` are no longer `IDisposable`:
133193

@@ -153,7 +213,7 @@ If using icons in QR codes:
153213
using SkiaSharp.QrCode.Image;
154214
```
155215

156-
### 🚫 Removed Features
216+
#### 🚫 Removed Features
157217

158218
The following features have been removed:
159219

@@ -189,15 +249,6 @@ var pngBytes = QRCodeImageBuilder.GetPngBytes(qr, 512);
189249
File.WriteAllBytes(path, pngBytes);
190250
```
191251

192-
### ✨ New Features to Explore
193-
194-
Take advantage of new capabilities:
195-
- **Gradient colors** - Create eye-catching QR codes with color gradients
196-
- **Enhanced customization** - More control over module shapes and colors
197-
- **Better performance** - Dramatically faster generation with lower memory usage
198-
199-
For complete migration details and examples, see [Release 0.9.0](https://github.com/guitarrapc/SkiaSharp.QrCode/releases/tag/0.9.0).
200-
201252
## API Overview
202253

203254
SkiaSharp.QrCode provides three main APIs for different use cases.

0 commit comments

Comments
 (0)