Blender
V3.3
|
#include "potracelib.h"
Go to the source code of this file.
Functions | |
void | ED_gpencil_trace_bitmap_print (FILE *f, const potrace_bitmap_t *bm) |
potrace_bitmap_t * | ED_gpencil_trace_bitmap_new (int32_t w, int32_t h) |
void | ED_gpencil_trace_bitmap_free (const potrace_bitmap_t *bm) |
void | ED_gpencil_trace_bitmap_invert (const potrace_bitmap_t *bm) |
void | ED_gpencil_trace_image_to_bitmap (struct ImBuf *ibuf, const potrace_bitmap_t *bm, float threshold) |
void | ED_gpencil_trace_data_to_strokes (struct Main *bmain, potrace_state_t *st, struct Object *ob, struct bGPDframe *gpf, int32_t offset[2], float scale, float sample, int32_t resolution, int32_t thickness) |
#define BM_ALLBITS (~(potrace_word)0) |
Definition at line 23 of file gpencil_trace.h.
Definition at line 38 of file gpencil_trace.h.
Definition at line 36 of file gpencil_trace.h.
#define BM_HIBIT (((potrace_word)1) << (BM_WORDBITS - 1)) |
Definition at line 22 of file gpencil_trace.h.
#define bm_index | ( | bm, | |
x, | |||
y | |||
) | (&bm_scanline(bm, y)[(x) / BM_WORDBITS]) |
Definition at line 26 of file gpencil_trace.h.
Definition at line 39 of file gpencil_trace.h.
#define bm_mask | ( | x | ) | (BM_HIBIT >> ((x) & (BM_WORDBITS - 1))) |
Definition at line 27 of file gpencil_trace.h.
Definition at line 40 of file gpencil_trace.h.
Definition at line 28 of file gpencil_trace.h.
Definition at line 29 of file gpencil_trace.h.
Definition at line 25 of file gpencil_trace.h.
Definition at line 37 of file gpencil_trace.h.
Definition at line 33 of file gpencil_trace.h.
Definition at line 31 of file gpencil_trace.h.
Definition at line 34 of file gpencil_trace.h.
Definition at line 35 of file gpencil_trace.h.
Definition at line 32 of file gpencil_trace.h.
#define BM_WORDBITS (8 * BM_WORDSIZE) |
Definition at line 21 of file gpencil_trace.h.
#define BM_WORDSIZE ((int)sizeof(potrace_word)) |
Definition at line 20 of file gpencil_trace.h.
#define GPENCIL_TRACE_MODE_SEQUENCE 1 |
Definition at line 44 of file gpencil_trace.h.
#define GPENCIL_TRACE_MODE_SINGLE 0 |
Definition at line 43 of file gpencil_trace.h.
void ED_gpencil_trace_bitmap_free | ( | const potrace_bitmap_t * | bm | ) |
Free a trace bitmap
bm | Trace bitmap |
Definition at line 80 of file gpencil_trace_utils.c.
References bm, free(), MEM_SAFE_FREE, and NULL.
Referenced by gpencil_trace_image().
void ED_gpencil_trace_bitmap_invert | ( | const potrace_bitmap_t * | bm | ) |
Invert the given bitmap (Black to White)
bm | Trace bitmap |
Definition at line 88 of file gpencil_trace_utils.c.
References bm, BM_ALLBITS, bm_scanline, and y.
Return new un-initialized trace bitmap
w | Width in pixels |
h | Height in pixels |
Definition at line 59 of file gpencil_trace_utils.c.
References bm, BM_WORDBITS, BM_WORDSIZE, free(), MEM_mallocN, NULL, and w().
Referenced by gpencil_trace_image().
void ED_gpencil_trace_bitmap_print | ( | FILE * | f, |
const potrace_bitmap_t * | bm | ||
) |
void ED_gpencil_trace_data_to_strokes | ( | struct Main * | bmain, |
potrace_state_t * | st, | ||
struct Object * | ob, | ||
struct bGPDframe * | gpf, | ||
int32_t | offset[2], | ||
float | scale, | ||
float | sample, | ||
int32_t | resolution, | ||
int32_t | thickness | ||
) |
Convert Potrace Bitmap to Grease Pencil strokes
st | Data with traced data |
ob | Target grease pencil object |
offset | Offset to center |
scale | Scale of the output |
sample | Sample distance to distribute points |
Definition at line 194 of file gpencil_trace_utils.c.
References add_bezier(), add_point(), BKE_gpencil_free_stroke(), BKE_gpencil_material_find_index_by_name_prefix(), BKE_gpencil_object_material_new(), BKE_gpencil_stroke_add(), BKE_gpencil_stroke_geometry_update(), BKE_gpencil_stroke_length(), BKE_gpencil_stroke_sample(), BLI_remlink(), Freestyle::c, copy_v2_v2(), copy_v4_v4(), Object::data, MaterialGPencilStyle::fill_rgba, MaterialGPencilStyle::flag, GP_MATERIAL_FILL_SHOW, GP_MATERIAL_IS_FILL_HOLDOUT, GP_MATERIAL_IS_STROKE_HOLDOUT, GP_MATERIAL_STROKE_SHOW, Material::gp_style, blender::math::length(), MAX_LENGTH, NULL, offset, sample, usdtokens::st(), MaterialGPencilStyle::stroke_rgba, bGPDframe::strokes, Object::totcol, bGPDstroke::totpoints, x, and y.
Referenced by gpencil_trace_image().
void ED_gpencil_trace_image_to_bitmap | ( | struct ImBuf * | ibuf, |
const potrace_bitmap_t * | bm, | ||
float | threshold | ||
) |
Convert image to BW bitmap for tracing
ibuf | ImBuf of the image |
bm | Trace bitmap |
Definition at line 130 of file gpencil_trace_utils.c.
References bm, BM_PUT, color, mul_v3_fl(), pixel_at_index(), usdtokens::rgba(), threshold, x, ImBuf::x, y, and ImBuf::y.
Referenced by gpencil_trace_image().