本文整理汇总了C++中CG32bitImage类的典型用法代码示例。如果您正苦于以下问题:C++ CG32bitImage类的具体用法?C++ CG32bitImage怎么用?C++ CG32bitImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CG32bitImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaint
void CTransmuterSession::OnPaint(CG32bitImage &Screen, const RECT &rcInvalid)
{
// paint the background
Screen.Fill(0, 0, Screen.GetWidth(), Screen.GetHeight(), CG32bitPixel(32, 32, 32));
// make sure m_SubSessions is up-to-date with any error sessions
UpdateSubSessionsList();
// call paint functions of all subsessions
for (int i = 0; i < m_SubSessions.GetCount(); i++)
{
m_SubSessions[i]->OnPaint(Screen, rcInvalid);
}
}
示例2:
CGlowingRingPainter::CGlowingRingPainter (CG32bitImage &Dest, int iRadius, int iWidth, const TArray<CG32bitPixel> &ColorRamp, BYTE byOpacity) :
m_Dest(Dest),
m_rcClip(Dest.GetClipRect()),
m_iRadius(iRadius),
m_iWidth(iWidth)
// CGlowingRingPainter constructor
{
int i;
// Pre-multiply the color ramp
m_ColorRamp.InsertEmpty(ColorRamp.GetCount());
m_pColorRamp = &m_ColorRamp;
if (byOpacity == 0xff)
{
for (i = 0; i < m_ColorRamp.GetCount(); i++)
m_ColorRamp[i] = CG32bitPixel::PreMult(ColorRamp[i]);
}
else
{
for (i = 0; i < m_ColorRamp.GetCount(); i++)
{
CG32bitPixel rgbPreMult = CG32bitPixel::PreMult(ColorRamp[i]);
m_ColorRamp[i] = CG32bitPixel(CG32bitPixel::Blend(0, rgbPreMult, byOpacity), CG32bitPixel::BlendAlpha(rgbPreMult.GetAlpha(), byOpacity));
}
}
}
示例3: Paint
void CGTextArea::Paint (CG32bitImage &Dest, const RECT &rcRect)
// Paint
//
// Handle paint
{
RECT rcText = CalcTextRect(rcRect);
// Paint the background
if (m_iBorderRadius > 0)
CGDraw::RoundedRect(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_iBorderRadius, m_rgbBackColor);
else
Dest.Fill(rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), m_rgbBackColor);
// Paint the editable box
if (m_bEditable)
{
CG32bitPixel rgbBorderColor = CG32bitPixel::Blend(CG32bitPixel(0, 0, 0), m_rgbColor, (BYTE)128);
CGDraw::RectOutlineDotted(Dest, rcRect.left, rcRect.top, RectWidth(rcRect), RectHeight(rcRect), rgbBorderColor);
}
// Paint the content
if (!m_sText.IsBlank())
PaintText(Dest, rcText);
else
PaintRTF(Dest, rcText);
}
示例4: GetBackgroundImageSize
void CSystemMap::GetBackgroundImageSize (int *retcx, int *retcy)
// GetBackgroundImageSize
//
// Returns the size of the background image
{
CG32bitImage *pImage = g_pUniverse->GetLibraryBitmap(m_dwBackgroundImage);
if (pImage)
{
*retcx = pImage->GetWidth();
*retcy = pImage->GetHeight();
}
else
{
*retcx = 0;
*retcy = 0;
}
}
示例5: OnPaint
void CGalacticMapSession::OnPaint (CG32bitImage &Screen, const RECT &rcInvalid)
// OnPaint
//
// Paint
{
int cxScreen = Screen.GetWidth();
int cyScreen = Screen.GetHeight();
const CVisualPalette &VI = m_HI.GetVisuals();
CG32bitPixel rgbBackgroundColor = VI.GetColor(colorAreaDeep);
CG32bitPixel rgbLineColor = VI.GetColor(colorLineFrame);
const CG16bitFont &HeaderFont = VI.GetFont(fontHeader);
const CG16bitFont &MediumFont = VI.GetFont(fontMedium);
// Paint the actual map
if (m_pPainter)
{
m_pPainter->Paint(Screen);
// Paint the ship
CSpaceObject *pPlayer = g_pUniverse->GetPlayerShip();
if (pPlayer)
{
int xPos, yPos;
g_pUniverse->GetCurrentSystem()->GetTopology()->GetDisplayPos(&xPos, &yPos);
int xShip, yShip;
m_pPainter->GalacticToView(xPos, yPos, m_xCenter, m_yCenter, m_Scale.GetScale(), &xShip, &yShip);
pPlayer->PaintMap(CMapViewportCtx(), Screen, xShip, yShip);
}
}
// Paint some help text
m_HelpPainter.Paint(Screen,
m_rcView.left + SCREEN_BORDER_X,
m_rcView.bottom - (SCREEN_BORDER_Y + m_HelpPainter.GetHeight()));
}
示例6: DrawLaserBeam
void DrawLaserBeam (CG32bitImage &Dest, const SBeamDrawCtx &Ctx)
// DrawLaserBeam
//
// Draws a simple laser beam
{
CG32bitPixel rgbGlow = CG32bitPixel(Ctx.rgbSecondaryColor, 100);
Dest.DrawLine(Ctx.xFrom, Ctx.yFrom,
Ctx.xTo, Ctx.yTo,
3,
rgbGlow);
Dest.DrawLine(Ctx.xFrom, Ctx.yFrom,
Ctx.xTo, Ctx.yTo,
1,
Ctx.rgbPrimaryColor);
}
示例7: OnPaint
void CExtensionNavigatorMenuItem::OnPaint(CG32bitImage &Screen, const RECT &rcInvalid)
{
// may remove panel outlining in future
DrawPanelOutline(Screen);
int xO = m_AssociatedPanel.GetOriginX();
int yO = m_AssociatedPanel.GetOriginY();
int SpaceWidth = m_AssociatedPanel.GetSpaceWidth();
int SpaceHeight = m_AssociatedPanel.GetSpaceHeight();
Screen.DrawText(m_AssociatedPanel.GetOriginX() + 10, m_AssociatedPanel.GetOriginY() + 10, m_HeadingFont, m_HeadingColor, m_Extension.GetName());
}
示例8: PaintInfoText
void CGameSession::PaintInfoText (CG32bitImage &Dest, const CString &sTitle, const TArray<CString> &Body, bool bAboveTargeting)
// PaintInfoText
//
// Paints info text on the screen
{
int i;
const CVisualPalette &VI = m_HI.GetVisuals();
const CG16bitFont &TitleFont = VI.GetFont(fontHeader);
const CG16bitFont &BodyFont = VI.GetFont(fontMedium);
int x = m_rcScreen.left + 2 * TitleFont.GetAverageWidth();
int cy = TitleFont.GetHeight() + Body.GetCount() * BodyFont.GetHeight();
int cySpacing = BodyFont.GetHeight() / 2;
RECT rcCenter;
m_HUD.GetClearHorzRect(&rcCenter);
int y = (bAboveTargeting ? rcCenter.bottom : m_rcScreen.bottom) - (cy + cySpacing);
Dest.DrawText(x,
y,
TitleFont,
VI.GetColor(colorTextHighlight),
sTitle);
y += TitleFont.GetHeight();
// Paint the body
for (i = 0; i < Body.GetCount(); i++)
{
Dest.DrawText(x,
y,
BodyFont,
VI.GetColor(colorTextDialogLabel),
Body[i]);
y += BodyFont.GetHeight();
}
}
示例9: CopyGalacticMapToClipboard
void CopyGalacticMapToClipboard (HWND hWnd, CGalacticMapPainter *pPainter)
{
// Save some parameters
RECT rcOldView = pPainter->GetViewport();
int xOldCenter, yOldCenter;
pPainter->GetPos(&xOldCenter, &yOldCenter);
int iOldScale = pPainter->GetScale();
// Compute the size of the map
RECT rcView;
rcView.left = 0;
rcView.top = 0;
rcView.right = pPainter->GetWidth();
rcView.bottom = pPainter->GetHeight();
// Create a bitmap of the appropriate size
CG32bitImage FullMap;
FullMap.Create(RectWidth(rcView), RectHeight(rcView));
// Paint
pPainter->SetViewport(rcView);
pPainter->SetScale(100);
pPainter->SetPos(0, 0);
pPainter->Paint(FullMap);
// Copy to cliboard
FullMap.CopyToClipboard();
// Restore
pPainter->SetScale(iOldScale);
pPainter->SetViewport(rcOldView);
pPainter->SetPos(xOldCenter, yOldCenter);
}
示例10: Paint
void CGImageArea::Paint (CG32bitImage &Dest, const RECT &rcRect)
// Paint
//
// Handle paint
{
if (!m_bTransBackground)
Dest.Fill(rcRect.left,
rcRect.top,
RectWidth(rcRect),
RectHeight(rcRect),
m_rgbBackColor);
if (m_pImage)
{
int x, y;
// Compute position of image in the area rect
if (m_dwStyles & alignCenter)
x = rcRect.left + (RectWidth(rcRect) - RectWidth(m_rcImage)) / 2;
else if (m_dwStyles & alignRight)
x = rcRect.left + (RectWidth(rcRect) - RectWidth(m_rcImage));
else
x = rcRect.left;
if (m_dwStyles & alignMiddle)
y = rcRect.top + (RectHeight(rcRect) - RectHeight(m_rcImage)) / 2;
else if (m_dwStyles & alignBottom)
y = rcRect.top + (RectHeight(rcRect) - RectHeight(m_rcImage));
else
y = rcRect.top;
// Blt
//
// For compatibility with previous (Transcendence) releases, we assume
// black is transparent if the image has no alpha channel.
CGDraw::BltWithBackColor(Dest,
x,
y,
*m_pImage,
m_rcImage.left,
m_rcImage.top,
RectWidth(m_rcImage),
RectHeight(m_rcImage),
CG32bitPixel(0, 0, 0));
}
}
示例11: Paint
void CCommandLineDisplay::Paint (CG32bitImage &Dest)
// Paint
//
// Paint display
{
Update();
// Paint the cursor
m_Buffer.Fill(m_rcCursor.left + 1,
m_rcCursor.top,
RectWidth(m_rcCursor) - 1,
RectHeight(m_rcCursor),
(((m_iCounter % 30) < 20) ? INPUT_COLOR : BACK_COLOR));
// Redraw character under cursor
if ((m_iCounter % 30) >= 20 && m_iCursorPos < m_sInput.GetLength())
{
CString sLine(m_sInput.GetASCIIZPointer() + m_iCursorPos, 1);
m_Buffer.DrawText(m_rcCursor.left, m_rcCursor.top, m_pFonts->Console, INPUT_COLOR, sLine);
}
// Blt
Dest.Blt(0,
0,
RectWidth(m_rcRect),
RectHeight(m_rcRect),
200,
m_Buffer,
m_rcRect.left,
m_rcRect.top);
m_iCounter++;
}
示例12: PaintModifier
void CGSelectorArea::PaintModifier (CG32bitImage &Dest, int x, int y, const CString &sText, CG32bitPixel rgbColor, CG32bitPixel rgbBackColor, int *rety)
// PaintModifier
//
// Paints a modifier block.
{
int cx = m_VI.GetFont(fontSmall).MeasureText(sText);
if (!rgbBackColor.IsNull())
Dest.Fill(x - cx - 8,
y,
cx + 8,
m_VI.GetFont(fontSmall).GetHeight(),
rgbBackColor);
m_VI.GetFont(fontSmall).DrawText(Dest,
x - cx - 4,
y,
rgbColor,
sText);
if (rety)
*rety = y + m_VI.GetFont(fontSmall).GetHeight() + 1;
}
示例13: RectWidth
void CFilterColorizeEntry::GetImage (const CCompositeImageSelector &Selector, CObjectImageArray *retImage)
// GetImage
//
// Fills in the image
{
// Null case
if (m_pSource == NULL)
{
*retImage = EMPTY_IMAGE;
return;
}
// Get the source image (which we want to colorize)
CObjectImageArray Source;
m_pSource->GetImage(Selector, &Source);
const RECT &rcSource = Source.GetImageRect();
CG32bitImage &SourceImage = Source.GetImage(NULL_STR);
int cxWidth = RectWidth(rcSource);
int cyHeight = RectHeight(rcSource);
if (!Source.IsLoaded() || cxWidth == 0 || cyHeight == 0)
{
*retImage = EMPTY_IMAGE;
return;
}
// Create the destination image
CG32bitImage *pDest = new CG32bitImage;
pDest->Create(cxWidth, cyHeight, SourceImage.GetAlphaType());
// Blt the to the destination with colorization
CGDraw::CopyColorize(*pDest,
0,
0,
SourceImage,
rcSource.left,
rcSource.top,
cxWidth,
cyHeight,
(REALPIXEL)m_dwHue,
(REALPIXEL)m_dwSaturation / 100.0);
// Initialize an image
RECT rcFinalRect;
rcFinalRect.left = 0;
rcFinalRect.top = 0;
rcFinalRect.right = cxWidth;
rcFinalRect.bottom = cyHeight;
CObjectImageArray Comp;
Comp.Init(pDest, rcFinalRect, 0, 0, true);
// Done
retImage->TakeHandoff(Comp);
}
示例14: CreateNewsAnimation
void CTranscendenceWnd::CreateNewsAnimation (CMultiverseNewsEntry *pEntry, IAnimatron **retpAnimatron)
// CreateNewsAnimation
//
// Creates animation of a Multiverse news entry.
{
int iDuration = 600;
int iInitialFade = 30;
int iEndFade = 30;
// Compute some metrics for the pane based on the entry information
int cxInnerPane = NEWS_PANE_WIDTH - (2 * NEWS_PANE_PADDING_X);
CG32bitImage *pImage = pEntry->LoadImageHandoff();
int cyImage = (pImage ? pImage->GetHeight() : 0);
TArray<CString> TitleLines;
m_Fonts.SubTitle.BreakText(pEntry->GetTitle(), cxInnerPane, &TitleLines);
int cyTitle = m_Fonts.SubTitle.GetHeight() * TitleLines.GetCount();
TArray<CString> BodyLines;
m_Fonts.Medium.BreakText(pEntry->GetBody(), cxInnerPane, &BodyLines);
int cyBody = m_Fonts.Medium.GetHeight() * BodyLines.GetCount();
TArray<CString> FooterLines;
m_Fonts.MediumHeavyBold.BreakText(pEntry->GetCallToActionText(), cxInnerPane, &FooterLines);
int cyFooter = m_Fonts.MediumHeavyBold.GetHeight() * FooterLines.GetCount();
int cyPane = cyImage
+ cyTitle
+ NEWS_PANE_INNER_SPACING_Y
+ cyBody
+ NEWS_PANE_INNER_SPACING_Y
+ cyFooter
+ NEWS_PANE_PADDING_Y;
int xPane = m_rcIntroMain.left + (RectWidth(m_rcIntroMain) / 2) + (RectWidth(m_rcIntroMain) / 6);
int yPane = m_rcIntroMain.top + ((RectHeight(m_rcIntroMain) - cyPane) / 2);
// Create sequencer to hold everything The origin of the sequencer is
// at the top-center of the pane.
CAniSequencer *pSeq = new CAniSequencer;
pSeq->SetPropertyVector(PROP_POSITION, CVector(xPane, yPane));
int xLeft = -NEWS_PANE_WIDTH / 2;
// Create a button that will respond to clicks on the news pane
CAniButton *pButton = new CAniButton;
pButton->SetPropertyVector(PROP_POSITION, CVector(xLeft, 0));
pButton->SetPropertyVector(PROP_SCALE, CVector(NEWS_PANE_WIDTH, cyPane));
pButton->SetStyle(STYLE_DOWN, NULL);
pButton->SetStyle(STYLE_HOVER, NULL);
pButton->SetStyle(STYLE_NORMAL, NULL);
pButton->SetStyle(STYLE_DISABLED, NULL);
pButton->SetStyle(STYLE_TEXT, NULL);
pButton->AddListener(EVENT_ON_CLICK, m_pIntroSession, CMD_OPEN_NEWS);
pSeq->AddTrack(pButton, 0);
// Create the background
CAniRoundedRect *pPane = new CAniRoundedRect;
pPane->SetPropertyVector(PROP_POSITION, CVector(xLeft, 0));
pPane->SetPropertyVector(PROP_SCALE, CVector(NEWS_PANE_WIDTH, cyPane));
pPane->SetPropertyColor(PROP_COLOR, RGB_NEWS_PANE_BACKGROUND);
pPane->SetPropertyOpacity(PROP_OPACITY, 64);
pPane->SetPropertyInteger(PROP_UL_RADIUS, NEWS_PANE_CORNER_RADIUS);
pPane->SetPropertyInteger(PROP_UR_RADIUS, NEWS_PANE_CORNER_RADIUS);
pPane->SetPropertyInteger(PROP_LL_RADIUS, NEWS_PANE_CORNER_RADIUS);
pPane->SetPropertyInteger(PROP_LR_RADIUS, NEWS_PANE_CORNER_RADIUS);
pPane->AnimateLinearFade(iDuration, iInitialFade, iEndFade, 64);
pSeq->AddTrack(pPane, 0);
// Add the content
int yPos = 0;
int xInnerLeft = -(cxInnerPane / 2);
// Create the image
if (pImage)
{
// If the image is wide enough to hit the rounded corners, then we
// need to mask it out.
if (pImage->GetWidth() > (NEWS_PANE_WIDTH - 2 * NEWS_PANE_CORNER_RADIUS))
{
// Create a mask the size of the pane and apply it to the image
// (We own the image so we can modify it).
CG8bitImage PaneMask;
PaneMask.CreateRoundedRect(NEWS_PANE_WIDTH, cyPane, NEWS_PANE_CORNER_RADIUS);
pImage->IntersectMask(0,
0,
PaneMask.GetWidth(),
//.........这里部分代码省略.........
示例15: GenerateImageChart
//.........这里部分代码省略.........
Desc.cxSpacing = cxSpacing;
Desc.cxExtraMargin = cxExtraMargin;
Desc.pHeader = &NameFont;
// Generate a table of cells for the arranger
TArray<CCompositeImageSelector> Selectors;
Selectors.InsertEmpty(Table.GetCount());
CString sLastCategory;
TArray<CImageArranger::SCellDesc> Cells;
for (i = 0; i < Table.GetCount(); i++)
{
SEntryDesc &Entry = Table[i];
CImageArranger::SCellDesc *pNewCell = Cells.Insert();
pNewCell->cxWidth = (Entry.pImage ? RectWidth(Entry.pImage->GetImageRect()) : 0) + cxImageMargin;
pNewCell->cyHeight = (Entry.pImage ? RectHeight(Entry.pImage->GetImageRect()) : 0) + cxImageMargin;
pNewCell->sText = Entry.sName;
if (!strEquals(sLastCategory, Entry.sCategorize))
{
sLastCategory = Entry.sCategorize;
pNewCell->bStartNewRow = true;
}
}
// Arrange
Arranger.ArrangeByRow(Desc, Cells);
// Create a large image
CG32bitImage Output;
int cxWidth = Max(cxDesiredWidth, Arranger.GetWidth());
int cyHeight = Arranger.GetHeight();
Output.Create(cxWidth, cyHeight);
printf("Creating %dx%d image.\n", cxWidth, cyHeight);
// Paint the images
for (i = 0; i < Table.GetCount(); i++)
{
SEntryDesc &Entry = Table[i];
int x = Arranger.GetX(i);
int y = Arranger.GetY(i);
// Paint
if (x != -1)
{
int xCenter = x + (Arranger.GetWidth(i) / 2);
int yCenter = y + (Arranger.GetHeight(i) / 2);
int xOffset;
int yOffset;
Entry.pImage->GetImageOffset(0, Entry.iRotation, &xOffset, &yOffset);
int cxImage = RectWidth(Entry.pImage->GetImageRect());
int cyImage = RectHeight(Entry.pImage->GetImageRect());
// Paint image
if (!bTextBoxesOnly && Entry.pImage)
{
Entry.pImage->PaintImageUL(Output,