Merge pull request #43627 from aaronfranke/pixelvi
Use Vector2i instead of Vector2 for Image get_pixelv and set_pixelv
This commit is contained in:
commit
ba989a1d39
4 changed files with 54 additions and 24 deletions
|
|
@ -2766,8 +2766,8 @@ Dictionary Image::_get_data() const {
|
|||
return d;
|
||||
}
|
||||
|
||||
Color Image::get_pixelv(const Point2 &p_src) const {
|
||||
return get_pixel(p_src.x, p_src.y);
|
||||
Color Image::get_pixelv(const Point2i &p_point) const {
|
||||
return get_pixel(p_point.x, p_point.y);
|
||||
}
|
||||
|
||||
Color Image::_get_color_at_ofs(const uint8_t *ptr, uint32_t ofs) const {
|
||||
|
|
@ -2976,8 +2976,8 @@ Color Image::get_pixel(int p_x, int p_y) const {
|
|||
return _get_color_at_ofs(data.ptr(), ofs);
|
||||
}
|
||||
|
||||
void Image::set_pixelv(const Point2 &p_dst, const Color &p_color) {
|
||||
set_pixel(p_dst.x, p_dst.y, p_color);
|
||||
void Image::set_pixelv(const Point2i &p_point, const Color &p_color) {
|
||||
set_pixel(p_point.x, p_point.y, p_color);
|
||||
}
|
||||
|
||||
void Image::set_pixel(int p_x, int p_y, const Color &p_color) {
|
||||
|
|
@ -3132,9 +3132,9 @@ void Image::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("_set_data", "data"), &Image::_set_data);
|
||||
ClassDB::bind_method(D_METHOD("_get_data"), &Image::_get_data);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_pixelv", "src"), &Image::get_pixelv);
|
||||
ClassDB::bind_method(D_METHOD("get_pixelv", "point"), &Image::get_pixelv);
|
||||
ClassDB::bind_method(D_METHOD("get_pixel", "x", "y"), &Image::get_pixel);
|
||||
ClassDB::bind_method(D_METHOD("set_pixelv", "dst", "color"), &Image::set_pixelv);
|
||||
ClassDB::bind_method(D_METHOD("set_pixelv", "point", "color"), &Image::set_pixelv);
|
||||
ClassDB::bind_method(D_METHOD("set_pixel", "x", "y", "color"), &Image::set_pixel);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("load_png_from_buffer", "buffer"), &Image::load_png_from_buffer);
|
||||
|
|
|
|||
|
|
@ -387,9 +387,9 @@ public:
|
|||
UsedChannels detect_used_channels(CompressSource p_source = COMPRESS_SOURCE_GENERIC);
|
||||
void optimize_channels();
|
||||
|
||||
Color get_pixelv(const Point2 &p_src) const;
|
||||
Color get_pixelv(const Point2i &p_point) const;
|
||||
Color get_pixel(int p_x, int p_y) const;
|
||||
void set_pixelv(const Point2 &p_dst, const Color &p_color);
|
||||
void set_pixelv(const Point2i &p_point, const Color &p_color);
|
||||
void set_pixel(int p_x, int p_y, const Color &p_color);
|
||||
|
||||
void set_as_black();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue