Neue Testversion 20.40b11

Hier diskutieren die Betatester von PhotoLine untereinander und mit den Entwicklern
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Re: Scripting: Text layers

Post by photoken »

Success!!!

I can create a named Text layer with user-defined content, and hard code the text color and paragraph alignment! Yaaay! :mrgreen:

I found that I had to change the VBS code for setting the paragraph alignment:

Code: Select all

		paragraphAttribute.Add "Alignment", 0
to this:

Code: Select all

		paragraphAttribute.Add("Alignment", PhotoLine.ParagraphAlignment.PACenter);
In other words, using the ParagraphAlignment index number did not work.

A couple of questions:
  1. Is the ability to set the font ("Arial") and the font style ("Bold") coming later?
  2. What is that PhotoLine.Dictionary object? Is it a kind of general purpose object thing?
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Martin Huber
Entwickler
Entwickler
Posts: 4208
Joined: Tue 19 Nov 2002 15:49

Re: Scripting: Text layers

Post by Martin Huber »

photoken wrote: Thu 29 Jun 2017 09:35 I found that I had to change the VBS code for setting the paragraph alignment:

Code: Select all

		paragraphAttribute.Add "Alignment", 0
to this:

Code: Select all

		paragraphAttribute.Add("Alignment", PhotoLine.ParagraphAlignment.PACenter);
In other words, using the ParagraphAlignment index number did not work.
Strange.
photoken wrote: Thu 29 Jun 2017 09:35A couple of questions:
  1. Is the ability to set the font ("Arial") and the font style ("Bold") coming later?
  2. What is that PhotoLine.Dictionary object? Is it a kind of general purpose object thing?
A Dictionary is an object to describe data. It contains key-value pairs. The key is always a string (in your example above "Alignment") and the value is dependent on the key and on the data you are describing.

The font is part of the text attributes. Every font is defined by a font dictionary. A font dictionary has usually the following keys:
- "FamilyName": String, for example "Arial"
- "PostScriptName": String, optional if setting a font
- "Size": float, font size
- "Weight": LONG, the weight of the font in the range ]0;1000], 400 is normal/regular, 700 is bold
- "Width": LONG, the width of the font in the range ]0;1000], 500 is medium width, 300 is condensed, 700 is expanded
- "Style": LONG, 1: italic
- "Scale": float, optional horizontal scaling (1: normal width)

Of course, "Size", "Weight", "Width" and "Style" have to be supported by the given font family, otherwise a similar font is used. If you set "PostScriptName", this values will be set implicitly, because a postscript name is sufficient to define a font completely. Only "Size" and "Scale" can be set in this case.

Martin
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Re: Scripting: Text layers

Post by photoken »

Martin Huber wrote: Thu 29 Jun 2017 10:04 A Dictionary is an object to describe data. It contains key-value pairs. The key is always a string (in your example above "Alignment") and the value is dependent on the key and on the data you are describing.
Excellent. So a Dictionary is a nice flexible key-value object.
Martin Huber wrote: Thu 29 Jun 2017 10:04 The font is part of the text attributes. Every font is defined by a font dictionary. A font dictionary has usually the following keys:
...
Thanks for that. I'll get some more sleep and bash at this tomorrow, but I see how I can create a Dictionary object to be a font dictionary to set the text attributes.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Martin Huber
Entwickler
Entwickler
Posts: 4208
Joined: Tue 19 Nov 2002 15:49

Re: Scripting: Text layers

Post by Martin Huber »

photoken wrote: Thu 29 Jun 2017 10:24 Thanks for that. I'll get some more sleep and bash at this tomorrow, but I see how I can create a Dictionary object to be a font dictionary to set the text attributes.
If you just set a single attribute via Text.SetAttribute, you should be able to use incomplete dictionaries for fonts and paragraphs. This way you could modify only a single aspect of that attribute. So - for example - if you set a font with just a "Size" key, all fonts in the text should be set to this size, but all other features should stay the same.

But be aware, that many things are untested yet.

Martin
User avatar
Gerhard Huber
Entwickler
Entwickler
Posts: 4174
Joined: Mon 18 Nov 2002 15:30
Location: Bad Gögging

Re: Neue Testversion 20.40b11

Post by Gerhard Huber »

I added code that replaces RGB black by CMYK black in all text layers and text styles of a whole document to my C# project.
You do not have the required permissions to view the files attached to this post.
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Re: Scripting: Text layers

Post by photoken »

Martin Huber wrote: Thu 29 Jun 2017 10:04
photoken wrote: Thu 29 Jun 2017 09:35 In other words, using the ParagraphAlignment index number did not work.
Strange.
I think it's because, in terms of the C# code, the "0" is just an independent integer. It exists as its own entity and does not implicitly reference any enumerator index or array index. In C#, the value must explicitly reference the PhotoLine.ParagraphAlignment enumerator.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

AddIn: Solution for rogue PL background process

Post by photoken »

I've found a solution for the unwanted PL background process being created if the AddIn is not closed before exiting PL:

Code: Select all

namespace PL_Test_01 {
	public partial class Form1 : Form {
		public Form1() {
			InitializeComponent();
		}

		public static void CloseAddIn() {
			Form1.ActiveForm.Dispose();
		}

		private void OKbutton_Click(object sender, EventArgs e) {
			...
			(Perform various tasks)
			...
			CloseAddIn();
		 }
	 }
}
By calling the Dispose method of the form as the last task, the AddIn is dismissed, various things are cleaned up, and the PL editing window is refreshed to show the effect of the AddIn. PL can be used as usual (including running the AddIn again) and, when PL is exited, no background PL process is created -- PL can be restarted without any problem. :D
Last edited by photoken on Thu 29 Jun 2017 22:53, edited 1 time in total.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Re: Scripting: Text layers

Post by photoken »

Martin Huber wrote: Thu 29 Jun 2017 10:04 The font is part of the text attributes. Every font is defined by a font dictionary. A font dictionary has usually the following keys:
- "FamilyName": String, for example "Arial"
- "PostScriptName": String, optional if setting a font
- "Size": float, font size
- "Weight": LONG, the weight of the font in the range ]0;1000], 400 is normal/regular, 700 is bold
- "Width": LONG, the width of the font in the range ]0;1000], 500 is medium width, 300 is condensed, 700 is expanded
- "Style": LONG, 1: italic
- "Scale": float, optional horizontal scaling (1: normal width)
I'm confused about the difference between "Weight" and "Style".

I simply want to define the text as being "Arial" and boldface. What is the best attribute to use for that?
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Martin Huber
Entwickler
Entwickler
Posts: 4208
Joined: Tue 19 Nov 2002 15:49

Re: Scripting: Text layers

Post by Martin Huber »

photoken wrote: Thu 29 Jun 2017 22:47 I'm confused about the difference between "Weight" and "Style".
There is only one special style: 1 (italic).
photoken wrote: Thu 29 Jun 2017 22:47I simply want to define the text as being "Arial" and boldface. What is the best attribute to use for that?
If you want bold text, you have to set "Weight" to 700. And "FamilyName" would be "Arial".

Martin
Martin Huber
Entwickler
Entwickler
Posts: 4208
Joined: Tue 19 Nov 2002 15:49

Re: AddIn: Solution for rogue PL background process

Post by Martin Huber »

photoken wrote: Thu 29 Jun 2017 22:31 I've found a solution for the unwanted PL background process being created if the AddIn is not closed before exiting PL:
If PhotoLine is quit while a script/com application has a reference to one of its objects, PhotoLine will just hide and continue to exist in the background.

But this background process should disappear, when the script/com application ends.

Martin
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Re: AddIn: Solution for rogue PL background process

Post by photoken »

Martin Huber wrote: Fri 30 Jun 2017 09:21
photoken wrote: Thu 29 Jun 2017 22:31 I've found a solution for the unwanted PL background process being created if the AddIn is not closed before exiting PL:
If PhotoLine is quit while a script/com application has a reference to one of its objects, PhotoLine will just hide and continue to exist in the background.

But this background process should disappear, when the script/com application ends.
It never disappears.

By keeping Task Manager open, I can see that normally there is one PL process (in the "Apps" section). Closing PL while the AddIn is open closes that "App" PL process. Then closing that AddIn creates a new PL process in the "Background Process" section. That background PL process never disappears and prevents PL from launching again.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Re: Scripting: Text layers

Post by photoken »

Martin Huber wrote: Fri 30 Jun 2017 09:16 There is only one special style: 1 (italic).
If you want bold text, you have to set "Weight" to 700. And "FamilyName" would be "Arial".
OK, thanks! :)
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
mwenz
Mitglied
Posts: 122
Joined: Fri 13 May 2011 23:50

Re: Neue Testversion 20.40b11

Post by mwenz »

RGB image, Layer, convert layer type, choose gray. In my case, the image turns solid black.

Also a similar issue choosing high-pass filter.

I can use cover to profile and choose a grayscale profile and the conversion works.

Mike
User avatar
photoken
Mitglied
Posts: 2162
Joined: Sat 28 Sep 2013 01:25

Fixed: Open As Placeholder fails

Post by photoken »

Win10 1607 x64
PL 20.40b11 x64

When using "File"..."Open as Placeholder" for a 112Mb uncompressed TIF, the image does not open. PL is labelled by Windows as "Not Responding" and I must use the "Not Responding" error messagebox to forcibly close PL.

This does not happen with PL 20.02 x64.

In beta11, I can successfully open the TIF as a "normal" image and then use the layer properties to change the layer to a placeholder layer, although creating that placeholder does seem to take an unusually long time.
Last edited by photoken on Wed 19 Jul 2017 11:16, edited 1 time in total.
Ken
Yes, I think it can be eeeeeasily done....
Just take everything out on Highway 61.
Martin Huber
Entwickler
Entwickler
Posts: 4208
Joined: Tue 19 Nov 2002 15:49

Re: Neue Testversion 20.40b11

Post by Martin Huber »

mwenz wrote: Tue 04 Jul 2017 23:12 RGB image, Layer, convert layer type, choose gray. In my case, the image turns solid black.
I can't reproduce that here.
You are on Windows? What's the bit depth of the RGB image? What's the default gray profile in the PhotoLine settings? Is the destination bit depth in "Convert Layer Type" the same as the source bit depth?
mwenz wrote: Tue 04 Jul 2017 23:12I can use cover to profile and choose a grayscale profile and the conversion works.
If there is a default gray profile, "Tool > Color > Convert to Profile" is doing the same as "Layer > Convert Layer Type", so that is quite strange.

Are you using the current beta? Previous versions had some problems, because the new Microsoft compiler seem to be a bit buggy.

Martin