Coder Social home page Coder Social logo

Comments (5)

zizhengtai avatar zizhengtai commented on September 26, 2024

Same problem here. Trying to use this with SKTexture, but everything
appears upside down.

On Friday, October 10, 2014, Erik van der Neut [email protected]
wrote:

Hi Nigel,

I cannot tell you how excited I am to have your UIImage+PDF. This is an
amazing tool in simplifying the image asset management, especially now with
the introduction of @3x https://github.com/3x for the iPhone 6 Plus.

Back in January 2012, algal reported having his images displayed upside
down. You replied you had never experienced that issue, and he figured out
that it was caused by assigning it to the layer's background instead of the
view's background.

In my project I have replaced several UIImage creation lines of code with
your imageWithPDFNamed:fitSize: and imageWithPDFNamed:atWidth, and the PDFs
are displaying beautifully, but strangely enough all upside down :-( So far
I have not been able to figure out what I possibly could have done wrong.
Would you have any inkling as to how I should go about debugging this..?

I can't attach examples of my PDF files -- it says "Unfortunately, we
don't support that file type. Try again with a PNG, GIF, or JPG.", but all
my PDFs are small in size.

Thanks so much,
Erik


Reply to this email directly or view it on GitHub
#30.

from uiimage-pdf.

vanderneut avatar vanderneut commented on September 26, 2024

What I'm doing is I think really basic stuff, for example setting button images:

UIImage *replayButtonImage = [UIImage imageWithPDFNamed:@"ec-control-button-replay.pdf" atWidth:120];
[_replayButton setImage:replayButtonImage forState:UIControlStateNormal];

Or something as simple as setting the image on a UIImageView:

_backgroundImageView.image = [UIImage imageWithPDFNamed:@"ec_background_mode.pdf" atSize:self.frame.size];

All images are rendering beautifully and at the right size. It's just that they are all upside down.
I'll keep moving forward with my implementation, but I will need a solution for this to complete this.

Anybody else out there who has experienced this and might have an idea what it could be?

Erik

from uiimage-pdf.

mindbrix avatar mindbrix commented on September 26, 2024

Hi Erik. Thanks for your feedback. I've just pushed a commit: 3be234d that should fix your problem.

Nigel.

from uiimage-pdf.

vanderneut avatar vanderneut commented on September 26, 2024

Hi Nigel,

I just came back here to tell you that if I commented out the following two lines, that all images appear correctly:

CGContextScaleCTM( ctx, 1, -1 );
CGContextTranslateCTM( ctx, 0, -size.height );

And now I see you have made that same change already and committed it.

Thanks so much!

Now, I'm just curious why that code was in there. In the 2012 thread with algal I see now that you referred to those lines as well. There must have been a deliberate intent behind that flipping.

Thanks for any further insights you can share. Either way: your UIImage+PDF is making me extremely happy - just so you know :-)

Erik

from uiimage-pdf.

mindbrix avatar mindbrix commented on September 26, 2024

Hi Erik. Great minds think alike ;-)

The flipping code is now redundant, as I now create the drawing context with CGBitmapContextCreate() instead of UIGraphicsBeginImageContextWithOptions(). The latter transforms the context differently.

Nigel.

from uiimage-pdf.

Related Issues (20)

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.