Double Buffering In Computer Graphics


 Double Buffering


double buffering in computer graphics,double buffering in c graphics,double buffering,double buffering in cg
Image Source - Google | Image By - slideshare
• The idea of maintaining 2 images, one to show and one to build or alter is called double buffering.

• Eg - word file

Rename Segment

rename_segment (old_seg, new_seg)

{

If (old_seg < 1 or new_seg < 1 or old_seg > num_seg or new_seg > num_seg) then

Error: "Invalid segment name"

If now_open  = old_seg or now_open = new_seg then

Error: "Segment open"

If seg_size [new_seg] > 0 then

Error: "Segment already exists"

seg_start [new_seg] = seg_start [old_seg]

seg_size [new_seg] = seg_size [old_seg]

visibility [new_seg] = visibility [old_seg]

trans_x [new_seg] = trans_x [old_seg]

trans_y [new_seg] = trans_y [old_seg]

scale_x [new_seg] = scale_x [old_seg]

scale_y [new_seg] = scale_y [old_seg]

angle [new_seg] = angle [old_seg]

seg_size [old_seg] = 0

}

Set Visibility

set_visibility (seg_name)

{

If seg_name < 1 or seg_name > num_seg

Error: "Invalid segment name"

visibility [seg_name] = 0 / 1

If visibility [seg_name] = 0 then

new_frame();

}

Set Transform

set_transform (seg_name, tx, ty, sx, sy, a)

{

If seg_name < 1 or seg_name > num_seg

Error: "Invalid segment name"

trans_x [seg_name] = tx

trans_y [seg_name] = ty

scale_x [seg_name] = sx

scale_y [seg_name] = sy

angle [seg_name] = a

If visibility [seg_name] = 1 then

new_frame();

}

Build Transform

build_transform (seg_name)

{

If seg_name < 1 or If seg_name > num_seg

Error: "Invalid segment name"

identity_matrix ()

scaling (scale_x [seg_name], scale_y [seg_name], h)

rotation (theta [seg_name], h)

translation (trans_x [seg_name], trans_y [seg_name], h)

}

• Seg_name is not specified as only 1 segment will be opened.

putpoint (op, x, y)

{

If (free > df_size) then

Error: "Display file full"

seg_size [now_open] += 1

df_op [free] = op 

df_x [free] = x

df_y [free] = y

free ++

}

make_pic_current ()

{

If (erase_flag == 1) then

erase ();

erase_flag = 0

for (i = 0 to num_seg)

{

If (seg_size [i] != 0 & visibility == 1) then

build_transform (i)

interpret (seg_start [i], seg_size [i]);

}

delete_seg (0)

}  

Segments In Computer Graphics

Cohen Sutherland In Computer Graphics

Comment your views on this Article :)


Thank you for visiting my blog :)


No comments

Comment your views on this article

Powered by Blogger.