mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-22 23:04:16 +02:00
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
This commit is contained in:
parent
761002e0e5
commit
f2963b9e2a
@ -95,7 +95,7 @@ static void draw_image(GtkWidget *widget, struct face *f, int osd)
|
||||
static void draw_xz(GtkWidget *widget, struct face *f, int y)
|
||||
{
|
||||
int zm = f->a->max_z;
|
||||
int sz = f->sz*z0_scale(f);
|
||||
int sz = f->sz*z0_scale(f)+2*PROJECTION_BORDER;
|
||||
int x, z;
|
||||
double z0;
|
||||
guchar *rgbbuf, *p;
|
||||
@ -111,19 +111,22 @@ static void draw_xz(GtkWidget *widget, struct face *f, int y)
|
||||
z0 = face_z0(f, x, y);
|
||||
if (z == UNDEF || z == z0) {
|
||||
aa_line(rgbbuf, x,
|
||||
(zm-z0)*z0_scale(f), (zm-z0)*z0_scale(f),
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
sz-1, f->sx,
|
||||
(uint8_t *) "\0\0\xff", vpoint);
|
||||
continue;
|
||||
}
|
||||
if (z > z0) {
|
||||
aa_line(rgbbuf, x,
|
||||
(zm-z)*z0_scale(f), (zm-z0)*z0_scale(f),
|
||||
(zm-z)*z0_scale(f)+PROJECTION_BORDER,
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
sz-1, f->sx,
|
||||
(uint8_t *) "\0\xff\0", vpoint);
|
||||
} else {
|
||||
aa_line(rgbbuf, x,
|
||||
(zm-z0)*z0_scale(f), (zm-z)*z0_scale(f),
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
(zm-z)*z0_scale(f)+PROJECTION_BORDER,
|
||||
sz-1, f->sx,
|
||||
(uint8_t *) "\xff\0\0", vpoint);
|
||||
}
|
||||
@ -139,7 +142,7 @@ static void draw_xz(GtkWidget *widget, struct face *f, int y)
|
||||
static void draw_zy(GtkWidget *widget, struct face *f, int x)
|
||||
{
|
||||
int zm = f->a->max_z;
|
||||
int sz = f->sz*z0_scale(f);
|
||||
int sz = f->sz*z0_scale(f)+2*PROJECTION_BORDER;
|
||||
int y, z;
|
||||
double z0;
|
||||
guchar *rgbbuf, *p;
|
||||
@ -155,19 +158,22 @@ static void draw_zy(GtkWidget *widget, struct face *f, int x)
|
||||
z0 = face_z0(f, x, f->sy-y-1);
|
||||
if (z == UNDEF || z == z0) {
|
||||
aa_line(rgbbuf, y,
|
||||
(zm-z0)*z0_scale(f), (zm-z0)*z0_scale(f),
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
sz-1, sz,
|
||||
(uint8_t *) "\0\0\xff", hpoint);
|
||||
continue;
|
||||
}
|
||||
if (z > z0) {
|
||||
aa_line(rgbbuf, y,
|
||||
(zm-z)*z0_scale(f), (zm-z0)*z0_scale(f),
|
||||
(zm-z)*z0_scale(f)+PROJECTION_BORDER,
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
sz-1, sz,
|
||||
(uint8_t *) "\0\xff\0", hpoint);
|
||||
} else {
|
||||
aa_line(rgbbuf, y,
|
||||
(zm-z0)*z0_scale(f), (zm-z)*z0_scale(f),
|
||||
(zm-z0)*z0_scale(f)+PROJECTION_BORDER,
|
||||
(zm-z)*z0_scale(f)+PROJECTION_BORDER,
|
||||
sz-1, sz,
|
||||
(uint8_t *) "\xff\0\0", hpoint);
|
||||
}
|
||||
@ -298,8 +304,10 @@ void level(GtkWidget *canvas, struct face *f)
|
||||
GDK_POINTER_MOTION_MASK);
|
||||
|
||||
gtk_widget_set_size_request(xy, f->sx, f->sy);
|
||||
gtk_widget_set_size_request(xz, f->sx, f->sz*z0_scale(f));
|
||||
gtk_widget_set_size_request(zy, f->sz*z0_scale(f), f->sy);
|
||||
gtk_widget_set_size_request(xz,
|
||||
f->sx, f->sz*z0_scale(f)+2*PROJECTION_BORDER);
|
||||
gtk_widget_set_size_request(zy,
|
||||
f->sz*z0_scale(f)+2*PROJECTION_BORDER, f->sy);
|
||||
|
||||
gtk_table_set_row_spacings(GTK_TABLE(tab), 2);
|
||||
gtk_table_set_col_spacings(GTK_TABLE(tab), 2);
|
||||
|
@ -26,6 +26,7 @@ extern GdkGC *gc_osd;
|
||||
#define SLOWEST_ROT 3 /* thrice the half-diagonal */
|
||||
#define FASTEST_ROT 2 /* one pixel in distance of 2 pixels */
|
||||
#define DIST_STEPS 5 /* fastest shift is 5 px/wheel step */
|
||||
#define PROJECTION_BORDER 2 /* pixels around projections */
|
||||
|
||||
|
||||
void init_style(GdkDrawable *da);
|
||||
|
Loading…
Reference in New Issue
Block a user