Hi,
Thank you for your reply.
I wish to draw primitives like line, rectangle etc using the filter modes (like what you have in Photoshop).
Calculating per pixel will be very slow as using ~8000x8000 image area rendering ~1000 objects.
Here is an explanation from the manual for the different modes used in the iPhone app:
GRAPHICS MODE X
sets graphics commands compositing mode to X, where X is one of the modes listed below (R = premultiplied result; S = source color and alpha; D = destination color and alpha; Ra, Sa, Da = alpha components of
R, S, D). Default mode is “NORMAL”.
NORMAL : Paints the source image samples over the background image samples.
MULTIPLY : Multiplies the source image samples with the background image samples. This results in colors that are at least as dark as either of the two contributing sample colors.
SCREEN : Multiplies the inverse of the source image samples with the inverse of the background image samples. The result is then also inverted. This results in colors that are at least as light as either of the two contributing sample colors.
OVERLAY : Either multiplies or screens the source image samples with the background image samples, depending on the background color. The result is to overlay the existing image samples while preserving the highlights and shadows of the background.
DARKEN : Creates the composite image samples by choosing the darker samples (either from the source image or the background). The result is that the background image samples are replaced by any source image samples that are darker.
LIGHTEN : Creates the composite image samples by choosing the lighter samples (either from the source image or the background). The result is that the background image samples are replaced by any source image samples that are lighter.
COLORDODGE : Brightens the background image samples to reflect the source image samples. Source image sample values that specify black do not produce a change.
COLORBURN : Darkens the background image samples to reflect the source image samples. Source image sample values that specify white do not produce a change.
SOFTLIGHT : Either darkens or lightens colors, depending on the source image sample color. If the source image sample color is lighter than 50% gray, the background is lightened, similar to dodging. If the source image sample color is darker than 50% gray, the background is darkened, similar to burning. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white produce darker or lighter areas, but do not result in pure black or white. The overall effect is similar to what you’d achieve by shining a diffuse spotlight on the source image. Use this to add highlights to a scene.
HARDLIGHT : Either multiplies or screens colors, depending on the source image sample color. If the source image sample color is lighter than 50% gray, the background is lightened, similar to screening. If the source image sample color is darker than 50% gray, the background is darkened, similar to multiplying. If the source image sample color is equal to 50% gray, the background is not changed. Image samples that are equal to pure black or pure white result in pure black or white. The overall effect is similar to what you’d achieve by shining a harsh spotlight on the source image. Use this to add highlights to a scene.
DIFFERENCE : Subtracts either the source image sample color from the background image sample color, or the reverse, depending on which sample has the greater brightness value. Source image sample values that are black produce no change; white inverts the background color values.
EXCLUSION : Produces an effect similar to that produced by “DIFFERENCE”, but with lower contrast. Source image sample values that are black don’t produce a change; white inverts the background color values.
HUE : Uses the luminance and saturation values of the background with the hue of the source image.
SATURATION : Uses the luminance and hue values of the background with the saturation of the source image. Areas of the background that have no saturation (that is, pure gray areas) don’t produce a change.
COLOR : Uses the luminance values of the background with the hue and saturation values of the source image. This mode preserves the gray levels in the image. You can use this mode to color monochrome images or to tint color images.
LUMINOSITY : Uses the hue and saturation of the background with the luminance of the source image. This mode creates an effect that is inverse to the effect created by “COLOR”.
Hope this helps