- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试从 Cairo 图像表面切换到 xlib 表面。我的代码在图像表面上运行良好,但我认为我没有正确初始化 xlib 表面。它可以编译,但会抛出警告并且不再显示任何内容。
这是我当前用于初始化表面的代码:
int width, height;
gdk_threads_enter();
gdk_drawable_get_size(pixmap, &width, &height);
gdk_threads_leave();
/*** Create surface to draw on ***/
cairo_surface_t *cst = cairo_xlib_surface_create(gdk_x11_drawable_get_xdisplay(pixmap),
gdk_x11_drawable_get_xid(pixmap),
gdk_x11_visual_get_xvisual(gvis),
width, height);
编译时出现如下警告:
In function 'do_draw':
evis.c:112:11: warning: passing argument 1 of 'cairo_xlib_surface_create' makes pointer from integer without a cast [enabled by default]
width, height);
^
In file included from evis.c:6:0:
/usr/include/cairo/cairo-xlib.h:49:1: note: expected 'struct Display *' but argument is of type 'int'
cairo_xlib_surface_create (Display *dpy,
^
evis.c:112:11: warning: passing argument 3 of 'cairo_xlib_surface_create' makes pointer from integer without a cast [enabled by default]
width, height);
^
In file included from evis.c:6:0:
/usr/include/cairo/cairo-xlib.h:49:1: note: expected 'struct Visual *' but argument is of type 'int'
cairo_xlib_surface_create (Display *dpy,
^
我很确定这些警告会破坏代码,但我不确定如何修复它们。我尝试将第一个参数和第三个参数分别转换为 (Display *)
和 (Visual *)
但这也不起作用。开始发出其他警告。
*编辑 1 *试图理解这一点,但到目前为止我对指针的理解仅限于不存在。 gdk_drawable_get_xdisplay()
返回一个 Display*
但我的函数正在寻找一个指向 struct Display *
的指针。 2 之间有什么区别,我如何从 Display*
到 Display *
。
最佳答案
编译器认为函数返回 int 的“通常”原因(这是这里发生的情况,因为它提示这两个函数的结果)是它找不到函数的原型(prototype),这意味着你错过了#include。 (虽然我希望在那种情况下找到其他警告?)
关于开罗到开罗-xlib : cairo_xlib_surface_create problems (C),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20763560/
我很绝望,现在已经两天(!!)天都没有解决方案来解决以下问题。 更新 Lion 后,我想使用最新版本的 rvm 安装额外的 rubies。 这是我之后调用 bundler 时发生的情况: /Users
我的问题: ajax 调用的无限循环会产生问题吗? 假设有这样的代码: ajaxcall(); function ajaxcall(){ jQuery.ajax({ typ
这是一个有趣的小项目,我已经开始尝试并最大限度地提高赢得办公室曲棍球池的机会。我试图找到最好的方法来选择 20 名能够在最高工资帽内给我最多分数的球员。 例如,假设原始数据由 玩家姓名 位置(前锋,后
我有一个总数为540000的数字列表。我想将此列表分为3个列表,每个列表总共180000。最有效的编程方法是这样做,假设数字列表是一个平面文件,每个数字为线? 最佳答案 听起来像Knapsack pr
抱歉,也许因为我不是英语,我不知道,但我找不到解决几个问题的任何资源;也许我用的词不正确.. 我想了解有关 iPhone 4 和 5 不同分辨率的更多信息。 首先:如果我开发针对 iPhone 4 分
在全局配置缓存后,如 docs ,如果我在 app.module 之外使用 CacheInterceptor,它会抛出错误。 app.module.ts const cacheConfig = {
我无法让 g:each 工作。我正在尝试遍历任何内容,但它永远不起作用 = 不生成任何 html。 索引.gsp Item ${i.name} 用户 Controller .g
在我的 XAML 文件中,我有一个这样声明的 ListBox:
想知道你是否可以帮助我: 我有一个名为initializeAll的方法: public final void initializeAll() { //other stuff........ rand
我尝试过使用 XML 和 JAVA 在我的 Android Activity 中创建一个 ImageView。这两次,我都能够获取我一天前创建的所有其他 PNG 资源以显示在 ImageView 中。
我需要你的帮助。这是什么意思? Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'
这是一段代码 function test() { this.value = "foo"; } $(document).ready(function () { test();
这是一些非常基础的东西。渲染期间引发异常:java.util.Locale.toLanguageTag()Ljava/lang/String; XML: 问题似乎出在 Edit
除其他来源外,我还使用 Stackoverflow 上的各种帖子,尝试实现我自己的 PHP 分类器,以将推文分类为正面、中性和负面类别。在编码之前,我需要弄清楚流程。我的思路和例子如下:
在过去的几周里,每当我在 Eclipse 上使用 SVN 插件时,我都会收到以下错误: Certificate Problem There is a problem with the site's s
我被拒绝运行以下功能(位于 /var/www/mysite/public_html/app/Controllers/Script.php) $structure = '/var/www/mysite/
我正在使用 ctags 为我的 Emacs 创建标签以使用 cygwin 从中读取符号。 Emacs 说 “访问标签表缓冲区:文件/home/superman/tags 不是有效的标签表” 这是我查找
我知道作为一种函数式语言,XSL 没有像传统的 for 循环(而是 for-each)那样的东西。 我正在尝试从可变数量的元素开始创建一个具有固定数量 (7) 的表。总之,我有
我正在使用RavenDB进行一些测试,以基于iphone应用程序存储数据。该应用程序将发送一个带有GPS key 的5个GPS坐标的字符串。我在RavenDB中看到每个文档约为664-668字节。这是
我无法理解我的应用程序的行为。我想创建一个简单的窗口 (1000x700px),分为两部分(分别为 250px 和 750px 宽度)。我尝试了以下代码: import java.awt.Color;
我是一名优秀的程序员,十分优秀!