Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Image DnD into Upp app
|
Re: Image DnD into Upp app [message #44202 is a reply to message #44199] |
Fri, 23 January 2015 09:43 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
bushman wrote on Thu, 22 January 2015 21:18Hello, Mirek,
Splendid! Almost there...
...works great in Win7 now, but still does not drop jpg from MS Word into UWord in Win8.1. Test output creates a blank data.bin and this fmt LOG:
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 22.01.2015 17:05:00, user: admin
fmt = dib
DnD jpg from File Explorer into UWord works perfectly in both OS versions.
Any hint on what to try next?
Many thanks!!!
Well, looks like problem with dib... Some more logs:
Image GetImage(PasteClip& clip)
{
GuiLock __;
Image m;
if(Accept<Image>(clip)) {
LoadFromString(m, ~clip);
if(!m.IsEmpty())
return m;
}
if(clip.Accept("dib")) {
LOG("DIB accepted");
String data = ~clip;
if((unsigned)data.GetCount() < sizeof(BITMAPINFO)) return Null;
LOG("DIB accepted 2");
BITMAPINFO *lpBI = (BITMAPINFO *)~data;
BITMAPINFOHEADER& hdr = lpBI->bmiHeader;
byte *bits = (byte *)lpBI + hdr.biSize;
if(hdr.biBitCount <= 8)
bits += (hdr.biClrUsed ? hdr.biClrUsed : 1 << hdr.biBitCount) * sizeof(RGBQUAD);
if(hdr.biBitCount >= 16 || hdr.biBitCount == 32) {
if(hdr.biCompression == 3)
bits += 12;
if(hdr.biClrUsed != 0)
bits += hdr.biClrUsed * sizeof(RGBQUAD);
}
DUMP(bits);
DUMP((int)hdr.biHeight);
DUMP((int)hdr.biWidth);
int h = abs((int)hdr.biHeight);
ImageDraw iw(hdr.biWidth, h);
::StretchDIBits(iw.GetHandle(),
0, 0, hdr.biWidth, h,
0, 0, hdr.biWidth, h,
bits, lpBI, DIB_RGB_COLORS, SRCCOPY);
return iw;
}
return Null;
}
Thanks!
Mirek
|
|
|
|
|
Re: Image DnD into Upp app [message #44206 is a reply to message #44205] |
Sat, 24 January 2015 11:49 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
bushman wrote on Fri, 23 January 2015 22:14Mirek,
tried out your latest advice, size of accepted data does not match size of BITMAPINFO struct (data.GetCount() == 0):
* C:\upp\out\examples\MSC9.Debug.Debug_Full.Gui.Mt\UWord.exe 23.01.2015 16:02:45, user: admin
DIB accepted
Just a few Side Comments:
Maybe it's something specific to my Win8.1 installation after all. This time I also did a few tests dragging jpg from MS Word into both LibreOffice and OpenOffice Writer and they failed too, showing only blank img frames over a doc background.
Both LibreOffice and OpenOffice show context menu options to dialogs to manipulate imgs when you right-click on img frame icon. These dialog boxes however show copies of the DnDropped img thumbs, which they save in a TMP file. So I'm confused: how come the img can't be shown on document while they save and show it correctly from a TMP file?
Thank you once more, for your patience!
Well, let us see what word really puts there... It looks really weird, like data are truncated or not complete or perhaps contain some HANDLE...
if(clip.Accept("dib")) {
LOG("DIB accepted");
String data = ~clip;
DUMPHEX(data);
|
|
|
|
|
|
Goto Forum:
Current Time: Thu Mar 28 18:46:24 CET 2024
Total time taken to generate the page: 0.01205 seconds
|