summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 627d593)
raw | patch | inline | side by side (parent: 627d593)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 16 Dec 2007 23:28:17 +0000 (23:28 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 16 Dec 2007 23:28:17 +0000 (23:28 +0000) |
src/display/guideline.cpp | patch | blob | history | |
src/display/guideline.h | patch | blob | history |
index b029be7a0ee91f02ea162ff3151b314d7c87af26..154b7c3b8aea59f34781c421644593018e2f5ac7 100644 (file)
#define __SP_GUIDELINE_C__
/*
- * Infinite horizontal/vertical line
+ * Horizontal/vertical but can also be angled line
*
- * Author:
+ * Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
+ * Johan Engelen
*
* Copyright (C) 2000-2002 Lauris Kaplinski
+ * Copyright (C) 2007 Johan Engelen
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
unsigned int const b = NR_RGBA32_B (gl->rgba);
unsigned int const a = NR_RGBA32_A (gl->rgba);
- int p0, p1, step;
- unsigned char *d;
-
if (gl->normal[Geom::Y] == 0.) {
-
if (gl->position < buf->rect.x0 || gl->position >= buf->rect.x1) {
return;
}
- p0 = buf->rect.y0;
- p1 = buf->rect.y1;
- step = buf->buf_rowstride;
- d = buf->buf + 3 * (gl->position - buf->rect.x0);
-
- } else {
+ int p0 = buf->rect.y0;
+ int p1 = buf->rect.y1;
+ int step = buf->buf_rowstride;
+ unsigned char *d = buf->buf + 3 * (gl->position - buf->rect.x0);
+ for (int p = p0; p < p1; p++) {
+ d[0] = NR_COMPOSEN11_1111(r, a, d[0]);
+ d[1] = NR_COMPOSEN11_1111(g, a, d[1]);
+ d[2] = NR_COMPOSEN11_1111(b, a, d[2]);
+ d += step;
+ }
+ } else if (gl->normal[Geom::X] == 0.) {
if (gl->position < buf->rect.y0 || gl->position >= buf->rect.y1) {
return;
}
- p0 = buf->rect.x0;
- p1 = buf->rect.x1;
- step = 3;
- d = buf->buf + (gl->position - buf->rect.y0) * buf->buf_rowstride;
- }
+ int p0 = buf->rect.x0;
+ int p1 = buf->rect.x1;
+ int step = 3;
+ unsigned char *d = buf->buf + (gl->position - buf->rect.y0) * buf->buf_rowstride;
- for (int p = p0; p < p1; p++) {
- d[0] = NR_COMPOSEN11_1111(r, a, d[0]);
- d[1] = NR_COMPOSEN11_1111(g, a, d[1]);
- d[2] = NR_COMPOSEN11_1111(b, a, d[2]);
- d += step;
+ for (int p = p0; p < p1; p++) {
+ d[0] = NR_COMPOSEN11_1111(r, a, d[0]);
+ d[1] = NR_COMPOSEN11_1111(g, a, d[1]);
+ d[2] = NR_COMPOSEN11_1111(b, a, d[2]);
+ d += step;
+ }
+ } else {
+ // render angled line
}
}
index 85f39754ba76681235cc812653084478803539d3..a9bfc809bf96c1432dba5dd678a2b8aaceda80e7 100644 (file)
--- a/src/display/guideline.h
+++ b/src/display/guideline.h
#define __SP_GUIDELINE_H__
/*
- * Infinite horizontal/vertical line; the visual representation of SPGuide.
+ * The visual representation of SPGuide.
*
- * Author:
+ * Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
+ * Johan Engelen
*
* Copyright (C) 2000-2002 Lauris Kaplinski
+ * Copyright (C) 2007 Johan Engelen
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
int position;
Geom::Point normal;
-// unsigned int vertical : 1;
+
unsigned int sensitive : 1;
};