rFlex / SCWaveformView

A blazing fast customizable waveform view
Apache License 2.0
457 stars 59 forks source link

Re-colorized images were flipped vertically #2

Closed msrdjan closed 10 years ago

msrdjan commented 10 years ago

Best regards, Srdjan

rFlex commented 10 years ago

Hey,

Thanks for the feedback. Where do you see that the re-colorized images are flipped? I just pushed a new commit with a button that changes the colors randomly, can you look that up and tell me if there is something wrong with it? The images don't appear flipped (even though if they were, they are totally symmetrical btw).

Thank you ;)

msrdjan commented 10 years ago

If you change the line SCWaveformView.m#L82:

CGContextAddLineToPoint(context, x, halfGraphHeight + pixelHeight);

to:

CGContextAddLineToPoint(context, x, halfGraphHeight);// + pixelHeight);

you'll have non-symetrical image (just as a test), and will see that the progress image is flipped vertically.

Then, when you change line SCWaveformView.m#L220:

CGContextDrawImage(UIGraphicsGetCurrentContext(), imageRect, image.CGImage);

to:

CGContextRef context = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0.0, image.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, imageRect, image.CGImage);

it'll work for non-symetrical images.

rFlex commented 10 years ago

Awesome, thank you so much ;)

msrdjan commented 10 years ago

Thanks @rFlex :)

Best regards, Srdjan