我需要创建一个 NPAPI 浏览器插件来显示图片。到现在为止,我已经成功地用GDK创建并在插件中绘制了一张图片,我在“NPP_HandleEvent()”函数中捕获了事件,并使用“gdk_pixmap_lookup”方法获取了一个GdkDrawable对象,就像下面的代码一样:
int16_t NPP_HandleEvent(NPP instance, void* event) {
XGraphicsExposeEvent *expose = &nativeEvent->xgraphicsexpose;
instanceData->window.window = (void*)(expose->drawable);
GdkNativeWindow nativeWinId = (XID)(instanceData->window.window);
GdkDrawable* gdkWindow = GDK_DRAWABLE(gdk_pixmap_lookup(xid));
NPSetWindowCallbackStruct *ws_info = (NPSetWindowCallbackStruct*)(instanceData->window.ws_info);
GdkVisual* gdkVisual = gdkx_visual_get(ws_info->visual ? XVisualIDFromVisual(ws_info->visual) : 0);
GdkColormap* gdkColormap = gdk_x11_colormap_foreign_new(gdkVisual, ws_info->colormap);
gdk_drawable_set_colormap(gdkWindow, gdkColormap);
// another method, to use GdkWindow to draw picture.
drawWindow(instanceData, gdkWindow);
}
所以现在,我想知道如何使用 QT 方法在这个插件中绘制图片?有什么方法可以使用 QT 和 X11 相关的存根来实现吗?