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


C++ Label::SetColor方法代码示例

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


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

示例1: DisplayString

void DisplayMessage::DisplayString(const String& text, unsigned int color, Scriptable *target) const
{
    if (!text.length()) return;

    Label *l = core->GetMessageLabel();
    if (l) {
        const Color fore = { (ieByte)((color >> 16) & 0xFF), (ieByte)((color >> 8) & 0xFF), (ieByte)(color & 0xFF), (ieByte)((color >> 24) & 0xFF)};
        l->SetColor( fore, ColorBlack );
        l->SetText(text);
    }
开发者ID:jrial,项目名称:gemrb,代码行数:10,代码来源:DisplayMessage.cpp

示例2: GetWindow


//.........这里部分代码省略.........
        {
            //Label
            ieResRef FontResRef;
            ieStrRef StrRef;
            RevColor fore, back;
            ieWord alignment;
            str->ReadDword( &StrRef );
            str->ReadResRef( FontResRef );
            Font* fnt = core->GetFont( FontResRef );
            str->Read( &fore, 4 );
            str->Read( &back, 4 );
            str->ReadWord( &alignment );
            Label* lab = new Label( fnt );
            lab->ControlID = ControlID;
            lab->XPos = XPos;
            lab->YPos = YPos;
            lab->Width = Width;
            lab->Height = Height;
            lab->ControlType = ControlType;
            char* str = core->GetString( StrRef );
            lab->SetText( str );
            core->FreeString( str );
            if (alignment & 1) {
                lab->useRGB = true;
                Color f, b;
                f.r = fore.b;
                f.g = fore.g;
                f.b = fore.r;
                f.a = 0;
                b.r = back.b;
                b.g = back.g;
                b.b = back.r;
                b.a = 0;
                lab->SetColor( f, b );
            }
            int align = IE_FONT_ALIGN_CENTER;
            if (( alignment & 0x10 ) != 0) {
                align = IE_FONT_ALIGN_RIGHT;
                goto endvertical;
            }
            if (( alignment & 0x04 ) != 0) {
                goto endvertical;
            }
            if (( alignment & 0x08 ) != 0) {
                align = IE_FONT_ALIGN_LEFT;
                goto endvertical;
            }
endvertical:
            if (( alignment & 0x20 ) != 0) {
                align |= IE_FONT_ALIGN_TOP;
                goto endalign;
            }
            if (( alignment & 0x80 ) != 0) {
                align |= IE_FONT_ALIGN_BOTTOM;
            } else {
                align |= IE_FONT_ALIGN_MIDDLE;
            }
endalign:
            lab->SetAlignment( align );
            win->AddControl( lab );
        }
        break;

        case IE_GUI_SCROLLBAR:
        {
            //ScrollBar
开发者ID:NickDaly,项目名称:GemRB-MultipleConfigs,代码行数:67,代码来源:CHUImporter.cpp

示例3: localeSwitch


//.........这里部分代码省略.........
        castFilter->SetInput(element.second);
        castFilter->Update();

        Image::Pointer layerImage;
        CastToMitkImage(castFilter->GetOutput(), layerImage);

        // Get pixel value of the label
        itkInternalImageType::ValueType segValue = 1;
        typedef itk::ImageRegionIterator<const itkInternalImageType> IteratorType;
        // Iterate over the image to find the pixel value of the label
        IteratorType iter(element.second, element.second->GetLargestPossibleRegion());
        iter.GoToBegin();
        while (!iter.IsAtEnd())
        {
          itkInputImageType::PixelType value = iter.Get();
          if (value != 0)
          {
            segValue = value;
            break;
          }
          ++iter;
        }

        dcmqi::JSONSegmentationMetaInformationHandler metaInfo(dcmqiOutput.second.c_str());
        metaInfo.read();
        MITK_INFO << "Input " << metaInfo.getJSONOutputAsString();
        // TODO: Read all DICOM Tags

        // Get the label information from segment attributes
        vector<map<unsigned, dcmqi::SegmentAttributes *>>::const_iterator segmentIter =
          metaInfo.segmentsAttributesMappingList.begin();
        map<unsigned, dcmqi::SegmentAttributes *> segmentMap = (*segmentIter);
        map<unsigned, dcmqi::SegmentAttributes *>::const_iterator segmentMapIter = (*segmentIter).begin();
        dcmqi::SegmentAttributes *segmentAttr = (*segmentMapIter).second;

        OFString labelName;

        if (segmentAttr->getSegmentedPropertyTypeCodeSequence() != nullptr)
          segmentAttr->getSegmentedPropertyTypeCodeSequence()->getCodeMeaning(labelName);
        else
        {
          labelName = std::to_string(segmentAttr->getLabelID()).c_str();
          if (labelName.empty())
            labelName = "Unnamed";
        }

        float tmp[3] = {0.0, 0.0, 0.0};
        if (segmentAttr->getRecommendedDisplayRGBValue() != nullptr)
        {
          tmp[0] = segmentAttr->getRecommendedDisplayRGBValue()[0] / 255.0;
          tmp[1] = segmentAttr->getRecommendedDisplayRGBValue()[1] / 255.0;
          tmp[2] = segmentAttr->getRecommendedDisplayRGBValue()[2] / 255.0;
        }

        // If labelSetImage do not exists (first image)
        if (labelSetImage.IsNull())
        {
          // Initialize the labelSetImage with the read image
          labelSetImage = LabelSetImage::New();
          labelSetImage->InitializeByLabeledImage(layerImage);
          // Already a label was generated, so set the information to this
          Label *activeLabel = labelSetImage->GetActiveLabel(labelSetImage->GetActiveLayer());
          activeLabel->SetName(labelName.c_str());
          activeLabel->SetColor(Color(tmp));
          activeLabel->SetValue(segValue);
        }
        else
        {
          // Add a new layer to the labelSetImage. Background label is set automatically
          labelSetImage->AddLayer(layerImage);

          // Add new label
          Label *newLabel = new Label;
          newLabel->SetName(labelName.c_str());
          newLabel->SetColor(Color(tmp));
          newLabel->SetValue(segValue);

          labelSetImage->GetLabelSet(labelSetImage->GetActiveLayer())->AddLabel(newLabel);
        }

        ++segmentIter;
      }
      // Clean up
      if (converter != nullptr)
        delete converter;
    }
    catch (const std::exception &e)
    {
      MITK_ERROR << "An error occurred while reading the DICOM Seg file: " << e.what();
      return result;
    }

    // Set active layer to th first layer of the labelset image
    if (labelSetImage->GetNumberOfLayers() > 1 && labelSetImage->GetActiveLayer() != 0)
      labelSetImage->SetActiveLayer(0);

    result.push_back(labelSetImage.GetPointer());

    return result;
  }
开发者ID:pollen-metrology,项目名称:MITK,代码行数:101,代码来源:mitkDICOMSegmentationIO.cpp

示例4: GetWindow


//.........这里部分代码省略.........
					win->Link( SBID, ( unsigned short ) ControlID );
			}
			break;

			case IE_GUI_LABEL:
			{
				//Label
				ieResRef FontResRef;
				ieStrRef StrRef;
				RevColor fore, back;
				ieWord alignment;
				str->ReadDword( &StrRef );
				str->ReadResRef( FontResRef );
				Font* fnt = core->GetFont( FontResRef );
				str->Read( &fore, 4 );
				str->Read( &back, 4 );
				str->ReadWord( &alignment );
				char* str = core->GetString( StrRef );
				Label* lab = new Label( ctrlFrame, fnt, str );
				core->FreeString( str );
				lab->ControlID = ControlID;

				if (alignment & 1) {
					lab->useRGB = true;
					Color f, b;
					f.r = fore.b;
					f.g = fore.g;
					f.b = fore.r;
					f.a = 0;
					b.r = back.b;
					b.g = back.g;
					b.b = back.r;
					b.a = 0;
					lab->SetColor( f, b );
				}
				int align = IE_FONT_ALIGN_CENTER;
				if (( alignment & 0x10 ) != 0) {
					align = IE_FONT_ALIGN_RIGHT;
					goto endvertical;
				}
				if (( alignment & 0x04 ) != 0) {
					goto endvertical;
				}
				if (( alignment & 0x08 ) != 0) {
					align = IE_FONT_ALIGN_LEFT;
					goto endvertical;
				}
endvertical:
				if (( alignment & 0x20 ) != 0) {
					align |= IE_FONT_ALIGN_TOP;
					goto endalign;
				}
				if (( alignment & 0x80 ) != 0) {
					align |= IE_FONT_ALIGN_BOTTOM;
				} else {
					align |= IE_FONT_ALIGN_MIDDLE;
				}
endalign:
				lab->SetAlignment( align );
				win->AddControl( lab );
			}
			break;

			case IE_GUI_SCROLLBAR:
			{
				//ScrollBar
开发者ID:OldSnapo,项目名称:gemrb,代码行数:67,代码来源:CHUImporter.cpp


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