|
|
In semi-pseudocode, you want to do something like this:
render_window::on_mousedown(point)
{
if(selmode == lasso)
pt_array.clear();
pt_array.push_back(point);
set_capture(this);
}
render_window::on_mousemove(point)
{
if(selmode == lasso)
if(get_capture() = this))
pt_array.push_back(point);
}
render_window::on_mouseup(point)
{
if(selmode == lasso)
release_capture(this);
pt_array.push_back(point);
build_mask(pt_array);
pt_array.clear();
}
build_mask(pt_array)
{
if(win32)
set up offscreen 1-bit dib
dib.clear(black);
define polygon from pt_array
make region from polygon
dib.selectobject(region)
dib.fillregion(white);
povray.mask.make_from(dib); // white = transparent
}
povray::render_scene(...)
{
...
for each pixel in scene
if(mask.exists and mask pixel is black)
continue;
...
render(pixel);
}
Ray
Sven Littkowski wrote:
> Sounds very interesting, but also very ununderstandable! Ray, I just never
> had POV-Ray doing such. I even don't know, how. Can you give me/us more
> details? Can you describe the entire procedure?
>
> Sorry for my unknowledgement, but I really want to understand your idea as I
> truly look for suggestions.
>
> Thanks, greetings,
>
> Sven
>
>
>
>
>
> "Ray Gardener" <ray### [at] daylongraphicscom> schrieb im Newsbeitrag
> news:445c4cab$1@news.povray.org...
>> It's trivially easy, actually. Just render the selection region to a
>> 1-bit mask, then test the mask pixels to see if a display pixel should be
>> rendered.
>>
>> Ray
>>
>>
>> Chambers wrote:
>>> Alain wrote:
>>>> Also, rendering an irregular shaped area could ultimately be slower than
>>>> a slightly to large area. This will be due to a substentialy more
>>>> complex code. The code for a simple square section is simple: you limit
>>>> the region to render. That for an arbitrary free-hand capture will need
>>>> to test every pixel against the desired area. You may also need to
>>>> render, but not display, in a, square, region larger than the selected
>>>> area.
>>> While I don't necessarily think we need this feature, I don't think it
>>> would be that bad. For each line, you could just store the beginning and
>>> ending points (assuming only convex shapes were allowed) and render a
>>> straight line across.
>>>
>>> ...Chambers
>
>
Post a reply to this message
|
|