mattgemmell / mgimageutilities Goto Github PK
View Code? Open in Web Editor NEWUseful UIImage categories for iPhone/iPad developers.
Home Page: http://mattgemmell.com/
Useful UIImage categories for iPhone/iPad developers.
Home Page: http://mattgemmell.com/
There is a problem with the current availability check. In UIImage+Tint.m
the current code is:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) {
UIGraphicsBeginImageContextWithOptions([self size], NO, 0.0); // 0.0 for scale means "scale for device's main screen".
}
#else
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 4.0) {
UIGraphicsBeginImageContext([self size]);
}
#endif
However, imagine you compile against iOS 4.0, so __IPHONE_OS_VERSION_MAX_ALLOWED
will be 40000
, thus only
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0) {
UIGraphicsBeginImageContextWithOptions([self size], NO, 0.0); // 0.0 for scale means "scale for device's main screen".
}
will get compiled. Now run the app in iOS prior to 4.0 and no context will get created, since the if-statement will return NO
. Vice versa is the same of course, compiled against 3.x.x and run in iOS 4.x.x will not work.
I have a fork already available at http://github.com/JoostK/MGImageUtilities which fixes the problem.
Cropping sprite works well, but it does not support for the tint color.
Hi,
I looked out the code & tried with several ways. though the cropping is supported in the whole image i,e By passing the origin & size parameters but I didn't find where user can crop the image like a Right Angle Triangle , means cropping at an angle of 45 *.
This method doesnot support cropping if user wish to have the partial image since one wo'nt be able to pass the paramters other than Height ,width & Origin.
Required Output :
-------
|\ |
| \ |
| \ |
| \|
-------
I tried using this category on a project that has camera functionality. Unfortunately the scaled output is screwy when the input image is a photo taken in portrait mode. It comes out distorted. The type and magnitude of the distortion varies depending on what scaling mode you use, but it's always pretty severe.
Try using the image file below (direct from my iphone 4s) in the sample project. The distortion appears there for me.
Hi,
If I use the categories on an IOS 6 SDK project. I am getting the following on the console:
: CGContextDrawImage: invalid context 0x0
: CGBitmapContextCreateImage: invalid context 0x0
While debugging it I am able to pinpoint the issue but have not been able to find a remedy for it. The issue is that context is null:
CGContextRef context = CGBitmapContextCreate(NULL, scaledWidth, scaledHeight, 8, (scaledWidth * 4),colorSpace, kCGImageAlphaPremultipliedLast);
Any solution you can provide would be a great help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.