Loading...
Searching...
No Matches

Detailed Description

Classes

struct  HexEditorHighlightState
struct  CellAlignedText
 A piece of text together with the character cell it starts at. More...
class  FontParameters
class  RenderContext

Enumerations

enum  HexEditorHighlightMode { NoHighlight , ColumnHighlight , ByteValueHighlight }
enum  HexEditorColorMode { NoColorization , AsciiColorization , ModificationColorization }
enum  HexEditorHighlightContrast { NormalContrastHighlight , MediumContrastHighlight , HighContrastHighlight }

Class Documentation

◆ HexEditorHighlightState

struct HexEditorHighlightState

Public Member Functions

void restoreSettings ()
void saveSettings ()

Public Attributes

HexEditorHighlightMode mode
HexEditorColorMode color
HexEditorHighlightContrast contrast

Member Function Documentation

◆ restoreSettings()

void HexEditorHighlightState::restoreSettings ( )

◆ saveSettings()

void HexEditorHighlightState::saveSettings ( )

Member Data Documentation

◆ mode

HexEditorHighlightMode HexEditorHighlightState::mode

◆ color

HexEditorColorMode HexEditorHighlightState::color

◆ contrast

HexEditorHighlightContrast HexEditorHighlightState::contrast

◆ CellAlignedText

struct CellAlignedText

A piece of text together with the character cell it starts at.

Class Members
QString text
size_t cell

◆ FontParameters

class FontParameters

Public Member Functions

 FontParameters (QWidget *parent, float fontScale=1.0f)
void update ()
const QFont & getFont () const
QFont & getFont ()
const QFont & getEmojiFont () const
QFont & getEmojiFont ()
void setFont (const QFont &font)
void setEmojiFont (const QFont &emojiFont)
int getBaseline () const
int getWidth () const
int getHeight () const
int getOffset () const

Constructor & Destructor Documentation

◆ FontParameters()

FontParameters::FontParameters ( QWidget * parent,
float fontScale = 1.0f )

Member Function Documentation

◆ update()

void FontParameters::update ( )

◆ getFont() [1/2]

const QFont & FontParameters::getFont ( ) const
inline

◆ getFont() [2/2]

QFont & FontParameters::getFont ( )
inline

◆ getEmojiFont() [1/2]

const QFont & FontParameters::getEmojiFont ( ) const
inline

◆ getEmojiFont() [2/2]

QFont & FontParameters::getEmojiFont ( )
inline

◆ setFont()

void FontParameters::setFont ( const QFont & font)

◆ setEmojiFont()

void FontParameters::setEmojiFont ( const QFont & emojiFont)

◆ getBaseline()

int FontParameters::getBaseline ( ) const
inline

◆ getWidth()

int FontParameters::getWidth ( ) const
inline

◆ getHeight()

int FontParameters::getHeight ( ) const
inline

◆ getOffset()

int FontParameters::getOffset ( ) const
inline

◆ RenderContext

class RenderContext

Public Member Functions

 RenderContext (QWidget *parent, float fontScale=1.0f)
void update ()
FontParametersgetFontParamters ()
const FontParametersgetFontParameters () const
int getFontWidth () const
int getFontHeight () const
void init (QPainter &p)
QColor getColorForHexDumpByte (const HexEditorHighlightState &state, BNModificationStatus modification, uint8_t byte)
QColor getHighlightColor (BNHighlightColor color)
HighlightTokenState getTokenForDisassemblyLinePosition (int64_t col, const std::vector< BinaryNinja::InstructionTextToken > &tokens)
HighlightTokenState getTokenForDisassemblyTokenIndex (size_t tokenIndex, const std::vector< BinaryNinja::InstructionTextToken > &tokens)
HighlightTokenState getHighlightTokenForTextToken (const BinaryNinja::InstructionTextToken &token)
void drawText (QPainter &p, int x, int y, QColor color, const QString &text) const
void drawCellAlignedText (QPainter &p, int x, int y, QColor color, const std::string &text) const
 Draws text positioned on the character cell grid, so that wide code points occupy the cells their token width accounted for.
void drawUnderlinedText (QPainter &p, int x, int y, QColor color, const QString &text)
void drawSeparatorLine (QPainter &p, QColor top, QColor bottom, QColor line, const QRect &rect)
void drawInstructionHighlight (QPainter &p, const QRect &rect, bool focused=true)
void drawLinearDisassemblyLineBackground (QPainter &p, BNLinearDisassemblyLineType type, const QRect &rect, const QRect &dirtyRect, int gutterWidth)
int drawDisassemblyLine (QPainter &p, int left, int top, const std::vector< BinaryNinja::InstructionTextToken > &tokens, HighlightTokenState &highlight, bool highlightOnly=false, bool renderCollapseIndicator=false) const
void drawHexEditorLine (QPainter &p, int left, int top, const HexEditorHighlightState &highlight, BinaryViewRef view, uint64_t lineStartAddr, size_t cols, size_t firstCol, size_t count, bool cursorVisible, bool cursorAscii, size_t cursorPos, bool byteCursor)
QFont getFont () const
QFont getEmojiFont () const
void setFont (const QFont &font)

Static Public Member Functions

static std::vector< CellAlignedTextlayOutTextInCells (const std::string &text)
 Splits text into the pieces needed to draw it on the character cell grid.

Constructor & Destructor Documentation

◆ RenderContext()

RenderContext::RenderContext ( QWidget * parent,
float fontScale = 1.0f )

Member Function Documentation

◆ update()

void RenderContext::update ( )

◆ getFontParamters()

FontParameters & RenderContext::getFontParamters ( )
inline

◆ getFontParameters()

const FontParameters & RenderContext::getFontParameters ( ) const
inline

◆ getFontWidth()

int RenderContext::getFontWidth ( ) const
inline

◆ getFontHeight()

int RenderContext::getFontHeight ( ) const
inline

◆ init()

void RenderContext::init ( QPainter & p)

◆ getColorForHexDumpByte()

QColor RenderContext::getColorForHexDumpByte ( const HexEditorHighlightState & state,
BNModificationStatus modification,
uint8_t byte )

◆ getHighlightColor()

QColor RenderContext::getHighlightColor ( BNHighlightColor color)

◆ getTokenForDisassemblyLinePosition()

HighlightTokenState RenderContext::getTokenForDisassemblyLinePosition ( int64_t col,
const std::vector< BinaryNinja::InstructionTextToken > & tokens )

◆ getTokenForDisassemblyTokenIndex()

HighlightTokenState RenderContext::getTokenForDisassemblyTokenIndex ( size_t tokenIndex,
const std::vector< BinaryNinja::InstructionTextToken > & tokens )

◆ getHighlightTokenForTextToken()

HighlightTokenState RenderContext::getHighlightTokenForTextToken ( const BinaryNinja::InstructionTextToken & token)

◆ drawText()

void RenderContext::drawText ( QPainter & p,
int x,
int y,
QColor color,
const QString & text ) const

◆ drawCellAlignedText()

void RenderContext::drawCellAlignedText ( QPainter & p,
int x,
int y,
QColor color,
const std::string & text ) const

Draws text positioned on the character cell grid, so that wide code points occupy the cells their token width accounted for.

ASCII text is drawn in a single call as a fast path.

◆ drawUnderlinedText()

void RenderContext::drawUnderlinedText ( QPainter & p,
int x,
int y,
QColor color,
const QString & text )

◆ drawSeparatorLine()

void RenderContext::drawSeparatorLine ( QPainter & p,
QColor top,
QColor bottom,
QColor line,
const QRect & rect )

◆ drawInstructionHighlight()

void RenderContext::drawInstructionHighlight ( QPainter & p,
const QRect & rect,
bool focused = true )

◆ drawLinearDisassemblyLineBackground()

void RenderContext::drawLinearDisassemblyLineBackground ( QPainter & p,
BNLinearDisassemblyLineType type,
const QRect & rect,
const QRect & dirtyRect,
int gutterWidth )

◆ drawDisassemblyLine()

int RenderContext::drawDisassemblyLine ( QPainter & p,
int left,
int top,
const std::vector< BinaryNinja::InstructionTextToken > & tokens,
HighlightTokenState & highlight,
bool highlightOnly = false,
bool renderCollapseIndicator = false ) const

◆ drawHexEditorLine()

void RenderContext::drawHexEditorLine ( QPainter & p,
int left,
int top,
const HexEditorHighlightState & highlight,
BinaryViewRef view,
uint64_t lineStartAddr,
size_t cols,
size_t firstCol,
size_t count,
bool cursorVisible,
bool cursorAscii,
size_t cursorPos,
bool byteCursor )

◆ getFont()

QFont RenderContext::getFont ( ) const
inline

◆ getEmojiFont()

QFont RenderContext::getEmojiFont ( ) const
inline

◆ setFont()

void RenderContext::setFont ( const QFont & font)

◆ layOutTextInCells()

std::vector< CellAlignedText > RenderContext::layOutTextInCells ( const std::string & text)
static

Splits text into the pieces needed to draw it on the character cell grid.

Text is broken at grapheme cluster boundaries, since a cluster is what the user sees as a single character and what the width accounting measured; a cluster can span many code points, as combining marks, emoji modifiers, and ZWJ sequences all join into one. Runs of plain ASCII are kept together so the font can still shape and apply ligatures across them.

The returned cell offsets always total the string's width as reported by BinaryNinja::Unicode::GetDisplayWidth, so drawing stays aligned with the layout that width produced.

Parameters
textText to lay out
Returns
The pieces to draw, in order, each with the cell offset to draw it at

Enumeration Type Documentation

◆ HexEditorHighlightMode

Enumerator
NoHighlight 
ColumnHighlight 
ByteValueHighlight 

◆ HexEditorColorMode

Enumerator
NoColorization 
AsciiColorization 
ModificationColorization 

◆ HexEditorHighlightContrast

Enumerator
NormalContrastHighlight 
MediumContrastHighlight 
HighContrastHighlight