On Wed, Jul 13, 2011 at 09:30:46PM -0400, Hezekiah M. Carty wrote:
> While trying to create a coarse cross-hatch pattern on a plot, I ran
> into an issue with plpat.  When plpat is called, it does not set
> plsc->patt, the plot stream's fill-pattern flag.  This flag indicates
> that filled polygons should be drawn with the defined pattern rather
> than with a solid color.  It took me a while to track the source of
> this problem down because the second page of PLplot's example 15 uses
> plpat successfully.  The reason this works is because plpsty is called
> with a non-zero value before any calls to plpat are made.  plpsty sets
> the plsc->patt flag, so the changes made my plpat propagate along to
> subsequent fill calls.
> 
> The simple fix for this problem is to set the plsc->patt flag in
> c_plpat.  My only concern is that this change to plpat may
> significantly alter the output of programs using PLplot which are
> relying on this seemingly incorrect behavior.  Is it enough to change
> plpat to set plsc->patt and add an entry in the release notes
> explaining the change?
> 
> Another relatively minor issue is that the fill pattern can not be
> reset with a call to plpat.  plpsty(0) must be called in order to go
> back to drawing with filled polygons.
> 
> I have filed a bug report here:
> 
> https://sourceforge.net/tracker/?func=detail&aid=3366397&group_id=2915&atid=102915
> 
> I'm happy to implement the fix once a decision is made on the best approach.

Hez,

There are more problems that just the ones you've noticed. Both the pllegend
and plbuf code just save / restore plsc->patt and not the actual pattern 
information so any custom pattern created with plpat will be lost. 

I would suggest :
1) plspat set plsc->patt to some other value (say 255) 
2) Code which saves / restores plsc->patt checks for this value and then save
the fill pattern if required.
3) Update one of the examples to more thoroughly test all this pattern code
to check it works and demonstrate the possibilities.
4) I think that calling plpsty(0) to reset to the (predefined) solid fill 
pattern
is fine, but this is not documented and should be!

(Actually don't use a hard-coded value of 255, make this a macro so it is 
clearer
and can be changed if it is ever needed. I'd use a large value so if anyone ever
wants to add more pre-defined patterns it won't interefere. Negative values have
a different meaning, or I would suggest that.)

If you are still happy to fix this, then feel free.

Andrew

------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to