Skip to content
Snippets Groups Projects
identicon.h 780 B
Newer Older
  • Learn to ignore specific revisions
  • #ifndef IDENTICON_H
    #define IDENTICON_H
    
    #include <QByteArray>
    
    #include "identiconstyle.h"
    
    #include "rendering/icongenerator.h"
    
    #include "rendering/rectangle.h"
    
    #include "rendering/svgrenderer.h"
    
    
    class Identicon
    {
    private:
    
    Joe Donofry's avatar
    Joe Donofry committed
        QString hash_;
    
        int size_;
        rendering::IconGenerator iconGenerator_;
        IdenticonStyle style_;
        static IdenticonStyle defaultStyle_;
    
    Joe Donofry's avatar
    Joe Donofry committed
        Identicon(QString &hash, int size);
    
        int size() { return size_; }
    
        rendering::Rectangle getIconBounds();
        static Identicon fromHash(QByteArray &hash, int size);
        static Identicon fromHash(QString &hash, int size);
        static QString generateSvg(Identicon &identicon, bool fragment);
        void draw(rendering::Renderer &renderer, rendering::Rectangle &rect);
    };
    
    #endif // IDENTICON_H