Mercurial > hg > dmlib
annotate src/dmlinefunc.h @ 2298:b5abfff07ca9
Add new DMGrowBuf helper functions dmGrowBufCopyOffsSize() and
dmGrowBufConstCopyOffsSize().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 04 Jul 2019 10:54:16 +0300 |
parents | f654435df15e |
children |
rev | line source |
---|---|
0 | 1 |
2 #define DM_DRAWLINE_NAME dmDrawLine8 | |
3 #define DM_DRAWLINE_DST_BYTES 1 | |
4 #define DM_DRAWLINE_DST_TYPE Uint8 | |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
5 #define DM_DRAWLINE_INNER pix[y0 + x0] = col; |
0 | 6 #include "dmdrawline.h" |
7 | |
8 | |
9 #define DM_DRAWLINE_NAME dmDrawLine32 | |
10 #define DM_DRAWLINE_DST_BYTES 4 | |
11 #define DM_DRAWLINE_DST_TYPE Uint32 | |
149
c2bf01e180a3
Hmm, two missing lines. Added back. O_o
Matti Hamalainen <ccr@tnsp.org>
parents:
133
diff
changeset
|
12 #define DM_DRAWLINE_INNER pix[y0 + x0] = col; |
0 | 13 #include "dmdrawline.h" |
14 | |
22
997e26f17946
Initial fixes for getting the line drawing functions "working".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
15 |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
16 #define DM_DRAWLINE_NAME dmDrawLine8Transparent |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
17 #define DM_DRAWLINE_DST_BYTES 1 |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
18 #define DM_DRAWLINE_DST_TYPE Uint8 |
0 | 19 #define DM_DRAWLINE_INNER \ |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
20 pix[y0 + x0] = ((int)pix[y0 + x0] + col) >> 1; |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
21 #include "dmdrawline.h" |
0 | 22 |
23 | |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
24 #define DM_DRAWLINE_NAME dmDrawLine32Transparent |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
25 #define DM_DRAWLINE_DST_BYTES 4 |
971
f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
26 #define DM_DRAWLINE_DST_TYPE DMColor |
f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
27 #define DM_DRAWLINE_INIT const DMColor *c = (DMColor*) &col; |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
28 #define DM_DRAWLINE_INNER \ |
971
f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
29 const DMColor q = pix[y0 + x0]; \ |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
30 const int qr = (q.r + c->r) >> 1, qg = (q.g + c->g) >> 1, qb = (q.b + c->b) >> 1; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
31 pix[y0 + x0].r = qr; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
32 pix[y0 + x0].g = qg; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
33 pix[y0 + x0].b = qb; |
0 | 34 #include "dmdrawline.h" |
35 | |
36 | |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
37 |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
38 |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
39 #define DM_DRAWLINE_NAME dmDrawLine8Saturate |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
40 #define DM_DRAWLINE_DST_BYTES 1 |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
41 #define DM_DRAWLINE_DST_TYPE Uint8 |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
42 #define DM_DRAWLINE_INNER \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
43 const int q = pix[y0 + x0] + col; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
44 pix[y0 + x0] = q < 255 ? q : 255; |
0 | 45 #include "dmdrawline.h" |
46 | |
47 | |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
48 #define DM_DRAWLINE_NAME dmDrawLine32Saturate |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
49 #define DM_DRAWLINE_DST_BYTES 4 |
971
f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
50 #define DM_DRAWLINE_DST_TYPE DMColor |
f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
51 #define DM_DRAWLINE_INIT const DMColor *c = (DMColor*) &col; |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
52 #define DM_DRAWLINE_INNER \ |
971
f654435df15e
Rename DMRGBA32 struct to DMColor and remove the original redundant DMColor
Matti Hamalainen <ccr@tnsp.org>
parents:
812
diff
changeset
|
53 const DMColor q = pix[y0 + x0]; \ |
133
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
54 const int qr = q.r + c->r, qg = q.g + c->g, qb = q.b + c->b; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
55 pix[y0 + x0].r = qr < 255 ? qr : 255; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
56 pix[y0 + x0].g = qg < 255 ? qg : 255; \ |
92cc5e1fa180
Some work on line drawing routines.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
57 pix[y0 + x0].b = qb < 255 ? qb : 255; |
0 | 58 #include "dmdrawline.h" |
59 |