diff --git a/core/image.cpp b/core/image.cpp index 023a0586677..76f21a25de7 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -423,7 +423,7 @@ void Image::convert(Format p_new_format) { for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { - new_img.put_pixel(i, j, get_pixel(i, j)); + new_img.set_pixel(i, j, get_pixel(i, j)); } } @@ -1737,7 +1737,7 @@ void Image::blend_rect(const Ref &p_src, const Rect2 &p_src_rect, const P dc.g = (double)(sc.a * sc.g + dc.a * (1.0 - sc.a) * dc.g); dc.b = (double)(sc.a * sc.b + dc.a * (1.0 - sc.a) * dc.b); dc.a = (double)(sc.a + dc.a * (1.0 - sc.a)); - put_pixel(dst_x, dst_y, dc); + set_pixel(dst_x, dst_y, dc); } } @@ -1792,7 +1792,7 @@ void Image::blend_rect_mask(const Ref &p_src, const Ref &p_mask, c dc.g = (double)(sc.a * sc.g + dc.a * (1.0 - sc.a) * dc.g); dc.b = (double)(sc.a * sc.b + dc.a * (1.0 - sc.a) * dc.b); dc.a = (double)(sc.a + dc.a * (1.0 - sc.a)); - put_pixel(dst_x, dst_y, dc); + set_pixel(dst_x, dst_y, dc); } } } @@ -1812,7 +1812,7 @@ void Image::fill(const Color &c) { int pixel_size = get_format_pixel_size(format); // put first pixel with the format-aware API - put_pixel(0, 0, c); + set_pixel(0, 0, c); for (int y = 0; y < height; y++) { @@ -2041,12 +2041,12 @@ Color Image::get_pixel(int p_x, int p_y) const { return Color(); } -void Image::put_pixel(int p_x, int p_y, const Color &p_color) { +void Image::set_pixel(int p_x, int p_y, const Color &p_color) { uint8_t *ptr = write_lock.ptr(); #ifdef DEBUG_ENABLED if (!ptr) { - ERR_EXPLAIN("Image must be locked with 'lock()' before using put_pixel()"); + ERR_EXPLAIN("Image must be locked with 'lock()' before using set_pixel()"); ERR_FAIL_COND(!ptr); } @@ -2160,7 +2160,7 @@ void Image::put_pixel(int p_x, int p_y, const Color &p_color) { } break; default: { - ERR_EXPLAIN("Can't put_pixel() on compressed image, sorry."); + ERR_EXPLAIN("Can't set_pixel() on compressed image, sorry."); ERR_FAIL(); } } @@ -2270,7 +2270,7 @@ void Image::_bind_methods() { ClassDB::bind_method(D_METHOD("lock"), &Image::lock); ClassDB::bind_method(D_METHOD("unlock"), &Image::unlock); - ClassDB::bind_method(D_METHOD("put_pixel", "x", "y", "color"), &Image::put_pixel); + ClassDB::bind_method(D_METHOD("set_pixel", "x", "y", "color"), &Image::set_pixel); ClassDB::bind_method(D_METHOD("get_pixel", "x", "y"), &Image::get_pixel); ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE), "_set_data", "_get_data"); diff --git a/core/image.h b/core/image.h index e523f703fab..7acc4744e90 100644 --- a/core/image.h +++ b/core/image.h @@ -315,7 +315,7 @@ public: DetectChannels get_detected_channels(); Color get_pixel(int p_x, int p_y) const; - void put_pixel(int p_x, int p_y, const Color &p_color); + void set_pixel(int p_x, int p_y, const Color &p_color); void copy_internals_from(const Ref &p_image) { ERR_FAIL_COND(p_image.is_null()); diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 39f5c94a944..6ff3e0fa292 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -19218,7 +19218,7 @@ - + diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index c74eaf21a15..2d05c8eba12 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -874,7 +874,7 @@ Ref CurvePreviewGenerator::generate(const Ref &p_from) { Color bg_color(0.1, 0.1, 0.1, 1.0); for (int i = 0; i < thumbnail_size; i++) { for (int j = 0; j < thumbnail_size; j++) { - im.put_pixel(i, j, bg_color); + im.set_pixel(i, j, bg_color); } } @@ -890,7 +890,7 @@ Ref CurvePreviewGenerator::generate(const Ref &p_from) { // Plot point if (y >= 0 && y < im.get_height()) { - im.put_pixel(x, y, line_color); + im.set_pixel(x, y, line_color); } // Plot vertical line to fix discontinuity (not 100% correct but enough for a preview) @@ -904,7 +904,7 @@ Ref CurvePreviewGenerator::generate(const Ref &p_from) { y1 = y; } for (int ly = y0; ly < y1; ++ly) { - im.put_pixel(x, ly, line_color); + im.set_pixel(x, ly, line_color); } } diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 11d804422a0..7f8581535c0 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -431,7 +431,7 @@ Ref EditorScriptPreviewPlugin::generate(const RES &p_from) { for (int i = 0; i < thumbnail_size; i++) { for (int j = 0; j < thumbnail_size; j++) { - img->put_pixel(i, j, bg_color); + img->set_pixel(i, j, bg_color); } } @@ -469,8 +469,8 @@ Ref EditorScriptPreviewPlugin::generate(const RES &p_from) { Color ul = color; ul.a *= 0.5; - img->put_pixel(col, line * 2, bg_color.blend(ul)); - img->put_pixel(col, line * 2 + 1, color); + img->set_pixel(col, line * 2, bg_color.blend(ul)); + img->set_pixel(col, line * 2 + 1, color); prev_is_text = _is_text_char(c); } diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp index 9c65ef667a7..5506c035ece 100644 --- a/editor/plugins/shader_graph_editor_plugin.cpp +++ b/editor/plugins/shader_graph_editor_plugin.cpp @@ -1382,7 +1382,7 @@ ToolButton *ShaderGraphView::make_editor(String text,GraphNode* gn,int p_id,int Color c = graph->default_get_value(type,p_id,param); for (int x=1;x<14;x++) for (int y=1;y<14;y++) - icon_color.put_pixel(x,y,c); + icon_color.set_pixel(x,y,c); Ref t; t.instance(); t->create_from_image(icon_color);