//-------------------------------------------------------------------------------- // @ Text::Text() //-------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------- Text::Text(std::string _name, uint16 _size, Color _clr) :size(_size), name(_name), clr(_clr), x(DEF_xy), y(DEF_xy), str(DEF_string), spacing(DEF_spacing), tab(DEF_tab) { //Generate new image GenerateImages(); } //End: Text::Text()
//-------------------------------------------------------------------------------- // @ Text::Text() //-------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------- Text::Text() : size(DEF_size), name(DEF_name), clr(DEF_clr), x(DEF_xy), y(DEF_xy), str(DEF_string), spacing(DEF_spacing), tab(DEF_tab) { //Generate images GenerateImages(); } //End: Text::Text()
BOOL CWinXPButtonComp::CreateComponent(Component * _Parent) { SetComponentParent(_Parent); CWinXPButton::Create((HWND)_Parent->GetHandle(),GetBoundsRect(),NULL,get_CtrlWindowStyle(),get_CtrlWindowStyleEx()); SetBkColor(RGB(238,243,250)); GenerateImages(_T(""), IDB_PROPERTYGRID, TRUE); return ::IsWindow(m_hWnd); }
//-------------------------------------------------------------------------------- // @ Text::SetString() //-------------------------------------------------------------------------------- // Set string //-------------------------------------------------------------------------------- void Text::SetString(std::string newstr) { //Set new string str = newstr; //Generate new image GenerateImages(); } //End: Text::SetColor()
//-------------------------------------------------------------------------------- // @ Text::SetColor() //-------------------------------------------------------------------------------- // Set font color //-------------------------------------------------------------------------------- void Text::SetColor(Color newclr) { //Set new color clr = newclr; //Generate new image GenerateImages(); } //End: Text::SetColor()
//-------------------------------------------------------------------------------- // @ Text::SetSize() //-------------------------------------------------------------------------------- // Set Font size //-------------------------------------------------------------------------------- void Text::SetSize(uint16 newsize) { //Assign new size and spacing size = newsize; //Generate new image GenerateImages(); } //End: Text::SetFont()
//-------------------------------------------------------------------------------- // @ Text::SetFont() //-------------------------------------------------------------------------------- // Sets the font of this text object //-------------------------------------------------------------------------------- void Text::SetFont(std::string newfont) { //Assign new name name = newfont; //Generate new image GenerateImages(); } //End: Text::SetFont()
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); FileRoot = "C:\\Data\\Images\\En\\"; ascii_counter = 65; ascii_counter1 = 97; ascii_counter2=48; desImg= QImage(FileRoot + "SavedImage"); desImg = desImg.scaled(20,20); desImg.save(FileRoot + "SavedImage.bmp"); GenerateImages(); QPixmap genPix; for(int i = ascii_counter; i<91; i++) { sourceImg= QImage(FileRoot + "img_" +QString::number(i)+".bmp"); resImg = QImage(20, 20, QImage::Format_ARGB32_Premultiplied); genPix = recalculateResult(); genPix.save(FileRoot+"resImg\\"+QString::number(i)+".bmp"); } for(int i = ascii_counter1; i<123;i++) { sourceImg= QImage(FileRoot + "img_" +QString::number(i)+".bmp"); resImg = QImage(20, 20, QImage::Format_ARGB32_Premultiplied); genPix = recalculateResult(); genPix.save(FileRoot+"resImg\\"+QString::number(i)+".bmp"); } for(int i = ascii_counter2; i<58;i++) { sourceImg= QImage(FileRoot + "img_" +QString::number(i)+".bmp"); resImg = QImage(20, 20, QImage::Format_ARGB32_Premultiplied); genPix = recalculateResult(); genPix.save(FileRoot+"resImg\\"+QString::number(i)+".bmp"); } QImage countImg; int lowest_white=20*20; int highest_black=0; int index; int index_b; for(int i = ascii_counter; i<91; i++) { countImg = QImage(FileRoot + "resImg\\" +QString::number(i)+".bmp"); int white=0; int black=0; for (int j=0; j<countImg.width(); j++) { for (int k=0; k<countImg.height(); k++) { QRgb getRgb = countImg.pixel(j,k); if (qRed(getRgb)>=200 && qGreen(getRgb)>=200 && qBlue(getRgb)>=200) { white++; } if (qRed(getRgb)<=20 && qGreen(getRgb)<=20 && qBlue(getRgb)<=20) { black++; } } } if (white<=lowest_white) { lowest_white = white; index = i; } if (black>=highest_black) { highest_black = black; index_b = i; } } for(int i = ascii_counter1; i<123;i++) { countImg = QImage(FileRoot + "resImg\\" +QString::number(i)+".bmp"); int white=0; int black=0; for (int j=0; j<countImg.width(); j++) { for (int k=0; k<countImg.height(); k++) { QRgb getRgb = countImg.pixel(j,k); int a = qRed(getRgb); if (qRed(getRgb)>=200 && qGreen(getRgb)>=200 && qBlue(getRgb)>=200) { white++; } if (qRed(getRgb)<=20 && qGreen(getRgb)<=20 && qBlue(getRgb)<=20) { black++; } } } if (white<=lowest_white) { lowest_white = white; index = i; } if (black>=highest_black) { highest_black = black; index_b = i; } } for(int i = ascii_counter2; i<58;i++) { countImg = QImage(FileRoot + "resImg\\" +QString::number(i)+".bmp"); //qdebug()<<"FILE"<<QString::number(i); int white=0; int black=0; for (int j=0; j<countImg.width(); j++) { for (int k=0; k<countImg.height(); k++) { QRgb getRgb = countImg.pixel(j,k); //qdebug()<<"RED"<<qRed(getRgb)<< // "GREEN"<<qGreen(getRgb)<< // "BLUE"<<qBlue(getRgb); if (qRed(getRgb)>=200 && qGreen(getRgb)>=200 && qBlue(getRgb)>=200) { white++; } if (qRed(getRgb)<=20 && qGreen(getRgb)<=20 && qBlue(getRgb)<=20) { black++; } } } if (white<=lowest_white) { lowest_white = white; index = i; } if (black>=highest_black) { highest_black = black; index_b = i; } } qDebug()<<"WHITE"<<index<<QString(QChar(index))<<lowest_white; qDebug()<<"BLACK"<<index_b<<QString(QChar(index_b))<<highest_black; }
void CExport::DoExport(bool previewMode, const CString& pathName, bool bApp, int layoutid) { // Progress dialog is going from 10% to 100% in this function // Make the DLL list CList<CString, CString&> dllList; CPath path; path.SetToCurrentDirectory(); // Allocate some initial space for the binary blocks imageBlock.allocate(20000); // 20kb initial image buffer eventBlock.allocate(5000); // 5kb initial event buffer LayoutBlock.allocate(5000); // 5kb initial frame buffer appBlock.allocate(1000); // 1kb initial app buffer hlslBlock.allocate(5000); // 5kb initial hlsl buffer menuBlock.allocate(1000); // Generate GenerateLayout(dllList); // also loads DLLs to dllList ProgressDlg.SetProgress(15); GenerateEvents(); ProgressDlg.SetProgress(20); GenerateApplicationData(layoutid); ProgressDlg.SetProgress(25); GenerateImages(); // Longest job, use 25-80% ProgressDlg.SetProgress(80); // Open the file for addition of file data in resource m_UpdateHandle = BeginUpdateResource(pathName, FALSE); // Do python GeneratePython(); // HLSL UpdateResource(m_UpdateHandle, "HLSL", MAKEINTRESOURCE(994), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), hlslBlock.ptr(), hlslBlock.size()); ProgressDlg.SetProgress(81); // Images UpdateResource(m_UpdateHandle, "IMAGEBLOCK", MAKEINTRESOURCE(995), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), imageBlock.ptr(), imageBlock.size()); ProgressDlg.SetProgress(82); // Application settings UpdateResource(m_UpdateHandle, "APPBLOCK", MAKEINTRESOURCE(997), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), appBlock.ptr(), appBlock.size()); ProgressDlg.SetProgress(83); // Layouts UpdateResource(m_UpdateHandle, "LEVELBLOCK", MAKEINTRESOURCE(998), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), LayoutBlock.ptr(), LayoutBlock.size()); ProgressDlg.SetProgress(84); // Events UpdateResource(m_UpdateHandle, "EVENTBLOCK", MAKEINTRESOURCE(999), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), eventBlock.ptr(), eventBlock.size()); ProgressDlg.SetProgress(85); // Number of DLLs long c = dllList.GetCount(); CString ibuf; long te = c; te += MvtLookup.size(); ibuf.Format("%d", te); int ilen = 0; // Make string of DLL count in to resource string format wchar_t* resString = AllocStringResourceFormat(ibuf, 1, &ilen); // String of DLL count is a string at resource 1 UpdateResource(m_UpdateHandle, RT_STRING, MAKEINTRESOURCE(1), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), resString, ilen); // AllocStringResourceFormat makes a new string delete [] resString; CString dll; POSITION pos4 = dllList.GetHeadPosition(); int d = 0; for (d = 1000; d < (1000 + c); d++) { // In preview mode, we only put the string of the plugin name in the resources if (previewMode) { dll = dllList.GetNext(pos4); ilen = 0; // Make string of DLL count in to resource string format wchar_t* resString = AllocStringResourceFormat(dll, 1, &ilen); UpdateResource(m_UpdateHandle, RT_STRING, MAKEINTRESOURCE(d), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), resString, ilen); delete [] resString; } // In export EXE mode, the actual DLL file must be dumped in resources else { CString dllPath; dllPath.Format("%sPlugins\\Runtime\\%s", path.GetFullPath(), dllList.GetNext(pos4)); // Get the DLL file binary FILE* f = fopen(dllPath, "rb"); fseek(f, 0, SEEK_END); int fsize = ftell(f); fseek(f, 0, SEEK_SET); BYTE* fdata = new BYTE[fsize]; fread(fdata, 1, fsize, f); fclose(f); UpdateResource(m_UpdateHandle, "DLLBLOCK", MAKEINTRESOURCE(d), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), fdata, fsize); delete [] fdata; } }//for ProgressDlg.SetProgress(88); // Behavior DLLs are added afterwards int iter = 0; for (int Mvt = d; Mvt < (d + MvtLookup.size()); Mvt++) { if (previewMode) { dll = MvtLookup[iter].Name; ilen = 0; // Make string of DLL count in to resource string format wchar_t* resString = AllocStringResourceFormat(dll, 1, &ilen); UpdateResource(m_UpdateHandle, RT_STRING, MAKEINTRESOURCE(Mvt), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), resString, ilen); delete [] resString; iter++; } // In EXE mode export actual DLL file else { CString dllPath; dllPath.Format("%sPlugins\\Runtime\\%s", path.GetFullPath(), MvtLookup[iter].Name); // Get the DLL file binary FILE* f = fopen(dllPath, "rb"); fseek(f, 0, SEEK_END); int fsize = ftell(f); fseek(f, 0, SEEK_SET); BYTE* fdata = new BYTE[fsize]; fread(fdata, 1, fsize, f); fclose(f); UpdateResource(m_UpdateHandle, "DLLBLOCK", MAKEINTRESOURCE(Mvt), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), fdata, fsize); delete [] fdata; iter++; } }//for ProgressDlg.SetProgress(90); ExportResources(previewMode); ProgressDlg.SetProgress(99); UpdateResource(m_UpdateHandle, "MENUBLOCK", MAKEINTRESOURCE(993), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), menuBlock.ptr(), menuBlock.size()); // Write DLL segment EndUpdateResource(m_UpdateHandle, FALSE); // Free the bin data imageBlock.free(); eventBlock.free(); appBlock.free(); LayoutBlock.free(); hlslBlock.free(); menuBlock.free(); if (m_bInstaller) { // Now create an installer if necessary CreateInstaller(); // Delete the old file DeleteFile(m_Out); // Transfer installer to path CPath Transfer; Transfer.SetPath(m_Out); CopyFile(m_InstallerOut, m_Out, FALSE); } // Now we're done ProgressDlg.SetProgress(100); }