Contents

조회 수 15122 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
제가 전에 했던 작업중 샘플입니다.
Web상에서 Counter를 jpeg로 만들어서 뿌려주던 것입니다. 

#include "gd.h" 
#include "gdfontl.h"
    
void outCounter(long lTotal, long lToday)
{   
    gdImagePtr im;
    FILE *pngout, *jpegout;
    int black, white, back, blue;
    int nTextColor;

    int brect[8];
    int x, y, nXTop, nYLeft;
    int nSizeX, nSizeY;
    char s[40];
    char *f = "/usr/share/fonts/user/hatten.ttf";
    double sz = 12.;
    char *err; 

    sprintf(s, "Today:%08ld / Total:%08ld", lToday, lTotal);
    err = gdImageStringTTF(NULL,&brect[0],0,f,sz,0.,0,0,s);
    
    nSizeX = 180;
    nSizeY = brect[3]-brect[7] + 6;
    
    im = gdImageCreate(nSizeX, nSizeY);

    black = gdImageColorAllocate(im, 0, 0, 0);
    white = gdImageColorAllocate(im, 255, 255, 255);
    back = gdImageColorAllocate(im, 200, 200, 200);
    blue = gdImageColorAllocate(im, 211, 212, 223);
    nTextColor = gdImageColorAllocate(im, 12, 4, 89);

    gdImageFill(im, 1, 1, blue);

    nXTop = 5-brect[6];
    nYLeft = 13; 

    err = gdImageStringTTF(im,&brect[0],nTextColor,f,sz,0.0,nXTop,nYLeft,s);
    if (err) {fprintf(stderr,err); return;}
    
    printf("Content-type: image/jpeg\n\n");
    gdImageJpeg(im, stdout, -1);
    
    gdImageDestroy(im);
}


?

  1. '2014 모바일 개발 트렌드' 발표자료입니다.

    Date2014.10.02 CategoryDevelop Byhooni Views1114
    Read More
  2. Apache CORS 설정

    Date2020.09.04 CategorySystem/OS Byhooni Views2846
    Read More
  3. Aspect Oriented Programming in Objective-C

    Date2015.05.18 CategoryDevelop Byhooni Views910
    Read More
  4. asx미디어 정보 기록..

    Date2003.04.23 CategorySystem/OS Byhooni Views20587
    Read More
  5. CentOS 6.5 USB 설치

    Date2013.12.18 CategorySystem/OS Byhooni Views37778
    Read More
  6. CentOS 에서 Cacti 설치하기

    Date2015.01.02 CategorySystem/OS Byhooni Views1907
    Read More
  7. Configure Postfix to Use Gmail SMTP on Ubuntu 18.04

    Date2020.02.07 CategorySystem/OS Byhooni Views1451
    Read More
  8. DDay Memo 1.9.4 소스코드

    Date2015.10.03 CategoryDevelop Byhooni Views0
    Read More
  9. EBS [수학영역] 미적분과 통계 기본 - 정규분포의 의미와 특징은?

    Date2015.04.20 CategoryEtc Byhooni Views1080
    Read More
  10. Enable Safari Hidden Debug Menu in Mac OS X

    Date2017.02.07 CategorySystem/OS Byhooni Views1648
    Read More
  11. Enable the Develop Menu in Safari

    Date2017.02.07 CategorySystem/OS Byhooni Views1288
    Read More
  12. GCM 사용하기 2 (단말에 GCM 구현하기)

    Date2013.07.06 CategoryDevelop Byhooni Views23375
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 98 Next
/ 98