本文整理汇总了C++中picture函数的典型用法代码示例。如果您正苦于以下问题:C++ picture函数的具体用法?C++ picture怎么用?C++ picture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了picture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_peephole
static void test_peephole() {
SkRandom rand;
SkPictureRecorder recorder;
for (int j = 0; j < 100; j++) {
SkRandom rand2(rand); // remember the seed
SkCanvas* canvas = recorder.beginRecording(100, 100);
for (int i = 0; i < 1000; ++i) {
rand_op(canvas, rand);
}
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
rand = rand2;
}
{
SkCanvas* canvas = recorder.beginRecording(100, 100);
SkRect rect = SkRect::MakeWH(50, 50);
for (int i = 0; i < 100; ++i) {
canvas->save();
}
while (canvas->getSaveCount() > 1) {
canvas->clipRect(rect);
canvas->restore();
}
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
}
}
示例2: test_serializing_empty_picture
// Ensure that serializing an empty picture does not assert. Likewise only runs in debug mode.
static void test_serializing_empty_picture() {
SkPictureRecorder recorder;
recorder.beginRecording(0, 0);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
SkDynamicMemoryWStream stream;
picture->serialize(&stream);
}
示例3: test_analysis
/* Hit a few SkPicture::Analysis cases not handled elsewhere. */
static void test_analysis(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(100, 100);
{
canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ());
}
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
REPORTER_ASSERT(reporter, !picture->willPlayBackBitmaps());
canvas = recorder.beginRecording(100, 100);
{
SkPaint paint;
// CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader
// gets optimized into a non-bitmap form, so we create a 2x2 bitmap here.
SkBitmap bitmap;
bitmap.allocPixels(SkImageInfo::MakeN32Premul(2, 2));
bitmap.eraseColor(SK_ColorBLUE);
*(bitmap.getAddr32(0, 0)) = SK_ColorGREEN;
SkShader* shader = SkShader::CreateBitmapShader(bitmap, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode);
paint.setShader(shader)->unref();
REPORTER_ASSERT(reporter,
shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault_BitmapType);
canvas->drawRect(SkRect::MakeWH(10, 10), paint);
}
picture.reset(recorder.endRecording());
REPORTER_ASSERT(reporter, picture->willPlayBackBitmaps());
}
示例4: test_analysis
/* Hit a few SkPicture::Analysis cases not handled elsewhere. */
static void test_analysis(skiatest::Reporter* reporter) {
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(100, 100);
{
canvas->drawRect(SkRect::MakeWH(10, 10), SkPaint ());
}
sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
REPORTER_ASSERT(reporter, !picture->willPlayBackBitmaps());
canvas = recorder.beginRecording(100, 100);
{
SkPaint paint;
// CreateBitmapShader is too smart for us; an empty (or 1x1) bitmap shader
// gets optimized into a non-bitmap form, so we create a 2x2 bitmap here.
SkBitmap bitmap;
bitmap.allocPixels(SkImageInfo::MakeN32Premul(2, 2));
bitmap.eraseColor(SK_ColorBLUE);
*(bitmap.getAddr32(0, 0)) = SK_ColorGREEN;
paint.setShader(SkShader::MakeBitmapShader(bitmap, SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode));
REPORTER_ASSERT(reporter, paint.getShader()->isABitmap());
canvas->drawRect(SkRect::MakeWH(10, 10), paint);
}
REPORTER_ASSERT(reporter, recorder.finishRecordingAsPicture()->willPlayBackBitmaps());
}
示例5: Element_Name
//---------------------------------------------------------------------------
// Packet "C8"
void File_Dirac::Intra_Non_Reference_Picture_Low()
{
Element_Name("Intra Non Reference Picture (low-delay)");
//Parsing
picture();
}
示例6: main
int main(void)
{
USART_Init(103);
DDRD=0xff;
DDRE=0xff;
GLCD_Init128();
picture(&sportronix[0]);
_delay_ms(2500);
clrlcd();
sei();
lcdputs2(46,2,ar3); //score
lcdputs2(5,6,ar4);
lcdputs2(110,6,ar4); //FOUL
lcdputs2(58,6,ar6);
lcdnumdata(25,3,AS);
lcdnumdata(85,3,BS);
lcdnumdata(55,7,QT);
lcdnumdata(5,7,AF);
lcdnumdata(110,7,BF);
while(1)
{
}
}
示例7: picture
/*! \brief paint method.
In this method each Plotter is grabbed from its own QCustomPlot Widget
to a Pixmap and then drawed with the QPainter primitive drawPixmap
*/
void QtYARPScope::paint(QPainter *painter)
{
if(!loader){
return;
}
int rows = loader->portscope_rows;
int cols = loader->portscope_columns;
int w = painter->device()->width();
int h = painter->device()->height();
for (int i=0; i<plotManager->getPlotters()->count();i++)
{
painter->beginNativePainting(); // Workaround to flush the painter
auto* plotter = (Plotter*)plotManager->getPlotters()->at(i);
int hSpan = plotter->hspan;
int vSpan = plotter->vspan;
int plotterWidth = (w/cols) * hSpan;
int plotterHeight = (h/rows) * vSpan;
QPixmap picture(QSize(plotter->customPlot.width() * plotter->customPlot.devicePixelRatio(),
plotter->customPlot.height() * plotter->customPlot.devicePixelRatio()));
QCPPainter qcpPainter( &picture );
plotter->customPlot.toPainter( &qcpPainter );
QRectF r = QRectF(plotter->gridx * plotterWidth/hSpan,
plotter->gridy * plotterHeight/vSpan,
picture.rect().width(),picture.rect().height());
plotter->setPaintGeometry(r);
painter->drawPixmap(r,picture,QRectF(0,0,plotterWidth,plotterHeight) );
painter->endNativePainting();
}
}
示例8: ParseXMLGeometry
/*
<ButtonPic x="250px" y="50px"
width="120px" height="110px"
action="localGame"
picture="menu/i_play.png"
text="Play" />
*/
bool ButtonPic::LoadXMLConfiguration(void)
{
if (NULL == profile || NULL == widgetNode) {
//TODO error ... xml attributs not initialized !
return false;
}
XmlReader * xmlFile = profile->GetXMLDocument();
ParseXMLGeometry();
ParseXMLMisc();
ParseXMLBorder();
ParseXMLBackground();
std::string picture("menu/pic_not_found.png");
if (!xmlFile->ReadStringAttr(widgetNode, "picture", picture)) {
//TODO error
return false;
}
picture = profile->relative_path + picture;
Surface surface(picture.c_str());
m_img_normal = surface;
std::string labelText("No Text");
xmlFile->ReadStringAttr(widgetNode, "text", labelText);
txt_label = new Text(_(labelText.c_str()), dark_gray_color, Font::FONT_SMALL, Font::FONT_BOLD, false);
//txt_label->SetMaxWidth(size.x);
return true;
}
示例9: DEF_TEST
// Verify that associated bitmap cache entries are purged on SkImage destruction.
DEF_TEST(BitmapCache_discarded_image, reporter) {
// Cache entries associated with SkImages fall into two categories:
//
// 1) generated image bitmaps (managed by the image cacherator)
// 2) scaled/resampled bitmaps (cached when HQ filters are used)
//
// To exercise the first cache type, we use generated/picture-backed SkImages.
// To exercise the latter, we draw scaled bitmap images using HQ filters.
const SkMatrix xforms[] = {
SkMatrix::MakeScale(1, 1),
SkMatrix::MakeScale(1.7f, 0.5f),
};
for (size_t i = 0; i < SK_ARRAY_COUNT(xforms); ++i) {
test_discarded_image(reporter, xforms[i], []() {
SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
surface->getCanvas()->clear(SK_ColorCYAN);
return surface->newImageSnapshot();
});
test_discarded_image(reporter, xforms[i], []() {
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(10, 10);
canvas->clear(SK_ColorCYAN);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
return SkImage::NewFromPicture(picture, SkISize::Make(10, 10), nullptr, nullptr);
});
}
}
示例10: loadWidgets
void loadWidgets(tgui::Gui& gui, tgui::Gui& gui2, sf::RenderWindow& window)
{
tgui::Picture::Ptr picture(gui2);
picture->load("images/xubuntu_bg_aluminium.jpg");
picture->setCallbackId(3);
//would be nice to get below to work, but OpenGL covers it
//picture->bindCallbackEx(onBackClick, tgui::Picture::LeftMouseClicked);
tgui::Label::Ptr instructions1(gui);
instructions1->setText("Use up and down arrow keys");
instructions1->setPosition(0, 0);
tgui::Label::Ptr instructions2(gui);
instructions2->setText("to control speed of spin");
instructions2->setPosition(0, 32);
// Create check box for pausing
tgui::Checkbox::Ptr checkbox(gui);
checkbox->load("widgets/Black.conf");
checkbox->setPosition(window.getSize().x - 128, 30);
checkbox->setText("Paused");
checkbox->setSize(32, 32);
checkbox->setCallbackId(1);
checkbox->bindCallbackEx(pauseCallback, tgui::Checkbox::LeftMouseClicked);
// Create the quit button
tgui::Button::Ptr quit(gui);
quit->load("widgets/Black.conf");
quit->setSize(128, 30);
quit->setPosition(window.getSize().x - 128, 0);
quit->setText("Quit");
quit->setCallbackId(2);
quit->bindCallbackEx(quitCallback, tgui::Button::LeftMouseClicked);
}
示例11: ERROR
YamiStatus
VaapiPostProcessScaler::process(const SharedPtr<VideoFrame>& src,
const SharedPtr<VideoFrame>& dest)
{
if (!m_context) {
ERROR("NO context for scaler");
return YAMI_FAIL;
}
if (!src || !dest) {
return YAMI_INVALID_PARAM;
}
copyVideoFrameMeta(src, dest);
SurfacePtr surface(new VaapiSurface(m_display,(VASurfaceID)dest->surface));
VaapiVppPicture picture(m_context, surface);
VAProcPipelineParameterBuffer* vppParam;
if (!picture.editVppParam(vppParam))
return YAMI_OUT_MEMORY;
VARectangle srcCrop, destCrop;
if (fillRect(srcCrop, src->crop))
vppParam->surface_region = &srcCrop;
vppParam->surface = (VASurfaceID)src->surface;
vppParam->surface_color_standard = fourccToColorStandard(src->fourcc);
if (fillRect(destCrop, dest->crop))
vppParam->output_region = &destCrop;
vppParam->output_background_color = 0xff000000;
vppParam->output_color_standard = fourccToColorStandard(dest->fourcc);
return picture.process() ? YAMI_SUCCESS : YAMI_FAIL;
}
示例12: C_DrawingStrategyPtr
boost::shared_ptr<pathprovider> pathprovider::instance(C_ItemPtr &item)
{
map<C_ItemPtr, boost::shared_ptr<pathprovider> >::iterator it = _map.find(item);
if (it == _map.end()) {
I_MapItem *subject = NULL;
C_DrawingStrategyPtr(item)->get_Subject(&subject);
C_LinkPtr link(subject);
C_ItemPtr item(subject);
C_PicturePtr picture(subject);
if (subject) {
subject->Release();
}
if (link && item) {
_map[item] = boost::shared_ptr<pathprovider>(new subjectpath(item));
}
else if (picture && item) {
_map[item] = boost::shared_ptr<pathprovider>(new subjectpath(item));
}
else {
_map[item] = boost::shared_ptr<pathprovider>(new nullpath);
}
it = _map.find(item);
}
return it->second;
}
示例13: run_single_benchmark
static bool run_single_benchmark(const SkString& inputPath,
sk_tools::PictureBenchmark& benchmark) {
SkFILEStream inputStream;
inputStream.setPath(inputPath.c_str());
if (!inputStream.isValid()) {
SkString err;
err.printf("Could not open file %s\n", inputPath.c_str());
gLogger.logError(err);
return false;
}
bool success = false;
SkPicture picture(&inputStream, &success, &SkImageDecoder::DecodeStream);
if (!success) {
SkString err;
err.printf("Could not read an SkPicture from %s\n", inputPath.c_str());
gLogger.logError(err);
return false;
}
SkString filename;
sk_tools::get_basename(&filename, inputPath);
SkString result;
result.printf("running bench [%i %i] %s ", picture.width(),
picture.height(), filename.c_str());
gLogger.logProgress(result);
benchmark.run(&picture);
return true;
}
示例14: picture
Encode_Status VaapiEncoderH264::reorder(const SurfacePtr& surface, uint64_t timeStamp, bool forceKeyFrame)
{
if (!surface)
return ENCODE_INVALID_PARAMS;
PicturePtr picture(new VaapiEncPictureH264(m_context, surface, timeStamp));
bool isIdr = (m_frameIndex == 0 ||m_frameIndex >= keyFramePeriod() || forceKeyFrame);
if (isIdr) {
setIdrFrame (picture);
m_reorderFrameList.push_back(picture);
m_curFrameNum++;
m_reorderState = VAAPI_ENC_REORD_DUMP_FRAMES;
} else if (m_frameIndex % intraPeriod() == 0) {
setIFrame (picture);
m_reorderFrameList.push_front(picture);
m_curFrameNum++;
m_reorderState = VAAPI_ENC_REORD_DUMP_FRAMES;
}else if (m_frameIndex % (m_numBFrames + 1) != 0) {
setBFrame (picture);
m_reorderFrameList.push_back(picture);
} else {
setPFrame (picture);
m_reorderFrameList.push_front(picture);
m_curFrameNum++;
m_reorderState = VAAPI_ENC_REORD_DUMP_FRAMES;
}
picture->m_poc = ((m_frameIndex * 2) % m_maxPicOrderCnt);
m_frameIndex++;
return ENCODE_SUCCESS;
}
示例15: handle
int handle(Request* request, MHD_Connection* connection,
const char* url, const char* method,
const char* upload_data, size_t* upload_data_size) override {
if (!request->fPicture.get()) {
return MHD_NO;
}
// TODO move to a function
// Playback into picture recorder
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(kImageWidth, kImageHeight);
request->fDebugCanvas->draw(canvas);
SkAutoTUnref<SkPicture> picture(recorder.endRecording());
SkDynamicMemoryWStream outStream;
SkAutoTUnref<SkPixelSerializer> serializer(SkImageEncoder::CreatePixelSerializer());
picture->serialize(&outStream, serializer);
SkAutoTUnref<SkData> data(outStream.copyToData());
// TODO fancier name handling
return SendData(connection, data, "application/octet-stream", true,
"attachment; filename=something.skp;");
}