mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.uppdev
git-svn-id: svn://ultimatepp.org/upp/trunk@2394 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ce9b93d72e
commit
a70015f78b
8 changed files with 114 additions and 1 deletions
11
uppdev/Debug/Debug.cpp
Normal file
11
uppdev/Debug/Debug.cpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
int a[3];
|
||||
a[0] = 2;
|
||||
a[1] = 3;
|
||||
Cout() << a[0];
|
||||
}
|
||||
9
uppdev/Debug/Debug.upp
Normal file
9
uppdev/Debug/Debug.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
Debug.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
void EditFieldApp::Set()
|
||||
{
|
||||
ef1 <<= "Just a test!";
|
||||
ef1.SetReadOnly();
|
||||
}
|
||||
|
||||
EditFieldApp::EditFieldApp()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ GUI_APP_MAIN
|
|||
fs.Multi();
|
||||
// fs.ActiveDir("/usr/include");
|
||||
// fs.NoEditFileName();
|
||||
// fs.PreSelect("U:/file1.txt");
|
||||
fs.ActiveDir("c:/");
|
||||
fs.PreSelect("U:/log.txt");
|
||||
for(;;) {
|
||||
if(!fs.ExecuteSaveAs())
|
||||
break;
|
||||
|
|
|
|||
9
uppdev/MetricsIssue/MetricsIssue.upp
Normal file
9
uppdev/MetricsIssue/MetricsIssue.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
27
uppdev/MetricsIssue/main.cpp
Normal file
27
uppdev/MetricsIssue/main.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
struct Test : TopWindow {
|
||||
virtual void Paint(Draw& w) {
|
||||
w.DrawRect(GetSize(), White());
|
||||
w.DrawText(100, 100, WString(0x9500, 1));
|
||||
}
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
/* Font f = Arial(40);
|
||||
DDUMP(f[0xbd]);
|
||||
DDUMP(f['X']);
|
||||
|
||||
WString x("销");
|
||||
DDUMP(FormatIntHex(x[0]));
|
||||
|
||||
for(int i = 1; i < Font::GetFaceCount(); i++)
|
||||
if(Font(i, 10).IsNormal(0x9500))
|
||||
DDUMP(Font::GetFaceName(i));
|
||||
*/
|
||||
DDUMP(GetGlyphInfo(Font().FaceName("PMingLiU").Height(20), 0x9500).IsNormal());
|
||||
Test().Run();
|
||||
}
|
||||
9
uppdev/ScreenShotter/ScreenShotter.upp
Normal file
9
uppdev/ScreenShotter/ScreenShotter.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
|
||||
46
uppdev/ScreenShotter/main.cpp
Normal file
46
uppdev/ScreenShotter/main.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
Image ScreenShot(int x, int y, int cx, int cy)
|
||||
{
|
||||
HDC dcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
RGBA *pixels;
|
||||
|
||||
Buffer<byte> data;
|
||||
data.Alloc(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
|
||||
BITMAPINFOHEADER *hi = (BITMAPINFOHEADER *) ~data;;
|
||||
memset(hi, 0, sizeof(BITMAPINFOHEADER));
|
||||
hi->biSize = sizeof(BITMAPINFOHEADER);
|
||||
hi->biPlanes = 1;
|
||||
hi->biBitCount = 32;
|
||||
hi->biCompression = BI_RGB;
|
||||
hi->biSizeImage = 0;
|
||||
hi->biClrUsed = 0;
|
||||
hi->biClrImportant = 0;
|
||||
hi->biWidth = cx;
|
||||
hi->biHeight = -cy;
|
||||
|
||||
HBITMAP hbmp = CreateDIBSection(dcScreen, (BITMAPINFO *)hi, DIB_RGB_COLORS, (void **)&pixels, NULL, 0);
|
||||
HDC dcMem = ::CreateCompatibleDC(dcScreen);
|
||||
HBITMAP hbmpOld = (HBITMAP) ::SelectObject(dcMem, hbmp);
|
||||
HDC hdcCompatible = CreateCompatibleDC(dcScreen);
|
||||
::BitBlt(dcMem, 0, 0, cx, cy, dcScreen, x, y, SRCCOPY);
|
||||
|
||||
ImageBuffer ib(cx, cy);
|
||||
memcpy(~ib, pixels, cx * cy * sizeof(RGBA));
|
||||
|
||||
::DeleteObject(::SelectObject(dcMem, hbmpOld));
|
||||
::DeleteDC(dcMem);
|
||||
::DeleteDC(dcScreen);
|
||||
|
||||
return ib;
|
||||
};
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
Image m = ScreenShot(100, 100, 300, 300);
|
||||
PNGEncoder().SaveFile("u:/test.png", m);
|
||||
}
|
||||
Um2%+63FwV
|
||||
Loading…
Add table
Add a link
Reference in a new issue