Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No transformation result with QImage transformed

No transformation result with QImage transformed

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 370 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    doubitchou
    wrote on last edited by
    #1

    Hi,
    I'm currently implementing a class that operates on Matrices based on QImage as described bellow. But even if I know from docs that Transformed returns a copy of the QImage, no transformation occurs.

    What is wrong with LineShift this please?

    Matrix.cpp

    MathMatrix::MathMatrix(const QString MName, const quint16 MCols, const quint16 MRows, const quint32 MColors):
        Name(MName),Cols(MCols),Rows(MRows),Colors( MColors)
    {
         WorkMatrix = new QImage(Cols,Rows,QImage::Format_RGB32);
         Name = MName;
         Cols= MCols ;
         Rows = MRows;
         Colors  = MColors;
         Reset();
    }
    
    void MathMatrix::LineShift(  int Offset)
    {
       *WorkMatrix = WorkMatrix->transformed(QTransform().translate(0,Offset)) ;
    }
    
    void MathMatrix::Fill(uint Value)
    {
        WorkMatrix->fill(Value);
    }
    etc...
    

    Matrix.h

    class MathMatrix
    {
    private:
        QString Name ;
        quint16 Cols;
        quint16 Rows ;
        quint32 Colors ;
        QImage *WorkMatrix;
    
    public:
        MathMatrix(const QString MName="Matrix Name", const quint16 MCols=8 , const quint16 MRows=8, const quint32 MColors=3);
        ~MathMatrix();
        QString getName()   { return Name   ;}
        quint16 getCols()   { return Cols   ;}
        quint16 getRows()   { return Rows   ;}
        quint32 getColors() { return Colors ;}
        
        void Fill(uint Value);
        void Fill(QColor NamedColor);   
        void LineShift(int Offset);
        void TestMatrix();
    };
    

    This class is called like this :

    ProjectMatrix::ProjectMatrix(const QString M_Name, const quint16 M_Cols, const quint16 M_Rows, const quint32 M_Colors)
    {
        MathMatrix ProjMatrix(M_Name,M_Cols,M_Rows,M_Colors);
        ProjMatrix.SetLine(1,0xFF000001) ;
        ProjMatrix.LineShift( 1);
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved