Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone iOS how to create graphics effects like drop shadow, etc? What effects are built-into iOS?

I apologize for a large set of questions here. I'm starting to play with Quartz Graphics more and more, and found that it has interesting effects, yet I do not have many samples to see them in action.

 view.layer.shadowPath = [UIBezierPath bezierPathWithRect:view.bounds].CGPath;

There's a shadow property:

view.layer.shadowColor = [UIColor grayColor].CGColor;
view.layer.shadowOffset = CGSizeMake(5, 5);
view.layer.shadowPath = [UIBezierPath bezierPathWithRect:view.bounds].CGPath;
view.layer.shadowRadius = 9;

I was unable to make the shadow show though.

Borders:

 view.layer.borderWidth = 1;
   view.layer.borderColor=[[UIColor whiteColor] CGColor];

What other effects can I get from built-in iOS on iPhone? *Is there a comprehensive demo project that can showcase what kind of graphic manipulation functionality is built into iOS?*

How do I do transparency masking?

Is there a way to add inner shadow or inner glow? Is there a way to make an iOS button appear more "concave" than it really is?

Is there a way to do radial gradients? Is there a way to create multi-ray lens flare effects like Adobe Illustrator? Is there a way to blend layers using "lighten, dissolve", or other photoshop effects? Is there a way to dynamically adjust the brightness of the image? I know how to do hue shift.

I would appreciate any other hints on what kind of layer effects I can apply to the CALayers

like image 250
Alex Stone Avatar asked Apr 30 '12 12:04

Alex Stone


2 Answers

What an interesting coincidence! I've just recently held a presentation at an iOS Game Design Seminar on CoreGraphics and CoreAnimation and just today I've published some of the documents on Github.

So if you prefer some hands on examples you can check out the repository here: https://github.com/pkluz/PKCoreTechniques

Includes some of the following examples:

  • Color Fill

  • Gradient Fill (Linear and Radial)

  • Simple Paths

  • Bezier Curves

  • Clipping (Standard and Even-Odd)

  • Creating custom-drawn Buttons

  • Simple Translations

  • Translations with Hit-Test Triggers

  • A very primitive 'CoverFlow' with 3D Transformations in CoreAnimation.

.. and some more ;-)

Hope you find what you need, but from what I see it should cover a fair amount of what you've requested.

Note: There's also a PDF that serves as an interactive tutorial.

like image 118
pkluz Avatar answered Sep 24 '22 15:09

pkluz


Here is a really good tutorial, it helped me a lot, maybe it'll help you too.

like image 35
Templar Avatar answered Sep 22 '22 15:09

Templar