首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Qt嵌入的交换颜色位:红色和蓝色

Qt嵌入的交换颜色位:红色和蓝色
EN

Stack Overflow用户
提问于 2012-08-07 00:18:41
回答 2查看 3.2K关注 0票数 6

我在ARM显示设备上使用QtEmbedded (4.8.0),帧缓冲区(/dev/fb0)上有16位颜色深度。在这种情况下,我们得到红色和蓝色位交换的颜色。

我们使用以下编译标志:

代码语言:javascript
复制
./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -prefix /home/rchaves/Toolchain -release -opensource -shared -fast -depths 16 -largefile -no-exceptions -no-accessibility -stl -no-sql-mysql -no-sql-psql -no-sql-oci -no-sql-odbc -no-sql-tds -no-sql-db2 -no-sql-sqlite -no-sql-sqlite2 -no-sql-ibase -no-qt3support -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -iconv -no-pch -no-dbus -qt-freetype -no-opengl -qt-gfx-linuxfb -qt-kbd-linuxinput -qt-mouse-tslib -nomake demos -nomake examples

和以下参数来执行应用程序:

代码语言:javascript
复制
QWS_DISPLAY=LinuxFb:/dev/fb0:depth=16 ./app -qws

下面是应用程序帧缓冲区(示例)日志:

代码语言:javascript
复制
The framebuffer device was opened successfully.

Fixed screen info:
    id:          DISP3 BG
    smem_start:  0x93800000
    smem_len:    7864320
    type:        0
    type_aux:    0
    visual:      2
    xpanstep:    1
    ypanstep:    1
    ywrapstep:   0
    line_length: 2048
    mmio_start:  0x0
    mmio_len:    0
    accel:       0

The framebuffer device was mapped to memory successfully.

Successfully switched to graphics mode.

Variable screen info:
    xres:           1024
    yres:           768
    xres_virtual:   1024
    yres_virtual:   3840
    yoffset:        0
    xoffset:        0
    bits_per_pixel: 16
    grayscale: 0
    red:    offset:  0, length:  5, msb_right:  0
    green:  offset:  5, length:  6, msb_right:  0
    blue:   offset: 11, length:  5, msb_right:  0
    transp: offset:  0, length:  0, msb_right:  0
    nonstd:       0
    activate:     64
    height:       -1
    width:        -1
    accel_flags:  0x0
    pixclock:     15385
    left_margin:  157
    right_margin: 157
    upper_margin: 16
    lower_margin: 15
    hsync_len:    5
    vsync_len:    1
    sync:         0
    vmode:        0

Frame Buffer Performance test...
    Average:   43020 usecs
    Bandwidth: 174.338 MByte/Sec
    Max. FPS:  23.245 fps

Will draw 3 rectangles on the screen,
they should be colored red, green and blue (in that order).
Done.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-05-20 09:13:09

晚做总比不做强。我在使用Qt5.5.1和linuxfb插件的SAM5处理器上遇到了这个问题。重新配置或重新编译Qt5框架不会解决问题。

显然,LinuxFB插件不支持BGR格式。有一个跟踪此问题的open bug。检查../src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp中的determineFormat函数,在该函数中,无论提供何种帧缓冲区信息,ImageFormats都被硬编码为**RGB。

要解决此问题,应用附加到错误的patch可能会帮助您解决此问题。

我说“可能”是因为我的帧缓冲区驱动程序错误地报告它是RBG格式的。所以请注意这一点。如果是这种情况,只需对swapRgb标志进行硬编码,直到修复帧缓冲区驱动程序。

票数 1
EN

Stack Overflow用户

发布于 2012-08-07 00:28:41

更新:尝试在./configure中设置-depths generic并使用-display linuxfb:genericcolors运行。这是根据讨论该问题的this thread

老答案:听起来你的显示器的字节顺序被调换了。

根据documentation,您可以尝试将littleendian选项传递给显示字符串。另一种选择是查阅关于执行字节顺序交换的linux fb文档。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11832120

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档