>> Read Reply from No. 11917 article  
RE: [요청]cgi로gd라이브리를 이용하여 그래프를 그릴
려고 합니다..도와주세요..

등록 2000-11-19 10:37:00     조회 1
이름 이실    

		예제 소스는 라이브러리 소스를 받으시면 그안에 같이 들어있습니다.
 아래가 그 소스입니다.
 gddemo.c
 #include <stdio.h>
#include "gd.h"
#include "gdfontg.h"
#include "gdfonts.h"
 int main(void)
{
        /* Input and output files */
        FILE *in;
        FILE *out;
         /* Input and output images */
        gdImagePtr im_in, im_out;
         /* Brush image */
        gdImagePtr brush;
         /* Color indexes */
        int white;
        int blue;
        int red;
        int green;
         /* Points for polygon */
        gdPoint points[3];
         /* Create output image, 128 by 128 pixels. */
        im_out = gdImageCreate(128, 128);
         /* First color allocated is background. */
        white = gdImageColorAllocate(im_out, 255, 255, 255);
         /* Set transparent color. */
        gdImageColorTransparent(im_out, white);
         /* Try to load demoin.gif and paste part of it into the
                output image. */
         in = fopen("demoin.gif", "rb");
        if (!in) {
                fprintf(stderr, "Can't load source image; this demo");
                fprintf(stderr, "is much more impressive if demoin.gif");
                fprintf(stderr, "is available.");
                im_in = 0;
        } else {
                im_in = gdImageCreateFromGif(in);
                fclose(in);
                /* Now copy, and magnify as we do so */
                gdImageCopyResized(im_out, im_in,
                        16, 16, 0, 0, 96, 96, 127, 127);
        }
        red = gdImageColorAllocate(im_out, 255, 0, 0);
        green = gdImageColorAllocate(im_out, 0, 255, 0);
        blue = gdImageColorAllocate(im_out, 0, 0, 255);
        /* Rectangle */
        gdImageLine(im_out, 8, 8, 120, 8, green);
        gdImageLine(im_out, 120, 8, 120, 120, green);
        gdImageLine(im_out, 120, 120, 8, 120, green);
        gdImageLine(im_out, 8, 120, 8, 8, green);
        /* Circle */
        gdImageArc(im_out, 64, 64, 30, 10, 0, 360, blue);
        /* Arc */
        gdImageArc(im_out, 64, 64, 20, 20, 45, 135, blue);
        /* Flood fill */
        gdImageFill(im_out, 4, 4, blue);
        /* Polygon */
        points[0].x = 32;
        points[0].y = 0;
        points[1].x = 0;
        points[1].y = 64;
        points[2].x = 64;
        points[2].y = 64;
        gdImageFilledPolygon(im_out, points, 3, green);
        /* Brush. A fairly wild example also involving a line style! */
        if (im_in) {
                int style[8];
                brush = gdImageCreate(8, 8);
                gdImageCopyResized(brush, im_in,
                        0, 0, 0, 0,
                        gdImageSX(brush), gdImageSY(brush),
                        gdImageSX(im_in), gdImageSY(im_in));
                gdImageSetBrush(im_out, brush);
                /* With a style, so they won't overprint each other.
                        Normally, they would, yielding a fat-brush effect. */
                style[0] = 0;
                style[1] = 0;
                style[2] = 0;
                style[3] = 0;
                style[4] = 0;
                style[5] = 0;
                style[6] = 0;
                style[7] = 1;
                gdImageSetStyle(im_out, style, 8);
                /* Draw the styled, brushed line */
                gdImageLine(im_out, 0, 127, 127, 0, gdStyledBrushed);
        }
        /* Text */
        gdImageString(im_out, gdFontGiant, 16, 16, "hi", red);
        gdImageStringUp(im_out, gdFontSmall, 32, 32, "hi", red);
        /* Make output image interlaced (allows "fade in" in some viewers,
                and in the latest web browsers) */
        gdImageInterlace(im_out, 1);
        out = fopen("demoout.gif", "wb");
        /* Write GIF */
        gdImageGif(im_out, out);
        fclose(out);
        gdImageDestroy(im_out);
        if (im_in) {
                gdImageDestroy(im_in);
        }
        return 0;
}
  : cgi로 gd라이브리를 이용하여 간단한 그래프를 그리고 싶어요..
: 고수님들...간단한 소스 좀 부탁할께요...
: 도와주세요...
:
: perl말고 c를 소스를 원합니다...
: 그럼 수거하세요...
이름
암호


>> 관련글
11917 [요청]cgi로gd라이브리를 이용하여 그래프를 그릴려고 합니다..도와주세요..  cgi & gd  2000.11.19  ....
  답장 RE: [요청]cgi로gd라이브리를 이용하여 그래프를 그릴려고 합니다..도와주세요..  이실  2000.11.19  ....
Register [ localhost 목록보기 윗글 아랫글
글쓰기
답장쓰기 수정 삭제
정규표현식 [ 상세 검색 ]
페이지로딩: [ 0.80 초 ] 작업시간: [ 0.08 초 ]

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved
[TOP]

적수네 동네
+
| 적수네 동네
| 공부방
| 리눅스 잡지 서고
| LSN 소스
| 링크 모음
+---+
게시판
+
| 떠들어보세!
| 질문과 답변
| 새소식과 정보
| 1원짜리 팁?
| 대화방
+---+
칼럼?
+
| 세하 훔쳐보기
| Welcome2nite
| 혜진의 염장판
+---+
리눅스 상표권
+
| 반대 서명란
| 토론 게시판
+---+
GNU
+
| GNU 선언문
| GNU GPL
| GNU 미러 목록
+---+
프로젝트?
+
| 리눅스카운터
| RC5DES
| 실질헌법 제작
+---+
커널 소식
+
| 안정 버젼: 2.4.14
+---+
테마 선택
+
LSN 방송국?
+
| OFF AIR
+---+
회원
+
| 로그인
+---+
[ 적수네 동네 ] [ 리눅스 상표권 독점 반대 ] [ 한글 리눅스 문서 프로젝트 ] [ KrLine ] [ 사랑넷 ] [ Valid HTML 4.0! ] [ SlashDot ] [ Freshmeat ]
Copyleft (C) 1998-2001 Byeong-Chan Kim . License
TIME: 1789710410
System by WYZsoft, HDD by I.O.Linux, Mizi Research, Embryo, WOWLINUX, Domain by SarangNet, Network by KrLine.