Page 7 of 10

Re: Addons/Plugins/...

Posted: Mon Nov 23, 2015 1:21 pm
by heimaki
https://github.com/leavinel/BPG-Plugins

^ this plugin crashes xnview immediately.
Problemereignisname: APPCRASH
Anwendungsname: xnview.exe
Anwendungsversion: 2.34.0.0
Anwendungszeitstempel: 55ed9448
Fehlermodulname: Xbpg.usr
Fehlermodulversion: 0.0.0.2
Fehlermodulzeitstempel: 03be4e90
Ausnahmecode: c0000091
Ausnahmeoffset: 00287812
Betriebsystemversion: 6.1.7601.2.1.0.256.1
Gebietsschema-ID: 2055
Zusatzinformation 1: 0a9e
Zusatzinformation 2: 0a9e372d3b4ad19135b953a78882e789
Zusatzinformation 3: 0a9e
Zusatzinformation 4: 0a9e372d3b4ad19135b953a78882e789
i posted the same under https://github.com/leavinel/BPG-Plugins/issues/1
not sure which one is the best place to do.

Re: Addons/Plugins/...

Posted: Tue Jan 05, 2016 7:51 pm
by Mixer
It is really nice to see that grayscale jpegs which are loaded with SDK's function LoadBitmap() have they own proper palette in 2.35! Thank you.
I can't find sticky dedicated topic for SDK, so I'm going to ask it here.
Is it technically possible to expand SDK with second version of LoadBitmap(), which will use filename given as wchar_t string?
BOOL (__stdcall * LoadBitmapW)(const wchar_t* filename, PLUGIN_BITMAP* bitmap); //something like this
I don't know how XnView processes files from addons, is name used somewhere inside PLUGIN_BITMAP object or does object consist only of image data?
Please don't tell me "you have XnView MP".

Re: Addons/Plugins/...

Posted: Wed Jan 06, 2016 7:38 am
by xnview
Mixer wrote: Is it technically possible to expand SDK with second version of LoadBitmap(), which will use filename given as wchar_t string?
BOOL (__stdcall * LoadBitmapW)(const wchar_t* filename, PLUGIN_BITMAP* bitmap); //something like this
XnView use only char*, and if you convert the wchar before?

Re: Addons/Plugins/...

Posted: Wed Jan 06, 2016 12:17 pm
by Mixer
wchar_t is 2 bytes, char is 1 byte. Higher 16 bits can be safely skipped only if they are zeros, that is it works only for first 255 characters of 2-bytes encoded character set: http://unicode-table.com/en/. Or else you'll get "??" in place of character with non-zero higher byte:
Image
If I just cast pointer to wchar_t string as (char*), then no Windows will ever understand this twice-long char string path.
Therefore I'm asking, if you could make one, only one for entire XnView function, capable of creating PLUGIN_BITMAP object by reading it from file, which name is given as wchar_t string.
I, of course, can open files with Imagine Unicode, FastStone, can find some food for Mantis by using XnViewMP, can use my Unicode-to-8.3 addon. But if XnView Classic and its SDK are important enough to take place on forum and on downloads page, and if you accept suggestions, then this above is the feature I'd like to have.

fixing embarassing mistake: 8 bits, of course, was thinking about 32-bit lParam and HIWORD/LOWORD while writing it

Re: Addons/Plugins/...

Posted: Thu Jan 07, 2016 8:44 am
by xnview
Mixer wrote:wchar_t is 2 bytes, char is 1 byte. Higher 16 bits can be safely skipped only if they are zeros, that is it works only for first 255 characters of 2-bytes encoded character set: http://unicode-table.com/en/. Or else you'll get "??" in place of character with non-zero higher byte:
why not using WideCharToMultiByte?

Re: Addons/Plugins/...

Posted: Sun Jan 10, 2016 8:14 pm
by Mixer
Please elaborate.
To which exactly charset do you prompt to convert wchar_t string with WideCharToMultiByte() and why?

Re: Addons/Plugins/...

Posted: Mon Jan 11, 2016 9:58 am
by xnview
Mixer wrote:Please elaborate.
To which exactly charset do you prompt to convert wchar_t string with WideCharToMultiByte() and why?
XnView use internally local 8bits charset

Re: Addons/Plugins/...

Posted: Mon Jan 11, 2016 6:00 pm
by Mixer
I took API Monitor to see which Windows functions XnView calls after receiving filename from my addon to load new picture from file by using SDK's LoadBitmap().

Code: Select all

WideCharToMultiByte ( CP_ACP, 0, "D:\4354~1\D7E0~1\F695~1.JPG", -1, 0x000537b4, 261, NULL, NULL )
GetWindowLongA ( 0x00010462, GWL_USERDATA )
LoadCursorA ( NULL, IDC_WAIT )
SetCursor ( 0x00010015 )
FindFirstFileA ( "D:\4354~1\D7E0~1\F695~1.JPG", 0x00052df4 )
memmove ( 0x00052a98, 0x000527e6, 36 )
memmove ( 0x00052ca0, 0x000527ce, 20 )
memmove ( 0x00052df4, 0x00052a6c, 44 )
FindClose ( 0x00199770 )
CreateFileA ( "D:\4354~1\D7E0~1\F695~1.JPG", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0x00052f0c, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL )
GetFileType ( 0x00000188 )
SetFilePointer ( 0x00000188, 0, NULL, FILE_BEGIN )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x00052a00, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01909b28, 4096, 0x0005295c, NULL )
ReadFile ( 0x00000188, 0x01899758, 4096, 0x00052948, NULL )
I'm not sure what for is called FindFirstFileA(), since returned handle isn't used anywhere.
But handle returned by CreateFileA() is used only by bunch of calls to ReadFile(), therefore I assume this handle doesn't mess with any Unicode-unsupporting windows and controls of XnView.
I see no reason why is impossible accepting filenames in wchar_t and using CreateFileW() to open them for reading.

Re: Addons/Plugins/...

Posted: Tue Jan 12, 2016 9:04 am
by xnview
Mixer wrote: But handle returned by CreateFileA() is used only by bunch of calls to ReadFile(), therefore I assume this handle doesn't mess with any Unicode-unsupporting windows and controls of XnView.
I see no reason why is impossible accepting filenames in wchar_t and using CreateFileW() to open them for reading.
i don't use windows function, but fopen

Re: Addons/Plugins/...

Posted: Tue Jan 12, 2016 1:15 pm
by Mixer

Re: Addons/Plugins/...

Posted: Tue Jan 12, 2016 2:52 pm
by xnview
it's not easy, not a function call change only.

Re: Addons/Plugins/...

Posted: Mon Jan 18, 2016 4:36 pm
by omniplex
heimaki wrote:i posted the same under https://github.com/leavinel/BPG-Plugins/issues/1
not sure which one is the best place to do.
Something happened, your ticket is closed, there is a new version 0.0.0.3 of Xbpg.usr, and it can write BPG for XnView 2.35, if the source is PNG or JPG. I opened a new issue asking for more documentation how -lossless in Xbpg.ini is supposed to work.

Re: Addons/Plugins/...

Posted: Thu Feb 11, 2016 11:23 am
by Mixer
1. Download SDK for AddOns http://www.xnview.com/download/addons/P ... DK-win.zip
2. Open project in Visual Studio. In my example I have changed Plugin.cpp in following way.
In DialogDlgProc2 code of "My Filter" button was changed from what it was to this:

Code: Select all

			case IDC_FILTER:
				{	
					EnableWindow(GetParent(hDlg), TRUE);
					SetFocus(GetParent(hDlg));
				}
				break; 
3. Build Plugin.xnp.
4. Put Plugin.xnp to AddOn folder, start XnView, go to Viewer with some picture and run this plugin from Filter menu.
5. Click redefined "My Filter" button.
6. Now you should have main window activated.

Questions:
1. Why picture disappears when I click Zoom In or Zoom Out in activated this way XnView's window?
2. Why XnView crashes if I try to select some other than 100% type of Zoom, like "Fit image to window"?
If you first change picture to next or previous, then new picture won't crash XnView on zooming.

If you're lazy compiling new plugins, I have attached debug build of addon which does the same. It also has another text on redefined button and disables XnView main window if addon's window is activated again.

Re: Addons/Plugins/...

Posted: Fri Feb 12, 2016 10:21 pm
by herr_k.
about the imgur upload addon.
when i unpack the files into the addon dir and try to upload a pic via tools/upload/imgur,
there is an error that the addon is not installed and i have to download it?? (using xn 2.35)

also there is no option in the xnshell to upload it to imgur, only to imageshack, isnt this implemented?

is there an (txt).ini, where i can define maybe a login/pass to upload it directly to my imgur account?

Re: Addons/Plugins/...

Posted: Mon Feb 22, 2016 11:37 pm
by herr_k.
hello? anyone interested in the plugin not working or am i doing something wrong here?