Holmes Card Workshop!

The image above represents a bit of a milestone. It’s a Holmes card image for use in a stereo viewer, but the big thing about this one is that it’s created by a real, proper application that I wrote. 

I have done this before. I’ve written something very similar in LiveCode – which (to those who remember such things) is a HyperCard-like development environment. The only problems with LiveCode is that the resulting application is slow – especially when doing heavy lifting in the graphics area. I was using it to call ImageMagick to do some of the more complex operations, but it was still far too slow.

I remember being told once by an experienced software engineer that slow response times in a UI can lead to mental illness. Even though I expect that comment was laced with a little hyperbole, I am certainly aware that even a small delay of a couple of seconds after every mouse click can be very frustrating, especially if you are in a situation where the beta software you are using is being used in a production environment because that’s part of your testing duties for your client.

If you wonder why your computer does a little animation when you click on a button (windows open with a flourish, buttons pulse, etc.), then this is why. You’re getting *some* kind of reaction, even if a response to the task is delayed. You feel that the computer is doing something because it has responded in some fashion.

So when other applications just do things with big bitmaps almost immediately, and your application appears to require more progress bars than Dublin has pubs, you know that you’re doing it wrong. Add to this LiveCode’s $999 per annum fee if you are wanting to write commercial software, then I realised that if, by some chance, I arrive at something that people will hand over cash for, then I have to be able to cover at least my costs. Stereo card making is a bit niche, so the numbers alone tell me that I’ll lose out big time if I carry on down that path.

XCode

So I cracked open Xcode. It seems that Swift (Apple’s new development language) has grown since it was introduced, and it now covers Mac development as well as iOS development, so I thought I’d give it a go. After a week of sporadic tinkering, I managed to get the flow I wanted going – import from Stereo Camera, choose options, export image.

The application also allows the sizing of images, and the changing of the space between them. So far that’s it for controlling the design of the card, but I have a list of things that my LiveCode project does that I need to learn how to do the Xcode way. As I learned this week, working on LiveCode did not necessarily give me the right concepts or groundings to work in Xcode. So I’m finding that I’m having to unlearn what I expect would be deemed as, at best, “very bad habits”.

MPO Files

One problem I came across, and I could not find a way to solve it myself, was extracting the two JPEG images in an MPO file. This is the data my stereo camera outputs – effectively it’s two JPEG images one after the other. In LiveCode, I was able to extract the two image fairly easily, but applying the same process in Xcode was not working. I also could not find any solution that would work, so I  asked a question on StackOverflow.

John Parker, who incidentally writes the glorious Retrospecs iPhone app (buy a copy at the iPhone App Store here) offered a solution that works. It returns the images that I need, and after I had added his code to my app, I was able to continue. For completion, here’s the question and answer incase others want to do similar things. Thanks, John!

Problems With Swift

When Apple introduced their programming language Swift, it was introduced to for iOS development. Since then, its scope has been extended to include OSX development as well, but it seems that the bulk of information about it is still based firmly in writing apps for iPhone, iPads and Apple Watches. There are differences in how things are done between those devices and OSX, and things either work, don’t work, or need some kind of translation. Inexperience means that I may not always get things working properly the first time, and it can get frustrating. It also seems that Swift 3’s syntax and vocabulary has also changed, so examples online are outdated in more than one way. It can get frustrating.

End Result

The end result of my efforts is, however, promising. It’s probably the most advanced thing I’ve done in Xcode – it loads images, scales & crops them, and combines them when it’s ready to export. And, unlike LiveCode, the result is fast. Things happen pretty much on the click of the mouse. I’ve not had to create a progress bar yet!

Things will progress now – again at a faltering, limping way. I’m working on a better way to present the choice of card backgrounds (of which there will be many), and that presents more obstacles (caused by my ignorance) to overcome.