Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: Need a graphics algorithm



Trygve,

> In a rectangular 24bit RGB pixel field, two areas A & B, both are contiguous
> (no islands), but B is an island within A. Given a point in B, find the
> straight line distance to the nearest point in A... And do it quickly.
>
> What I am ultimately trying to do is antialias the edge of a "blob" (B). I
> figure if I can find the distance to the edge I can just adjust the
> transparency when it gets within 2 pixels or so. Maybe there is a better
> way, but this was my initial thought.

How is B defined, is it a Region (RgnHandle) or a bitmap which can be made
into a region, or are you using core graphics.

If you in QuickDraw, and have a region for B, you could make a copy of it
[C], inset it by your two pixels, subtract is from B [ D = B - C ] and then
use PtInRgn( D ) when you scan you pixels.

You could avoid the region maths using PtInRgn( B ) & !PtInRgn( C ). If you
want varying levels, make multiple inset regions.

Douglas
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >OT: Need a graphics algorithm (From: Trygve Inda <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.