You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Processing images by _CoreGraphics_ is complicated: various formats, old C APIs and painful memory management. _EasyImagy_ provides easier APIs to process images.
29
+
Image processing by _CoreGraphics_ is complicated: various formats, old C APIs and painful memory management. _EasyImagy_ provides easy and Swifty APIs for image processing.
30
30
31
-
Typically the `Image` type is used with the `RGBA` type. The `RGBA` is a simple structure declared as follows.
31
+
With _EasyImagy_, images are handled as instances of the `Image` type. `Image` is a type similar to `Array`.
Typically `Image` is used with the `RGBA` type. `RGBA` is a simple structure declared as follows.
32
44
33
45
```swift
34
46
structRGBA<Channel> {
@@ -39,15 +51,17 @@ struct RGBA<Channel> {
39
51
}
40
52
```
41
53
42
-
You can easily access to pixels using subscripts like `image[x, y]` and also their channels using properties `red`, `green`, `blue` and `alpha`.
54
+
Because both `Image` and `RGBA` are generic types, concrete image types have a nested type parameter like `Image<RGBA<UInt8>>` when `Image` and `RGBA` are combined.
43
55
44
-
In addition, `Image` and `RGBA` provide some powerful APIs to process images. For example, it is possible to convert an image to grayscale combining `Image.map` with `RGBA.gray` in one line as shown below.
56
+
`Image` and `RGBA` provide some powerful APIs to process images. For example, it is possible to convert an RGBA image to grayscale combining `Image.map` with `RGBA.gray` in one line as shown below.
45
57
46
58
```swift
59
+
var image = Image<RGBA<UInt8>>(named: "ImageName")!
47
60
let grayscale: Image<UInt8> = image.map { $0.gray }
61
+
48
62
```
49
63
50
-
Another notable feature of _EasyImagy_ is that the `Image` is a `struct`, i.e. a value type, with copy-on-write. It means
64
+
Another notable feature of _EasyImagy_ is that `Image` is a structure, i.e. a value type, with copy-on-write. It means
0 commit comments