当前位置: 首页>>代码示例>>C++>>正文


C++ BFont::SetShear方法代码示例

本文整理汇总了C++中BFont::SetShear方法的典型用法代码示例。如果您正苦于以下问题:C++ BFont::SetShear方法的具体用法?C++ BFont::SetShear怎么用?C++ BFont::SetShear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BFont的用法示例。


在下文中一共展示了BFont::SetShear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Read

status_t
CanvasMessage::ReadFontState(BFont& font)
{
	uint8 encoding, spacing;
	uint16 face;
	uint32 flags, familyAndStyle;
	font_direction direction;
	float falseBoldWidth, rotation, shear, size;

	Read(direction);
	Read(encoding);
	Read(flags);
	Read(spacing);
	Read(shear);
	Read(rotation);
	Read(falseBoldWidth);
	Read(size);
	Read(face);
	status_t result = Read(familyAndStyle);
	if (result != B_OK)
		return result;

	font.SetFamilyAndStyle(familyAndStyle);
	font.SetEncoding(encoding);
	font.SetFlags(flags);
	font.SetSpacing(spacing);
	font.SetShear(shear);
	font.SetRotation(rotation);
	font.SetFalseBoldWidth(falseBoldWidth);
	font.SetSize(size);
	font.SetFace(face);
	return B_OK;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:33,代码来源:CanvasMessage.cpp

示例2:

// GetBFont
BFont
Font::GetBFont() const
{
	BFont font;
	font.SetFamilyAndStyle(fFamily.String(), fStyle.String());
	font.SetSize(fSize);
	font.SetRotation(fRotation);
	font.SetShear(fShear);
	font.SetSpacing(fSpacing);
	return font;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:12,代码来源:Font.cpp

示例3:

BFont
PSettings::GetFont(const char *name)
{
	BFont font = be_plain_font;
	font_data *val;
	ssize_t	  size;
	status_t s=FindData(name,B_ANY_TYPE,(const void**)&val,&size);
	if(s==B_OK)
	{
		char *fstyle=NULL,*ffamily=NULL;
		if(val->style[0]!=0)fstyle=val->style;
		if(val->family[0]!=0)ffamily=val->family;
		font.SetFamilyAndStyle(ffamily,fstyle);
		font.SetSize(val->size);
		font.SetShear(val->shear);
	}
	return font;	
}
开发者ID:threedeyes,项目名称:DjVuViewer,代码行数:18,代码来源:Settings.cpp

示例4: screen

void 
Message::Draw(BView *view, int32 frame)
{
	if (view == NULL || view->Window() == NULL || !view->Window()->IsLocked())
		return;

	BScreen screen(view->Window());
	if (!screen.IsValid())
		return;

	// Double-buffered drawing
	BBitmap buffer(view->Bounds(), screen.ColorSpace(), true);
	if (buffer.InitCheck() != B_OK)
		return;

	BView offscreen(view->Bounds(), NULL, 0, 0);
	buffer.AddChild(&offscreen);
	buffer.Lock();

	// Set up the colors
	rgb_color base_color = {(uint8)(rand() % 25), (uint8)(rand() % 25),
		(uint8)(rand() % 25)};
	offscreen.SetHighColor(base_color); 
	offscreen.SetLowColor(tint_color(base_color, 0.815F));
	offscreen.FillRect(offscreen.Bounds(), kCheckered);
	rgb_color colors[8] = {
		tint_color(base_color, B_LIGHTEN_1_TINT),
		tint_color(base_color, 0.795F),
		tint_color(base_color, 0.851F),
		tint_color(base_color, 0.926F),
		tint_color(base_color, 1.05F),
		tint_color(base_color, B_DARKEN_1_TINT),
		tint_color(base_color, B_DARKEN_2_TINT),
		tint_color(base_color, B_DARKEN_3_TINT),
	};

	offscreen.SetDrawingMode(B_OP_OVER);

	// Set the basic font parameters, including random font family
	BFont font;
	offscreen.GetFont(&font);
	font.SetFace(B_BOLD_FACE);
	font.SetFamilyAndStyle(*(fFontFamilies.ItemAt(rand() % fFontFamilies.CountItems())), NULL);
	offscreen.SetFont(&font);

	// Get the message
	BString *message = get_message();
	BString *origMessage = new BString();
	message->CopyInto(*origMessage, 0, message->Length());
	// Replace newlines and tabs with spaces
	message->ReplaceSet("\n\t", ' ');

	int height = (int) offscreen.Bounds().Height();
	int width = (int) offscreen.Bounds().Width();

	// From 14 to 22 iterations
	int32 iterations = (rand() % 8) + 14;
	for (int32 i = 0; i < iterations; i++) {
		// Randomly set font size and shear
		BFont font;
		offscreen.GetFont(&font);
		float fontSize = ((rand() % 320) + 42) * fScaleFactor;
		font.SetSize(fontSize);
		// Set the shear off 90 about 1/2 of the time
		if (rand() % 2 == 1)
			font.SetShear((float) ((rand() % 135) + (rand() % 45)));
		else
			font.SetShear(90.0);
		offscreen.SetFont(&font);

		// Randomly set drawing location
		int x = (rand() % width) - (rand() % width/((rand() % 8)+1));
		int y = rand() % height;

		// Draw new text
		offscreen.SetHighColor(colors[rand() % 8]);
		int strLength = message->Length();
		// See how wide this string is with the current font
		float strWidth = offscreen.StringWidth(message->String());
		int drawingLength = (int) (strLength * (width / strWidth));
		int start = 0;
		if (drawingLength >= strLength)
			drawingLength = strLength;
		else
			start = rand() % (strLength - drawingLength);
		char *toDraw = new char[drawingLength+1];
		strncpy(toDraw, message->String()+start, drawingLength);
		toDraw[drawingLength] = 0;
		offscreen.DrawString(toDraw, BPoint(x, y));
		delete[] toDraw;
	}

	// Now draw the full message in a nice translucent box, but only
	// if this isn't preview mode
	if (!fPreview) {
		BFont font(be_fixed_font);
		font.SetSize(14.0); 
		offscreen.SetFont(&font);
		font_height fontHeight;
		font.GetHeight(&fontHeight);
//.........这里部分代码省略.........
开发者ID:AmirAbrams,项目名称:haiku,代码行数:101,代码来源:Message.cpp

示例5: if

//ctor
SpecificColorWindow	::	SpecificColorWindow(	BRect paramBound,
												uint32 paramkind)
				: 
				ScrollingWindow(	paramBound, 
									myPrefs->lvwTitleStr[paramkind], 
									lScrollViewName[paramkind],
									lNamePrefFrame[paramkind],
									myPrefs->mpPreferenceSet,
									true,
									false),
				mui32Kind(paramkind),
				mpViewColorControl(NULL),
				mpHighColorControl(NULL),
				mpLowColorControl(NULL),
				mpBarColorControl(NULL),
				mpFillColorControl(NULL),
				mpViewColorWell(NULL),
				mpHighColorWell(NULL),
				mpLowColorWell(NULL),
				mpBarColorWell(NULL),
				mpFillColorWell(NULL),
				mpBarHeightGadget(NULL),
				mpColorWellWidthGadget(NULL),
				mpColorWellHeightGadget(NULL),
				mpThumbRadioView(NULL),
				mpCCLrv(NULL),
				mpSliderBarCB(NULL),
				mpSliderBarFillCB(NULL),
				mpDemoItem(NULL)
{
	sem_id calc_sem;
	if ((calc_sem = create_sem(1, "calc_sem")) < B_NO_ERROR)
	{
		warning(myPrefs->FailCreateSemaphore);
		return;
	}
	acquire_sem(calc_sem);
	try 
	{
		LayoutMatrix *	pholdTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns
/////////////////////////////////////////////////////////////////////////////////////////////
		BFont * pBFont = new BFont(myPrefs->GetPreferredFont());
		float fontSize = pBFont->Size();
		fontSize *= 2;
		if (fontSize > 200)
		{
			fontSize = 200;
		}
		pBFont->SetSize(fontSize);
		pBFont->SetShear(122);
		//will need offset for demo--use a seperate matrix and get it's bottom
		MyStringDrawer * pMyStringDrawer = new MyStringDrawer(	"specificTitleMyStringDrawer", 
																myPrefs->lvwTitleStr[mui32Kind],
																pholdTitleLayoutMatrix, 
																pBFont);
/////////////////////////////
		if (!myPrefs->mbUseColorControl && !myPrefs->mbUseColorWell)
		{
			warning(myPrefs->noCCenabled);
		}
		LayoutMatrix * pholdViewCCLayoutMatrix = NULL;
		LayoutMatrix * pholdHighCCLayoutMatrix = NULL;
		LayoutMatrix * pholdLowCCLayoutMatrix = NULL;
		MyStringDrawer * pMyStringDrawerAXX = NULL;
		MyStringDrawer * pMyStringDrawerBXX = NULL;
		MyStringDrawer * pMyStringDrawerCXX = NULL;
		rgb_color color;//re-use for every setvalue
		if (myPrefs->mbUseColorControl)
		{
			pholdViewCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns
	/////////////////////////////////////////////////////////////////////////////////////
			pMyStringDrawerAXX = new MyStringDrawer(	"MyStringDrawerAXX", 
														myPrefs->ColorWindowHeading2, 
														pholdViewCCLayoutMatrix);
	////////////////////////////////////////////////////////////////////
			mpViewColorControl = new MyColorControl(	myPrefs->mCCL,
														"ColorControlAXX", 
														COLORCONTROL_VIEW,
														pholdViewCCLayoutMatrix);
			switch (mui32Kind)
			{
				case SPECIFIC_COLOR_BUTTON:
					myPrefs->GetPreferredMyButtonViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_PICTURE:
					myPrefs->GetPreferredMyPictureButtonViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_RADIOVIEW:
					myPrefs->GetPreferredMyRadioViewViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_CHECKBOX:
					myPrefs->GetPreferredMyCheckBoxViewColor(&color);
					mpViewColorControl->SetValue(color);
				break;
				case SPECIFIC_COLOR_STATUSBAR:
					myPrefs->GetPreferredMyStatusBarViewColor(&color);
//.........这里部分代码省略.........
开发者ID:DonkeyWs,项目名称:BeGUI,代码行数:101,代码来源:specificColorWindowCTOR.cpp


注:本文中的BFont::SetShear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。