void GNC::SimplePrintTool::doPrint() { wxImage image = getImage(WidgetsContract->GetViewerActivo()->GetRenderWindow()); if (image.IsOk()) { wxPrintDialogData dlgData(*pData); wxPrinter printer(&dlgData); ginkgoPrintOutImage prOut(image); printer.Print(WidgetsContract->GetManager()->GetVista()->GetWindow(), &prOut); } }
void SE_TriSurfaceRenderUnit::getTexImage(int texIndex, SE_ImageData**& imageDataArray, int& imageDataNum) { if(texIndex < SE_TEXTURE0 || texIndex >= SE_TEXUNIT_NUM) { imageDataArray = NULL; imageDataNum = 0; return; } getImage(texIndex, imageDataArray, imageDataNum); }
bool GLRenderTexture::readRenderResult(uint8_t* readback_buffer){ Image* image = getImage(); long neededCapacity = image->getWidth() * image->getHeight(); if (!readback_buffer) { LOGE("GLRenderTexture::readRenderResult: readback_buffer is null"); return false; } readRenderResult(readback_buffer,neededCapacity); return true; }
QString TestBase::snapAndContrast(const QString& sLabel, const QString& sFilenameContrast) { QString sFilename = getFilename(sLabel); QImage image = getImage(); image.save(sFilename); compare(image, sFilename, sFilenameContrast, false); return sFilename; }
/* * 找多个球,改编自单个球,返回vector数组 * 为了支持绕障碍功能 */ std::vector<cv::Point2f> Robot::findMulBall() { getImage(); std::vector<cv::Point2f> ans; while (true) { if (!image_r) return ans; ip.setBound(BALL_BOUND); std::vector<cv::Point3f> tmp = ip.extractCircles(image_r); if (tmp.size() <= 0) { turnRight(FIND_BALL_ANGLE); getImage(); continue; } cv::Point2f rCoord; rCoord = worldMap.coord_screen2robot(cv::Point2f(tmp[0].x, tmp[0].y + tmp[0].z)); cv::Point2f ball_coord_sub = worldMap.coord_robot2world(rCoord); CvRect bbox = worldMap.getMap_bbox(); cv::Point2f ball_coord_img = world2image(ball_coord_sub); if (ball_coord_img.x >= bbox.x && ball_coord_img.x <= bbox.x + bbox.width && ball_coord_img.y >= bbox.y && ball_coord_img.y <= bbox.y + bbox.height) { turnRight(FIND_BALL_ANGLE); getImage(); continue; } if (ans.size() == 1) { //判断找到的是不是同一个球 if (abs(ball_coord_sub.x - ans[0].x) <= 10 && abs(ball_coord_sub.y - ans[0].y) <= 10) { turnRight(FIND_BALL_ANGLE); getImage(); continue; } } ans.push_back(ball_coord_sub); if (ans.size() > 1) break; turnRight(FIND_BALL_ANGLE); getImage(); } return ans; }
void Graphics2D::drawCharSet(structure::EventState& state, Vector2D const& dstP) { Vector2D srcP( state.charSetPos() % 4 * CharSet::Pat::END + state.charSetPat(), state.charSetPos() / 4 * CharSet::Dir::END + state.charSetDir() ); drawImage( getImage( Material::CharSet, state.charSet() ), dstP, srcP * CHAR_SIZE, CHAR_SIZE ); }
QPixmap ImageManager::prefetchImage(const QString& host, const QString& url) { // TODO See if this actually helps on the N900 & Symbian Phones #if defined Q_WS_QWS || defined Q_WS_MAEMO_5 || defined Q_WS_S60 // on mobile devices we don´t want the display refreshing when tiles are received which are // prefetched... This is a performance issue, because mobile devices are very slow in // repainting the screen prefetch.append(url); #endif return getImage(host, url); }
QSize ScreenieFilePathModel::getSize() const { QSize result; if (!d->image.isNull()) { result = d->image.size(); } else { /*!\todo Optimisation: use Exiv2 (or http://www.sentex.net/~mwandel/jhead/) library to quickly read the image size from disk (EXIF data). */ result = getImage().size(); } return result; }
perchFrame::perchFrame( poXMLNode _framesNode, poXMLNode _productNode ) { controlswitch = false; framesNode = _framesNode; productNode = _productNode; // object position position = poPoint( framesNode.getChild("posx").innerInt(), framesNode.getChild("posy").innerInt() ); // make image frame float S = framesNode.getChild("scale").innerFloat(); std::string imageName = framesNode.getChild("image").innerString(); frameImg = getImage(imageName); R = new poRectShape( imageName ); R->alignment( PO_ALIGN_CENTER_CENTER ); R->scale.set( S,S,1 ); R->strokeColor = poColor::red; R->addEvent( PO_MOUSE_DRAG_EVENT, this, "drag the frame" ); R->addEvent(PO_MOUSE_DOWN_INSIDE_EVENT,this, "click the frame"); addChild( R ); //text box for info tb = new poTextBox(getWindowWidth(), getWindowHeight()/2); tb->textAlignment(PO_ALIGN_TOP_LEFT); tb->textColor = poColor::green; tb->font(getFont("Courier", 12)); addChild(tb); //small rectangles to control the scale SR1 = new poRectShape(30,30); SR1->fillColor = poColor::green; SR1->alignment(PO_ALIGN_CENTER_CENTER); SR1->drawBounds = false; SR1->position = poPoint(0,0); SR1->addEvent(PO_MOUSE_DRAG_EVENT, this, "drag the green rect"); SR1->addEvent(PO_MOUSE_DOWN_INSIDE_EVENT,this, "click the green rect"); R->addChild(SR1); //show the info of this product productInfo = new perchProduct(productNode);//according to current frameID find the product info in product.xml // productInfo->position = poPoint(R->bounds.width()*R->scale.x/2,R->bounds.height()*R->scale.x/2); productInfo->position = poPoint(80,80); productInfo->alignment(PO_ALIGN_TOP_LEFT); productInfo->visible = false; productInfo->displaynum = 0; R->addChild(productInfo); }
void FullColorBrushTool::draw() { if (TRasterImageP ri = TRasterImageP(getImage(false))) { TRasterP ras = ri->getRaster(); glColor3d(1.0, 0.0, 0.0); tglDrawCircle(m_brushPos, (m_minThick + 1) * 0.5); tglDrawCircle(m_brushPos, (m_maxThick + 1) * 0.5); } }
void MoveRegionTool::OnLButtonUp(UINT nFlags, const CPoint &point) { if(m_copy == NULL) { invertPolygon(); // remove polygon m_rect = m_polygon.getBoundsRect(); // define rect if(m_polygon.size() > 2 && m_rect.Width() > 0 && m_rect.Height() > 0) { // if valid rectangle m_copy = theApp.fetchPixRect(m_rect.Size()); // define copy m_mask = theApp.fetchPixRect(m_rect.Size()); // define mask m_old = theApp.fetchPixRect(m_rect.Size()); // define old m_copy->rop(ORIGIN,m_rect.Size(),SRCCOPY, getImage(),m_rect.TopLeft()); // take a copy m_old->rop( ORIGIN,m_rect.Size(),SRCCOPY, getImage(),m_rect.TopLeft()); // take a copy createMask(); invertPolygon(); // draw polygon } else { m_polygon.clear(); } } else { invertPolygon(); // draw polygon } }
StatePtr SimpleTexturedMaterial::makeState(void) { StatePtr state = Inherited::makeState(); prepareLocalChunks(); state->addChunk(_textureChunk); state->addChunk(_texGenChunk); if(getImage() != NullFC && getImage()->hasAlphaChannel() && getEnvMode() != GL_DECAL) { if(getImage()->isAlphaBinary()) { if(_blendChunk->getSrcFactor() == GL_SRC_ALPHA) { beginEditCP(_blendChunk); _blendChunk->setSrcFactor(GL_ONE); _blendChunk->setDestFactor(GL_ZERO); _blendChunk->setAlphaFunc(GL_NOTEQUAL); _blendChunk->setAlphaValue(0); endEditCP(_blendChunk); } } else { if(_blendChunk->getSrcFactor() != GL_SRC_ALPHA) { beginEditCP(_blendChunk); _blendChunk->setSrcFactor(GL_SRC_ALPHA); _blendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA); _blendChunk->setAlphaFunc(GL_NONE); _blendChunk->setAlphaValue(0); endEditCP(_blendChunk); } } } return state; }
/* GfxEntryPanel::onYOffsetChanged * Called when the Y offset value is modified *******************************************************************/ void GfxEntryPanel::onYOffsetChanged(wxCommandEvent& e) { // Change the image y-offset int offset = spin_yoffset->GetValue(); getImage()->setYOffset(offset); // Update variables setModified(); // Refresh canvas gfx_canvas->Refresh(); }
MotionAwayPlugin::MotionAwayPlugin( QObject *parent, const char *name, const QStringList & /* args */ ) : Kopete::Plugin( MotionAwayPluginFactory::instance(), parent, name ) { kdDebug(14305) << k_funcinfo << "Called." << endl; /* This should be read from config someday may be */ m_width = DEF_WIDTH; m_height = DEF_HEIGHT; m_quality = DEF_QUALITY; m_maxChanges = DEF_CHANGES; m_gap = DEF_GAP; /* We haven't took the first picture yet */ m_tookFirst = false; m_captureTimer = new QTimer(this); m_awayTimer = new QTimer(this); connect( m_captureTimer, SIGNAL(timeout()), this, SLOT(slotCapture()) ); connect( m_awayTimer, SIGNAL(timeout()), this, SLOT(slotTimeout()) ); signal(SIGCHLD, SIG_IGN); m_imageRef.resize( m_width * m_height * 3); m_imageNew.resize( m_width * m_height * 3); m_imageOld.resize( m_width * m_height * 3); m_imageOut.resize( m_width * m_height * 3); kdDebug(14305) << k_funcinfo << "Opening Video4Linux Device" << endl; m_deviceHandler = open( videoDevice.latin1() , O_RDWR); if (m_deviceHandler < 0) { kdDebug(14305) << k_funcinfo << "Can't open Video4Linux Device" << endl; } else { kdDebug(14305) << k_funcinfo << "Worked! Setting Capture timers!" << endl; /* Capture first image, or we will get a alarm on start */ getImage (m_deviceHandler, m_imageRef, DEF_WIDTH, DEF_HEIGHT, IN_DEFAULT, NORM_DEFAULT, VIDEO_PALETTE_RGB24); /* We have the first image now */ m_tookFirst = true; m_wentAway = false; m_captureTimer->start( DEF_POLL_INTERVAL ); m_awayTimer->start( awayTimeout * 60 * 1000 ); } loadSettings(); connect(this, SIGNAL(settingsChanged()), this, SLOT( loadSettings() ) ); }
void Wall::Draw(Graphics* g) { auto pContext = GlobalContext::singleton(); auto isoPos = utils::toIsometric(getPos()); g->DrawImage(getImage().get() , Rect(isoPos.cellX - pContext->m_cellWidth,isoPos.cellY - pContext->m_cellHeight, pContext->m_cellWidth*2, pContext->m_cellHeight*2), Rect(IMAGE_CELL_X*IMAGE_CELL_WIDTH, IMAGE_CELL_Y*IMAGE_CELL_HEIGHT, IMAGE_CELL_WIDTH, IMAGE_CELL_HEIGHT)); }
void GNC::SimplePrintTool::doPrintPreview() { wxImage image = getImage(WidgetsContract->GetViewerActivo()->GetRenderWindow()); if (image.IsOk()) { wxPrintPreview* myPrintPreview = new wxPrintPreview(new ginkgoPrintOutImage(image), new ginkgoPrintOutImage(image), pData); wxPreviewFrame *frame = new wxPreviewFrame(myPrintPreview, WidgetsContract->GetManager()->GetVista()->GetWindow(), _("Print image"), wxDefaultPosition, wxSize(800, 600)); frame->InitializeWithModality(wxPreviewFrame_WindowModal); frame->Show(true); frame->Show(true); } }
int main(const int argc, const char *const *const argv) { if (4 != argc) { printf("usage: %s imagename outputfilename\n", argv[0]); return 1; } int nRet = 0; nRet = getImage(argv[1], argv[2], argv[3]); if (0 == nRet) { nRet = putImage(argv[1], argv[2], argv[3]); } return nRet; }
void Image<Type>::fill(Type g) { Type * hdr_img = getImage(); unsigned int x,y; for(y = 0; y < height; y++) { for(x = 0; x < width; x++) { hdr_img[y * width + x] = g; } } }
TexModule *TextureManager::getImageTexModule(Texture2D *tex) { CCASSERT(tex->isReference(), "texture is real!!!"); GLuint name = tex->getName(); auto iter = texFilenameMap.find(name); if(iter != texFilenameMap.end()) { auto image = getImage(iter->second); return image->getTexModule(); } return nullptr; }
void MoveRegionTool::OnMouseMove(UINT nFlags, const CPoint &point) { if(nFlags & MK_LBUTTON) { if(m_copy == NULL) { invertPolygon(false); // remove polygon m_polygon.add(point); invertPolygon(); // draw polygon } else { m_container->saveDocState(); getImage()->rop(m_rect.TopLeft(),m_rect.Size(),SRCCOPY, m_old,ORIGIN); m_rect += point - m_lastPoint; m_polygon.move(point - m_lastPoint); m_lastPoint = point; m_old->rop(ORIGIN,m_rect.Size(),SRCCOPY, getImage(),m_rect.TopLeft()); // getImage()->rop(m_rect.TopLeft(),m_rect.Size(),DSTINVERT,NULL,ORIGIN); // getImage()->mask(m_rect.TopLeft(),m_rect.Size(),MAKEROP4(SRCCOPY,DSTINVERT), m_copy,ORIGIN, m_mask); getImage()->mask(m_rect.TopLeft(),m_rect.Size(),SRCCOPY, m_copy,ORIGIN, m_mask); repaint(); } } }
void Slider::update(const Control* container, const Vector2& offset) { Label::update(container, offset); _minImage = getImage("minCap", _state); _maxImage = getImage("maxCap", _state); _markerImage = getImage("marker", _state); _trackImage = getImage("track", _state); char s[32]; sprintf(s, "%.*f", _valueTextPrecision, _value); _valueText = s; if (_delta != 0.0f) { float oldValue = _value; float total = _max - _min; if (_step > 0.0f) { _gamepadValue += (total * GAMEPAD_FRACTION) * _delta; int numSteps = round(_gamepadValue / _step); _value = _step * numSteps; } else { _value += (total * GAMEPAD_FRACTION) * _delta; } if (_value > _max) _value = _max; else if (_value < _min) _value = _min; if (_value != oldValue) { notifyListeners(Control::Listener::VALUE_CHANGED); } } }
void FullColorBrushTool::leftButtonUp(const TPointD &pos, const TMouseEvent &e) { m_brushPos = m_mousePos = pos; TRasterImageP ri = (TRasterImageP)getImage(true); if (!ri) return; if (m_points.size() != 1) { double maxThickness = m_thickness.getValue().second; double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThickness; double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01; TPointD rasCenter = ri->getRaster()->getCenterD(); TThickPoint point(pos + rasCenter, thickness); m_points.push_back(point); int m = m_points.size(); vector<TThickPoint> points; points.push_back(m_points[m - 3]); points.push_back(m_points[m - 2]); points.push_back(m_points[m - 1]); TRect bbox = m_brush->getBoundFromPoints(points); updateWorkAndBackupRasters(bbox); m_tileSaver->save(bbox); m_brush->addArc(points[0], points[1], points[2], m_oldOpacity, opacity); m_brush->updateDrawing(ri->getRaster(), m_backUpRas, m_currentColor, bbox, m_opacity.getValue().second * 0.01); TRectD invalidateRect = ToolUtils::getBounds(points, maxThickness); invalidate(invalidateRect.enlarge(2) - rasCenter); m_strokeRect += bbox; m_lastRect.empty(); } if (m_brush) { delete m_brush; m_brush = 0; } m_workRaster->unlock(); if (m_tileSet->getTileCount() > 0) { delete m_tileSaver; TTool::Application *app = TTool::getApplication(); TXshLevel *level = app->getCurrentLevel()->getLevel(); TXshSimpleLevelP simLevel = level->getSimpleLevel(); TFrameId frameId = getCurrentFid(); TRasterP ras = ri->getRaster()->extract(m_strokeRect)->clone(); TUndoManager::manager()->add(new FullColorBrushUndo(m_tileSet, simLevel.getPointer(), frameId, m_isFrameCreated, ras, m_strokeRect.getP00())); } notifyImageChanged(); m_strokeRect.empty(); }
AlphaTestTextureApp::AlphaTestTextureApp() { addModifier(new poCamera2D(poColor::green)); poRectShape *shape = addChild(new poRectShape(getImage("1_Dry Dock 1.png")->texture())); shape->position.set(100,100,0); shape->drawBounds = true; shape->alphaTestTexture = true; shape->addEvent(PO_MOUSE_DOWN_INSIDE_EVENT, this); shape->addEvent(PO_MOUSE_ENTER_EVENT, this); shape->addEvent(PO_MOUSE_LEAVE_EVENT, this); }
void QTextImageHandler::drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) { Q_UNUSED(posInDocument) const QTextImageFormat imageFormat = format.toImageFormat(); if (qApp->thread() != QThread::currentThread()) { const QImage image = getImage(doc, imageFormat); p->drawImage(rect, image, image.rect()); } else { const QPixmap pixmap = getPixmap(doc, imageFormat); p->drawPixmap(rect, pixmap, pixmap.rect()); } }
bool MJPEGStreamer::execute() { pthread_mutex_lock(&(mServer->Mutex)); if(mServer->getClientRequest()) { mServer->setDataBufferSize(compress_yuyv_to_jpeg(getImage(), mServer->getDataBuffer(), (size_t)(800*600*2), 80)); } mServer->notifyDataBufferUpdate(); mServer->setClientRequest(false); pthread_mutex_unlock(&(mServer->Mutex)); return true; }
void RegionLoad::Save(SDL_RWops *src) { //Save region defination SDL_WriteLE32(src, getImage()->X()); SDL_WriteLE32(src, getImage()->Y()); SDL_WriteLE32(src, ((SlowCanvas *)getImage())->Width()); SDL_WriteLE32(src, ((SlowCanvas *)getImage())->Height()); //Save default region in view Uint8 bDefaultRegion = (defaultRegion == this)?1:0; SDL_RWwrite(src, &bDefaultRegion, sizeof(Uint8), 1); //Save actors list SDL_WriteLE32(src, regionActors.size()); MapRegionActorsIterator it(regionActors); for( it.Begin(); !it.Done(); it.Next() ) { WriteString(src, *it.Key()); } }
bool VAApiWriter::getRGB32Image( VAImageFormat *img_fmt, VASurfaceID surfaceID, void *dest ) const { VAImage image; quint8 *data = getImage( image, surfaceID, img_fmt ); if ( data ) { memcpy( dest, data + image.offsets[ 0 ], outW * outH << 2 ); vaUnmapBuffer( VADisp, image.buf ); vaDestroyImage( VADisp, image.image_id ); return true; } return false; }
/* GfxEntryPanel::onBtnAutoOffset * Called when the 'modify offsets' button is clicked *******************************************************************/ void GfxEntryPanel::onBtnAutoOffset(wxCommandEvent& e) { ModifyOffsetsDialog dlg; dlg.SetParent(theMainWindow); dlg.CenterOnParent(); if (dlg.ShowModal() == wxID_OK) { // Calculate new offsets point2_t offsets = dlg.calculateOffsets(spin_xoffset->GetValue(), spin_yoffset->GetValue(), gfx_canvas->getImage()->getWidth(), gfx_canvas->getImage()->getHeight()); // Change offsets spin_xoffset->SetValue(offsets.x); spin_yoffset->SetValue(offsets.y); getImage()->setXOffset(offsets.x); getImage()->setYOffset(offsets.y); refreshPanel(); // Set changed setModified(); } }
void Guard::Draw(Graphics* g) { auto pContext = GlobalContext::singleton(); int rowNumber = GetRow(m_MoveDirection); // row of image auto isoPos = utils::toIsometric(getPos()); g->DrawImage(getImage().get() , Rect(isoPos.cellX - pContext->m_cellWidth,isoPos.cellY - pContext->m_cellHeight, pContext->m_cellWidth*2, pContext->m_cellHeight*2), Rect(m_RowImageIndex*CELL_IMAGE_WIDTH, rowNumber*CELL_IMAGE_HEIGHT, CELL_IMAGE_WIDTH, CELL_IMAGE_HEIGHT)); }
std::vector<unsigned char> Texture::getImage(const GLint level, const GLenum format, const GLenum type) const { GLint width = getLevelParameter(level, GL_TEXTURE_WIDTH); GLint height = getLevelParameter(level, GL_TEXTURE_HEIGHT); GLint depth = getLevelParameter(level, GL_TEXTURE_DEPTH); int byteSize = imageSizeInBytes(width, height, depth, format, type); std::vector<unsigned char> data(byteSize); getImage(level, format, type, data.data()); return data; }