Monday, February 4, 2008

2. What I need?

I spent the latest hours to find resources about handling tablet and/or mouse events. This to understand how difficult can be to develop such things. Of course there are several informations about it.

In the Chapter 2 of the Core Image Programming Guide, the part Imaging Dynamical System, describes a MicroPaint application that is able to capture mouse events and draw on a canvas. The guide is available either in the Cocoa area of Apple Developer Connection site and in the Xcode included documentation. Though, even if it will be soon useful, the MicroPaint application example focuses on the use of CIImageAccumulator class and not on how to actualy handle mouse events.
There is also a CIMicroPaint example in the /Developer/Examples/Quartz/Core Image/CIMicroPaint folder installed with development tools. But it is based on OpenGL and at this point it confuses me a little.
Talking about event handling there is the Cocoa Event-Handling Guide at ADC, available also in the Xcode documentation. But it does not make any example/tutorial and I want a pratical tutorial to learn quickly what to do.

So, I found the Mouse Events article at Cocoa Dev Central that introduces the reader to a tutorial for mouse event handling. I will use it for quickly understand the needed knowledge and then I will explore the examples provided by Wacom at Mac Software Development Support page.

But before to do it I want to write a list of features for my application, to understand what I actually need to know to go on.
  1. Tablet support with pressure sensitivity;
  2. Layers support.
  3. Alpha channel support, for each layer and the global image.
  4. Blending modes support.
  5. Layer transparency support.
  6. Tablet strokes smoothing to avoid stright lines when user moves the pen really fast.
Reading the Cocoa Drawing Guide, I discovered that Quartz gives support for:
  • Layers
  • Gradients (also called shadings)
  • Image data sources
  • Blend modes (Cocoa uses compositing modes instead)
  • Masking images
  • Transparency layers (for grouping content)
  • Arbitrary patterns (other than images)
That means that I can skip to project my self made layers system and use the one provided by Apple and that I can choose between two different blending systems: Quartz blend modes or Cocoa compositing modes.

No comments: