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


C++ Pixel类代码示例

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


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

示例1:

bool Pixel::operator==(Pixel &pixel){
	return (this->empty == pixel.empty && (
				this->Red()	 == pixel.Red()
				&& this->Green() == pixel.Green()
				&& this->Blue()	 == pixel.Blue()
			));
}
开发者ID:leftfelt,项目名称:cpp,代码行数:7,代码来源:PixelClass.cpp

示例2:

void img::PixMat::histogram(std::vector<int>& result) const {
	result.resize(Pixel::NUM_COLOR);
	for (std::size_t i = 0; i < size(); i++) {
		const Pixel p = operator[](i);
		result[p.luminance()]++;
	}
}
开发者ID:mhbackes,项目名称:photo-chopp,代码行数:7,代码来源:pixmat.cpp

示例3: writeSprite

bool SavePartSprite::writeSprite(Surface &sprite) const {
	// The sprite's dimensions have to fit
	if (((uint32)sprite.getWidth()) != _width)
		return false;
	if (((uint32)sprite.getHeight()) != _height)
		return false;

	if (_trueColor) {
		if (sprite.getBPP() <= 1)
			return false;

		Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();

		const byte *data = _dataSprite;
		Pixel pixel = sprite.get();
		for (uint32 i = 0; i < (_width * _height); i++, ++pixel, data += 3)
			pixel.set(pixelFormat.RGBToColor(data[0], data[1], data[2]));

	} else {
		if (sprite.getBPP() != 1)
			return false;

		memcpy(sprite.getData(), _dataSprite, _spriteSize);
	}

	return true;
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:27,代码来源:savefile.cpp

示例4: contains

bool PixelIterator::contains(const Pixel& pix) {
    return pix.x() >= _box.min_corner().x() &&
            pix.x() < _box.max_corner().x()  &&
            pix.y() >= _box.min_corner().y() &&
            pix.y() < _box.max_corner().y();

}
开发者ID:JeroenBrinkman,项目名称:IlwisCore,代码行数:7,代码来源:pixeliterator.cpp

示例5: in_file

int DataProcessor::load_train_result(const string &name)
{
    map<int, Pixel> label_color;

    ifstream in_file(name.c_str());
    if (!in_file)
    {
        return -1;
    }

    string line;
    while (getline(in_file, line))
    {
        vector<string> fields;
        split_string(line, '\t', fields);
        Pixel pixel;
        pixel._pixel_size = 3;
        char pixel_str[3];
        pixel_str[0] = (unsigned char)atoi(fields[3].c_str());
        pixel_str[1] = (unsigned char)atoi(fields[4].c_str());
        pixel_str[2] = (unsigned char)atoi(fields[5].c_str());
        pixel.set_data(pixel_str);
        int label = atoi(fields[6].c_str());
        if (label_color.find(label) == label_color.end())
        {
            label_color[label] = pixel;
        }

        set_pixel(_picture, atoi(fields[0].c_str()), label_color[label]);
    }
    in_file.close();
    return 0;
}
开发者ID:dusiliang,项目名称:kNN,代码行数:33,代码来源:DataProcessor.cpp

示例6: get_grey

  /**
   * @return returns the Pixels average gray value 
   */
  inline Pixel<T> get_grey() const {
    Pixel<T> p = Pixel<T>(*this);
    
    p.grey();

    return p;
  }
开发者ID:Eyenseo,项目名称:Image-Compression,代码行数:10,代码来源:Pixel.hpp

示例7: main

int main()
{
    cout << Pixel::GetK() << endl;
    {
    cout << "Урок 6. Наследование классов." << endl;
    cout << "-----------------------------" << endl;

    Pixel a(10,20, Pixel::red);
    cout << "Pixel a: "; a.Print(); cout << endl;

    cout << Pixel::GetK() << endl;

    Pixel b(Point(30,40), Pixel::blue);
    cout << "Pixel b: "; b.Print(); cout << endl;

    cout << Pixel::GetK() << endl;

    b.SetColor(Pixel::green);
    b.Move(10,20);
    cout << "Pixel b: "; b.Print(); cout << endl;

    cout << "Dist =" << a.Dist(b) <<endl;
    cout << "Color of Pixel b = " << b.GetColor() << endl;

    Pixel c = a;
    cout << "Pixel c = "; c.Print(); cout << endl;

    }
    cout << Pixel::GetK() << endl;
    return 0;
}
开发者ID:krang4d,项目名称:code,代码行数:31,代码来源:UsePixel.cpp

示例8: range_error

  /**
   * Mathematical operation /
   * if the size of the left hand side object is 0 the right hand side 
   * else the size of both pixels has to be the same
   */
  Pixel<T> operator/=(const Pixel<T> &rhs) {
    if(size_ == rhs.size()) {
      for(unsigned char i = 0; i < size_; ++i) {
        pixel_[i] /= rhs.get_pixel(i);
        validate_value(pixel_[i]);
      }
      return *this;
    } else if(size_ == 0) {
       size_ = rhs.size();
  
      delete[] pixel_; 
      
      T *temp = new T[size_];

      for(unsigned char i = 0; i < size_; ++i) {
        temp[i] = rhs.get_pixel(i);
      }

      
      pixel_ = temp;; 
      return *this;
    }
    std::ostringstream ss;
    ss << "A Division between pixels can only happen when they have the same "
    << "size!\t LHS: " << size_ << "\tRHS: "<< rhs.size() << '\n';

    throw std::range_error(ss.str());
  }
开发者ID:Eyenseo,项目名称:Image-Compression,代码行数:33,代码来源:Pixel.hpp

示例9: ofBackground

void GenericClientManager::draw()
{
    ofBackground(50);
    ofSetColor(255,255,255);
    if (enableDraw) {
        cam.begin();

        if (showAxis) {
            //axis
            ofSetColor(255,0,0);
            ofSetLineWidth(3);
            ofLine(0, 0, 0, 100, 0, 0);
            ofSetColor(0,255,0);
            ofLine(0, 0, 0, 0, 100, 0);
            ofSetColor(0,0,255);
            ofLine(0, 0, 0, 0, 0, 100);
            //axis
        }
        glPushMatrix();
        //ofScale(5,5,5);
        float width = (float) ofGetWidth();
        float height = (float) ofGetHeight();
        vector<Pixel*>::iterator it = this->pixelsFast->begin();
        while (it!=this->pixelsFast->end())
        {
            Pixel* px = *it;
            px->draw();
            it++;
        }
        glPopMatrix();

        cam.end();
    }
}
开发者ID:Gonzant,项目名称:TDI,代码行数:34,代码来源:GenericClientManager.cpp

示例10:

Pixel::Pixel(Pixel &p)
{
    this->_r = p.getR();
    this->_g = p.getG();
    this->_b = p.getB();
    this->_a = p.getA();
}
开发者ID:ionaic,项目名称:barbs-bandits,代码行数:7,代码来源:Pixel.cpp

示例11: Pixel

Pixel Pixel::copy() {
    Pixel *p = new Pixel();
    p->setR(r);
    p->setG(g);
    p->setB(b);
    return *p;
}
开发者ID:WesleyTo,项目名称:as2,代码行数:7,代码来源:RayTrace.cpp

示例12:

bool Pixel::operator==(Pixel &pxArg)
{
	if(this->GetRed() == pxArg.GetRed() && this->GetRed() == pxArg.GetRed() && this->GetRed() == pxArg.GetRed())
		return true;
	else
		return false;
}
开发者ID:JuannyWang,项目名称:ImageProcessing-2,代码行数:7,代码来源:Pixel.cpp

示例13: Pixel

  /**
   * Copy Constructor
   */
  Pixel(const Pixel<T> &copy) {
    size_ = copy.size();
    pixel_ = new T[size_]();

    for(int i = 0; i < size_; ++i) {
      pixel_[i] = copy.get_pixel(i);
    }
  }
开发者ID:Eyenseo,项目名称:Image-Compression,代码行数:11,代码来源:Pixel.hpp

示例14:

    bool operator==(const Pixel<T>& p1, const Pixel<T>& p2) {
      if (p1.nbChannels() != p2.nbChannels())
	return false;
      for (unsigned int i=0; i<p1.nbChannels(); ++i)
	if (p1[i] != p2[i])
	  return false;
      return true;
    }
开发者ID:TheSamos,项目名称:pdpSmithDr,代码行数:8,代码来源:Pixel.hpp

示例15: destruct

int PixelBinder::destruct(lua_State* L)
{
	void* ptr = *(void**)lua_touserdata(L, 1);
	Pixel* bitmap = static_cast<Pixel*>(ptr);
	bitmap->unref();

	return 0;
}
开发者ID:Nlcke,项目名称:gideros,代码行数:8,代码来源:pixelbinder.cpp


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