64,639
社区成员
发帖
与我相关
我的任务
分享
srand( (unsigned)time(NULL) );
int nRed, nGreen, nBlue;
for(int i=0; i < 6; i++){
nRed = (UINT8 *)( rend() ) % 255;
nGreen = (UINT8 *)( rend() ) % 255;
nBlue = (UINT8 *)( rend() ) % 255;
myColor[i].BmpBKColor = Color( nRed, nGreen, nBlue );
nRed = (UINT8 *)( rend() ) % 255;
nGreen = (UINT8 *)( rend() ) % 255;
nBlue = (UINT8 *)( rend() ) % 255;
myColor[i].penBKColor = Color( nRed, nGreen, nBlue );
nRed = (UINT8 *)( rend() ) % 255;
nGreen = (UINT8 *)( rend() ) % 255;
nBlue = (UINT8 *)( rend() ) % 255;
myColor[i].aRectBKColor = Color( nRed, nGreen, nBlue );
nRed = (UINT8 *)( rend() ) % 255;
nGreen = (UINT8 *)( rend() ) % 255;
nBlue = (UINT8 *)( rend() ) % 255;
myColor[i].aaRectBKColor = Color( nRed, nGreen, nBlue );
nRed = (UINT8 *)( rend() ) % 255;
nGreen = (UINT8 *)( rend() ) % 255;
nBlue = (UINT8 *)( rend() ) % 255;
myColor[i].aaaRectBKColor = Color( nRed, nGreen, nBlue );
nRed = (UINT8 *)( rend() ) % 255;
nGreen = (UINT8 *)( rend() ) % 255;
nBlue = (UINT8 *)( rend() ) % 255;
myColor[i].aaaaRectBKColor = Color( nRed, nGreen, nBlue );
}
struct BKColor
{
Color BmpBKColor;
Color penBKColor;
Color aRectBKColor;
Color aaRectBKColor;
Color aaaRectBKColor;
Color aaaaRectBKColor;
}BKColor myColor[6];
void ColorSchemesPane::FillPreviewControl ( void )
{
for ( sal_Int32 nIndex = 0; nIndex < 6; nIndex++ ){
mpVSColorSchemesStyles->InsertItem( static_cast <USHORT>(nIndex+1), Image( CreateStylePreview( myColor )) );
}
}
const Bitmap CreateStylePreview( BKColor myCol)
{
// initialize the size of bmp
Bitmap aPreviewBmp( Size(70,56), 24,NULL );
BitmapWriteAccess* pAccess = aPreviewBmp.AcquireWriteAccess();
if ( pAccess ){
// initialize the bkcolor of bmp
pAccess->Erase( Color(COL_LIGHTCYAN) );
}
// draw the Pentagon
Point aPentagon[5];
aPentagon[0] = Point( 5, 33 );
aPentagon[1] = Point( 16, 33 );
aPentagon[2] = Point( 22, 39);
aPentagon[3] = Point( 16, 45 );
aPentagon[4] = Point( 5, 45 );
const Polygon aPenPoly( 5, aPentagon );
pAccess->SetFillColor( Color(COL_BLACK) );
pAccess->FillPolygon( aPenPoly );
// draw the histogram
const Rectangle aRect( 30, 40, 37, 53 );
pAccess->SetFillColor( Color(COL_LIGHTBLUE) );
pAccess->FillRect( myCol.aRect );
const Rectangle aaRect( 38, 30, 44, 53 );
pAccess->SetFillColor( Color(COL_GREEN) );
pAccess->FillRect( myCol.aaRect );
const Rectangle aaaRect( 45, 35, 51, 53 );
pAccess->SetFillColor( Color(COL_LIGHTRED) );
pAccess->FillRect( myCol.aaaRect );
const Rectangle aaaaRect( 52, 42, 58, 53 );
pAccess->SetFillColor( Color(COL_GREEN) );
pAccess->FillRect( myCol.aaaaRect );
// draw the line of the graph bottom and left side.
const Point aLPoint( 30, 53 );
const Point aRPoint( 62, 53 );
const Point aTPoint( 30, 29 );
const Point aBPoint( 30, 53 );
pAccess->SetLineColor( Color(COL_BLACK) );
pAccess->DrawLine( aLPoint, aRPoint );
pAccess->DrawLine( aTPoint, aBPoint );
aPreviewBmp.ReleaseAccess( pAccess );
return aPreviewBmp;
}