2014-09-03 41 views
0

我想加載一個int字符串,其中包含width×height元素,它表示一個32位RGB值,並將其轉換爲Xlib中的Pixmap如何在Xlib中將具有給定寬度和高度的32位RGB字符串加載到Pixmap中?

我剛剛找到XReadBitmapFile(),它可以從X位圖讀取到X Pixmap,這可能不能真正滿足我的需求。

那麼,我應該設計一個新的函數來處理它嗎?任何提示都表示讚賞。

+2

請閱讀XImage和相關函數,谷歌爲例。 – 2014-09-03 17:11:38

+0

好提示,我會嘗試其餘部分。 :-) – 2014-09-03 17:21:35

回答

-1
void drawString::DrawString(Display *d, Drawable win, XFontStruct *fontType, int rectWidth, int rectHeight, int HAlign, int VAlign, char* fmt, unsigned long color, unsigned long textColor, Pixmap bgPixmap) 
{ 
    GC gc; 

    if(initValues->blnExitUITThread) 
     return; 

    if(fontType == NULL) 
     return; 

    unsigned short fontHeight, fontWidth, singleFontHeight; 
    int x, y; 
    Pixmap pixmap; 
    char* token; 

    initValues->trueColor = textColor; 

    pixmap = XCreatePixmap(d, win, rectWidth, rectHeight, DefaultDepth(d, 0)); 
    gc = XCreateGC(d, pixmap, 0, NULL); 
相關問題