Patch level : 2.0 nopatch
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Corretta stampa Bitmap molto grandi in Win98 git-svn-id: svn://10.65.10.50/trunk@11597 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8170c4aa45
commit
f7b99b82f3
@ -200,50 +200,52 @@ void OsWin32_UpdateWindow(unsigned int handle)
|
|||||||
::UpdateWindow(hwnd);
|
::UpdateWindow(hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OsWin32_StretchBlt(unsigned int hDst, int xd, int yd, int wd, int hd,
|
|
||||||
unsigned int hSrc, int xs, int ys, int ws, int hs)
|
|
||||||
{
|
|
||||||
const int nColors = ::GetDeviceCaps((HDC)hDst, NUMCOLORS);
|
|
||||||
::SetStretchBltMode((HDC)hDst, nColors == 2 ? STRETCH_HALFTONE : STRETCH_DELETESCANS);
|
|
||||||
::StretchBlt((HDC)hDst, xd, yd, wd, hd, (HDC)hSrc, xs, ys, ws, hs, SRCCOPY);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Drawing bitmaps
|
// Drawing bitmaps
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void OsWin32_DrawBitmap(unsigned int hBitmap, unsigned int hDC,
|
bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc,
|
||||||
int xd, int yd, int wd, int hd,
|
int xd, int yd, int wd, int hd,
|
||||||
int xs, int ys, int ws, int hs)
|
int xs, int ys, int ws, int hs)
|
||||||
{
|
{
|
||||||
const int nTechno = ::GetDeviceCaps((HDC)hDC, TECHNOLOGY);
|
HBITMAP hBMP = (HBITMAP)bmp.GetHBITMAP();
|
||||||
if (nTechno == DT_RASPRINTER) // Sto stampando!
|
bool ok = hBMP != NULL;
|
||||||
{
|
|
||||||
BITMAPINFO bi; memset(&bi, 0, sizeof(bi));
|
if (ok)
|
||||||
BITMAPINFOHEADER& bih = bi.bmiHeader;
|
{
|
||||||
bih.biSize = sizeof(bih);
|
HDC hDC = (HDC)dc.GetHDC();
|
||||||
HDC hMemDC = ::CreateCompatibleDC(NULL);
|
HDC hMemDC = ::CreateCompatibleDC((HDC)NULL);
|
||||||
GetDIBits(hMemDC, (HBITMAP)hBitmap, 0, 0, NULL, &bi, DIB_RGB_COLORS);
|
const int nTechno = ::GetDeviceCaps(hDC, TECHNOLOGY);
|
||||||
if (bih.biSizeImage > 0)
|
if (nTechno == DT_RASPRINTER) // Sto stampando!
|
||||||
{
|
{
|
||||||
LPBYTE bits = new BYTE[bih.biSizeImage];
|
BITMAPINFO* bi = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) );
|
||||||
::GetDIBits(hMemDC, (HBITMAP)hBitmap, 0, bih.biHeight,
|
memset(bi, 0, sizeof( BITMAPINFOHEADER ) );
|
||||||
bits, &bi, DIB_RGB_COLORS);
|
BITMAPINFOHEADER& bih = bi->bmiHeader;
|
||||||
::StretchDIBits((HDC)hDC, xd, yd, wd, hd, xs, ys, ws, hs,
|
|
||||||
bits, &bi, DIB_RGB_COLORS, SRCCOPY);
|
bih.biSize = sizeof(bih);
|
||||||
delete bits;
|
GetDIBits(hMemDC, hBMP, 0, bmp.GetHeight(), NULL, bi, DIB_RGB_COLORS);
|
||||||
}
|
ok = bih.biSizeImage > 0;
|
||||||
::DeleteDC(hMemDC);
|
if (ok)
|
||||||
}
|
{
|
||||||
else
|
LPBYTE bits = new BYTE[bih.biSizeImage];
|
||||||
{
|
::GetDIBits(hMemDC, hBMP, 0, hs,
|
||||||
HDC hMemDC = ::CreateCompatibleDC((HDC)hDC);
|
bits, bi, DIB_RGB_COLORS);
|
||||||
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, (HBITMAP)hBitmap);
|
::StretchDIBits((HDC)dc.GetHDC(), xd, yd, wd, hd, xs, 0, ws, hs,
|
||||||
::SetStretchBltMode((HDC)hDC, STRETCH_DELETESCANS);
|
bits, bi, DIB_RGB_COLORS, SRCCOPY);
|
||||||
::StretchBlt((HDC)hDC, xd, yd, wd, hd, hMemDC, xs, ys, ws, hs, SRCCOPY);
|
delete bits;
|
||||||
::SelectObject(hMemDC, hOldBitmap);
|
}
|
||||||
::DeleteDC(hMemDC);
|
free(bi);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, hBMP);
|
||||||
|
::SetStretchBltMode((HDC)hDC, STRETCH_DELETESCANS);
|
||||||
|
::StretchBlt((HDC)hDC, xd, yd, wd, hd, hMemDC, xs, ys, ws, hs, SRCCOPY);
|
||||||
|
::SelectObject(hMemDC, hOldBitmap);
|
||||||
|
}
|
||||||
|
::DeleteDC(hMemDC);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OsWin32_DrawDottedRect(unsigned int hDC, int left, int top, int right, int bottom)
|
void OsWin32_DrawDottedRect(unsigned int hDC, int left, int top, int right, int bottom)
|
||||||
|
@ -2,7 +2,7 @@ void OsWin32_Beep(int severity);
|
|||||||
bool OsWin32_CheckPrinterInfo(const void* data, unsigned int size);
|
bool OsWin32_CheckPrinterInfo(const void* data, unsigned int size);
|
||||||
void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nSize);
|
void* OsWin32_ConvertFromNativePrinterInfo(void* hGlobal, unsigned int& nSize);
|
||||||
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nSize);
|
void* OsWin32_ConvertToNativePrinterInfo(void* data, unsigned int nSize);
|
||||||
void OsWin32_DrawBitmap(unsigned int hBitmap, unsigned int hDC,
|
bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc,
|
||||||
int xd, int yd, int wd, int hd, int xs, int ys, int ws, int hs);
|
int xd, int yd, int wd, int hd, int xs, int ys, int ws, int hs);
|
||||||
void OsWin32_DrawDottedRect(unsigned int hDC, int left, int top, int right, int bottom);
|
void OsWin32_DrawDottedRect(unsigned int hDC, int left, int top, int right, int bottom);
|
||||||
|
|
||||||
@ -15,8 +15,6 @@ int OsWin32_EnumerateSizes(unsigned int hDC, const char* name, long* sizes, shor
|
|||||||
void OsWin32_SetCaptionStyle(unsigned int handle, bool set);
|
void OsWin32_SetCaptionStyle(unsigned int handle, bool set);
|
||||||
void* OsWin32_GetPrinterInfo(int& size, const char* printer);
|
void* OsWin32_GetPrinterInfo(int& size, const char* printer);
|
||||||
void OsWin32_SetClippingRect(unsigned int hDC, int x, int y, int w, int h);
|
void OsWin32_SetClippingRect(unsigned int hDC, int x, int y, int w, int h);
|
||||||
void OsWin32_StretchBlt(unsigned int hDst, int xd, int yd, int wd, int hd,
|
|
||||||
unsigned int hSrc, int xs, int ys, int ws, int hs);
|
|
||||||
|
|
||||||
void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent);
|
void OsWin32_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent);
|
||||||
void OsWin32_UpdateWindow(unsigned int handle);
|
void OsWin32_UpdateWindow(unsigned int handle);
|
||||||
|
@ -2041,12 +2041,24 @@ void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE image, RCT* dest, RCT* source)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
OsWin32_DrawBitmap(bmp.GetHBITMAP(), dc.GetHDC(),
|
if (!OsWin32_DrawBitmap(bmp, dc,
|
||||||
dst.x, dst.y, dst.width, dst.height,
|
dst.x, dst.y, dst.width, dst.height,
|
||||||
src.x, src.y, src.width, src.height);
|
src.x, src.y, src.width, src.height))
|
||||||
|
{
|
||||||
|
const int k = 4;
|
||||||
|
bool ok = false;
|
||||||
|
for (int s = k-1; s > 0 && !ok; s--)
|
||||||
|
{
|
||||||
|
wxImage img = ((TXVT_IMAGE*)image)->Image().GetSubImage(src);
|
||||||
|
img.Rescale(s * src.width / k, s * src.height / k);
|
||||||
|
ok = OsWin32_DrawBitmap(img.ConvertToBitmap(), dc,
|
||||||
|
dst.x, dst.y, dst.width, dst.height,
|
||||||
|
0, 0, s*src.width/k, s*src.height/k);
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
const wxImage& img = ((const TXVT_IMAGE*)image)->Image();
|
const wxImage& img = ((TXVT_IMAGE*)image)->Image());
|
||||||
wxImage sub = img.GetSubImage(src);
|
wxImage sub = img.GetSubImage(src);
|
||||||
|
|
||||||
sub.Rescale(dst.width, dst.height);
|
sub.Rescale(dst.width, dst.height);
|
||||||
@ -3673,7 +3685,7 @@ public:
|
|||||||
|
|
||||||
wxThread::ExitCode TIconizeTaskThread::Entry()
|
wxThread::ExitCode TIconizeTaskThread::Entry()
|
||||||
{
|
{
|
||||||
Sleep(500);
|
Sleep(250);
|
||||||
if (__bChildRunning) // Il programma e' ancora attivo
|
if (__bChildRunning) // Il programma e' ancora attivo
|
||||||
{
|
{
|
||||||
wxFrame* frame = (wxFrame*)_task_win;
|
wxFrame* frame = (wxFrame*)_task_win;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user