@nativescript-community/ui-image 4.3.26 → 4.3.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,7 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
- #import <Foundation/Foundation.h>
3
- #import <CoreText/CoreText.h>
4
-
5
- #import "NSImageRoundCornerTransformer.h"
6
- #import "NSImageDecodeSizeTransformer.h"
7
- #import "NSImageRoundAsCircleTransformer.h"
@@ -1,11 +0,0 @@
1
- #import <SDWebImage/SDImageTransformer.h>
2
-
3
- @interface NSImageDecodeSizeTransformer: NSObject <SDImageTransformer>
4
-
5
- @property (nonatomic, assign, readonly) CGFloat decodeWidth;
6
- @property (nonatomic, assign, readonly) CGFloat decodeHeight;
7
-
8
- - (nonnull instancetype)init NS_UNAVAILABLE;
9
- + (nonnull instancetype)transformerWithDecodeWidth:(CGFloat)decodeWidth decodeHeight:(CGFloat)decodeHeight;
10
-
11
- @end
@@ -1,44 +0,0 @@
1
- #import "NSImageDecodeSizeTransformer.h"
2
- #import <SDWebImage/SDGraphicsImageRenderer.h>
3
-
4
- @interface NSImageDecodeSizeTransformer ()
5
-
6
- @property (nonatomic, assign) CGFloat decodeWidth;
7
- @property (nonatomic, assign) CGFloat decodeHeight;
8
-
9
- @end
10
-
11
- @implementation NSImageDecodeSizeTransformer
12
- + (nonnull instancetype)transformerWithDecodeWidth:(CGFloat)decodeWidth decodeHeight:(CGFloat)decodeHeight {
13
- NSImageDecodeSizeTransformer *transformer = [NSImageDecodeSizeTransformer new];
14
- transformer.decodeWidth = decodeWidth;
15
- transformer.decodeHeight = decodeHeight;
16
-
17
- return transformer;
18
- }
19
-
20
- - (NSString *)transformerKey {
21
- return [NSString stringWithFormat:@"NSImageDecodeSizeTransformer(%f,%f)", self.decodeWidth, self.decodeHeight];
22
- }
23
-
24
- - (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
25
- if (!image) {
26
- return nil;
27
- }
28
- CGFloat widthRatio = 1.0f;
29
- CGFloat heightRatio = 1.0f;
30
-
31
- CGFloat width = (CGFloat)image.size.width;
32
- CGFloat height = (CGFloat)image.size.height;
33
- if (self.decodeWidth && self.decodeHeight) {
34
- widthRatio = self.decodeWidth / width;
35
- heightRatio = self.decodeHeight / height;
36
- } else if (self.decodeWidth > 0) {
37
- widthRatio = self.decodeWidth / width;
38
- } else {
39
- heightRatio = self.decodeHeight / height;
40
- }
41
- return [image sd_resizedImageWithSize:CGSizeMake(width * widthRatio, height * heightRatio) scaleMode:2];
42
- }
43
-
44
- @end
@@ -1,8 +0,0 @@
1
- #import <SDWebImage/SDImageTransformer.h>
2
-
3
- @interface NSImageRoundAsCircleTransformer: NSObject <SDImageTransformer>
4
-
5
- - (nonnull instancetype)init NS_UNAVAILABLE;
6
- + (nonnull instancetype)transformer;
7
-
8
- @end
@@ -1,40 +0,0 @@
1
- #import "NSImageRoundAsCircleTransformer.h"
2
- #import <SDWebImage/SDGraphicsImageRenderer.h>
3
-
4
- @interface NSImageRoundAsCircleTransformer ()
5
-
6
- @end
7
-
8
- @implementation NSImageRoundAsCircleTransformer
9
- + (instancetype)transformer {
10
-
11
- NSImageRoundAsCircleTransformer *transformer = [NSImageRoundAsCircleTransformer new];
12
- return transformer;
13
- }
14
-
15
- - (NSString *)transformerKey {
16
- return [NSString stringWithFormat:@"NSImageRoundAsCircleTransformer"];
17
- }
18
-
19
- - (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
20
- if (!image) {
21
- return nil;
22
- }
23
-
24
- CGFloat width = (CGFloat)image.size.width;
25
- CGFloat height = (CGFloat)image.size.height;
26
- CGFloat minwidth = MIN(width, height);
27
- CGFloat cornerRadius = minwidth / 2;
28
-
29
- UIImage * resultImage = [image sd_resizedImageWithSize:CGSizeMake(minwidth, minwidth) scaleMode:SDImageScaleModeAspectFill];
30
- resultImage = [resultImage sd_roundedCornerImageWithRadius:cornerRadius corners:UIRectCornerAllCorners borderWidth:0 borderColor:nil];
31
- return resultImage;
32
- // const result = (image as any)
33
- // .sd_resizedImageWithSizeScaleMode(CGSizeMake(minwidth, minwidth), SDImageScaleMode.AspectFill)
34
- // .sd_roundedCornerImageWithRadiusCornersBorderWidthBorderColor(cornerRadius, UIRectCorner.BottomLeft | UIRectCorner.BottomRight | UIRectCorner.TopLeft | UIRectCorner.TopRight, 0, null)
35
- // .sd_resizedImageWithSizeScaleMode(CGSizeMake(width, height), SDImageScaleMode.AspectFit);
36
- // return result;
37
- // return resultImage;
38
- }
39
-
40
- @end
@@ -1,13 +0,0 @@
1
- #import <SDWebImage/SDImageTransformer.h>
2
-
3
- @interface NSImageRoundCornerTransformer: NSObject <SDImageTransformer>
4
-
5
- @property (nonatomic, assign, readonly) CGFloat topLeftRadius;
6
- @property (nonatomic, assign, readonly) CGFloat topRightRadius;
7
- @property (nonatomic, assign, readonly) CGFloat bottomRightRadius;
8
- @property (nonatomic, assign, readonly) CGFloat bottomLeftRadius;
9
-
10
- - (nonnull instancetype)init NS_UNAVAILABLE;
11
- + (nonnull instancetype)transformerWithTopLefRadius:(CGFloat)topLeftRadius topRightRadius:(CGFloat)topRightRadius bottomRightRadius:(CGFloat)bottomRightRadius bottomLeftRadius:(CGFloat)bottomLeftRadius;
12
-
13
- @end
@@ -1,59 +0,0 @@
1
- #import "NSImageRoundCornerTransformer.h"
2
- #import <SDWebImage/SDGraphicsImageRenderer.h>
3
-
4
- @interface NSImageRoundCornerTransformer ()
5
-
6
- @property (nonatomic, assign) CGFloat topLeftRadius;
7
- @property (nonatomic, assign) CGFloat topRightRadius;
8
- @property (nonatomic, assign) CGFloat bottomRightRadius;
9
- @property (nonatomic, assign) CGFloat bottomLeftRadius;
10
-
11
- @end
12
-
13
- @implementation NSImageRoundCornerTransformer
14
- + (instancetype)transformerWithTopLefRadius:(CGFloat)topLeftRadius topRightRadius:(CGFloat)topRightRadius bottomRightRadius:(CGFloat)bottomRightRadius bottomLeftRadius:(CGFloat)bottomLeftRadius {
15
-
16
- NSImageRoundCornerTransformer *transformer = [NSImageRoundCornerTransformer new];
17
- transformer.topLeftRadius = topLeftRadius;
18
- transformer.topRightRadius = topRightRadius;
19
- transformer.bottomRightRadius = bottomRightRadius;
20
- transformer.bottomLeftRadius = bottomLeftRadius;
21
-
22
- return transformer;
23
- }
24
-
25
- - (NSString *)transformerKey {
26
- return [NSString stringWithFormat:@"NSImageRoundCornerTransformer(%f,%f,%f,%f)", self.topLeftRadius,self.topRightRadius,self.bottomRightRadius,self.bottomLeftRadius];
27
- }
28
-
29
- - (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
30
- if (!image) {
31
- return nil;
32
- }
33
-
34
- SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init];
35
- format.scale = image.scale;
36
- SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:image.size format:format];
37
- UIImage *resultImage = [renderer imageWithActions:^(CGContextRef _Nonnull context) {
38
- CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
39
-
40
- UIBezierPath *newPath = [UIBezierPath bezierPath];
41
-
42
- CGFloat left = M_PI;
43
- CGFloat up = 1.5*M_PI;
44
- CGFloat down = M_PI_2;
45
- CGFloat right = 0.0;
46
- [newPath addArcWithCenter:CGPointMake( CGRectGetMinX(rect) + self.topLeftRadius, CGRectGetMinY( rect) + self.topLeftRadius) radius: self.topLeftRadius startAngle: left endAngle: up clockwise: true];
47
- [newPath addArcWithCenter:CGPointMake( CGRectGetMaxX(rect) - self.topRightRadius, CGRectGetMinY( rect) + self.topRightRadius) radius: self.topRightRadius startAngle: up endAngle: right clockwise: true];
48
- [newPath addArcWithCenter:CGPointMake( CGRectGetMaxX(rect) - self.bottomRightRadius, CGRectGetMaxY( rect) - self.bottomRightRadius) radius: self.bottomRightRadius startAngle: right endAngle: down clockwise: true];
49
- [newPath addArcWithCenter:CGPointMake(CGRectGetMinX(rect) + self.bottomLeftRadius, CGRectGetMaxY( rect) - self.bottomLeftRadius) radius: self.bottomLeftRadius startAngle: down endAngle: left clockwise: true];
50
- [newPath closePath];
51
- CGContextSaveGState(context);
52
- [newPath addClip];
53
- [image drawInRect:rect];
54
- CGContextRestoreGState(context);
55
- }];
56
- return resultImage;
57
- }
58
-
59
- @end
@@ -1,5 +0,0 @@
1
- module NImage {
2
- umbrella header "NImage.h"
3
- export *
4
- module * { export * }
5
- }
package/vue/index.mjs DELETED
@@ -1,8 +0,0 @@
1
- import { Img } from '../image';
2
- const ImagePlugin = {
3
- install(Vue) {
4
- Vue.registerElement('NSImg', () => Img);
5
- }
6
- };
7
- export default ImagePlugin;
8
- //# sourceMappingURL=index.mjs.map