本文整理汇总了C++中magick::Image::getPixels方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::getPixels方法的具体用法?C++ Image::getPixels怎么用?C++ Image::getPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magick::Image
的用法示例。
在下文中一共展示了Image::getPixels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyImage
void copyImage(Magick::Image& src,
yarp::sig::ImageOf<yarp::sig::PixelRgb>& dest) {
Magick::Geometry g = src.size();
int h = g.height();
int w = g.width();
src.depth(8);
dest.resize(w,h);
for (int i=0; i<h; i++) {
// must transfer row by row, since YARP may use padding in representation
Magick::PixelPacket *packet = src.getPixels(0,i,w,1);
src.writePixels(Magick::RGBQuantum,(unsigned char *)(&dest.pixel(0,i)));
}
src.syncPixels();
}
示例2: WriteGif
void DrvSDL::WriteGif() {
std::list<Magick::Image> gif;
int num = 0;
for(std::list<Magick::Blob>::iterator it = image_.begin(); it != image_.end(); it++) {
Magick::Image image;
image.magick("RGB");
image.depth(32);
image.size(Magick::Geometry(cols_ * pixels.x, rows_ * pixels.y));
Magick::PixelPacket *pixel_cache = image.getPixels(0, 0, cols_ * pixels.x, rows_ * pixels.y);
for(int n = 0; n < rows_ * pixels.y * cols_ * pixels.x; n++) {
int col = ((int *)(*it).data())[n];
uint8_t *rgb = (uint8_t *) &col;
Magick::PixelPacket *gif_pixel = pixel_cache + n;
*gif_pixel = Magick::ColorRGB(rgb[0] / 256.0, rgb[1] / 256.0, rgb[2] / 256.0);
}
image.syncPixels();
gif.push_back(image);
LCDInfo("Image %d", num++);
}
LCDInfo("Writing GIF image...");
for_each(gif.begin(), gif.end(), Magick::animationDelayImage(ani_speed_ / 10));
Magick::writeImages(gif.begin(), gif.end(), gif_file_);
}
示例3: imageToPixmap
void imageToPixmap() {
image.flip();
pixmap = image.getPixels(0, 0, image.columns(), image.rows());
}
示例4: filter
Image::Image(GLuint filter, string filename, string alphaFilename) :
filter(filter)
{
#if IMAGE_PRINT
cout << "Loading image " << filename << "..." << endl;
#endif
Magick::Image image;
image.read(filename);
Magick::PixelPacket* data = image.getPixels(0, 0, image.columns(), image.rows());
width = image.columns();
height = image.rows();
#if IMAGE_PRINT
cout << " Width: " << width << endl;
cout << " Height: " << height << endl;
#endif
// Convert to floats and flip vertically
pixels = new Color[width * height];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int idest = x + y * width;
int isrc = x + (height - 1 - y) * width;
pixels[idest] = {
(float)data[isrc].red / USHRT_MAX,
(float)data[isrc].green / USHRT_MAX,
(float)data[isrc].blue / USHRT_MAX,
1.f - (float)data[isrc].opacity / USHRT_MAX
};
}
}
// Load alpha map
if (alphaFilename != "") {
#if IMAGE_PRINT
cout << " Alpha map found: " << alphaFilename << endl;
#endif
Magick::Image aImage;
aImage.read(alphaFilename);
Magick::PixelPacket* aData = aImage.getPixels(0, 0, aImage.columns(), aImage.rows());
int aWidth = aImage.columns();
int aHeight = aImage.rows();
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (x >= aWidth || y >= aHeight)
continue;
int idest = x + y * width;
int isrc = x + (aHeight - 1 - y) * aWidth;
pixels[idest].a((float)aData[isrc].red / USHRT_MAX);
}
}
}
createTexture();
}