Hi, I made the original post on plplot-general list, concerning the difficulties encountered in extending the clipping region/disabling clipping which gave rise to the discussion about the plgvpw adjustment, so I come back to the clipping problem. Actually, giving a deeper look at the code, I noticed that the instruments for doing clip/unclip are already there, so I propose this function for clipping/unclipping which makes in C a better job than what I was trying to do in Fortran; I understand from the discussion that it is unlikely that the plplot API may be extended, however I think that it would be useful to have some kind of control on viewport clipping without having to do many not so intuitive calls, so here is my proposal.
        Best regards, and thank you for the discussion, Davide
#include "plplotP.h"

/*

Control viewport clipping state of current page/subpage

mode (PLINT, input)

 0 restore clipping to previous state (makes sense if plsclip
   has been previously called with mode = 1 or mode = 2 for the
   current page/subpage, otherwise results are unpredictable)
 1 disable clipping (clip area is now the whole viewport)
 2 disable clipping (clip area is now the whole subpage)

*/

void c_plsclip(PLINT mode)
{
  static PLINT crxmin=-1, crxmax=-1, crymin=-1, crymax=-1;
  PLINT pxmin, pxmax, pymin, pymax;

  if (mode == 0) {
    /* uninitialised case, return */
    if (crxmin == -1) return;
    /* reset clip limits to original values */
    plP_sclp(crxmin, crxmax, crymin, crymax);
  } else if (mode == 1) {
    /* disable clipping (clip area is now the whole viewport) */
    /* remember original values */
    plP_gclp(&crxmin, &crxmax, &crymin, &crymax);
    /* get page physical limits */
    plP_gphy(&pxmin, &pxmax, &pymin, &pymax);
    /* set clip limits to physical limits */
    plP_sclp(pxmin, pxmax, pymin, pymax);
  } else if (mode == 2) {
    /* disable clipping (clip area is now the whole subpage) */
    /* remember original values */
    plP_gclp(&crxmin, &crxmax, &crymin, &crymax);
    /* get subpage limits */
    pxmin = plsc->sppxmi; pxmax = plsc->sppxma;
    pymin = plsc->sppymi; pymax = plsc->sppyma;
    /* set clip limits to subpage limits */
    plP_sclp(pxmin, pxmax, pymin, pymax);
  }

}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to