Date:2010-09-29 01:33:40 (8 years 2 months ago)
Author:Werner Almesberger
Commit:f2963b9e2afe2b54534d695be740dc2cc4e99d04
Message:Added a thin black border above and below the projections.

- solidify/style.h (PROJECTION_BORDER): number of pixels to leave dark above
and below the face
- solidify/level.c (draw_xz, draw_zy, level): increase projection z size by
twice the border width
- solidify/level.c (draw_xz, draw_zy): offset z coordinates by the border
Files: solidify/level.c (5 diffs)
solidify/style.h (1 diff)

Change Details

solidify/level.c
9595static void draw_xz(GtkWidget *widget, struct face *f, int y)
9696{
9797    int zm = f->a->max_z;
98    int sz = f->sz*z0_scale(f);
98    int sz = f->sz*z0_scale(f)+2*PROJECTION_BORDER;
9999    int x, z;
100100    double z0;
101101    guchar *rgbbuf, *p;
...... 
111111            z0 = face_z0(f, x, y);
112112            if (z == UNDEF || z == z0) {
113113                aa_line(rgbbuf, x,
114                    (zm-z0)*z0_scale(f), (zm-z0)*z0_scale(f),
114                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
115                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
115116                    sz-1, f->sx,
116117                    (uint8_t *) "\0\0\xff", vpoint);
117118                                continue;
118119                        }
119120            if (z > z0) {
120121                aa_line(rgbbuf, x,
121                    (zm-z)*z0_scale(f), (zm-z0)*z0_scale(f),
122                    (zm-z)*z0_scale(f)+PROJECTION_BORDER,
123                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
122124                    sz-1, f->sx,
123125                    (uint8_t *) "\0\xff\0", vpoint);
124126            } else {
125127                aa_line(rgbbuf, x,
126                    (zm-z0)*z0_scale(f), (zm-z)*z0_scale(f),
128                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
129                    (zm-z)*z0_scale(f)+PROJECTION_BORDER,
127130                    sz-1, f->sx,
128131                    (uint8_t *) "\xff\0\0", vpoint);
129132            }
...... 
139142static void draw_zy(GtkWidget *widget, struct face *f, int x)
140143{
141144    int zm = f->a->max_z;
142    int sz = f->sz*z0_scale(f);
145    int sz = f->sz*z0_scale(f)+2*PROJECTION_BORDER;
143146    int y, z;
144147    double z0;
145148    guchar *rgbbuf, *p;
...... 
155158            z0 = face_z0(f, x, f->sy-y-1);
156159            if (z == UNDEF || z == z0) {
157160                aa_line(rgbbuf, y,
158                    (zm-z0)*z0_scale(f), (zm-z0)*z0_scale(f),
161                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
162                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
159163                    sz-1, sz,
160164                    (uint8_t *) "\0\0\xff", hpoint);
161165                continue;
162166            }
163167            if (z > z0) {
164168                aa_line(rgbbuf, y,
165                    (zm-z)*z0_scale(f), (zm-z0)*z0_scale(f),
169                    (zm-z)*z0_scale(f)+PROJECTION_BORDER,
170                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
166171                    sz-1, sz,
167172                    (uint8_t *) "\0\xff\0", hpoint);
168173            } else {
169174                aa_line(rgbbuf, y,
170                    (zm-z0)*z0_scale(f), (zm-z)*z0_scale(f),
175                    (zm-z0)*z0_scale(f)+PROJECTION_BORDER,
176                    (zm-z)*z0_scale(f)+PROJECTION_BORDER,
171177                    sz-1, sz,
172178                    (uint8_t *) "\xff\0\0", hpoint);
173179            }
...... 
298304        GDK_POINTER_MOTION_MASK);
299305
300306    gtk_widget_set_size_request(xy, f->sx, f->sy);
301    gtk_widget_set_size_request(xz, f->sx, f->sz*z0_scale(f));
302    gtk_widget_set_size_request(zy, f->sz*z0_scale(f), f->sy);
307    gtk_widget_set_size_request(xz,
308        f->sx, f->sz*z0_scale(f)+2*PROJECTION_BORDER);
309    gtk_widget_set_size_request(zy,
310        f->sz*z0_scale(f)+2*PROJECTION_BORDER, f->sy);
303311
304312    gtk_table_set_row_spacings(GTK_TABLE(tab), 2);
305313    gtk_table_set_col_spacings(GTK_TABLE(tab), 2);
solidify/style.h
2626#define SLOWEST_ROT 3 /* thrice the half-diagonal */
2727#define FASTEST_ROT 2 /* one pixel in distance of 2 pixels */
2828#define DIST_STEPS 5 /* fastest shift is 5 px/wheel step */
29#define PROJECTION_BORDER 2 /* pixels around projections */
2930
3031
3132void init_style(GdkDrawable *da);

Archive Download the corresponding diff file

Branches:
master



interactive