Coder Social home page Coder Social logo

ckimageadditions's People

Contributors

cmkilger avatar macguru avatar nachosoto avatar ptescher avatar ultramiraculous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ckimageadditions's Issues

zero the malloced buffer (fix inside)

after calling malloc need to set 0 to the buffer in

CoreGraphicsAdditions.c

include <string.h>

...

CGContextRef CKBitmapContextAndDataCreate(CGSize size, void ** data) {
...

   memset(bitmapData, 0, size.width*size.height*4 );

Library not found

I am getting this error : library not found for -lImageAdditions

Also : libImageAdditions.a not found

issue with Transparency trimming ( fix inside)

In CKImageCreateByTrimmingTransparency(CGImageRef image, CKImageTrimmingSides sides) a UInt32 array is used instead of an unsigned char array for the bitmap data received from context. It can cause big endian related issues. for example a pixel, when addressed via the UInt32 array will look like this
in the following debug code I have written

(data is defined as unsigned char* data)

            int r = data[4*y*width+4*x+0];
            int g = data[4*y*width+4*x+1];
            int b = data[4*y*width+4*x+2];
            int alpha = data[4*y*width+4*x+3];

            int xx = ((UInt32*)data)[y*width+x];

in the debugger the values will be as follows

        int xx = 0xff01ff00

while the components when addressed via rgba (alpha premultiplied last) are

int r = 0
int g = 0xff
int b = 0x1
int alpha = 0xff

As you can see, in images that have any value of Red the function will be correct, (since most often pixels that have an alpha=0 are also fully zeroed) but in case of almost pure green, (like my test case) it will be incorrect

The Fix is:

redefine

unsigned char * data = bitmapData;

and in the said function use the following code in the scan loops

            int alpha = data[4*y*width+4*x+3];

            if (alpha != 0) 
            {
                left = x;
                goto SCAN_TOP;
            }

Thanks for your work on the lib. Hope this helps

console error message on device 3.0 - 3.2

I got this error message when use this additions on device 3.0 - 3.2, how to solve this issue?

Program received signal: “EXC_BAD_ACCESS”.
Not safe to look up objc runtime data.
Not safe to look up objc runtime data.
Not safe to look up objc runtime data.

thanks.

Leak in CGImageCreateByBlendingImages()

You should release the context...
return CGBitmapContextCreateImage(context);

Should be something like ...
CGImageRef image = CGBitmapContextCreateImage(context);
CGContextRelease(context);
return image;

Use -[UIImage scale] and not -[UIScreen scale]

When finding a scale to use to resize an image, you should use the image's internal scale and not the screen's scale. If an image is only available @1x and the screen is @2x, this could have unintended side-effects.

Trimming colour issues

Thanks for this library. However, I seem to have issues using the trimming utility. I assign a UIColor with RGB colour space, but it doesn't actually trim the image.

Here's an example of an image I am trying to trim:

arcadefire

I'm wanting to trim the black borders on the top and bottom, so I set the UIColor to [UIColor colorWithRed:0 green:0 blue:0 alpha:1]] but I am returned the exact same image, nothing is being trimmed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.