本文整理汇总了C++中BitmapImage类的典型用法代码示例。如果您正苦于以下问题:C++ BitmapImage类的具体用法?C++ BitmapImage怎么用?C++ BitmapImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BitmapImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintTransformedSelection
void CanvasRenderer::paintTransformedSelection( QPainter& painter )
{
// Make sure there is something selected
//
if (mSelection.width() == 0 || mSelection.height() == 0) {
return;
}
Layer* layer = mObject->getLayer( mLayerIndex );
if (layer->type() == Layer::BITMAP) {
// Get the transformed image
//
BitmapImage* bitmapImage = dynamic_cast< LayerBitmap* >( layer )->getLastBitmapImageAtFrame( mFrameNumber, 0 );
BitmapImage transformedImage = bitmapImage->transformed(mSelection, mSelectionTransform, mOptions.bAntiAlias);
// Paint the transformation output
//
painter.setWorldMatrixEnabled( true );
transformedImage.paintImage(painter);
}
}
示例2: backup
bool Editor::importBitmapImage( QString filePath )
{
backup( tr( "ImportImg" ) );
QImageReader reader( filePath );
Q_ASSERT( layers()->currentLayer()->type() == Layer::BITMAP );
auto layer = static_cast<LayerBitmap*>( layers()->currentLayer() );
QImage img( reader.size(), QImage::Format_ARGB32_Premultiplied );
while ( reader.read( &img ) )
{
if ( img.isNull() || reader.nextImageDelay() <= 0 )
{
break;
}
if ( !layer->keyExists( currentFrame() ) )
{
addNewKey();
}
BitmapImage* bitmapImage = layer->getBitmapImageAtFrame( currentFrame() );
QRect boundaries = img.rect();
boundaries.moveTopLeft( mScribbleArea->getCentralPoint().toPoint() - QPoint( boundaries.width() / 2, boundaries.height() / 2 ) );
BitmapImage* importedBitmapImage = new BitmapImage( boundaries, img );
bitmapImage->paste( importedBitmapImage );
scrubTo( currentFrame() + 1 );
}
return true;
}
示例3: LoadImageForTest
void LoadImageForTest( const std::string& image_filepath )
{
LOG_SCOPE( image_filepath.c_str() );
BitmapImage img;
img.LoadFromFile( image_filepath );
}
示例4: copy
void Editor::copy()
{
Layer* layer = mObject->getLayer(layers()->currentLayerIndex());
if (layer == nullptr)
{
return;
}
if (layer->type() == Layer::BITMAP)
{
LayerBitmap* layerBitmap = static_cast<LayerBitmap*>(layer);
if (mScribbleArea->isSomethingSelected())
{
g_clipboardBitmapImage = layerBitmap->getLastBitmapImageAtFrame(currentFrame(), 0)->copy(mScribbleArea->getSelection().toRect()); // copy part of the image
}
else
{
g_clipboardBitmapImage = layerBitmap->getLastBitmapImageAtFrame(currentFrame(), 0)->copy(); // copy the whole image
}
clipboardBitmapOk = true;
if (g_clipboardBitmapImage.image() != nullptr)
QApplication::clipboard()->setImage(*g_clipboardBitmapImage.image());
}
if (layer->type() == Layer::VECTOR)
{
clipboardVectorOk = true;
g_clipboardVectorImage = *((static_cast<LayerVector*>(layer))->getLastVectorImageAtFrame(currentFrame(), 0)); // copy the image
}
}
示例5: applyFloydSteinberg
void applyFloydSteinberg(){
string path;
DIR* directory;
struct dirent *ep;
list<string> gabaritos;
cout << "Entre com o caminho com as imagens que se deseja aplicar o dithering: ";
getline(cin, path);
directory = opendir(path.c_str());
if(directory == NULL){
cerr << "Error(" << errno << ") opening " << directory << endl;
return;
}
while((ep = readdir(directory))){
auto filePath = path + "/" + ep->d_name;
if(has_suffix(filePath, ".bmp")){
cout << filePath << endl;
gabaritos.push_back(filePath);
}
}
for(auto it = gabaritos.begin(); it != gabaritos.end(); it++){
string aux="";
aux+= *it;
string aux2="";
BitmapImage teste = BitmapImage(aux, find_file_name((*it)));
teste.floydSteinberg();
}
return;
}
示例6:
void
BitmapImage::downloader_failed (EventObject *sender, EventArgs *calldata, gpointer closure)
{
BitmapImage *media = (BitmapImage *) closure;
media->DownloaderFailed ();
}
示例7: mouseReleaseEvent
void EyedropperTool::mouseReleaseEvent(QMouseEvent *event)
{
Layer* layer = mEditor->layers()->currentLayer();
if (layer == NULL) { return; }
if (event->button() == Qt::LeftButton)
{
if (layer->type() == Layer::BITMAP)
{
BitmapImage* targetImage = ((LayerBitmap *)layer)->getLastBitmapImageAtFrame( mEditor->currentFrame(), 0);
//QColor pickedColour = targetImage->pixel(getLastPoint().x(), getLastPoint().y());
QColor pickedColour;
pickedColour.setRgba( targetImage->pixel( getLastPoint().x(), getLastPoint().y() ) );
int transp = 255 - pickedColour.alpha();
pickedColour.setRed( pickedColour.red() + transp );
pickedColour.setGreen( pickedColour.green() + transp );
pickedColour.setBlue( pickedColour.blue() + transp );
if (pickedColour.alpha() != 0)
{
mEditor->color()->setColor(pickedColour);
}
}
else if (layer->type() == Layer::VECTOR)
{
VectorImage *vectorImage = ((LayerVector *)layer)->getLastVectorImageAtFrame(mEditor->currentFrame(), 0);
int colourNumber = vectorImage->getColourNumber(getLastPoint());
if (colourNumber != -1)
{
mEditor->color()->setColorNumber(colourNumber);
}
}
}
}
示例8: loadTextureImage
static void loadTextureImage() {
BitmapImage * image = NULL;
if (texture != NULL) {
texture->dispose(texture);
texture = NULL;
}
if (jsonPath != NULL) {
JSONDeserializationContext * context;
context = JSONDeserializationContext_createWithFile(jsonPath);
texture = GLTexture_deserialize(context);
if (texture == NULL) {
fprintf(stderr, "Error: Couldn't load %s as gltexture.json file: %d\n", jsonPath, context->status);
} else {
char imagePath[PATH_MAX];
if (jsonImagePath == NULL) {
size_t charIndex;
strncpy(imagePath, jsonPath, PATH_MAX);
for (charIndex = strlen(imagePath) - 1; charIndex > 0; charIndex--) {
if (imagePath[charIndex] == '/') {
charIndex++;
break;
}
}
strncpy(imagePath + charIndex, texture->imageName, PATH_MAX - charIndex);
} else {
snprintf(imagePath, PATH_MAX, "%s/%s", jsonImagePath, texture->imageName);
}
image = PNGImageIO_loadPNGFile(imagePath, PNG_PIXEL_FORMAT_AUTOMATIC, true);
if (image == NULL) {
fprintf(stderr, "Error: Couldn't load %s as gltexture.json file\n", imagePath);
texture->dispose(texture);
texture = NULL;
}
}
}
if (texture == NULL) {
image = PNGImageIO_loadPNGFile(resourcePath(textureImages[textureIndex].fileName), PNG_PIXEL_FORMAT_AUTOMATIC, true);
texture = GLTexture_create(textureImages[textureIndex].dataFormat,
GL_UNSIGNED_BYTE,
minFilters[minFilterIndex],
magFilters[magFilterIndex],
wrapModes[wrapSModeIndex],
wrapModes[wrapTModeIndex],
autoBlendModes[autoBlendModeIndex],
autoMipmap,
anisotropicFilter);
}
texture->setImage(texture, 0, image->width, image->height, image->bytesPerRow, image->pixels);
image->dispose(image);
}
示例9: GetSource
void
Image::DownloadProgress ()
{
BitmapImage *source = (BitmapImage *) GetSource ();
SetDownloadProgress (source->GetProgress ());
Emit (DownloadProgressChangedEvent);
}
示例10: EraseRect
void Icon::Paint( const Rect &cUpdateRect )
{
EraseRect( cUpdateRect );
if( m_bSelected )
{
Rect cUpdateFrame = GetBounds();
cUpdateFrame.top += 2;
cUpdateFrame.left += 2;
/* XXXKV: This is a hack; why is the height from GetBounds() so large? */
cUpdateFrame.right = m_cSize.x - 2;
cUpdateFrame.bottom = m_cSize.y - 2;
FillRect( cUpdateFrame, m_sHighlightColor );
/* Round edges */
SetDrawingMode( DM_COPY );
SetFgColor( m_sHighlightColor );
DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.top - 2 ),
os::Point( cUpdateFrame.right - 2, cUpdateFrame.top - 2 ) );
DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.top - 1 ),
os::Point( cUpdateFrame.right, cUpdateFrame.top - 1 ) );
DrawLine( os::Point( cUpdateFrame.left - 2, cUpdateFrame.top + 2 ),
os::Point( cUpdateFrame.left - 2, cUpdateFrame.bottom - 2 ) );
DrawLine( os::Point( cUpdateFrame.left - 1, cUpdateFrame.top ),
os::Point( cUpdateFrame.left - 1, cUpdateFrame.bottom ) );
DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.bottom + 2 ),
os::Point( cUpdateFrame.right - 2, cUpdateFrame.bottom + 2 ) );
DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.bottom + 1 ),
os::Point( cUpdateFrame.right, cUpdateFrame.bottom + 1 ) );
DrawLine( os::Point( cUpdateFrame.right + 2, cUpdateFrame.top + 2 ),
os::Point( cUpdateFrame.right + 2, cUpdateFrame.bottom - 2 ) );
DrawLine( os::Point( cUpdateFrame.right + 1, cUpdateFrame.top ),
os::Point( cUpdateFrame.right + 1, cUpdateFrame.bottom ) );
SetFgColor( m_sFgColor );
}
SetDrawingMode( DM_BLEND );
/* XXXKV: Will only work with BitmapImage; should use RTTI to find
type and handle accordingly */
BitmapImage *pcImage = static_cast<BitmapImage*>( m_pcImage );
Bitmap *pcBitmap = pcImage->LockBitmap();
DrawBitmap( pcBitmap, pcImage->GetBounds(), m_cImageFrame );
pcImage->UnlockBitmap();
/* Draw the icon name */
SetDrawingMode( DM_OVER );
MovePenTo( m_cNamePos );
DrawString( m_cName );
}
示例11: backup
bool Editor::importBitmapImage( QString filePath )
{
backup( tr( "ImportImg" ) );
qDebug(filePath.toLatin1().data());
QImageReader reader( filePath );
Q_ASSERT( layers()->currentLayer()->type() == Layer::BITMAP );
auto layer = static_cast<LayerBitmap*>( layers()->currentLayer() );
QImage img;//( reader.size(), QImage::Format_ARGB32_Premultiplied );
img.load(filePath);
while ( reader.read( &img ) )
{/*
if ( img.isNull() || reader.nextImageDelay() <= 0 )
{
qDebug("why not image");
break;
}*/
if ( !layer->keyExists( currentFrame() ) )
{
qDebug("why not imagesadfsdaf ssd");
addNewKey();
}
BitmapImage* bitmapImage = layer->getBitmapImageAtFrame( currentFrame() );
QRect boundaries = img.rect();
boundaries.moveTopLeft( mScribbleArea->getCentralPoint().toPoint() - QPoint( boundaries.width() / 2, boundaries.height() / 2 ) );
BitmapImage* importedBitmapImage = new BitmapImage( boundaries, img );
bitmapImage->paste( importedBitmapImage );
if(layers()->currentLayerIndex()>2)
{
//下面用来框出倒入的图片
mScribbleArea->mySelection.moveTopLeft(mScribbleArea->getCentralPoint().toPoint() - QPoint( boundaries.width()/1.5, boundaries.height()/1.5) );//这个是为了将值赋给QRectF
mScribbleArea->mySelection.moveBottomRight(mScribbleArea->getCentralPoint().toPoint() + QPoint( boundaries.width()/1.5, boundaries.height()/1.5));
mScribbleArea->mySelection.setTopLeft(mScribbleArea->getCentralPoint().toPoint() - QPoint( boundaries.width()/1.5, boundaries.height()/1.5));
mScribbleArea->mySelection.setBottomRight(mScribbleArea->getCentralPoint().toPoint() + QPoint( boundaries.width()/1.5, boundaries.height()/1.5));
//mScribbleArea->mySelection.moveBottomRight(QPoint( boundaries.width()/2, boundaries.height()/2));
mScribbleArea->setSelection( mScribbleArea->mySelection, true );
mScribbleArea->myTransformedSelection = mScribbleArea->mySelection.adjusted( 0, 0, 0, 0 );
mScribbleArea->myTempTransformedSelection = mScribbleArea->mySelection.adjusted( 0, 0, 0, 0 );
mScribbleArea->update();
mScribbleArea->mIncludeImg[mLayerManager->currentLayerIndex()]=mScribbleArea->mySelection;
tools()->setCurrentTool(MOVE);
}
// scrubTo( currentFrame() + 1 );
}
return true;
}
示例12: resource_notify
static void
resource_notify (NotifyType type, gint64 args, gpointer user_data)
{
BitmapImage *media = (BitmapImage *) user_data;
if (type == NotifyProgressChanged)
media->SetProgress ((double)(args)/100.0);
else if (type == NotifyFailed)
media->DownloaderFailed ();
else if (type == NotifyCompleted)
media->DownloaderComplete ();
}
示例13: while
void Editor::backup( int backupLayer, int backupFrame, QString undoText )
{
while ( mBackupList.size() - 1 > mBackupIndex && mBackupList.size() > 0 )
{
delete mBackupList.takeLast();
}
while ( mBackupList.size() > 19 ) // we authorize only 20 levels of cancellation
{
delete mBackupList.takeFirst();
mBackupIndex--;
}
Layer* layer = mObject->getLayer( backupLayer );
if ( layer != NULL )
{
if ( layer->type() == Layer::BITMAP )
{
BackupBitmapElement* element = new BackupBitmapElement();
element->layer = backupLayer;
element->frame = backupFrame;
element->undoText = undoText;
element->somethingSelected = this->getScribbleArea()->somethingSelected;
element->mySelection = this->getScribbleArea()->mySelection;
element->myTransformedSelection = this->getScribbleArea()->myTransformedSelection;
element->myTempTransformedSelection = this->getScribbleArea()->myTempTransformedSelection;
BitmapImage* bitmapImage = ( ( LayerBitmap* )layer )->getLastBitmapImageAtFrame( backupFrame, 0 );
if ( bitmapImage != NULL )
{
element->bitmapImage = bitmapImage->copy(); // copy the image
mBackupList.append( element );
mBackupIndex++;
}
}
if ( layer->type() == Layer::VECTOR )
{
BackupVectorElement* element = new BackupVectorElement();
element->layer = backupLayer;
element->frame = backupFrame;
element->undoText = undoText;
element->somethingSelected = this->getScribbleArea()->somethingSelected;
element->mySelection = this->getScribbleArea()->mySelection;
element->myTransformedSelection = this->getScribbleArea()->myTransformedSelection;
element->myTempTransformedSelection = this->getScribbleArea()->myTempTransformedSelection;
VectorImage* vectorImage = ( ( LayerVector* )layer )->getLastVectorImageAtFrame( backupFrame, 0 );
if ( vectorImage != NULL )
{
element->vectorImage = *vectorImage; // copy the image (that works but I should also provide a copy() method)
mBackupList.append( element );
mBackupIndex++;
}
}
}
}
示例14: QImage
void Editor::clipboardChanged()
{
if ( clipboardBitmapOk == false )
{
g_clipboardBitmapImage.setImage( new QImage( QApplication::clipboard()->image() ) );
g_clipboardBitmapImage.bounds() = QRect( g_clipboardBitmapImage.topLeft(), g_clipboardBitmapImage.image()->size() );
qDebug() << "New clipboard image" << g_clipboardBitmapImage.image()->size();
}
else
{
clipboardBitmapOk = false;
qDebug() << "The image has been saved in the clipboard";
}
}
示例15: delete
void CameraDelayedLooper::TimerTick(int nID)
{
if (nID == CAMERA_ID)
{
DateTime pcTime = DateTime::Now();
BitmapImage* pcBitmapImage;
BitmapImage* pcSaveImage;
os::String cScreenShotPath;
os::Desktop m_Screen;
pcSaveImage = new os::BitmapImage( Bitmap::SHARE_FRAMEBUFFER | Bitmap::ACCEPT_VIEWS );
pcSaveImage->SetColorSpace( CS_RGBA32 );
pcSaveImage->ResizeCanvas( os::Point( m_Screen.GetResolution() ) );
pcBitmapImage = new os::BitmapImage((uint8*)m_Screen.GetFrameBuffer(),m_Screen.GetResolution(),m_Screen.GetColorSpace());
pcBitmapImage->Draw( os::Point( 0, 0 ), pcSaveImage->GetView() );
pcSaveImage->Sync();
cScreenShotPath = os::String().Format("%s/Pictures/Screenshot-%d-%d-%d-%d_%d_%d.png",getenv("HOME"),pcTime.GetYear(),pcTime.GetMonth(),pcTime.GetDay(),pcTime.GetHour(),pcTime.GetMin(),pcTime.GetSec());
File vNewFile = os::File(cScreenShotPath,O_CREAT | O_TRUNC | O_WRONLY);
vNewFile.WriteAttr("os::MimeType", O_TRUNC, ATTR_TYPE_STRING,"image/png", 0,10 );
pcSaveImage->Save(&vNewFile,"image/png");
vNewFile.Flush();
delete( pcSaveImage );
delete pcBitmapImage;
RemoveTimer(this,nID);
}
}