I didn't find a rounded rectangle generator in the archives, though I did find a few people looking for one. I'm just posting the one I wrote in case it's of use to anyone else (I don't actually know if this belongs here or on quartz-dev):

kernel vec4 roundedRect(vec2 bottomLeft, vec2 topRight, float radius, __color color)
  vec2 p=destCoord();
  float dist=0;


  dist += p.x<bottomLeft.x ? pow(bottomLeft.x-p.x,2.0) : 0.0;
  dist += p.y<bottomLeft.y ? pow(bottomLeft.y-p.y,2.0) : 0.0;
  dist += p.x>topRight.x   ? pow(topRight.x-p.x,2.0)   : 0.0;
  dist += p.y>topRight.y   ? pow(topRight.y-p.y,2.0)   : 0.0;


  return color * clamp(radius - dist, 0.0, 1.0);

I'm still new to Core Image, so criticism is welcome.
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

Reply via email to