Showing posts with label data type. Show all posts
Showing posts with label data type. Show all posts

Monday, March 19, 2012

TCapStatus structure

CAPSTATUS
The CAPSTATUS structure defines the current state of the capture window.

typedef struct {
UINT uiImageWidth;
UINT uiImageHeight;
BOOL fLiveWindow;
BOOL fOverlayWindow;
BOOL fScale;
POINT ptScroll;
BOOL fUsingDefaultPalette;
BOOL fAudioHardware;
BOOL fCapFileExists;
DWORD dwCurrentVideoFrame;
DWORD dwCurrentVideoFramesDropped;
DWORD dwCurrentWaveSamples;
DWORD dwCurrentTimeElapsedMS;
HPALETTE hPalCurrent;
BOOL fCapturingNow;
DWORD dwReturn;
UINT wNumVideoAllocated;
UINT wNumAudioAllocated;
} CAPSTATUS;

Members

 uiImageWidth

Image width, in pixels.

 uiImageHeight 

Image height, in pixels

 fLiveWindow 

Live window flag. The value of this member is TRUE if the window is displaying video using the preview method.

 fOverlayWindow 

Overlay window flag. The value of this member is TRUE if the window is displaying video using hardware overlay.

 fScale

Input scaling flag. The value of this member is TRUE if the window is scaling the input video to the client area when displaying video using preview. This parameter has no effect when displaying video using overlay.

 ptScroll

The x- and y-offset of the pixel displayed in the upper left corner of the client area of the window.

 fUsingDefaultPalette

Default palette flag. The value of this member is TRUE if the capture driver is using its default palette.

 fAudioHardware

Audio hardware flag. The value of this member is TRUE if the system has waveform-audio hardware installed.

 fCapFileExists

Capture file flag. The value of this member is TRUE if a valid capture file has been generated.

 dwCurrentVideoFrame

Number of frames processed during the current (or most recent) streaming capture. This count includes dropped frames.

 dwCurrentVideoFramesDropped

Number of frames dropped during the current (or most recent) streaming capture. Dropped frames occur when the capture rate exceeds the rate at which frames can be saved to file. In this case, the capture driver has no buffers available for storing data. Dropping frames does not affect synchronization because the previous frame is displayed in place of the dropped frame.

 dwCurrentWaveSamples

Number of waveform-audio samples processed during the current (or most recent) streaming capture.

 dwCurrentTimeElapsedMS

Time, in milliseconds, since the start of the current (or most recent) streaming capture.

 hPalCurrent

Handle to current palette.

 fCapturingNow

Capturing flag. The value of this member is TRUE when capturing is in progress.

 dwReturn

Error return values. Use this member if your application does not support an error callback function.

 wNumVideoAllocated

Number of video buffers allocated. This value might be less than the number specified in the wNumVideoRequested member of the CAPTUREPARMS structure.

 wNumAudioAllocated

Number of audio buffers allocated. This value might be less than the number specified in the wNumAudioRequested member of the CAPTUREPARMS structure.

Remarks

Because the state of a capture window changes in response to various messages, an application should update the information in this structure whenever it needs to enable menu items, determine the actual state of the capture window, or call the video format dialog box. If the application yields during streaming capture, this structure returns the progress of the capture in the dwCurrentVideoFrame, dwCurrentVideoFramesDropped, dwCurrentWaveSamples, and dwCurrentTimeElapsedMS members. Use the WM_CAP_GET_STATUS message or capGetStatus macro to update the contents of this structure.

Saturday, February 25, 2012

wchar_t type

wchar_t 的用法:

wchar_t wchA = L'A';
wchar_t *wstrA = L"ABCD";

Wednesday, November 18, 2009

TBrush

Determines the color and pattern for filling graphical shapes and backgrounds.

__property TBrush* Brush = {read=FBrush, write=SetBrush};

Description


Set the Brush property to specify the color and pattern to use when drawing the background or filling in graphical shapes. The value of Brush is a TBrush object. Set the properties of the TBrush object to specify the color and pattern or bitmap to use when filling in spaces on the canvas.

Note: Setting the Brush property assigns the specified TBrush object, rather than replacing the current TBrush object.
Note: Brush must have a Style of bsSolid before you can paint.


Example:
Image1->Canvas->Brush->Color =(TColor)RGB(130,67,33);
設定 Image1 畫布上筆刷的顏色為 (130,67,33)。

Thursday, October 22, 2009

如何將 AnsiString 轉成 char 資料型態?

.c_str(); // for 舊版 C++ Builder
.t_str(); // for 新版 C++ Builder 2009

Example:
fopen(OpenDialog1->FileName.t_str(),"r");

Thursday, October 15, 2009

TBitmap::PixelFormat

Indicates the bit format of the bitmap image, specifying how the image is displayed and how the pixels of the bitmap image are stored in memory.

enum TPixelFormat {pfDevice, pf1bit, pf4bit, pf8bit, pf15bit, pf16bit, pf24bit, pf32bit, pfCustom};
__property TPixelFormat PixelFormat = {read=GetPixelFormat, write=SetPixelFormat, nodefault};

Description

Use PixelFormat to change a TBitmap's internal image to a particular memory format and color depth, or to find out what memory format and color depth a TBitmap is using.

For example, PixelFormat can be used to set the pixel format of the bitmap image to 8-bit for video drivers that cannot display the native format of a bitmap image.

Changing the pixel format is most commonly used with ScanLine, because your code must decode the pixel data accessed by ScanLine. Image-editing tools usually use one pixel for all internal image operations and copy the results to the screen (in whatever format) as the last step.

Friday, October 06, 2006

TCanvas

TCanvas 這個類別是用來處理 Window 繪圖的介面, 負責與 Window 的裝置驅動程式溝通, 透過裝置驅動程式將資料顯示在顯示器上面。

C++ Builder 中, 具有 Canvas 的元件有 TForm, TImage, TbitButton ... 等等, 換句話說, 你可以在這些元件上繪圖。

TCanvas 透過畫筆 (TPen) 和 畫刷 (TBrush) 兩個類別來進行繪圖。除此, 也可以直接透過 Pixels property 對畫布上的像素色彩值進行存取。

TCanvas provides an abstract drawing space for objects that must render their own images.
Hierarchy
TObject -> TPersistent -> TCanvas

Unit
Graphics

Description
Use TCanvas as a drawing surface for objects that draw an image of themselves. Standard window controls such as edit controls or list boxes do not require a canvas, as they are drawn by the system.

TCanvas provides properties, events and methods that assist in creating an image by
。Specifying the type of brush, pen and font to use.
。Drawing and filling a variety of shapes and lines.
。Writing text.
。Rendering graphic images.
。Enabling a response to changes in the current image.

TCanvas has two descendants, TControlCanvas and TMetafileCanvas, which assist in drawing images of controls and in creating metafile images for objects.

TColor type

TColor is used to specify the color of an object.
Unit
Graphics

enum TColor {clMin=-0x7fffffff-1, clMax=0x7fffffff};

Description
TColor is used to specify the color of an object. It is used by the Color property of many components and by a number of other properties that specify color values.

The Graphics unit contains definitions of useful constants for TColor. These constants map either directly to the closest matching color in the system palette (for example, clBlue maps to blue) or to the corresponding system screen element color defined in the Color section of the Windows Control panel (for example, clBtnFace maps to the system color for button faces).

If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green, and red, respectively. The value 0x00FF0000 represents full-intensity, pure blue, 0x0000FF00 is pure green, and 0x000000FF is pure red. 0x00000000 is black and 0x00FFFFFF is white.

If the highest-order byte is zero (0x00), the color obtained is the closest matching color in the system palette. If the highest-order byte is one (0x01), the color obtained is the closest matching color in the currently realized palette. If the highest-order byte is two (0x02), the value is matched with the nearest color in the logical palette of the current device context.
注意: TColor 本身已經是一個最底層的資料型態了, 本身是一個 enum 的型態, 長度為 4 個位元組(bytes) 的整數。

Sunday, May 28, 2006

tagPOINT type

tagPOINT 是一個結構型資料型態, 剛剛費了一點力氣把原始宣告的程式碼從

C:\Program Files\Borland\CBuilder6\Include\Vcl\

中給找出來, 我是在 types.hpp 這個檔案中找到宣告的程式碼的:

struct TPoint : public POINT
{
TPoint() {}
TPoint(int _x, int _y) { x=_x; y=_y; }
TPoint(POINT& pt) { x = pt.x; y = pt.y; }
};
typedef TPoint tagPoint;

也就是說, 由於 BCB 透過 vcl.h 將這段程式碼放到程式的開頭, 所以我們寫程式時, 只要前面有加上

#include < vcl.h >

就可以使用這個 tagPOINT 資料型態了。

但, 要怎麼使用呢?

宣告部份:

tagPOINT ptCurrent;
/* 當滑鼠的位置點在 (X, Y) 時, 我們就可以把這個座標存到 ptCurrent 這個變數之中。*/

程式部份:
ptCurrent.x = X; ptCurrent.y = Y;

同學們可以先試試使用 tagPOINT 這個資料型態, 然後嘗試把 tagPOINT 與 stack 的用法結合起來。