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: Linear image



Hi,

That depends how you implement the Image Unit (either way is possible), but I wouldn't really recommend that -- first, 0 to 1 coordinates are not used in any Image Unit host, so for example Motion / Fun House / iMaginator wouldn't be able to build consistent user interface for your Image Unit. Secondly, the approach fails when the input image has infinite size -- for example you couldn't apply it to the output of a radial gradient generator.

Writing it as a Image Unit is however good for correctness resons: It allows you to implement an region-of-interest function, which Quartz Composer doesn't allow you to do; but is actually required in this case.

- Ralph


On Jun 11, 2005, at 22:33, Nick Dan wrote:
If I was going to turn this code into an image unit
would float y expect values in the range 0 to 1?


--- Ralph Brunner <email@hidden> wrote:


Hi,

note that the kernel code below has a bug, in that
the sampler
transform is applied twice. This will fail in
interesting ways if the
sampler transform is not identity (when Core Image
tiles the
evaluation for example).

A different implementation could look like this:

kernel vec4 linearImage(sampler image, float y)
{
      vec2 xy = vec2(destCoord().x, y);

      return sample(image, samplerTransform(image,
xy));
}

- Ralph


--- Sam Kass <email@hidden> wrote:

Core Image kernel functions are called once for

each

output pixel.
If I understand LinearImage, it's picking one

raster

(y value) out of
the image and displaying that for the whole image?
If so, then for
each output pixel, you want to return the pixel

that

is in the same
column, but a specified row.  To duplicate what's

on

the web site,
try something like the following, and hook it up

to

a mouse input
(I'm coding in my email client, so there may be
bugs):

kernel vec4 linearImage(sampler image, float

ycoord)

{
     // get xy value
     vec2 xy = samplerCoord(image);
     // return image pixels for our column,
specified row
     return sample(image, samplerTransform(image,
vec2(xy.x, ycoord)));
}


 _______________________________________________
Do not post admin requests to the list. They will be
ignored.
Quartzcomposer-dev mailing list
(email@hidden)
Help/Unsubscribe/Update your Subscription:


http://lists.apple.com/mailman/options/quartzcomposer-dev/awrintu- email@hidden


This email sent to email@hidden




Send instant messages to your online friends http:// au.messenger.yahoo.com


_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Linear image (From: Nick Dan <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.