Skip to content

Commit 0027a20

Browse files
committed
Fix the typo of readme about SVG bitmap form
1 parent 7764951 commit 0027a20

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,26 @@ imageView.frame = rect
106106

107107
Note since UIImageView/NSImageView support this vector rendering, it means this coder plugin can be compatible for [SwiftUI](https://developer.apple.com/xcode/swiftui/). Check [SDWebImageSwiftUI](https://github.com/SDWebImage/SDWebImageSwiftUI/issues/50) for usage.
108108

109-
## Render SVG as bitmap image
109+
### Render SVG as bitmap image
110110

111111
In most cases, vector SVG is preferred. But however, sometimes you may want the bitmap form of SVG, used for image processing. You can use `.svgPrefersBitmap` to provide the bitmap format as well.
112112

113-
By default it use the SVG canvas size. You can also specify a desired size during image loading using `.svgImageSize` context option. And you can specify whether or not to keep aspect ratio during scale using `.pdfImagePreserveAspectRatio` context option.
113+
By default it use the SVG canvas size. You can also specify a desired size during image loading using `.svgImageSize` context option. And you can specify whether or not to keep aspect ratio during scale using `.svgImagePreserveAspectRatio` context option.
114114

115115
+ Objective-C
116116

117117
```objectivec
118118
UIImageView *imageView;
119119
CGSize SVGImageSize = CGSizeMake(500, 500);
120-
[imageView sd_setImageWithURL:url placeholderImage:nil options:0 context:@{SDWebImageContextSVGImageSize : @(SVGImageSize)];
120+
[imageView sd_setImageWithURL:url placeholderImage:nil options:0 context:@{SDWebImageContextSVGPrefersBitmap: @YES, SDWebImageContextSVGImageSize: @(SVGImageSize)];
121121
```
122122
123123
+ Swift
124124
125125
```swift
126126
let imageView: UIImageView
127127
let SVGImageSize = CGSize(width: 500, height: 500)
128-
imageView.sd_setImage(with: url, placeholderImage: nil, options: [], context: [.SVGImageSize : SVGImageSize])
128+
imageView.sd_setImage(with: url, placeholderImage: nil, options: [], context: [.svgPrefersBitmap : true, .svgImageSize : SVGImageSize])
129129
```
130130

131131
## Export SVG data

0 commit comments

Comments
 (0)