KanziStudio工程可執行程序在QNX背景透明詳細配置

 hpp文件 

// 庫文件引入
#ifdef __QNX__
screen_window_t* kzsWindowNativeGetScreenWindow(struct KzsWindowNative* windowNative);
struct KzsDesktopNative* kzsDesktopGetNative(const struct KzsDesktop* desktop);
screen_context_t* kzsDesktopNativeGetScreenContext(struct KzsDesktopNative* desktopNative);
#include <screen/screen.h>
#include <stdio.h>
#include <stdlib.h>
#define EGL_EGLEXT_PROTOTYPES = 1
#define GL_GLEXT_PROTOTYPES = 1
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/eglext.h>	  
#include <unistd.h>
#include <signal.h>
#include <kanzi/core.ui/platform/windowing/common/kzs_desktop.h>
#include <kanzi/core.ui/platform/windowing/kzs_window_native.hpp>
#include <kanzi/core.ui/platform/windowing/qnx_screen/kzs_desktop_native.h>
#include <kanzi/core.ui/platform/windowing/qnx_screen/kzs_display_native.h>
#include <kanzi/core.ui/platform/windowing/qnx_screen/kzs_window_native.h>
#include <screen/screen.h>
#endif

 main.cpp中onProjectLoaded()加入 

// 配置可執行程序name=TestDemo
#ifdef __QNX__
        shared_ptr<GlGraphicsOutput> output = dynamic_pointer_cast<GlGraphicsOutput>(getGraphicsOutput());
        KzsDesktopNative* desktopNative = kzsDesktopGetNative(output->getDesktop());
        screen_window_t mainWindow = *kzsWindowNativeGetScreenWindow(kzsWindowGetNative(output->getWindow()));
        char new_name[64] = "TestDemo";
        screen_set_window_property_cv(mainWindow, SCREEN_PROPERTY_ID_STRING, sizeof(new_name), new_name);
        screen_buffer_t screen_buf[2];
        screen_get_window_property_pv(mainWindow, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)screen_buf);
        //KzLogDebug(("set Window Name {}", new_name));
        int rc = screen_post_window(mainWindow, screen_buf[0], 0, NULL, 0);
        if (rc) {
            //KzLogDebug(("Kanzi screen_post_window failed."));
        }
#endif

(方式一)main.cpp中 onConfigure(ApplicationProperties& configuration)加入

virtual void onConfigure(ApplicationProperties& configuration) KZ_OVERRIDE
{
    configuration.binaryName = "demotest.kzb.cfg";
    // 配置可執行程序的groupname
    configuration.defaultWindowProperties.groupName = string("TEST_DEMO");
    configuration.defaultWindowProperties.width = 1280;
    configuration.defaultWindowProperties.height = 720;
    // 配置kanzi工程的rgba參數爲8位使在kzb中設置透明背景生效
    configuration.defaultSurfaceProperties.bitsColorR = 8;
    configuration.defaultSurfaceProperties.bitsColorG = 8;
    configuration.defaultSurfaceProperties.bitsColorB = 8;
    configuration.defaultSurfaceProperties.bitsAlpha = 8;
}

 (方式二)application.cfg中配置

SurfaceBitsRed = 8
SurfaceBitsGreen = 8
SurfaceBitsBlue = 8
SurfaceBitsAlpha = 8
DefaultDisplayIndex = 1

備註:kanzi工程中設置背景色rgba爲0,0,0,0(Screen+RootPage)

application.cfg 

example

 

# An example configuration for a typical high-speed rendering application
SurfaceBitsStencil = 1
SurfaceBitsDepthBuffer = 16
SurfaceBitsRed = 5
SurfaceBitsGreen = 6
SurfaceBitsBlue = 5
SurfaceBitsAlpha = 0
SurfaceSamplesAntialiasing = 0

 

 

# An example configuration for a high image quality application
SurfaceBitsStencil = 8
SurfaceBitsDepthBuffer = 24
SurfaceBitsRed = 8
SurfaceBitsGreen = 8
SurfaceBitsBlue = 8
SurfaceBitsAlpha = 8
SurfaceSamplesAntialiasing = 4

 

onConfigure() 

example

 

// An example configuration for a typical high-speed rendering application
configuration.defaultSurfaceProperties.bitsStencil = 1;
configuration.defaultSurfaceProperties.bitsDepthBuffer = 16;
configuration.defaultSurfaceProperties.bitsColorR = 5;
configuration.defaultSurfaceProperties.bitsColorG = 6;
configuration.defaultSurfaceProperties.bitsColorB = 5;
configuration.defaultSurfaceProperties.bitsAlpha = 0;
configuration.defaultSurfaceProperties.antiAliasing = 0;

 

 

// An example configuration for a high image quality application
configuration.defaultSurfaceProperties.bitsStencil = 8;
configuration.defaultSurfaceProperties.bitsDepthBuffer = 24;
configuration.defaultSurfaceProperties.bitsColorR = 8;
configuration.defaultSurfaceProperties.bitsColorG = 8;
configuration.defaultSurfaceProperties.bitsColorB = 8;
configuration.defaultSurfaceProperties.bitsAlpha = 8;
configuration.defaultSurfaceProperties.antiAliasing = 4;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章