Patch level : 2.o nopatch
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Migliorata stampa immagini grandi su Win 98 git-svn-id: svn://10.65.10.50/trunk@11601 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
cfbff9b347
commit
808f9f7ff3
@ -204,9 +204,7 @@ void OsWin32_UpdateWindow(unsigned int handle)
|
|||||||
// Drawing bitmaps
|
// Drawing bitmaps
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc,
|
bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc, const wxRect& dst, const wxRect& src)
|
||||||
int xd, int yd, int wd, int hd,
|
|
||||||
int xs, int ys, int ws, int hs)
|
|
||||||
{
|
{
|
||||||
HBITMAP hBMP = (HBITMAP)bmp.GetHBITMAP();
|
HBITMAP hBMP = (HBITMAP)bmp.GetHBITMAP();
|
||||||
bool ok = hBMP != NULL;
|
bool ok = hBMP != NULL;
|
||||||
@ -228,9 +226,8 @@ bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc,
|
|||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
LPBYTE bits = new BYTE[bih.biSizeImage];
|
LPBYTE bits = new BYTE[bih.biSizeImage];
|
||||||
::GetDIBits(hMemDC, hBMP, 0, hs,
|
::GetDIBits(hMemDC, hBMP, 0, src.height, bits, bi, DIB_RGB_COLORS);
|
||||||
bits, bi, DIB_RGB_COLORS);
|
::StretchDIBits(hDC, dst.x, dst.y, dst.width, dst.height, src.x, src.y, src.width, src.height,
|
||||||
::StretchDIBits((HDC)dc.GetHDC(), xd, yd, wd, hd, xs, 0, ws, hs,
|
|
||||||
bits, bi, DIB_RGB_COLORS, SRCCOPY);
|
bits, bi, DIB_RGB_COLORS, SRCCOPY);
|
||||||
delete bits;
|
delete bits;
|
||||||
}
|
}
|
||||||
@ -239,8 +236,9 @@ bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, hBMP);
|
HGDIOBJ hOldBitmap = ::SelectObject(hMemDC, hBMP);
|
||||||
::SetStretchBltMode((HDC)hDC, STRETCH_DELETESCANS);
|
::SetStretchBltMode(hDC, COLORONCOLOR);
|
||||||
::StretchBlt((HDC)hDC, xd, yd, wd, hd, hMemDC, xs, ys, ws, hs, SRCCOPY);
|
::StretchBlt(hDC, dst.x, dst.y, dst.width, dst.height,
|
||||||
|
hMemDC, src.x, src.y, src.width, src.height, SRCCOPY);
|
||||||
::SelectObject(hMemDC, hOldBitmap);
|
::SelectObject(hMemDC, hOldBitmap);
|
||||||
}
|
}
|
||||||
::DeleteDC(hMemDC);
|
::DeleteDC(hMemDC);
|
||||||
|
@ -2,8 +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);
|
||||||
bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc,
|
bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc, const wxRect& dst, const wxRect& src);
|
||||||
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);
|
||||||
|
|
||||||
wxString OsWin32_File2App(const char* filename);
|
wxString OsWin32_File2App(const char* filename);
|
||||||
|
@ -2025,6 +2025,15 @@ void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRect ComputeRect(const wxRect& rct, int h, int v, int k)
|
||||||
|
{
|
||||||
|
const int sx = rct.x + h * rct.width / k;
|
||||||
|
const int ex = rct.x + (h+1) * rct.width / k;
|
||||||
|
const int sy = rct.y + v * rct.height / k;
|
||||||
|
const int ey = rct.y + (v+1) * rct.height / k;
|
||||||
|
return wxRect(sx, sy, ex-sx, ey-sy);
|
||||||
|
}
|
||||||
|
|
||||||
void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE image, RCT* dest, RCT* source)
|
void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE image, RCT* dest, RCT* source)
|
||||||
{
|
{
|
||||||
XVT_ASSERT(image != NULL);
|
XVT_ASSERT(image != NULL);
|
||||||
@ -2035,32 +2044,31 @@ void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE image, RCT* dest, RCT* source)
|
|||||||
const wxRect src = NormalizeRCT(source);
|
const wxRect src = NormalizeRCT(source);
|
||||||
const wxRect dst = NormalizeRCT(dest);
|
const wxRect dst = NormalizeRCT(dest);
|
||||||
const wxBitmap& bmp = ((TXVT_IMAGE*)image)->Bitmap();
|
const wxBitmap& bmp = ((TXVT_IMAGE*)image)->Bitmap();
|
||||||
if (src.GetPosition() == wxPoint(0,0) && src.GetSize() == dst.GetSize())
|
if (src.GetPosition() == wxPoint(0,0) && src.GetSize() == dst.GetSize() && bmp.Ok())
|
||||||
{
|
{
|
||||||
dc.DrawBitmap(bmp, dst.GetPosition());
|
dc.DrawBitmap(bmp, dst.GetPosition());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (!OsWin32_DrawBitmap(bmp, dc,
|
if (!OsWin32_DrawBitmap(bmp, dc, dst, src))
|
||||||
dst.x, dst.y, dst.width, dst.height,
|
|
||||||
src.x, src.y, src.width, src.height))
|
|
||||||
{
|
{
|
||||||
const int k = 4;
|
const int k = 4;
|
||||||
bool ok = false;
|
for (int h = 0; h < k; h++)
|
||||||
for (int s = k-1; s > 0 && !ok; s--)
|
|
||||||
{
|
{
|
||||||
wxImage img = ((TXVT_IMAGE*)image)->Image().GetSubImage(src);
|
for (int v = 0; v < k; v++)
|
||||||
img.Rescale(s * src.width / k, s * src.height / k);
|
{
|
||||||
ok = OsWin32_DrawBitmap(img.ConvertToBitmap(), dc,
|
const wxRect destin = ComputeRect(dst, h, v, k);
|
||||||
dst.x, dst.y, dst.width, dst.height,
|
wxRect source = ComputeRect(src, h, v, k);
|
||||||
0, 0, s*src.width/k, s*src.height/k);
|
wxImage img = ((TXVT_IMAGE*)image)->Image().GetSubImage(source);
|
||||||
|
source.x = source.y = 0;
|
||||||
|
OsWin32_DrawBitmap(img.ConvertToBitmap(), dc, destin, source);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
const wxImage& img = ((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);
|
||||||
dc.DrawBitmap(sub.ConvertToBitmap(), dst.GetPosition());
|
dc.DrawBitmap(sub.ConvertToBitmap(), dst.GetPosition());
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user