帮忙把VC的代码翻译成delphi的(100分)

  • 主题发起人 主题发起人 jieson
  • 开始时间 开始时间
J

jieson

Unregistered / Unconfirmed
GUEST, unregistred user!
一样的翻译一次就行了,工作量不算大吧?

typedef unsigned long HRGBCAPTURE, *PHRGBCAPTURE, FAR *LPHRGBCAPTURE;

enum
{
RGBFORMAT_3WIRE_SYNC_ON_GREEN,
RGBFORMAT_4WIRE_COMPOSITE_SYNC,
RGBFORMAT_5WIRE_SEPARATE_SYNCS,
};

typedef void (RGBFRAMECAPTUREDFN)(LPVOID FrameCapturedArg);

typedef struct
{
unsigned short Size
/* Size in bytes of this structure. */
unsigned long Flags
/* Indicates which fields are relevant. */
unsigned short Input
/* Which input connector to capture from. */
unsigned short Format
/* Format of RGB signal to be captured. */
VDIF VideoTimings
/* The characteristics of the signal. */
unsigned short Phase
/* Aligns samples with pixels in signal. */
unsigned short Brightness
/* Modifies DC offset. */
unsigned short Contrast
/* Input voltage/gain. */
unsigned short BlackLevel
/* When to sample black level (number of
* pixels from the reference point). */
unsigned short SampleRate
/* Frames to drop between samples. */
unsigned short PixelFormat
/* Pixel format for frame buffer reads. */
unsigned short SyncEdge
/* The HSYNC edge to use as reference. */
signed long HorScale
/* . */
signed short HorOffset
/* . */
signed short VerOffset
/* . */
HWND HWnd
/* Window to receive messages from ISR. */
RGBFRAMECAPTUREDFN *FrameCapturedFn
/* Pointer to frame captured function.*/
LPVOID FrameCapturedArg; /* Parameters for function.*/
}
RGBCAPTUREPARMS, *PRGBCAPTUREPARMS, FAR *LPRGBCAPTUREPARMS;

typedef struct
{
unsigned short Size
/* Size in bytes of this structure. */
unsigned long NPixelsInBuffer
/* Maximum number of pixels. */
unsigned short NBuffers
/* Number of frame stores available. */
unsigned long Flags
/* General flags. */
} RGBCAPTURECAPS, *PRGBCAPTURECAPS, FAR *LPRGBCAPTURECAPS;


typedef unsigned long RGBERROR;

typedef struct
{
LPVOID LpVoidBuffer
/* Pointer application uses to access data. */
unsigned short Index
/* Used to identify buffer to RGB device. */
} RGBCAPTUREBUFFER, *PRGBCAPTUREBUFFER, FAR *LPRGBCAPTUREBUFFER;
 
其实找一本C语言入门书看看就了解了,
1.typedef unsigned long xxx
就是xxx value 相当于 unsigned long value
2.enum就是枚举
其他的再自己看看
 
我着急啊,没时间去查了,知道的给我改改就行了,楼上的老大写的我名看懂
 
我这里有段比你的长N倍的C程序,也要翻译成delphi的,苦恼郁闷啊
 
楼上的老大,哈哈,我也是比这长n倍的要翻译啊,能看懂的我就自己看,看不懂的就问了。
 
type
HRGBCAPTURE=Integer;
PHRGBCAPTURE=^HRGBCAPTURE
//16bit?
LPHRGBCAPTURE=^HRGBCAPTURE;

RGBFORMAT=(
RGBFORMAT_3WIRE_SYNC_ON_GREEN,
RGBFORMAT_4WIRE_COMPOSITE_SYNC,
RGBFORMAT_5WIRE_SEPARATE_SYNCS
);

RGBFRAMECAPTUREDFN=procedure(FrameCapturedArg:Pointer);

RGBCAPTUREPARMS=record
Size:Word
// Size in bytes of this structure.
Flags:LongWord
// Indicates which fields are relevant.
Input:Word
// Which input connector to capture from.
Format:Word
// Format of RGB signal to be captured.
VideoTimings:VDIF
// The characteristics of the signal. //???
Phase:Word
// Aligns samples with pixels in signal.
Brightness:Word
// Modifies DC offset.
Contrast:Word
// Input voltage/gain.
BlackLevel:Word
// When to sample black level (number of
// pixels from the reference point).
SampleRate:Word
// Frames to drop between samples.
PixelFormat:Word
// Pixel format for frame buffer reads.
SyncEdge:Word
// The HSYNC edge to use as reference.
HorScale:Integer
// .
HorOffset:SmallInt
// .
VerOffset:SmallInt
// .
HWind:HWND
// Window to receive messages from ISR.
FrameCapturedFn:^RGBFRAMECAPTUREDFN
// Pointer to frame captured function.
FrameCapturedArg:Pointer
// Parameters for function.
end;
PRGBCAPTUREPARMS=^RGBCAPTUREPARMS
//16bit?
LPRGBCAPTUREPARMS=^RGBCAPTUREPARMS;

RGBCAPTURECAPS=record
Size:Word
// Size in bytes of this structure.
NPixelsInBuffer:LongWord
// Maximum number of pixels.
NBuffers:Word
// Number of frame stores available.
Flags:LongWord
// General flags.
end;
PRGBCAPTURECAPS=^RGBCAPTURECAPS
//16bit?
LPRGBCAPTURECAPS=^RGBCAPTURECAPS;


RGBERROR=LongWord;

RGBCAPTUREBUFFER=record
LpVoidBuffer:Pointer
// Pointer application uses to access data.
Index:Word
// Used to identify buffer to RGB device.
end;
PRGBCAPTUREBUFFER=^RGBCAPTUREBUFFER
//16bit?
LPRGBCAPTUREBUFFER=^RGBCAPTUREBUFFER;


有一个未知数据类型:VDIF。还有,RGBCAPTUREPARMS中的HWnd由于和数据类型HWND同名,被改成了HWind。
 
楼上的老大,多谢了,试试看先,能用马上给分[:D][:D]
 
接受答案了.
 
后退
顶部