How do I use ICC profiles on the iPad/iPhone? - iphone

right now I'm implementing a basic PDF viewer, and I came across the problem that some files are displayed with wrong (too intense, too bright) colors for text and vector graphics when rendered on the device and in the simulator.
Since I have access to calibration hardware, I could create ICC profiles for the device with test data.
The only question I have now: Is there a way to use ICC profiles to aid the rendering of PDF data on the iPad's screen?
If someone wonders: I plan to target iOS 4.x on the iPad and possibly on the iPhone.
Thanks in advance!

I worked around this issue (of having PDFs render in different colors than pre-computed preview bitmaps) by generating all PDFs using sRGB (you can select this, for instance, in InDesign export settings).

Right now, iOS lacks a system-wide CMS like ColorSync.
What I would try to do is:
calibrate your iPad,
calculate the color transform from the ICC profile your calibrator gives you,
run that transform on the color values you display from the PDF data.
See where that gets you. There may be a lot of variance across the displays you are targeting (maybe different manufacturer batches == slightly different whitepoints, or something) but maybe that will assuage your problem.
... Which, since unlike some people, you're not defining that problem for 'perfect color reproduction in iOS' and as such, your problem is most likely quite solvable.
Bruce Lindbloom has a lot of color-conversion math (constants, definitions, etc) and his site is a great place to start, for this sort of thing.
http://www.brucelindbloom.com/
Since most Cocoa devs can depend on ColorSync, I haven't run across any relevant color transformation examples in Obj-C. There are plenty in Python that I know of -- python-colormath is a good example, with legible implementations of many of Mr. Lindbloom's matrices and transformations:
http://code.google.com/p/python-colormath/
... you may also be able to embed OpenCV in your iOS project. OpenCV has native matrix data structures and other useful things for you, if you are doing this kind of thing:
http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/
This is an area of interest for me, so let me know if you'd like me to elaborate on any of what I've provided. Good luck.

Related

WebGL framework - what's the best choice? X3DOM?

I'm about to start a Web application that will use interactive generated 3D content. Aim is to let it run natively in the browser, i.e. no Flash is allowed, only JavaScript + HTML5.
Apart from using pure WebGL it's better to use a lib that will offer a more high level interface.
The approach of X3DOM looks great for me - and it looks like it's supposed to become native in the browser and the lib will pave the road.
But after my first impressions I'm not sure if it's lightweight enough. Apart from the 400kb JS-File it slows down Firefox.
The features I need are not many. The whole scene set up could be easily done by "hand". But I need user interaction including to figure out where the user clicks. And later I want to be able to load and insert 3D objects in a common file format.
PS: Browsers of choice are Firefox and Webkit based ones. Desktop and Mobile ones. I don't care about IE.
PPS: Yes, I know the question: WebGL Framework
X3DOM is great when you come from an X3D background (and developed by great people), but if you have no preference watsoever, Three.JS would be my pick.
I looked at most WebGL frameworks just last week, and it indeed seems almost every one of them is in the 300kB range. That's too heavy for me, too. Luckily I found lightgl.js which has everything you need to get started in 28kB, MIT license.
The main thing for me is just abstracting canvas, shader and texture initialization. But lightgl.js does also have some mouse handling and model loading etc.
i think the decision boils down to:
do you want to have a more design or programmer approach.
x3dom: its leveraging of x3d for describing the scene lends itself to a more designer approach, with just the adding of the x3dom css and js one can do this :
<X3D><Scene><Shape><Box/></Shape</Scene></X3d>
three.js: only allows for scene generation through javascript, and a lot of additional code is necessary just to set up the canvas. view the source of this simple box example: http://stemkoski.github.com/Three.js/Template.html
neither way is wrong, i prefer designing the scene and then using js when needed for any computations.

Add a signature image to a pdf in iOS for the iPhone/iPad in particular

With the iOS support for Quartz 2D and its support for the PDF format; should adding a signature image to a pdf be a little easier. I have looked all over and saw people are using the PDFKit, UIView or Core Graphic Library. Which is the easiest and the recommended library for the effort? Also, are there simple examples of the recommend library. When I tried to see how Quartz 2D worked, all I could find are narrative explanations about how it worked and specific method you may use but no complete examples. You know the hello world one. Anyway, I am new to iOS development but been writing code for over 20 years so I might be able to pick this OS up as well.
Can some poor soul have pity on me and please point me in the right direction?
I have done this by loading the old pdf file on view and then add signature on that view and then render the view. check the following post
Add a signature image to a pdf without showing the pdf data to user in iOS
But not able create the pdf which contain existing pdf with signature "without showing on view" .
It's too late to answer this question now. But let me just provide some pointers for people who may bump into this question in future.
This one summarizes PDF handling in iOS pretty well. Good for starters.
http://www.ioslearner.com/generate-pdf-programmatically-iphoneipad/#more-242
This one is also similar, but not very exhaustive. http://www.absoluteripple.com/1/post/2012/03/generating-pdf-in-ios.html
The above links do not talk about handling existing PDFs. I found this stackoverflow answer really useful for that.
Add pdf page to an existing pdf objective-c
Just a note, if you want manipulate existing PDFs, Quartz 2d is the way to go.
Also look at reference pages of CGPDFDocument, CGPDFPage, CGPDFContext and CGContext.

Porting Max/MSP .app to iOS

I've read a number of posts on Apple's forums, and a number of posts on the Cycling '74 forums (with my own questions scattered around both) and nobody seems to be able to help me.
I used Max/MSP to write a 'patch' that takes samples and generates music. I'm going to release it as an album similar to Brian Eno's Thursday Afternoon, but wanted to make it available to people so they can have the music last for more than the hour a CD can hold.
What I don't know how to do, and can't figure out is HOW. It looks just like a regular OS X app, and the only difference I see in the directory structure is that my Max/MSP made application has extra .framework folders as well as the objects I use (which I guess are similar to 'functions' in JScript). I've looked at the package contents of both OS X files and the unpacked .ipa files from the App Store. Being so similar I would imagine it'd be pretty easy.
Where do I start? Has anybody on this forum done this? Thanks for your time!
[edit] - I just wanted to let you know I've discovered RJDJ, an iOS app that allows users to create 'scenes' in Puredata (Pd) and load them on their RJDJ program. I'd rather not go this route.
[edit2] - ok. I agree that it's very different. Especially having 4 (i could cut it down to 3) additional frameworks that aren't part of the SDK. But Ive been thinking. I can add a JavaScript object inside of my program, or make a special new object (object in max is sort of like a class in JS, i think) using C. Is there anything in these languages that would be able to convert a simple 'touch' to a 'mouseclick' in my app?
My application is very very simple. Basically just samples, played at randomly generated time intervals with some a 'conductor' to bring in/out the groups the samples are drawn from (piano, fx, etc...). So the user just clicks the 'start' button and off it goes. So the .nib file I would need to create is very simple. In my head it seems like the .ipa package/ios .app both contain unix executables and so long as these are basically the same it should work, right?
Max6 has been released.
A new object/concept named gen~ is available.
As far as I discussed with C74 dev, I know gen~ WILL provide its source code output. This code produce by the gen~ object could be useable in any other framework. basically, it will be C++
So it would really open A LOT of possibilities ; Max becoming a real graphical framework producing output that can be used in programming world.
It would save time for some part of the code.
As far as I can see from poking around at the Cycling '74 site and forums, there's currently no Max engine available for iOS. libpd is probably your best bet, really. (I'd note that the Inception app uses this Pure Data engine with a custom interface and it works very well.)
Unfortunately OSX and iOS apps are completely different under the hood. Outwardly they look similar (eg. you've noted the .app extension) but the internals are completely different.

How do I get my 3ds Max models into an iPhone 3D game?

I've written a couple apps that are currently published in the app store. However, I'd like to start writing games that use OpenGL ES. I know how to model objects in 3D Studio Max but what I don't know is how to get my models into an OpenGL ES application on the iPhone/iPad and then manipulate those objects to create gameplay.
Can anyone point me in the right direction to get started on this?
Just to clarify...I don't mind writing code; I'm not looking for a point and click solution.
I would imagine that I'd need to export my models into some sort of format. What is that format and how do I incorporate it into a game on the iPhone/iPad?
While more involved than you're looking for, Stephen Jayna has a great writeup on how he exported textured models from LightWave in COLLADA format for use in OpenGL ES on the iPhone.
Bill Dudney had put a little effort into making a Wave Front OBJ loader for the iPhone a while back, but I think that Jeff LaMarche's project to do the same might be the farthest along.
UPDATE (8/10/2011): Jonathan Wight recently posted his TouchOpenGL code, which includes an OBJ parser.
I've used this before with some luck. However, I would say there are no easy answers to this in my experience. They all required some coding/wiring up for me.
This is a nightmare process. My past approach to this was probably not the best. I worked on PC using 3DS Max to create an exporter using MaxScript. I dumped what I needed to a text file - in a format that I just invented for my own needs as an intermediate.
I then switched to Mac and wrote a command line tool that used NSFoundation to read this text file and convert it to a binary format that was optimized for my opengl renderer. This is okay for basic and static meshes. But I had hell exporting animated figures that used keyframed skelaton animations (the maths for that stuff is intense).
This did work, but I really think that I took the hardest approach.

What is a good vector library for Cocoa or Cocoa-touch?

I'm looking for a good vector library for displaying animated graphics on the iPhone. Something that could possibly display SVG. Anyone have any ideas or insights?
Quartz, i.e. the vector graphics library that's already built into the phone. Depending on the requirements, you could write a parser for the parts of the SVG spec you actually plan on using. For example perhaps your application only requires the Tiny SVG spec.
Sorry that this answer doesn't point to a framework that already exists, but depending on how badly you really need it, it might make sense to roll your own or a start an open source project (especially since this is the kind of project people would probably be quite happy to contribute to).
GCDrawKit is an outstanding vector illustration framework, but it does not have native support for SVG yet and is built around AppKit, so it's not iPhone compatible. It also is not geared towards animation.
WebKit provides native support for SVG on the Mac, and even lets you manipulate the DOM to modify or save SVG, but I don't believe you're given enough access to it on the iPhone to do the same there.
Your best bet is to write a parser for SVG XML (it isn't too difficult a format), use Quartz for drawing, and back it up with Core Animation for the animated elements.
WebKit
libsvg
Cairo
github.com/SVGKit/SVGKit - almost-but-not-quite standards compliant SVG lib on iOS. (FYI i'm one of the maintainers).
UIWebView works great for SVG.
Just drop it in you app in IB, load a file into it and you are set.
You can then call JavaScript from ObjC, very useful for manipulation.
I just answered another cocoa-touch SVG question: Drawing vector graphics on iphone
but my general suggestion was to look at GitHub for answers (Objective-c & SVG Search)
https://github.com/search?type=Everything&language=objective-c&q=SVG