Showing posts with label TCanvas. Show all posts
Showing posts with label TCanvas. Show all posts

Friday, December 07, 2012

TCanvas

剛剛在 C++ Builder 的 Developer's Guide 看到一段話, 解了一個很久以來的疑問!

"Canvases are available only at runtime, so you do all your work with canvases by writing code"

這也解釋了為什麼這個 Image 物件中的小物件沒有出現在 Object Inspector 的 Properties 之中, 而 Picture 卻有出現在 Image 中的 Properties 之中。


Wednesday, September 07, 2011

TCanvas::FillRect Method

Image1->Canvas->Brush->Color = (TColor) RGB(130,67,33);
Image1->Canvas->FillRect(Rect(50,100,80,200));

這兩行指令就是
1. 設定Image1畫布上筆刷的顏色為 (130,67,33)
2. 把矩形 Rect(50,100,80,200) 用筆刷填滿

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)。

Tuesday, November 17, 2009

TCanvas::Pixels

TCanvas 有一個 property , 一般表示成 TCanvas::Pixels, 是我們常會用到的, Pixels 這個 property 可以讀出, 也可以寫入某個特定位置的色彩值, 因此這個 property 的類別為 TColor。在 BCB Help 中的說明如下:
TCanvas::Pixels
Specifies the color of the pixels within the current ClipRect.

__property TColor Pixels[int X][int Y] = {read=GetPixel, write=SetPixel};

Description
Read Pixels to learn the color on the drawing surface at a specific pixel position within the current clipping region. If the position is outside the clipping rectangle, reading the value of Pixels returns -1.

Write Pixels to change the color of individual pixels on the drawing surface. Use Pixels for detailed effects on an image. Pixels may also be used to determine the color that should be used for the FillRect method.

Not every device context supports the Pixels property. Reading the Pixels property for such a device context will return a value of -1. Setting the Pixels property for such a device context does nothing.

Saturday, October 21, 2006

TCanvas::CopyRect method

Copies part of an image from another canvas into the canvas.
void __fastcall CopyRect(const TRect &Dest, TCanvas* Canvas, const TRect &Source);

Description
Use CopyRect to transfer part of the image on another canvas to the image of the TCanvas object. Dest specifies the rectangle on the canvas where the source image will be copied. The Canvas parameter specifies the canvas with the source image. Source specifies a rectangle bounding the portion of the source canvas that will be copied.

The portion of the source canvas is copied using the mode specified by CopyMode.
TCanvas::CopyRect method 可以將另外一個 Canvas ( 第二個輸入參數 ) 中的特定長方塊 (rectangle) ( 第三個輸入參數 ) 中的影像 copy 到自己這個 Canvas 的特定長方塊( 第一個輸入參數 ) 中。