Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/imageprocess.c
| Show All 31 Lines | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_task.h" | #include "BLI_task.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| #include "IMB_colormanagement.h" | |||||
| #include <math.h> | #include <math.h> | ||||
| /* Only this one is used liberally here, and in imbuf */ | /* Only this one is used liberally here, and in imbuf */ | ||||
| void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) | void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf) | ||||
| { | { | ||||
| size_t size; | size_t size; | ||||
| unsigned char rt, *cp = (unsigned char *)ibuf->rect; | unsigned char rt, *cp = (unsigned char *)ibuf->rect; | ||||
| float rtf, *cpf = ibuf->rect_float; | float rtf, *cpf = ibuf->rect_float; | ||||
| ▲ Show 20 Lines • Show All 440 Lines • ▼ Show 20 Lines | else { | ||||
| cp[2] = (cp[2] * alpha) + mul * backcol[2]; | cp[2] = (cp[2] * alpha) + mul * backcol[2]; | ||||
| } | } | ||||
| cp[3] = 255; | cp[3] = 255; | ||||
| cp += 4; | cp += 4; | ||||
| } | } | ||||
| } | } | ||||
| /* Sample pixel of image using NEAREST method. */ | |||||
| void IMB_sampleImageAtLocation(ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]) | |||||
| { | |||||
| if (ibuf->rect_float) { | |||||
| nearest_interpolation_color(ibuf, NULL, color, x, y); | |||||
| } | |||||
| else { | |||||
| unsigned char byte_color[4]; | |||||
| nearest_interpolation_color(ibuf, byte_color, NULL, x, y); | |||||
| rgba_uchar_to_float(color, byte_color); | |||||
| if (make_linear_rgb) { | |||||
| IMB_colormanagement_colorspace_to_scene_linear_v4(color, false, ibuf->rect_colorspace); | |||||
| } | |||||
| } | |||||
| } | |||||