- CVI 정보나눔(www.cvi.kr)
- 스터디
- 개발메모
개발메모(형식에 매이지 않는 짤막한 개발 낙서)
글 수 174
SCF(Simple "C" Function)에 대해 좀더 객체지향적인 개념을 추가한 스타일로 구조체를 이용하기 위해 멤버함수 형태를 만드는 예로서 작업 중인 구조체를 올려둡니다.
struct KD_Image_s
{
// 멤버데이터
unsigned short nBitColor;
long Width, Height;
unsigned long nColorUsed;
KD_RGB3 palette[256];
//KD_RGB3 *img_24;
unsigned char *img_uc;
// 2 Bytes(12 bits, 16 bits) 데이터를 수용하기 위해 확장
unsigned short *img_us;
int dataByte; /// 현재 데이터가 몇 바이트 데이터인지 표시. 0:데이터 없음, 1:1바이트, 2:2바이트
char flag_img_exist; /// 유효한 데이터가 있는지의 여부 0:없음, 1:있음
// 멤버함수(의 포인터)
int (*Init)(struct KD_Image_s *img, int dataByte, int width, int height);
int (*Finish)(struct KD_Image_s *img);
void (*PlotIntensity)(struct KD_Image_s *img, int panel, int control, ColorMapEntry *colormap);
};
typedef struct KD_Image_s KD_Image;
struct KD_Image_s
{
// 멤버데이터
unsigned short nBitColor;
long Width, Height;
unsigned long nColorUsed;
KD_RGB3 palette[256];
//KD_RGB3 *img_24;
unsigned char *img_uc;
// 2 Bytes(12 bits, 16 bits) 데이터를 수용하기 위해 확장
unsigned short *img_us;
int dataByte; /// 현재 데이터가 몇 바이트 데이터인지 표시. 0:데이터 없음, 1:1바이트, 2:2바이트
char flag_img_exist; /// 유효한 데이터가 있는지의 여부 0:없음, 1:있음
// 멤버함수(의 포인터)
int (*Init)(struct KD_Image_s *img, int dataByte, int width, int height);
int (*Finish)(struct KD_Image_s *img);
void (*PlotIntensity)(struct KD_Image_s *img, int panel, int control, ColorMapEntry *colormap);
};
typedef struct KD_Image_s KD_Image;