[Gegl-developer] How to get bounding box from inside a sampler

2008-09-19 Thread Nicolas Robidoux

Hello all:

This question will make clear that I don't understand c++.

Suppose that, in the code for, say,
gegl/gegl/buffer/gegl-sampler-cubic.c, I want to use information about
the bounding box of the input data.

More precisely:

I (believe that) I already know that the relevant pixel values start
at indices 0,0. Requested values to the left and above those are
created by the (currently 0,0,0,0) abyss policy.  Which is to say that
0 and 0 are the smallest x and y for which I have real data.

What I want to know is the width and height (in pixels) the area with
valid pixel values.

This is almost the same as:

I want to know the lowest positive indices at which the abyss policy
kicks in.

Which is almost the same as:

What is the index of the rightmost/lowest pixel with real data
associated to it.

--

Once I have this info, I can finish the yafr code.

With thanks,

Nicolas Robidoux
Laurentian University/Universite Laurentienne
___
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer


Re: [Gegl-developer] How to get bounding box from inside a sampler

2008-09-19 Thread Øyvind Kolås
On Sat, Sep 20, 2008 at 3:41 AM, Nicolas Robidoux
[EMAIL PROTECTED] wrote:

 Hello all:

 This question will make clear that I don't understand c++.

 Suppose that, in the code for, say,
 gegl/gegl/buffer/gegl-sampler-cubic.c, I want to use information about
 the bounding box of the input data.

 More precisely:

 I (believe that) I already know that the relevant pixel values start
 at indices 0,0. Requested values to the left and above those are
 created by the (currently 0,0,0,0) abyss policy.  Which is to say that
 0 and 0 are the smallest x and y for which I have real data.

Not true, the valid pixel values can be in any rectangular sub region of the
buffer, negative values should also be supported. GeglBuffer supports
dynamically growing (will be useful for GIMP having auto-growing layers when
painting.)

 What I want to know is the width and height (in pixels) the area with
 valid pixel values.

 This is almost the same as:

 I want to know the lowest positive indices at which the abyss policy
 kicks in.

 Which is almost the same as:

 What is the index of the rightmost/lowest pixel with real data
 associated to it.

From within the sampler you cannot really know the extent of the buffer being
handled. It would often be a rectangular sub-buffer of the real buffer
so you cannot
check the extent of the buffer being sampled from.

One way to achieve the desired behavior from a sampler is to pass the extent
of the rectangle in when using the sampler. This could then be done from bits
of the code that knows what extents to use. Haven't thought about how to add
or change API to well accommodate such a need.

For most cases though I think that extending GeglBuffer to support more abyss
models like mirror and smear as well as constant value of different kinds would
allow simplifying the code needed for many samplers.

/Øyvind K.
-- 
«The future is already here. It's just not very evenly distributed»
 -- William Gibson
http://pippin.gimp.org/ http://ffii.org/
___
Gegl-developer mailing list
Gegl-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gegl-developer