Lines Matching refs:list

102 /// NK_INCLUDE_VERTEX_BUFFER_OUTPUT | Defining this adds a vertex draw command list backend to this library, which allows you to convert queue commands into vertex draw commands. This is mainly if you need a hardware accessible format for OpenGL, DirectX, Vulkan, Metal,...
1134 /// __nk__begin__ | Returns the first draw command in the context draw command list to be drawn
1135 /// __nk__next__ | Increments the draw command iterator to the next command inside the context draw command list
1136 /// __nk_foreach__ | Iterates over each draw command inside the context draw command list
1137 /// __nk_convert__ | Converts from the abstract draw commands list into a hardware accessible vertex format
1138 /// __nk_draw_begin__ | Returns the first vertex command in the context vertex draw list to be executed
1139 /// __nk__draw_next__ | Increments the vertex command iterator to the next command inside the context vertex command list
1140 /// __nk__draw_end__ | Returns the end of the vertex draw list
1141 /// __nk_draw_foreach__ | Iterates over each vertex draw command inside the vertex draw list
1168 /// Returns a draw command list iterator to iterate all draw
1179 /// Returns draw command pointer pointing to the first command inside the draw command list
1183 /// Returns draw command pointer pointing to the next command inside the draw command list
1194 /// Returns draw command pointer pointing to the next command inside the draw command list
1198 /// Iterates over each draw command inside the context draw command list
1209 /// Iterates over each draw command inside the context draw command list
1318 /// is linked into a window stack list which determines the drawing and overlapping
3977 /* list of unicode ranges (2 values per range, zero terminated) */
4653 /* The optional vertex buffer draw list provides a 2D drawing context
4656 The actual draw list API is not required to be used directly while using this
4661 The draw list is based on a path buffering and polygon and polyline
4757 /* draw list */
5430 /* window list hooks */
5864 NK_INSERT_BACK, /* inserts window into the back of list (front of screen) */
5865 NK_INSERT_FRONT /* inserts window into the front of list (back of screen) */
9221 nk_draw_list_init(struct nk_draw_list *list)
9224 NK_ASSERT(list);
9225 if (!list) return;
9226 nk_zero(list, sizeof(*list));
9227 for (i = 0; i < NK_LEN(list->circle_vtx); ++i) {
9228 const float a = ((float)i / (float)NK_LEN(list->circle_vtx)) * 2 * NK_PI;
9229 list->circle_vtx[i].x = (float)NK_COS(a);
9230 list->circle_vtx[i].y = (float)NK_SIN(a);
9312 nk_draw_list_alloc_path(struct nk_draw_list *list, int count)
9318 nk_buffer_alloc(list->buffer, NK_BUFFER_FRONT,
9322 if (!list->path_offset) {
9323 void *memory = nk_buffer_memory(list->buffer);
9324 list->path_offset = (unsigned int)((nk_byte*)points - (nk_byte*)memory);
9326 list->path_count += (unsigned int)count;
9330 nk_draw_list_path_last(struct nk_draw_list *list)
9334 NK_ASSERT(list->path_count);
9335 memory = nk_buffer_memory(list->buffer);
9336 point = nk_ptr_add(struct nk_vec2, memory, list->path_offset);
9337 point += (list->path_count-1);
9341 nk_draw_list_push_command(struct nk_draw_list *list, struct nk_rect clip,
9348 NK_ASSERT(list);
9350 nk_buffer_alloc(list->buffer, NK_BUFFER_BACK, cmd_size, cmd_align);
9353 if (!list->cmd_count) {
9354 nk_byte *memory = (nk_byte*)nk_buffer_memory(list->buffer);
9355 nk_size total = nk_buffer_total(list->buffer);
9357 list->cmd_offset = (nk_size)(memory - (nk_byte*)cmd);
9364 cmd->userdata = list->userdata;
9367 list->cmd_count++;
9368 list->clip_rect = clip;
9372 nk_draw_list_command_last(struct nk_draw_list *list)
9377 NK_ASSERT(list->cmd_count);
9379 memory = nk_buffer_memory(list->buffer);
9380 size = nk_buffer_total(list->buffer);
9381 cmd = nk_ptr_add(struct nk_draw_command, memory, size - list->cmd_offset);
9382 return (cmd - (list->cmd_count-1));
9385 nk_draw_list_add_clip(struct nk_draw_list *list, struct nk_rect rect)
9387 NK_ASSERT(list);
9388 if (!list) return;
9389 if (!list->cmd_count) {
9390 nk_draw_list_push_command(list, rect, list->config.null.texture);
9392 struct nk_draw_command *prev = nk_draw_list_command_last(list);
9395 nk_draw_list_push_command(list, rect, prev->texture);
9399 nk_draw_list_push_image(struct nk_draw_list *list, nk_handle texture)
9401 NK_ASSERT(list);
9402 if (!list) return;
9403 if (!list->cmd_count) {
9404 nk_draw_list_push_command(list, nk_null_rect, texture);
9406 struct nk_draw_command *prev = nk_draw_list_command_last(list);
9410 prev->userdata = list->userdata;
9414 || prev->userdata.id != list->userdata.id
9416 ) nk_draw_list_push_command(list, prev->clip_rect, texture);
9421 nk_draw_list_push_userdata(struct nk_draw_list *list, nk_handle userdata)
9423 list->userdata = userdata;
9427 nk_draw_list_alloc_vertices(struct nk_draw_list *list, nk_size count)
9430 NK_ASSERT(list);
9431 if (!list) return 0;
9432 vtx = nk_buffer_alloc(list->vertices, NK_BUFFER_FRONT,
9433 list->config.vertex_size*count, list->config.vertex_alignment);
9435 list->vertex_count += (unsigned int)count;
9446 if(sizeof(nk_draw_index)==2) NK_ASSERT((list->vertex_count < NK_USHORT_MAX &&
9451 nk_draw_list_alloc_elements(struct nk_draw_list *list, nk_size count)
9457 NK_ASSERT(list);
9458 if (!list) return 0;
9461 nk_buffer_alloc(list->elements, NK_BUFFER_FRONT, elem_size*count, elem_align);
9463 cmd = nk_draw_list_command_last(list);
9464 list->element_count += (unsigned int)count;
9624 nk_draw_list_stroke_poly_line(struct nk_draw_list *list, const struct nk_vec2 *points,
9632 NK_ASSERT(list);
9633 if (!list || points_count < 2) return;
9635 color.a = (nk_byte)((float)color.a * list->config.global_alpha);
9641 nk_draw_list_push_userdata(list, list->userdata);
9644 color.a = (nk_byte)((float)color.a * list->config.global_alpha);
9658 nk_size index = list->vertex_count;
9663 void *vtx = nk_draw_list_alloc_vertices(list, vtx_count);
9664 nk_draw_index *ids = nk_draw_list_alloc_elements(list, idx_count);
9671 vertex_offset = (nk_size)((nk_byte*)vtx - (nk_byte*)list->vertices->memory.ptr);
9672 nk_buffer_mark(list->vertices, NK_BUFFER_FRONT);
9674 normals = (struct nk_vec2*) nk_buffer_alloc(list->vertices, NK_BUFFER_FRONT, size, pnt_align);
9679 vtx = (void*)((nk_byte*)list->vertices->memory.ptr + vertex_offset);
9745 const struct nk_vec2 uv = list->config.null.uv;
9746 vtx = nk_draw_vertex(vtx, &list->config, points[i], uv, col);
9747 vtx = nk_draw_vertex(vtx, &list->config, temp[i*2+0], uv, col_trans);
9748 vtx = nk_draw_vertex(vtx, &list->config, temp[i*2+1], uv, col_trans);
9810 const struct nk_vec2 uv = list->config.null.uv;
9811 vtx = nk_draw_vertex(vtx, &list->config, temp[i*4+0], uv, col_trans);
9812 vtx = nk_draw_vertex(vtx, &list->config, temp[i*4+1], uv, col);
9813 vtx = nk_draw_vertex(vtx, &list->config, temp[i*4+2], uv, col);
9814 vtx = nk_draw_vertex(vtx, &list->config, temp[i*4+3], uv, col_trans);
9818 nk_buffer_reset(list->vertices, NK_BUFFER_FRONT);
9822 nk_size idx = list->vertex_count;
9825 void *vtx = nk_draw_list_alloc_vertices(list, vtx_count);
9826 nk_draw_index *ids = nk_draw_list_alloc_elements(list, idx_count);
9831 const struct nk_vec2 uv = list->config.null.uv;
9849 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(p1.x + dy, p1.y - dx), uv, col);
9850 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(p2.x + dy, p2.y - dx), uv, col);
9851 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(p2.x - dy, p2.y + dx), uv, col);
9852 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(p1.x - dy, p1.y + dx), uv, col);
9864 nk_draw_list_fill_poly_convex(struct nk_draw_list *list,
9873 NK_ASSERT(list);
9874 if (!list || points_count < 3) return;
9877 nk_draw_list_push_userdata(list, list->userdata);
9880 color.a = (nk_byte)((float)color.a * list->config.global_alpha);
9892 nk_size index = list->vertex_count;
9897 void *vtx = nk_draw_list_alloc_vertices(list, vtx_count);
9898 nk_draw_index *ids = nk_draw_list_alloc_elements(list, idx_count);
9907 vertex_offset = (nk_size)((nk_byte*)vtx - (nk_byte*)list->vertices->memory.ptr);
9908 nk_buffer_mark(list->vertices, NK_BUFFER_FRONT);
9910 normals = (struct nk_vec2*) nk_buffer_alloc(list->vertices, NK_BUFFER_FRONT, size, pnt_align);
9912 vtx = (void*)((nk_byte*)list->vertices->memory.ptr + vertex_offset);
9941 const struct nk_vec2 uv = list->config.null.uv;
9954 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2_sub(points[i1], dm), uv, col);
9955 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2_add(points[i1], dm), uv, col_trans);
9967 nk_buffer_reset(list->vertices, NK_BUFFER_FRONT);
9970 nk_size index = list->vertex_count;
9973 void *vtx = nk_draw_list_alloc_vertices(list, vtx_count);
9974 nk_draw_index *ids = nk_draw_list_alloc_elements(list, idx_count);
9978 vtx = nk_draw_vertex(vtx, &list->config, points[i], list->config.null.uv, col);
9988 nk_draw_list_path_clear(struct nk_draw_list *list)
9990 NK_ASSERT(list);
9991 if (!list) return;
9992 nk_buffer_reset(list->buffer, NK_BUFFER_FRONT);
9993 list->path_count = 0;
9994 list->path_offset = 0;
9997 nk_draw_list_path_line_to(struct nk_draw_list *list, struct nk_vec2 pos)
10001 NK_ASSERT(list);
10002 if (!list) return;
10003 if (!list->cmd_count)
10004 nk_draw_list_add_clip(list, nk_null_rect);
10006 cmd = nk_draw_list_command_last(list);
10007 if (cmd && cmd->texture.ptr != list->config.null.texture.ptr)
10008 nk_draw_list_push_image(list, list->config.null.texture);
10010 points = nk_draw_list_alloc_path(list, 1);
10015 nk_draw_list_path_arc_to_fast(struct nk_draw_list *list, struct nk_vec2 center,
10019 NK_ASSERT(list);
10020 if (!list) return;
10023 const struct nk_vec2 c = list->circle_vtx[(nk_size)a % NK_LEN(list->circle_vtx)];
10026 nk_draw_list_path_line_to(list, nk_vec2(x, y));
10031 nk_draw_list_path_arc_to(struct nk_draw_list *list, struct nk_vec2 center,
10035 NK_ASSERT(list);
10036 if (!list) return;
10067 nk_draw_list_path_line_to(list, nk_vec2(x, y));
10076 nk_draw_list_path_rect_to(struct nk_draw_list *list, struct nk_vec2 a,
10080 NK_ASSERT(list);
10081 if (!list) return;
10087 nk_draw_list_path_line_to(list, a);
10088 nk_draw_list_path_line_to(list, nk_vec2(b.x,a.y));
10089 nk_draw_list_path_line_to(list, b);
10090 nk_draw_list_path_line_to(list, nk_vec2(a.x,b.y));
10092 nk_draw_list_path_arc_to_fast(list, nk_vec2(a.x + r, a.y + r), r, 6, 9);
10093 nk_draw_list_path_arc_to_fast(list, nk_vec2(b.x - r, a.y + r), r, 9, 12);
10094 nk_draw_list_path_arc_to_fast(list, nk_vec2(b.x - r, b.y - r), r, 0, 3);
10095 nk_draw_list_path_arc_to_fast(list, nk_vec2(a.x + r, b.y - r), r, 3, 6);
10099 nk_draw_list_path_curve_to(struct nk_draw_list *list, struct nk_vec2 p2,
10106 NK_ASSERT(list);
10107 NK_ASSERT(list->path_count);
10108 if (!list || !list->path_count) return;
10111 p1 = nk_draw_list_path_last(list);
10122 nk_draw_list_path_line_to(list, nk_vec2(x,y));
10126 nk_draw_list_path_fill(struct nk_draw_list *list, struct nk_color color)
10129 NK_ASSERT(list);
10130 if (!list) return;
10131 points = (struct nk_vec2*)nk_buffer_memory(list->buffer);
10132 nk_draw_list_fill_poly_convex(list, points, list->path_count, color, list->config.shape_AA);
10133 nk_draw_list_path_clear(list);
10136 nk_draw_list_path_stroke(struct nk_draw_list *list, struct nk_color color,
10140 NK_ASSERT(list);
10141 if (!list) return;
10142 points = (struct nk_vec2*)nk_buffer_memory(list->buffer);
10143 nk_draw_list_stroke_poly_line(list, points, list->path_count, color,
10144 closed, thickness, list->config.line_AA);
10145 nk_draw_list_path_clear(list);
10148 nk_draw_list_stroke_line(struct nk_draw_list *list, struct nk_vec2 a,
10151 NK_ASSERT(list);
10152 if (!list || !col.a) return;
10153 if (list->line_AA == NK_ANTI_ALIASING_ON) {
10154 nk_draw_list_path_line_to(list, a);
10155 nk_draw_list_path_line_to(list, b);
10157 nk_draw_list_path_line_to(list, nk_vec2_sub(a,nk_vec2(0.5f,0.5f)));
10158 nk_draw_list_path_line_to(list, nk_vec2_sub(b,nk_vec2(0.5f,0.5f)));
10160 nk_draw_list_path_stroke(list, col, NK_STROKE_OPEN, thickness);
10163 nk_draw_list_fill_rect(struct nk_draw_list *list, struct nk_rect rect,
10166 NK_ASSERT(list);
10167 if (!list || !col.a) return;
10169 if (list->line_AA == NK_ANTI_ALIASING_ON) {
10170 nk_draw_list_path_rect_to(list, nk_vec2(rect.x, rect.y),
10173 nk_draw_list_path_rect_to(list, nk_vec2(rect.x-0.5f, rect.y-0.5f),
10175 } nk_draw_list_path_fill(list, col);
10178 nk_draw_list_stroke_rect(struct nk_draw_list *list, struct nk_rect rect,
10181 NK_ASSERT(list);
10182 if (!list || !col.a) return;
10183 if (list->line_AA == NK_ANTI_ALIASING_ON) {
10184 nk_draw_list_path_rect_to(list, nk_vec2(rect.x, rect.y),
10187 nk_draw_list_path_rect_to(list, nk_vec2(rect.x-0.5f, rect.y-0.5f),
10189 } nk_draw_list_path_stroke(list, col, NK_STROKE_CLOSED, thickness);
10192 nk_draw_list_fill_rect_multi_color(struct nk_draw_list *list, struct nk_rect rect,
10207 NK_ASSERT(list);
10208 if (!list) return;
10210 nk_draw_list_push_image(list, list->config.null.texture);
10211 index = (nk_draw_index)list->vertex_count;
10212 vtx = nk_draw_list_alloc_vertices(list, 4);
10213 idx = nk_draw_list_alloc_elements(list, 6);
10220 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(rect.x, rect.y), list->config.null.uv, col_left);
10221 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(rect.x + rect.w, rect.y), list->config.null.uv, col_top);
10222 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(rect.x + rect.w, rect.y + rect.h), list->config.null.uv, col_right);
10223 vtx = nk_draw_vertex(vtx, &list->config, nk_vec2(rect.x, rect.y + rect.h), list->config.null.uv, col_bottom);
10226 nk_draw_list_fill_triangle(struct nk_draw_list *list, struct nk_vec2 a,
10229 NK_ASSERT(list);
10230 if (!list || !col.a) return;
10231 nk_draw_list_path_line_to(list, a);
10232 nk_draw_list_path_line_to(list, b);
10233 nk_draw_list_path_line_to(list, c);
10234 nk_draw_list_path_fill(list, col);
10237 nk_draw_list_stroke_triangle(struct nk_draw_list *list, struct nk_vec2 a,
10240 NK_ASSERT(list);
10241 if (!list || !col.a) return;
10242 nk_draw_list_path_line_to(list, a);
10243 nk_draw_list_path_line_to(list, b);
10244 nk_draw_list_path_line_to(list, c);
10245 nk_draw_list_path_stroke(list, col, NK_STROKE_CLOSED, thickness);
10248 nk_draw_list_fill_circle(struct nk_draw_list *list, struct nk_vec2 center,
10252 NK_ASSERT(list);
10253 if (!list || !col.a) return;
10255 nk_draw_list_path_arc_to(list, center, radius, 0.0f, a_max, segs);
10256 nk_draw_list_path_fill(list, col);
10259 nk_draw_list_stroke_circle(struct nk_draw_list *list, struct nk_vec2 center,
10263 NK_ASSERT(list);
10264 if (!list || !col.a) return;
10266 nk_draw_list_path_arc_to(list, center, radius, 0.0f, a_max, segs);
10267 nk_draw_list_path_stroke(list, col, NK_STROKE_CLOSED, thickness);
10270 nk_draw_list_stroke_curve(struct nk_draw_list *list, struct nk_vec2 p0,
10274 NK_ASSERT(list);
10275 if (!list || !col.a) return;
10276 nk_draw_list_path_line_to(list, p0);
10277 nk_draw_list_path_curve_to(list, cp0, cp1, p1, segments);
10278 nk_draw_list_path_stroke(list, col, NK_STROKE_OPEN, thickness);
10281 nk_draw_list_push_rect_uv(struct nk_draw_list *list, struct nk_vec2 a,
10294 NK_ASSERT(list);
10295 if (!list) return;
10303 index = (nk_draw_index)list->vertex_count;
10304 vtx = nk_draw_list_alloc_vertices(list, 4);
10305 idx = nk_draw_list_alloc_elements(list, 6);
10312 vtx = nk_draw_vertex(vtx, &list->config, a, uva, col);
10313 vtx = nk_draw_vertex(vtx, &list->config, b, uvb, col);
10314 vtx = nk_draw_vertex(vtx, &list->config, c, uvc, col);
10315 vtx = nk_draw_vertex(vtx, &list->config, d, uvd, col);
10318 nk_draw_list_add_image(struct nk_draw_list *list, struct nk_image texture,
10321 NK_ASSERT(list);
10322 if (!list) return;
10324 nk_draw_list_push_image(list, texture.handle);
10332 nk_draw_list_push_rect_uv(list, nk_vec2(rect.x, rect.y),
10334 } else nk_draw_list_push_rect_uv(list, nk_vec2(rect.x, rect.y),
10339 nk_draw_list_add_text(struct nk_draw_list *list, const struct nk_user_font *font,
10351 NK_ASSERT(list);
10352 if (!list || !len || !text) return;
10354 list->clip_rect.x, list->clip_rect.y, list->clip_rect.w, list->clip_rect.h)) return;
10356 nk_draw_list_push_image(list, font->texture);
10362 fg.a = (nk_byte)((float)fg.a * list->config.global_alpha);
10378 nk_draw_list_push_rect_uv(list, nk_vec2(gx,gy), nk_vec2(gx + gw, gy+ gh),
10832 /* move the current node to the free list */
10837 /* stitch the list back in */
11897 *step = z->next; /* delete from list */
11902 step = &((*step)->next); /* advance through list */
11942 step = &((*step)->next); /* advance through list */
12077 /* add edge from j to k to the list */
13524 /* insert font config into list */
13542 /* insert font into list */
15228 /* build one big draw command list out of all window buffers */
15380 /* unlink page element from free list */
15416 /* we have a pool so just add to free list */
16146 /* unlink windows from list */
18953 /* find persistent list view scrollbar offset */
22414 /* discard the oldest entry in the undo list */
22437 /* discard the oldest entry in the redo list--it's bad if this
25584 /// commit the whole list to nuklear (issue #269).