Comments (8)
Maybe it's because I use a pretty huge image in a small UIImageView, don't know to be honest. I'll let you know if there are performance drops, right now I have to get to a point of being able to determine that :)
from aggeometrykit.
Hello @skizzo ! Thanks for the kind words!
Are you talking about views in general using the layer.quadrilateral
API or are you talking about images you are rendering using this API
@interface UIImage (AGKQuad)
- (UIImage *)imageByCroppingToQuad:(AGKQuad)quad destinationSize:(CGSize)destinationSize;
- (UIImage *)imageByCroppingToRect:(CGRect)rect;
- (UIImage *)imageWithPerspectiveCorrectionFromQuad:(AGKQuad)quad;
@end
?
from aggeometrykit.
sorry, i actually mean both but could live with a preview as it is (setting the quad of a UIView) but a better looking rendering!
from aggeometrykit.
Allright, I get you. With regards to the preview there's some pretty quick and easy fixes I would recommend. https://markpospesel.wordpress.com/2012/03/30/efficient-edge-antialiasing/
Especially the transparent line trick!
When it comes to rendering to UIImage this is already an issue, #23. We can continue discussion at that issue.
from aggeometrykit.
Unfortunately, neither of the approaches mentioned in the link change anything about how the edges are displayed, but thanks.
from aggeometrykit.
+ (UIImage *)renderImageForAntialiasing:(UIImage *)image withInsets:(UIEdgeInsets)insets
{
CGSize imageSizeWithBorder = CGSizeMake([image size].width + insets.left + insets.right, [image size].height + insets.top + insets.bottom);
// Create a new context of the desired size to render the image
UIGraphicsBeginImageContextWithOptions(imageSizeWithBorder, NO, 0);
// The image starts off filled with clear pixels, so we don't need to explicitly fill them here
[image drawInRect:(CGRect){{insets.left, insets.top}, [image size]}];
// Fetch the image
UIImage *renderedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return renderedImage;
}
This didn't work?
Assumed old code
self.imageView.image = [UIImage imageWithName:@"foo.jpg"];
New code
UIImage *original = [UIImage imageWithName:@"foo.jpg"];
UIImage *aliased = [self renderImageForAntialiasing:original withInsets:UIEdgeInsetsMake(1, 1, 1, 1)];
self.imageView.image = aliased;
from aggeometrykit.
Nope, tried exactly this code. Turns out that this line solved the anti-aliasing problem:
[self.imageView.layer setMinificationFilter:kCAFilterTrilinear];
No hard edges any more :)
from aggeometrykit.
Huh, I find that really really strange. I've used that technique many times.
Any performance drops using setMinificationFilter:
?
from aggeometrykit.
Related Issues (20)
- Better resampling of images with AGKTransformPixelMapper HOT 5
- Possible to perspective-distort an image? HOT 17
- Linker errors building Demo HOT 6
- imageWithPerspectiveCorrectionFromQuad corrupts source image HOT 6
- Transformation not applied? HOT 4
- imageWithPerspectiveCorrectionFromQuad scale problem. HOT 7
- Repo moved
- macos support? HOT 2
- Multiple Drag points + Video HOT 5
- Auto-layout HOT 4
- How can I crop the image by using AGGeometryKit. HOT 2
- Rotate around point and scale HOT 3
- Missing AGGeometryKitTests.m HOT 2
- Hello, when i set quadrilateral, the position of the layer is shifted, and how to remove the quadrilateral settings HOT 11
- tvOS HOT 4
- Memory leak in imageByCroppingToRect HOT 3
- Memory leaks HOT 2
- How can I get the final result as UIView or UIImageView
- Is it possible to straighten all the lines?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aggeometrykit.