示例#1
0
文件: emulator.cpp 项目: mark711/Cafu
// Convert 6-digit hex string to a colour
wxColour wxHexStringToColour(const wxString& hex)
{
    unsigned char r = (unsigned char)wxHexToDec(hex.Mid(0, 2));
    unsigned char g = (unsigned char)wxHexToDec(hex.Mid(2, 2));
    unsigned char b = (unsigned char)wxHexToDec(hex.Mid(4, 2));

    return wxColour(r, g, b);
}
示例#2
0
// Convert 6-digit hex string to a colour
wxColour wxHexStringToColour(const wxString& hex)
{
    unsigned int r = 0;
    unsigned int g = 0;
    unsigned int b = 0;
    r = wxHexToDec(hex.Mid(0, 2));
    g = wxHexToDec(hex.Mid(2, 2));
    b = wxHexToDec(hex.Mid(4, 2));

    return wxColour(r, g, b);
}
示例#3
0
文件: utilscmn.cpp 项目: Aced14/pcsx2
// Convert 2-digit hex number to decimal
int wxHexToDec(const wxString& str)
{
    char buf[2];
    buf[0] = str.GetChar(0);
    buf[1] = str.GetChar(1);
    return wxHexToDec((const char*) buf);
}
示例#4
0
// Convert 2-digit hex number to decimal
int wxHexToDec(const wxString& str)
{
    wxCHECK_MSG( str.Length() >= 2, -1, wxS("Invalid argument") );

    char buf[2];
    buf[0] = str.GetChar(0);
    buf[1] = str.GetChar(1);
    return wxHexToDec(buf);
}
示例#5
0
文件: crypt.cpp 项目: Mileslee/wxgis
bool Decrypt(const wxString &sText, wxString &sDecryptText)
{
    sDecryptText.Clear();
    const wxString sPass(PASSWD);
    size_t pos(0);
    for(size_t i = 0; i < sText.Len(); i += 4)
    {
        if(pos == sPass.Len())
            pos = 0;
		wxString sHex = sText[i];
		sHex += sText[i + 1];
        char SymbolHi = wxHexToDec(sHex);
        sHex = sText[i + 2];
		sHex += sText[i + 3];
        char SymbolLo = wxHexToDec(sHex);
        wxUint32 Symbol = (SymbolHi << 8) + SymbolLo;
        wxUint32 val2 = sPass[pos].GetValue();
        Symbol = Symbol ^ val2;
        sDecryptText += wxUniChar(Symbol);
        pos++;
    }
    return true;
}
示例#6
0
/// Read encoding map
bool
MakeFont::ReadMap(const wxString& enc, CTGMap& cc2gn)
{
  //Read a map file
  wxString mapFileName = enc.Lower() + wxT(".map");
  wxFileInputStream mapFile(mapFileName);
  if (!mapFile.Ok())
  {
    wxLogMessage(wxT("Error: Unable to read map file '") + mapFileName + wxT("'."));
    return false;
  }

  wxTextInputStream text(mapFile);
  wxString charcode, unicode, glyphname;

  cc2gn.clear();
  while (!mapFile.Eof())
  {
    text >> charcode >> unicode >> glyphname;
    if (!mapFile.Eof() && charcode.Length() > 0)
    {
      if (charcode[0] == wxT('!'))
      {
        int cc = wxHexToDec(charcode.Mid(1));
        cc2gn[cc] = glyphname;
      }
    }
  }

  int i;
  for (i = 0; i <= 255; i++)
  {
    CTGMap::iterator iter = cc2gn.find(i);
    if (iter == cc2gn.end())
    {
      cc2gn[i] = wxT(".notdef");
    }
  }
  return true;
}