|
Blender
V2.93
|
#include <stdio.h>#include <string.h>#include "DNA_userdef_types.h"#include "DNA_vec_types.h"#include "BLI_math.h"#include "BLI_utildefines.h"#include "BKE_context.h"#include "BIF_glutil.h"#include "IMB_colormanagement.h"#include "IMB_imbuf_types.h"#include "GPU_immediate.h"#include "GPU_matrix.h"#include "GPU_texture.h"#include "UI_interface.h"Go to the source code of this file.
Macros | |
| #define | DATA(_y, _x) ((char *)rect + stride * ((size_t)(_y)*img_w + (_x))) |
Functions | |
| static void | immDrawPixelsTexSetupAttributes (IMMDrawPixelsTexState *state) |
| IMMDrawPixelsTexState | immDrawPixelsTexSetup (int builtin) |
| void | immDrawPixelsTexScaled_clipping (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float scaleX, float scaleY, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4]) |
| void | immDrawPixelsTexScaled (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4]) |
| void | immDrawPixelsTex (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float xzoom, float yzoom, const float color[4]) |
| void | immDrawPixelsTex_clipping (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4]) |
| void | ED_draw_imbuf_clipping (ImBuf *ibuf, float x, float y, bool use_filter, ColorManagedViewSettings *view_settings, ColorManagedDisplaySettings *display_settings, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y) |
| void | ED_draw_imbuf (ImBuf *ibuf, float x, float y, bool use_filter, ColorManagedViewSettings *view_settings, ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y) |
| void | ED_draw_imbuf_ctx_clipping (const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y) |
| void | ED_draw_imbuf_ctx (const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y) |
| int | ED_draw_imbuf_method (ImBuf *ibuf) |
| void | immDrawBorderCorners (uint pos, const rcti *border, float zoomx, float zoomy) |
| #define DATA | ( | _y, | |
| _x | |||
| ) | ((char *)rect + stride * ((size_t)(_y)*img_w + (_x))) |
| void ED_draw_imbuf | ( | ImBuf * | ibuf, |
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| ColorManagedViewSettings * | view_settings, | ||
| ColorManagedDisplaySettings * | display_settings, | ||
| float | zoom_x, | ||
| float | zoom_y | ||
| ) |
Definition at line 506 of file glutil.c.
References ED_draw_imbuf_clipping(), x, and y.
| void ED_draw_imbuf_clipping | ( | ImBuf * | ibuf, |
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| ColorManagedViewSettings * | view_settings, | ||
| ColorManagedDisplaySettings * | display_settings, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | zoom_x, | ||
| float | zoom_y | ||
| ) |
Definition at line 367 of file glutil.c.
References BLI_assert, ImBuf::channels, ImBuf::dither, ED_draw_imbuf_method(), ImBuf::float_colorspace, GPU_RGB16F, GPU_RGBA16F, GPU_RGBA8, GPU_SHADER_2D_IMAGE_COLOR, IMAGE_DRAW_METHOD_GLSL, IMB_colormanagement_finish_glsl_draw(), IMB_colormanagement_setup_glsl_draw(), IMB_colormanagement_setup_glsl_draw_from_space(), IMB_display_buffer_acquire(), IMB_display_buffer_release(), immDrawPixelsTex_clipping(), immDrawPixelsTexSetup(), immDrawPixelsTexSetupAttributes(), NULL, ImBuf::rect, ImBuf::rect_colorspace, ImBuf::rect_float, state, x, ImBuf::x, y, and ImBuf::y.
Referenced by ED_draw_imbuf(), and ED_draw_imbuf_ctx_clipping().
| void ED_draw_imbuf_ctx_clipping | ( | const bContext * | C, |
| ImBuf * | ibuf, | ||
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | zoom_x, | ||
| float | zoom_y | ||
| ) |
Definition at line 529 of file glutil.c.
References C, ED_draw_imbuf_clipping(), IMB_colormanagement_display_settings_from_ctx(), x, and y.
Referenced by ED_draw_imbuf_ctx().
| int ED_draw_imbuf_method | ( | ImBuf * | ibuf | ) |
Definition at line 566 of file glutil.c.
References ImBuf::channels, IMAGE_DRAW_METHOD_2DTEXTURE, IMAGE_DRAW_METHOD_AUTO, IMAGE_DRAW_METHOD_GLSL, ImBuf::rect_float, size(), ImBuf::x, and ImBuf::y.
Referenced by ED_draw_imbuf_clipping(), image_rect_update(), ocio_transform_ibuf(), and sequencer_OCIO_transform_ibuf().
Definition at line 582 of file glutil.c.
References border, GPU_PRIM_LINE_STRIP, immBegin(), immEnd(), immVertex2f(), min_ff(), pos, and UI_DPI_FAC.
| void immDrawPixelsTex | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| void * | rect, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] | ||
| ) |
immDrawPixelsTex - Functions like a limited glDrawPixels, but actually draws the image using textures, which can be tremendously faster on low-end cards, and also avoids problems with the raster position being clipped when offscreen. Pixel unpacking parameters and the glPixelZoom values are not respected.
Definition at line 298 of file glutil.c.
References immDrawPixelsTexScaled_clipping(), state, x, and y.
Referenced by draw_filled_lasso(), ED_mask_draw_region(), ed_preview_draw_rect(), icon_draw_rect(), node_draw_preview(), sima_draw_zbuf_pixels(), sima_draw_zbuffloat_pixels(), and ui_draw_but_IMAGE().
| void immDrawPixelsTex_clipping | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| void * | rect, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] | ||
| ) |
Definition at line 329 of file glutil.c.
References immDrawPixelsTexScaled_clipping(), state, x, and y.
Referenced by draw_image_buffer(), and ED_draw_imbuf_clipping().
| void immDrawPixelsTexScaled | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| void * | rect, | ||
| float | scaleX, | ||
| float | scaleY, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] | ||
| ) |
Definition at line 265 of file glutil.c.
References immDrawPixelsTexScaled_clipping(), state, x, and y.
Referenced by file_draw_preview(), and wm_drags_draw().
| void immDrawPixelsTexScaled_clipping | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| void * | rect, | ||
| float | scaleX, | ||
| float | scaleY, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] | ||
| ) |
Use the currently bound shader.
Use immDrawPixelsTexSetup to bind the shader you want before calling immDrawPixelsTex.
If using a special shader double check it uses the same attributes "pos" "texCoord" and uniform "image".
If color is NULL then use white by default
Be also aware that this function unbinds the shader when it's finished.
Definition at line 95 of file glutil.c.
References BLI_assert, bottom, data, DATA, ELEM, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_flush(), GPU_PRIM_TRI_FAN, GPU_R16F, GPU_R8, GPU_RGB16F, GPU_RGBA16F, GPU_RGBA8, GPU_shader_get_uniform(), GPU_texture_bind(), GPU_texture_create_2d(), GPU_texture_filter_mode(), GPU_texture_free(), GPU_texture_unbind(), GPU_texture_update_sub(), GPU_texture_wrap_mode(), GPU_unpack_row_length_set(), immAttr2f(), immBegin(), immEnd(), immUnbindProgram(), immUniformColor4fv(), immVertex2f(), left, NULL, pos, right, state, stride, tex, top, UNPACK2, x, and y.
Referenced by immDrawPixelsTex(), immDrawPixelsTex_clipping(), and immDrawPixelsTexScaled().
| IMMDrawPixelsTexState immDrawPixelsTexSetup | ( | int | builtin | ) |
To be used before calling immDrawPixelsTex Default shader is GPU_SHADER_2D_IMAGE_COLOR You can still set uniforms with: GPU_shader_uniform_int(shader, GPU_shader_get_uniform(shader, "name"), 0);
Definition at line 66 of file glutil.c.
References GPU_shader_get_builtin_shader(), immBindBuiltinProgram(), immDrawPixelsTexSetupAttributes(), immUniform1i(), and state.
Referenced by draw_filled_lasso(), draw_image_buffer(), ED_draw_imbuf_clipping(), ED_mask_draw_region(), ed_preview_draw_rect(), file_draw_preview(), icon_draw_rect(), node_draw_preview(), sima_draw_zbuf_pixels(), sima_draw_zbuffloat_pixels(), ui_draw_but_IMAGE(), and wm_drags_draw().
|
static |
Definition at line 52 of file glutil.c.
References GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_vertformat_attr_add(), immVertexFormat(), and state.
Referenced by ED_draw_imbuf_clipping(), and immDrawPixelsTexSetup().