Hi Jacktby,
Did you try looking at HeapTupleSatisfiesVisibility function (in src/backend/access/heap/heapam_visibility.c) ? I think it might give you some idea.
Thanks,
Ankit