Hi Manolo,
Thank you for your suggestions.
I've managed to fix the problem regarding passing the event to the window. I've tried with FL_DRAG and other methods, but something was not right with what I've did. But in the end I've managed to make it work.
I've saw the shapewindow example, so it went easy the first part. The problem is that, as far as I understood, I need to draw with WHITE the shape of the image while setting the shape. But I cannot find how I can edit the image to convert the transparent part to white and the rest in black. Any ideas on this?
I do not understand:
"""
"With an
Fl_RGB_Image with an alpha channel (depths 2 or 4), the shaped window covers the image part that is not fully transparent."
Thus, fully transparent parts of the png will be out of the window's shape.
""""
I think I understand the logic, but I can't get it right. I have something like (similar to shapewindow example) :
==================================
auto *surf = new Fl_Image_Surface(w, h);
Fl_Surface_Device* current = Fl_Surface_Device::surface();
surf->set_current();
// fl_color(FL_BLACK);
// fl_rectf(-1, -1, w+2, h+2);
// fl_color(FL_WHITE);
// fl_pie(2,2,w-4,h-4,0,360);
auto *img = new Fl_PNG_Image("item.png");
auto *imgV2 = new Fl_RGB_Image(new Fl_Pixmap(img->copy(w, h)->data()), FL_BLACK);
imgV2->draw(0,0);
Fl_Window::shape(surf->image());
delete surf;
current->set_current();
add(dragBox_);
Fl_Group::end();
Fl_Window::resizable();
==================================
The image still gets distorted and the shape is not right. What am I doing wrong? From what I understood, I need to draw with black the hole window to hide it, and the draw with white the shape I want to display.
Any ideas?