FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

new object attribute clip/noclip · gnuplot/gnuplot@a18230d · GitHub

Repository navigation

Commit a18230d

Browse files
authored andcommitted
new object attribute clip/noclip
1 parent abbb234 commit a18230d

9 files changed

Lines changed: 188 additions & 37 deletions

File tree

‎ChangeLog‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2013-10-18 Christoph Bersch <usenet@bersch.net>
2+
3+
* src/gadgets.h src/graphics.c src/graphics.h src/save.c src/set.c
4+
demo/all.dem demo/clipobject.dem docs/gnuplot.doc:
5+
New object attribute clip/noclip. "clip" retains the current default,
6+
clip to plot boundary unless one or more vertices are given in screen
7+
coordinates. "noclip" clips to the canvas.
8+
19
2013-10-18 Shigeharu Takeno <shige@iee.niit.ac.jp>
210

311
* docs/gnuplot-ja.doc term-ja.diff: Sync translation to version 1.830

‎demo/all.dem‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# $Id: all.dem,v 1.53 2012/11/24 21:54:29 sfeam Exp $
2+
# $Id: all.dem,v 1.54 2013/05/24 23:02:15 sfeam Exp $
33
#
44
# Executes all demos (OK, MOST demos) in this directory.
55
# This serves as a series of unit tests for non-interactive capabilities.
@@ -294,6 +294,10 @@ print "********************** file rectangle.dem *********************"
294294
load "rectangle.dem"
295295
reset
296296

297+
print "********************** file clipobject.dem *********************"
298+
load "clipobject.dem"
299+
reset
300+
297301
print "********************** file approximate.dem *********************"
298302
load "approximate.dem"
299303
reset

‎demo/clipobject.dem‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#
2+
# Demo and test for clipping applied to objects.
3+
# axis coordinates run from [-1:1]
4+
# graph coordinates from from [0:1]
5+
# screen coordinates from from [0.2:0.8]
6+
#
7+
reset
8+
9+
set title "Default object clipping"
10+
set label 1 at graph 0.5, 0.9 center
11+
set label 1 "Outer = screen coords\nMiddle = graph coords\nInner = axis coords"
12+
13+
set xrange[-1:1]
14+
set yrange[-1:1]
15+
set macros
16+
fs="fillstyle solid 1.0 border lc rgb 'black' lw 2"
17+
18+
set lmargin at screen 0.2
19+
set rmargin at screen 0.8
20+
set tmargin at screen 0.8
21+
set bmargin at screen 0.2
22+
23+
set object 1 rectangle from screen 0.1,screen 0.1 to screen 0.4, screen 0.4
24+
set object 1 fc rgb '#880000' @fs
25+
26+
set object 11 rectangle from first -1.1,first -1.1 to first -0.9, first -0.9
27+
set object 11 fc rgb 'red' @fs
28+
set object 11 front
29+
30+
set object 111 rectangle from graph -.1, -.1 to graph .1,.1
31+
set object 111 fc rgb "#DDAA00' @fs
32+
33+
34+
set object 2 circle at screen 0.2, screen 0.8 radius screen 0.1
35+
set object 2 fc rgb '#008800' @fs
36+
37+
set object 22 circle at first -1, 1 radius first .15
38+
set object 22 fc rgb 'green' @fs
39+
set object 22 front
40+
41+
set object 222 circle at graph 0, graph 1 radius graph 0.1
42+
set object 222 fc rgb '#00DDAA' @fs
43+
44+
45+
set object 3 polygon from screen 0.6,screen 0.6 rto 0.4,0 rto -0.2,0.4
46+
set object 3 fc rgb '#BBBB00' @fs
47+
48+
set object 33 polygon from first 0.8,first 0.8 rto first 0.4,0 rto first -0.2, 0.4
49+
set object 33 fc rgb 'yellow' @fs
50+
set object 33 front
51+
52+
set object 333 polygon from graph .8,graph .8 rto graph 0.4,0 rto graph -0.2, 0.4
53+
set object 333 fc rgb '#AAAA88' @fs
54+
55+
set object 4 ellipse at screen 0.8, screen 0.2 size screen 0.3, 0.25
56+
set object 4 fc rgb '#4444bb' @fs
57+
58+
set object 44 ellipse at first 1, -1 size first 0.4, first 0.25
59+
set object 44 fc rgb "cyan" @fs
60+
set object 44 front
61+
62+
set object 444 ellipse at graph 1,graph 0 size first 0.8, first 0.5
63+
set object 444 fc rgb '#6666ff' @fs
64+
65+
66+
plot 0
67+
68+
pause -1 "Hit return to continue"
69+
70+
set title "Object property 'noclip'"
71+
72+
do for [i=1:4]{ set object i noclip; set object i*11 noclip; set object i*111 noclip; }
73+
74+
plot 0
75+
76+
pause -1 "Hit return to continue"
77+
78+
reset

‎docs/gnuplot.doc‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
C RCS $Id: gnuplot.doc,v 1.828 2013/10/07 21:03:48 sfeam Exp $
1+
C RCS $Id: gnuplot.doc,v 1.830 2013/10/10 22:23:03 sfeam Exp $
22
C
33
C Copyright (C) 1986 - 1993, 1998, 1999, 2000, 2001, 2004 Thomas Williams, Colin Kelley et al.
44
C
@@ -9799,7 +9799,8 @@ Ffigure_missing
97999799
Syntax:
98009800
set object <index>
98019801
<object-type> <object-properties>
9802-
{front|back|behind} {fc|fillcolor <colorspec>} {fs <fillstyle>}
9802+
{front|back|behind} {clip|noclip}
9803+
{fc|fillcolor <colorspec>} {fs <fillstyle>}
98039804
{default} {lw|linewidth <width>}
98049805
unset object <index>
98059806

@@ -9813,6 +9814,10 @@ Ffigure_missing
98139814
set object rectangle from screen 0,0 to screen 1,1 behind
98149815
can be used to provide a colored background for the entire graph or page.
98159816

9817+
By default, objects are clipped to the graph boundary unless one or more
9818+
vertices are given in screen coordinates. Setting `noclip` will disable
9819+
clipping to the graph boundary, but will still clip against the screen size.
9820+
98169821
The fill color of the object is taken from the <colorspec>. `fillcolor`
98179822
may be abbreviated `fc`. The fill style is taken from <fillstyle>.
98189823
See `colorspec` and `fillstyle`. If the keyword `default` is given,
@@ -10986,8 +10991,8 @@ Ffigure_missing
1098610991
Syntax:
1098710992
set style arrow <n> <arrowstyle>
1098810993
set style boxplot <boxplot style options>
10989-
set style circle radius <size>
10990-
set style ellipse size <size> units {xy|xx|yy}
10994+
set style circle radius <size> {clip|noclip}
10995+
set style ellipse size <size> units {xy|xx|yy} {clip|noclip}
1099110996
set style fill <fillstyle>
1099210997
set style histogram <histogram style options>
1099310998
set style line <n> <linestyle>
@@ -11435,13 +11440,17 @@ Ffigure_missing
1143511440
?show style circle
1143611441

1143711442
Syntax:
11438-
set style circle {radius {graph|screen} <R>} {{no}wedge}
11443+
set style circle {radius {graph|screen} <R>}
11444+
{{no}wedge}
11445+
{clip|noclip}
1143911446

1144011447
This command sets the default radius used in plot style "with circles". It
1144111448
applies to data plots with only 2 columns of data (x,y) and to function plots.
1144211449
The default is "set style circle radius graph 0.02". `Nowedge` disables
1144311450
drawing of the two radii that connect the ends of an arc to the center.
11444-
The default is `wedge`. This parameter has no effect on full circles.
11451+
The default is `wedge`. This parameter has no effect on full circles. `Clip`
11452+
clips the circle at the plot boundaries, `noclip` disables this. Default is
11453+
`clip`.
1144511454

1144611455
4 set style rectangle
1144711456
?commands set style rectangle
@@ -11479,6 +11488,7 @@ Ffigure_missing
1147911488
set style ellipse {units xx|xy|yy}
1148011489
{size {graph|screen} <a>, {{graph|screen} <b>}}
1148111490
{angle <angle>}
11491+
{clip|noclip}
1148211492

1148311493
This command governs whether the diameters of ellipses are interpreted in
1148411494
the same units or not.
@@ -11508,6 +11518,9 @@ Ffigure_missing
1150811518
`angle` keyword. The orientation, which is defined as the angle between the
1150911519
major axis of the ellipse and the plot's x axis, must be given in degrees.
1151011520

11521+
`Clip` clips the ellipse at the plot boundaries, `noclip` disables this.
11522+
Default is `clip`.
11523+
1151111524
For defining ellipse objects, see `set object ellipse`;
1151211525
for the 2D plot style, see `ellipses`.
1151311526
4 set style textbox

‎src/gadgets.h‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,19 @@ typedef struct polygon {
157157
t_position *vertex; /* Array of vertices */
158158
} t_polygon;
159159

160+
typedef enum en_clip_object {
161+
OBJ_CLIP, /* Clip to graph unless coordinate type is screen */
162+
OBJ_NOCLIP, /* Clip to canvas, never to graph */
163+
OBJ_ALWAYS_CLIP /* Not yet implemented */
164+
} t_clip_object;
165+
160166
/* Datastructure for 'set object' */
161167
typedef struct object {
162168
struct object *next;
163169
int tag;
164170
int layer; /* behind or back or front */
165171
int object_type; /* OBJ_RECTANGLE */
172+
t_clip_object clip;
166173
fill_style_type fillstyle;
167174
lp_style_type lp_properties;
168175
union o {t_rectangle rectangle; t_circle circle; t_ellipse ellipse; t_polygon polygon;} o;
@@ -524,24 +531,24 @@ extern fill_style_type default_fillstyle;
524531
#ifdef EAM_OBJECTS
525532
/* Warning: C89 does not like the union initializers */
526533
extern struct object default_rectangle;
527-
#define DEFAULT_RECTANGLE_STYLE { NULL, -1, 0, OBJ_RECTANGLE, \
534+
#define DEFAULT_RECTANGLE_STYLE { NULL, -1, 0, OBJ_RECTANGLE, OBJ_CLIP, \
528535
{FS_SOLID, 100, 0, BLACK_COLORSPEC}, \
529536
{0, LT_BACKGROUND, 0, 0, 1.0, 0.0, BACKGROUND_COLORSPEC}, \
530537
{.rectangle = {0, {0,0,0,0.,0.,0.}, {0,0,0,0.,0.,0.}, {0,0,0,0.,0.,0.}, {0,0,0,0.,0.,0.}}} }
531538

532539
extern struct object default_circle;
533-
#define DEFAULT_CIRCLE_STYLE { NULL, -1, 0, OBJ_CIRCLE, \
540+
#define DEFAULT_CIRCLE_STYLE { NULL, -1, 0, OBJ_CIRCLE, OBJ_CLIP, \
534541
{FS_SOLID, 100, 0, BLACK_COLORSPEC}, \
535542
{0, LT_BACKGROUND, 0, 0, 1.0, 0.0, BACKGROUND_COLORSPEC}, \
536543
{.circle = {1, {0,0,0,0.,0.,0.}, {graph,0,0,0.02,0.,0.}, 0., 360., TRUE }} }
537544

538545
extern struct object default_ellipse;
539-
#define DEFAULT_ELLIPSE_STYLE { NULL, -1, 0, OBJ_ELLIPSE, \
546+
#define DEFAULT_ELLIPSE_STYLE { NULL, -1, 0, OBJ_ELLIPSE, OBJ_CLIP, \
540547
{FS_SOLID, 100, 0, BLACK_COLORSPEC}, \
541548
{0, LT_BACKGROUND, 0, 0, 1.0, 0.0, BACKGROUND_COLORSPEC}, \
542549
{.ellipse = {ELLIPSEAXES_XY, {0,0,0,0.,0.,0.}, {graph,graph,0,0.05,0.03,0.}, 0. }} }
543550

544-
#define DEFAULT_POLYGON_STYLE { NULL, -1, 0, OBJ_POLYGON, \
551+
#define DEFAULT_POLYGON_STYLE { NULL, -1, 0, OBJ_POLYGON, OBJ_CLIP, \
545552
{FS_SOLID, 100, 0, BLACK_COLORSPEC}, \
546553
{0, LT_BLACK, 0, 0, 1.0, 0.0, BLACK_COLORSPEC}, \
547554
{.polygon = {0, NULL} } }

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL