40 sw =
bm->w < 79 ?
bm->w : 79;
41 sh =
bm->w < 79 ?
bm->h :
bm->h *
sw * 44 / (79 *
bm->w);
43 for (yy =
sh - 1; yy >= 0; yy--) {
44 for (xx = 0; xx <
sw; xx++) {
46 for (
x = xx *
bm->w /
sw;
x < (xx + 1) *
bm->w /
sw;
x++) {
47 for (
y = yy *
bm->h /
sh;
y < (yy + 1) *
bm->h /
sh;
y++) {
53 fputc(d ?
'*' :
' ', f);
64 bm = (potrace_bitmap_t *)
MEM_mallocN(
sizeof(potrace_bitmap_t), __func__);
99 for (
y = 0;
y <
bm->h;
y++) {
101 for (i = 0; i < dy; i++) {
118 const float *frgba = &ibuf->
rect_float[idx * 4];
122 unsigned char *cp = (
unsigned char *)(ibuf->
rect + idx);
123 r_col[0] = (
float)cp[0] / 255.0f;
124 r_col[1] = (
float)cp[1] / 255.0f;
125 r_col[2] = (
float)cp[2] / 255.0f;
126 r_col[3] = (
float)cp[3] / 255.0f;
131 const potrace_bitmap_t *
bm,
139 pixel = (ibuf->
x *
y) +
x;
181 const float step = 1.0f / (
float)(resolution - 1);
184 for (
int32_t i = 0; i < resolution; i++) {
185 if ((!skip) || (i > 0)) {
204 #define MAX_LENGTH 100.0f
209 const float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
211 if (mat_fill_idx == -1) {
219 mat_fill_idx = ob->
totcol - 1;
222 if (mat_mask_idx == -1) {
233 mat_mask_idx = ob->
totcol - 1;
237 potrace_dpoint_t(*
c)[3];
241 const float scalef = 0.008f * scale;
243 potrace_path_t *path =
st->plist;
244 while (path !=
NULL) {
246 tag = path->curve.tag;
248 int mat_idx = path->sign ==
'+' ? mat_fill_idx : mat_mask_idx;
252 float start_point[2], last[2];
253 start_point[0] =
c[n - 1][2].x;
254 start_point[1] =
c[n - 1][2].y;
256 for (
int32_t i = 0; i < n; i++) {
258 case POTRACE_CORNER: {
274 case POTRACE_CURVETO: {
275 float cp1[2], cp2[2], cp3[2], cp4[2];
277 cp1[0] = start_point[0];
278 cp1[1] = start_point[1];
typedef float(TangentPoint)[2]
struct Material * BKE_gpencil_object_material_new(struct Main *bmain, struct Object *ob, const char *name, int *r_index)
struct bGPDstroke * BKE_gpencil_stroke_add(struct bGPDframe *gpf, int mat_idx, int totpoints, short thickness, bool insert_at_head)
void BKE_gpencil_free_stroke(struct bGPDstroke *gps)
int BKE_gpencil_material_find_index_by_name_prefix(struct Object *ob, const char *name_prefix)
float BKE_gpencil_stroke_length(const struct bGPDstroke *gps, bool use_3d)
void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps)
bool BKE_gpencil_stroke_sample(struct bGPdata *gpd, struct bGPDstroke *gps, const float dist, const bool select, const float sharp_threshold)
General operations, lookup, etc. for materials.
void BLI_kdtree_nd_() free(KDTree *tree)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void interp_v2_v2v2v2v2_cubic(float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2], float u)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
@ GP_MATERIAL_IS_STROKE_HOLDOUT
@ GP_MATERIAL_STROKE_SHOW
@ GP_MATERIAL_IS_FILL_HOLDOUT
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT BMesh * bm
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
#define bm_scanline(bm, y)
#define BM_PUT(bm, x, y, b)
void ED_gpencil_trace_data_to_strokes(Main *bmain, potrace_state_t *st, Object *ob, bGPDframe *gpf, int32_t offset[2], const float scale, const float sample, const int32_t resolution, const int32_t thickness)
static void add_point(bGPDstroke *gps, float scale, const int32_t offset[2], float x, float y)
void ED_gpencil_trace_bitmap_print(FILE *f, const potrace_bitmap_t *bm)
static void pixel_at_index(const ImBuf *ibuf, const int32_t idx, float r_col[4])
void ED_gpencil_trace_bitmap_free(const potrace_bitmap_t *bm)
static void add_bezier(bGPDstroke *gps, float scale, int32_t offset[2], int32_t resolution, float bcp1[2], float bcp2[2], float bcp3[2], float bcp4[2], const bool skip)
void ED_gpencil_trace_image_to_bitmap(ImBuf *ibuf, const potrace_bitmap_t *bm, const float threshold)
void ED_gpencil_trace_bitmap_invert(const potrace_bitmap_t *bm)
potrace_bitmap_t * ED_gpencil_trace_bitmap_new(int32_t w, int32_t h)
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int int sw
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_gpu_kernel_postfix ccl_global float int int int int sh
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
T length(const vec_base< T, Size > &a)
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
static const pxr::TfToken rgba("rgba", pxr::TfToken::Immortal)
struct MaterialGPencilStyle * gp_style