PathGradientBrush::GetBlendCount method (gdipluspath.h)
Metode PathGradientBrush::GetBlendCount mendapatkan jumlah faktor campuran yang saat ini diatur untuk sikat gradien jalur ini.
Sintaks
INT GetBlendCount();
Mengembalikan nilai
Jenis: INT
Metode ini mengembalikan jumlah faktor campuran yang saat ini ditetapkan untuk sikat gradien jalur ini.
Keterangan
Sebelum Anda memanggil metode PathGradientBrush::GetBlend dari objek PathGradientBrush , Anda harus mengalokasikan dua buffer: satu untuk menerima array faktor campuran dan satu untuk menerima array posisi campuran. Untuk menentukan ukuran buffer yang diperlukan, panggil metode PathGradientBrush::GetBlendCount dari objek PathGradientBrush . Ukuran (dalam byte) dari setiap buffer harus menjadi nilai pengembalian PathGradientBrush::GetBlendCount dikalikan dengan sizeof( REAL).
Contoh
Contoh berikut menunjukkan beberapa metode kelas PathGradientBrush , termasuk PathGradientBrush::SetBlend, PathGradientBrush::GetBlendCount, dan PathGradientBrush::GetBlend. Kode membuat objek PathGradientBrush dan memanggil metode PathGradientBrush::SetBlend untuk membuat serangkaian faktor campuran dan posisi campuran untuk kuas. Kemudian kode memanggil metode PathGradientBrush::GetBlendCount untuk mengambil jumlah faktor campuran. Setelah jumlah faktor campuran diambil, kode mengalokasikan dua buffer: satu untuk menerima array faktor campuran dan satu untuk menerima array posisi campuran. Kemudian kode memanggil metode PathGradientBrush::GetBlend untuk mengambil faktor campuran dan posisi campuran.
VOID Example_GetBlend(HDC hdc)
{
Graphics graphics(hdc);
// Create a path that consists of a single ellipse.
GraphicsPath path;
path.AddEllipse(0, 0, 200, 100);
// Use the path to construct a brush.
PathGradientBrush pthGrBrush(&path);
// Set the color at the center of the path to blue.
pthGrBrush.SetCenterColor(Color(255, 0, 0, 255));
// Set the color along the entire boundary of the path to aqua.
Color colors[] = {Color(255, 0, 255, 255)};
INT count = 1;
pthGrBrush.SetSurroundColors(colors, &count);
// Set blend factors and positions for the path gradient brush.
REAL fac[] = {
0.0f,
0.4f, // 40 percent of the way from aqua to blue
0.8f, // 80 percent of the way from aqua to blue
1.0f};
REAL pos[] = {
0.0f,
0.3f, // 30 percent of the way from the boundary to the center
0.7f, // 70 percent of the way from the boundary to the center
1.0f};
pthGrBrush.SetBlend(fac, pos, 4);
// Fill the ellipse with the path gradient brush.
graphics.FillEllipse(&pthGrBrush, 0, 0, 200, 100);
// Obtain information about the path gradient brush.
INT blendCount = pthGrBrush.GetBlendCount();
REAL* factors = new REAL[blendCount];
REAL* positions = new REAL[blendCount];
pthGrBrush.GetBlend(factors, positions, blendCount);
for(INT j = 0; j < blendCount; ++j)
{
// Inspect or use the value in factors[j].
// Inspect or use the value in positions[j].
}
delete [] factors;
delete [] positions;
}
Persyaratan
Klien minimum yang didukung | Windows XP, Windows 2000 Professional [hanya aplikasi desktop] |
Server minimum yang didukung | Windows 2000 Server [hanya aplikasi desktop] |
Target Platform | Windows |
Header | gdipluspath.h (termasuk Gdiplus.h) |
Pustaka | Gdiplus.lib |
DLL | Gdiplus.dll |
Lihat juga
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk