예제 #1
0
파일: GD.c 프로젝트: drudru/cel
void GDstringwithFontXYColor(void)
{
    Proto  proto;
    Proto  tmp;
    Proto  blob;
    Proto  strObj;
    gdImagePtr imgPtr;
    gdFontPtr  fntPtr;
    char * p;
    int    x1,y1;
    int    font;
    int    index;
    char * buff;
    
    proto = (Proto) stackAt(Cpu, 2);

    objectGetSlot(proto, stringToAtom("_gdp"), &blob);
    p = (char *) objectPointerValue(blob);
    memcpy(&imgPtr, p, sizeof(imgPtr));
    
    tmp = (Proto) stackAt(Cpu, 4);
    strObj = tmp;

    tmp = (Proto) stackAt(Cpu, 5);
    font= objectIntegerValue(tmp);
    fntPtr = getFontPtr(font);

    tmp = (Proto) stackAt(Cpu, 6);
    x1 = objectIntegerValue(tmp);

    tmp = (Proto) stackAt(Cpu, 7);
    y1 = objectIntegerValue(tmp);

    tmp = (Proto) stackAt(Cpu, 8);
    index = objectIntegerValue(tmp);

    buff = string2CString(strObj);
    gdImageString(imgPtr, fntPtr, x1, y1, buff, index);
    celfree(buff);
    
    VMReturn(Cpu, (unsigned int) proto, 8);
}
예제 #2
0
 void putEmergencyChar(uint16 *dst, int _screenWidth, uint16 _color, int chr)
 {
     const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
     int y, x;
     byte bits = 0;
     const byte *src = getFontPtr(chr);
     
     int height, width;
     
     height = (chr & 0x7f00) ? _korFontHeight : _engFontHeight;
     width = (chr & 0x7f00) ? _korFontWidth : _engFontWidth;
     
     for (y = 0; y < height; y++) {
         for (x = 0; x < width; x++) {
             if ((x % 8) == 0)
                 bits = *src++;
             if ((bits & revBitMask[x % 8])) {
                 *dst = _color;
             }
             dst++;
         }
         dst += _screenWidth - width;
     }
 }