Neue Testversion 21.40b4

Hier diskutieren die Betatester von PhotoLine untereinander und mit den Entwicklern
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California
Kontaktdaten:

Re: Neue Testversion 21.40b4

Beitrag von russellcottrell »

Hello, and thank you for the feedback; it is very helpful. I have run into an issue; after doing a resize operation, trying to refer to the layers by name produces errors; examples are layer.Parent.Insert vector, layer; Set newLayer = layer.Duplicate(layer). If I do Set layer = doc.ActiveLayer after resizing (even if layer had already been set), I can then refer to layer, but can still not refer to any of the other layers. It is as if the layer references had been lost; but I can still do MsgBox layer.Name to all the layers.

Code: Alles auswählen

Dim pl
Dim doc, size
Dim aLayer, nLayer
Set pl = CreateObject("PhotoLine.Application")
Set doc = pl.ActiveDocument
size = doc.Size
pl.Visible = True
Set aLayer = doc.ActiveLayer
'this produces the errors below:
doc.DoOperation "Resize", "Size", Array(size(0) + 100, size(1) + 100), "Horizontal", 2, "Vertical", 2
Set nLayer = CreateObject("PhotoLine.Image")
nLayer.InitPicture 1, doc.Size

'aLayer.Parent.Insert nLayer, aLayer 'error

'doc.ActiveLayer = aLayer 'error

Set aLayer = doc.ActiveLayer 'o.k.
On another note, after inserting a new layer in the zero position, making it a new background, I cannot use the layer tool to move what used to be the background layer. This happens both interactively and after doing it with a script. Is there a way around this? Of note, I can move the layer by changing the position in the Layer panel, but not with a script using the Origin property.

p.s. I usually copy and paste the background layer when I do things like this. Could copy, merged copy, and paste be operations?
Zuletzt geändert von russellcottrell am Fr 12 Okt 2018 08:53, insgesamt 1-mal geändert.
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2136
Registriert: Sa 12 Mai 2012 21:38

Re: Neue Testversion 21.40b4

Beitrag von Herbert123 »

Martin Huber hat geschrieben: Do 11 Okt 2018 11:17
Herbert123 hat geschrieben: Fr 05 Okt 2018 09:44What would be handy is when the user holds down <ALT> (option Mac) while clicking a pattern or texture that the current transformation is maintained.

So: <Alt> click a pattern/texture maintain current fill transformation
<ALT><SHIFT> click maintain current stroke transformation

I feel that would be a simple and workable solution. What do you think?
I will check that.

Martin
That sounds brilliant and would save a lot of time doing architectural visualization/presentation work!
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California
Kontaktdaten:

Re: Neue Testversion 21.40b4

Beitrag von russellcottrell »

Here is a draft of a poster script that I use in another application. The issue referring to layers after resizing is present. I get the same error after merging two layers that are not the background layer.

Code: Alles auswählen

' PhotoLine script by Russell Cottrell.
' Adds faux matting and a title to an image.
' Optimized for printing.
' Images should have a resolution of at least 300 ppi but will work with any.

Option Explicit

Dim pl, doc, size, printSize, res, aLayer
Dim mountWidth, mountHeight, matSpace
Dim matPly, printEdge, ratio, surroundWidth
Dim matColor, mountColor, fontColor
Dim topColorP, sideColorP, bottomColorP, topColorM, sideColorM, bottomColorM
Dim ww, hh, left, top, x0, x1, x2, x3, y0, y1, y2, y3, i
Dim fontDict, paragraphDict, fontSize, textLayer, range

Set pl = CreateObject("PhotoLine.Application")
Set doc = pl.ActiveDocument
size = doc.Size
printSize = size
res = doc.Resolution
fontSize = size(1) * 0.05
matPly = 4 * (3/256)
matSpace = 1/4
printEdge = 1/150

  'set the mount size as a ratio of the linear dimensions of the mount to the print:
ratio = 1.6
surroundWidth = Sqr((size(0)/res) * (size(1)/res)) * ((ratio - 1) / 2)
mountWidth = size(0)/res + surroundWidth*2
mountHeight = size(1)/res + surroundWidth*2
  'extra space at the bottom; would use 0.1 if not adding a title:
mountHeight = mountHeight + (surroundWidth - matPly - matSpace - printEdge)*0.2



mountWidth = Round(mountWidth * res)
mountHeight = Round(mountHeight * res)
matSpace = Round(matSpace * res)
matPly = Round(matPly * res)
printEdge = Round(printEdge * res)
surroundWidth = Round(surroundWidth * res)

Set matColor = CreateObject("PhotoLine.Color")
matColor.Model = 1
matColor.Values = Array(240/255, 240/255, 240/255)

Set topColorP = CreateObject("PhotoLine.Color")
topColorP.Model = 1
topColorP.Values = Array(240/255, 240/255, 240/255)

Set sideColorP = CreateObject("PhotoLine.Color")
sideColorP.Model = 1
sideColorP.Values = Array(200/255, 200/255, 200/255)

Set bottomColorP = CreateObject("PhotoLine.Color")
bottomColorP.Model = 1
bottomColorP.Values = Array(160/255, 160/255, 160/255)

Set topColorM = CreateObject("PhotoLine.Color")
topColorM.Model = 1
topColorM.Values = Array(120/255, 120/255, 120/255)

Set sideColorM = CreateObject("PhotoLine.Color")
sideColorM.Model = 1
sideColorM.Values = Array(160/255, 160/255, 160/255)

Set bottomColorM = CreateObject("PhotoLine.Color")
bottomColorM.Model = 1
bottomColorM.Values = Array(200/255, 200/255, 200/255)

Set mountColor = CreateObject("PhotoLine.Color")
mountColor.Model = 1
mountColor.Values = Array(255/255, 255/255, 255/255)

Set fontColor = CreateObject("PhotoLine.Color")
fontColor.Model = 1
fontColor.Values = Array(51/255, 51/255, 51/255)



  'PRINT EDGE

ww = size(0) + printEdge*2
hh = size(1) + printEdge*2
doc.DoOperation "Resize", "Size", Array(ww, hh), "Horizontal", 2, "Vertical", 2, "Color", sideColorP
size = doc.Size
Set aLayer = doc.ActiveLayer 'have to do this after resizing

x0 = 0
x1 = size(0)
x2 = size(0) - printEdge
x3 = printEdge

y0 = 0
y1 = 0
y2 = printEdge
y3 = printEdge

FillSelection aLayer, topColorP

x0 = printEdge
x1 = size(0) - printEdge
x2 = size(0)
x3 = 0

y0 = size(1) - printEdge
y1 = size(1) - printEdge
y2 = size(1)
y3 = size(1)

FillSelection aLayer, bottomColorP



  'MAT SPACE

ww = size(0) + matSpace*2
hh = size(1) + matSpace*2
doc.DoOperation "Resize", "Size", Array(ww, hh), "Horizontal", 2, "Vertical", 2, "Color", MountColor
size = doc.Size
Set aLayer = doc.ActiveLayer



  'MAT BEVEL

ww = size(0) + matPly*2
hh = size(1) + matPly*2
doc.DoOperation "Resize", "Size", Array(ww, hh), "Horizontal", 2, "Vertical", 2, "Color", sideColorM
size = doc.Size
Set aLayer = doc.ActiveLayer

x0 = 0
x1 = size(0)
x2 = size(0) - matPly
x3 = matPly

y0 = 0
y1 = 0
y2 = matPly
y3 = matPly

FillSelection aLayer, topColorM

x0 = matPly
x1 = size(0) - matPly
x2 = size(0)
x3 = 0

y0 = size(1) - matPly
y1 = size(1) - matPly
y2 = size(1)
y3 = size(1)

FillSelection aLayer, bottomColorM



  'MOUNT SIZE

ww = mountWidth
hh = mountHeight
left = (mountWidth - size(0)) / 2
top = surroundWidth - matPly - matSpace - printEdge
doc.DoOperation "Resize", "Size", Array(ww, hh), "Position", Array(left, top), "Color", matColor
size = doc.Size
Set aLayer = doc.ActiveLayer



  'TITLE

Set fontDict = CreateObject("PhotoLine.Dictionary")
fontDict.Add "FamilyName", "Palatino Linotype", "Size", fontSize

Set paragraphDict = CreateObject("PhotoLine.Dictionary")
paragraphDict.Add "Alignment", 2


Set textLayer = CreateObject("PhotoLine.Text")
  'customize the title text; would like to read it from a text file:
textLayer.Text = Mid(doc.Path, InStrRev(doc.Path, "\") + 1)
range = Array(0, textLayer.TextLength)
textLayer.Origin = Array(0, surroundWidth + printSize(1) + matPly + matSpace + printEdge + fontSize*1.5)
textLayer.Size = Array(size(0), fontSize) 'is there a way to get the size from fontDict?
textLayer.SetAttribute range, "Color", fontColor
textLayer.SetAttribute range, "Font", fontDict
textLayer.SetAttribute range, "Paragraph", paragraphDict
aLayer.Parent.Insert textLayer, aLayer



Sub FillSelection(layer, color)
Dim vector
Set vector = CreateObject("PhotoLine.Vector")
vector.FillColor(0) = color
vector.LineColor(0) = Array(0, 0, 0, 0)
vector.InsertPoints 0, 0, array(x0, y0, x1, y1, x2, y2, x3, y3, x0, y0)
layer.Parent.Insert vector, layer
doc.Merge Array(layer, vector)
End Sub
If the image could be lifted to a layer off the background and moved, it would make it easy to adjust its vertical position.

I like to apply an emboss filter to the text; this would require converting the layer type from text to RGB, and then an emboss operation; could this be done?

Is there a way to get the attributes from dictionaries, such as the font size?

More items for the wish list:
reading and writing to and from a text file
creating a layer and inserting the image from another open document

Side note: in the ScriptingVBScript document, the text for ParagraphAlignment and ParagraphRegister are reversed.
Benutzeravatar
Herbert123
Mitglied
Beiträge: 2136
Registriert: Sa 12 Mai 2012 21:38

Re: Neue Testversion 21.40b4

Beitrag von Herbert123 »

Since colour SVG fonts are gaining in popularity, I'd love to see these fonts supported in PhotoLine as well. PhotoLine already has a great SVG engine, which (hopefully) means colour SVG font support would be relatively easily integrated?

For testing, download some of the free ones available here:
https://superdevresources.com/color-fonts-free-premium/

As it stands, currently PhotoLine only displays the black and white variants, and ignores the coloured versions.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait
Martin Huber
Entwickler
Entwickler
Beiträge: 4158
Registriert: Di 19 Nov 2002 15:49

Re: Neue Testversion 21.40b4

Beitrag von Martin Huber »

russellcottrell hat geschrieben: Fr 12 Okt 2018 04:44 Hello, and thank you for the feedback; it is very helpful. I have run into an issue; after doing a resize operation, trying to refer to the layers by name produces errors; examples are layer.Parent.Insert vector, layer; Set newLayer = layer.Duplicate(layer). If I do Set layer = doc.ActiveLayer after resizing (even if layer had already been set), I can then refer to layer, but can still not refer to any of the other layers.
Some operations and commands delete layers or replace them by other ones. You can still have a reference to the deleted layer, but you can't use them for most operations/commands any longer.
russellcottrell hat geschrieben: Fr 12 Okt 2018 04:44It is as if the layer references had been lost; but I can still do MsgBox layer.Name to all the layers.

Code: Alles auswählen

(...)Set aLayer = doc.ActiveLayer
'this produces the errors below:
doc.DoOperation "Resize", "Size", Array(size(0) + 100, size(1) + 100), "Horizontal", 2, "Vertical", 2
Set nLayer = CreateObject("PhotoLine.Image")
(...)
'aLayer.Parent.Insert nLayer, aLayer 'error

'doc.ActiveLayer = aLayer 'error
(...)
Here the "Resize" replaces aLayer by a new layer with the new size. aLayer still exists, but is no longer part of the document doc and no longer has a parent.
So you can't use it as a positional parameter of "Insert" or as new active layer.
russellcottrell hat geschrieben: Fr 12 Okt 2018 04:44On another note, after inserting a new layer in the zero position, making it a new background, I cannot use the layer tool to move what used to be the background layer. This happens both interactively and after doing it with a script. Is there a way around this? Of note, I can move the layer by changing the position in the Layer panel, but not with a script using the Origin property.
The original background layer keeps its edit flags and a background layer usually prohibits moving. Currently there is no way to modify these edit flags by script.
But this shouldn't affect the Origin property. I just tried "layer.Origin = Array(0,0)" and it worked. Do you have a sample script, that doesn't work?
russellcottrell hat geschrieben: Fr 12 Okt 2018 04:44p.s. I usually copy and paste the background layer when I do things like this. Could copy, merged copy, and paste be operations?
Operations currently can't return values. This doesn't affect copy and merged copy, but is bad for paste which should should return the created layer(s). I'll probably have to find a way for operations to return their results.

Martin
Martin Huber
Entwickler
Entwickler
Beiträge: 4158
Registriert: Di 19 Nov 2002 15:49

Re: Neue Testversion 21.40b4

Beitrag von Martin Huber »

russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25 Here is a draft of a poster script that I use in another application. The issue referring to layers after resizing is present. I get the same error after merging two layers that are not the background layer.
Merge is a command and returns its result, so you can do something like
Set image = doc.Merge Array(layer, vector)
russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25 (...)
If the image could be lifted to a layer off the background and moved, it would make it easy to adjust its vertical position.
I don't understand this, but is this related to the Origin problem in your previous post?
russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25I like to apply an emboss filter to the text; this would require converting the layer type from text to RGB, and then an emboss operation; could this be done?
Neither layer styles nor an emboss operation are currently available.
russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25Is there a way to get the attributes from dictionaries, such as the font size?
If fontDic is a "PhotoLine.Dictionary", "fontSize = fontDic("Size")" should do that.
russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25More items for the wish list:
reading and writing to and from a text file
Most people are using FileSystemObject for that:
https://stackoverflow.com/questions/155 ... -vb-script
russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25creating a layer and inserting the image from another open document
I don't fully understand, but the following scripts asks the user for files, opens them, moves the layers of theses files to the active document and closes them:

Code: Alles auswählen

Dim pl
Dim doc
Dim activeLayer
Dim page

Set pl = CreateObject("PhotoLine.Application")
Set doc = pl.ActiveDocument

pl.Visible = True

If Not doc Is Nothing Then
	Dim otherDoc
	Dim paths
	Dim path
	Dim layers

	Set page = doc.ActivePage
	paths = pl.OpenDialog
'	WScript.Echo "Paths-Typ: " & TypeName(paths) & ", Grenzen: " & LBound(paths) & ", ", UBound(paths)
	for each path in paths
		Set otherDoc = pl.Open(path)
		if (not otherDoc Is Nothing) Then
			Set layers = otherDoc.ActivePage.RootLayer.Children
			If (Not layers Is Nothing) Then
				page.RootLayer.Insert layers, -1
			End If
			otherDoc.Close(1)
		End If
	Next
End If
russellcottrell hat geschrieben: Mo 15 Okt 2018 21:25Side note: in the ScriptingVBScript document, the text for ParagraphAlignment and ParagraphRegister are reversed.
I will change that.

Martin
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California
Kontaktdaten:

Re: Neue Testversion 21.40b4

Beitrag von russellcottrell »

Some operations and commands delete layers or replace them by other ones. You can still have a reference to the deleted layer, but you can't use them for most operations/commands any longer.
This seems unfortunate; can it be changed? As it is, it looks like after one of these operations, the only layer that can be directly accessed is the active layer, by setting it. Then it looks like the only way to access other layers is layer.Previous.Previous.Previous or some such. Is there a layer collection for the document? doc.Item(index) does not work for layers. (And I cannot figure out what doc.RootLayer is; it does not seem to be the background layer.)
The original background layer keeps its edit flags and a background layer usually prohibits moving.
In another application, you can do this; just saying . . . .
doc.activeLayer.isBackgroundLayer = false;

I tried layer.Origin again and it worked this time.
If the image could be lifted to a layer off the background and moved, it would make it easy to adjust its vertical position.
This could be accomplished either by changing its background edit flags, or by copying and pasting it.
If fontDic is a "PhotoLine.Dictionary", "fontSize = fontDic("Size")" should do that.
That works; thank you.
Most people are using FileSystemObject for that
I guess I could have tried that . . . .

This works to insert open documents into the active document; but merged copy would be preferable.

Code: Alles auswählen

For i=0 To pl.Count-1

  If pl.Item(i).Path <> doc.Path Then
    Set bLayer = pl.Item(i).ActiveLayer 'would prefer to do a merged copy
    aLayer.Parent.Insert bLayer, aLayer
    Set bLayer = aLayer.Next 'otherwise bLayer still refers to the other document
    bLayer.Origin = Array(i*100, i*100) 'it evidently still has background flags and cannot be moved manually
  End If

Next
Thank you again for the help.
Martin Huber
Entwickler
Entwickler
Beiträge: 4158
Registriert: Di 19 Nov 2002 15:49

Re: Neue Testversion 21.40b4

Beitrag von Martin Huber »

russellcottrell hat geschrieben: Di 16 Okt 2018 21:45
Some operations and commands delete layers or replace them by other ones. You can still have a reference to the deleted layer, but you can't use them for most operations/commands any longer.
This seems unfortunate; can it be changed?
No.
russellcottrell hat geschrieben: Di 16 Okt 2018 21:45As it is, it looks like after one of these operations, the only layer that can be directly accessed is the active layer, by setting it. Then it looks like the only way to access other layers is layer.Previous.Previous.Previous or some such. Is there a layer collection for the document? doc.Item(index) does not work for layers. (And I cannot figure out what doc.RootLayer is; it does not seem to be the background layer.)
PhotoLine's layers are organised as a tree. The root of the tree is the RootLayer. The root layer is not visible in the UI of PhotoLine. The children of the root layer are the ones you are usually seeing in the Layer Panel.
You get the background layer (or the first layer in a document) with doc.RootLayer.First.
The number of layers in the lowest hierarchy is doc.RootLayer.Count and you can access the children of the root layer by doc.RootLayer(i) or doc.RootLayer.Item(i) (i is a number from 0 to doc.RootLayer.Count - 1).
There are several other ways of enumerating the child layers of a layer. The sample SaveAllImages lists a few of them.
russellcottrell hat geschrieben: Di 16 Okt 2018 21:45This works to insert open documents into the active document; but merged copy would be preferable.

Code: Alles auswählen

For i=0 To pl.Count-1

  If pl.Item(i).Path <> doc.Path Then
    Set bLayer = pl.Item(i).ActiveLayer 'would prefer to do a merged copy
    aLayer.Parent.Insert bLayer, aLayer
    Set bLayer = aLayer.Next 'otherwise bLayer still refers to the other document
    bLayer.Origin = Array(i*100, i*100) 'it evidently still has background flags and cannot be moved manually
  End If

Next
A few comments to your sample:
- If you don't mind that the other documents are modified, you can do a "Set bLayer = pl.Item(i).Merge". Another option would be creating a group in the active document (CreateObject(PhotoLine.Layer)) and inserting all layers from the other document in this group.
- Usually an easier (and more effective) way to enumerate all docs/layers/... is "For Each object In list". Of course, if you need the loop variable anyway, it's not really shorter.
- You should be able to compare the document references directly without using Path.

Martin
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California
Kontaktdaten:

Re: Neue Testversion 21.40b4

Beitrag von russellcottrell »

Thank you, this is helpful.
Paul
Mitglied
Beiträge: 235
Registriert: Fr 19 Dez 2008 11:36

Re: Neue Testversion 21.40b4

Beitrag von Paul »

Hi,
when I set the colour profile of a document to grey, the red lines of the spell checker get grey as well. They become barely noticable. But the whole point of the lines is to stand out and be noticed.
Could this be changed?

- Paul
Martin Huber
Entwickler
Entwickler
Beiträge: 4158
Registriert: Di 19 Nov 2002 15:49

Re: Neue Testversion 21.40b4

Beitrag von Martin Huber »

Paul hat geschrieben: Sa 20 Okt 2018 19:58 Hi,
when I set the colour profile of a document to grey, the red lines of the spell checker get grey as well. They become barely noticable. But the whole point of the lines is to stand out and be noticed.
Could this be changed?
I will check that.

Martin
Benutzeravatar
russellcottrell
Mitglied
Beiträge: 251
Registriert: Sa 26 Jul 2014 10:13
Wohnort: California
Kontaktdaten:

Re: Neue Testversion 21.40b4

Beitrag von russellcottrell »

Hello again; having trouble with SaveDialog. The dialog opens properly, but when I click “Save,” the document does not save:

Code: Alles auswählen

doc.Merge
doc.SaveDialog "Save As", path & name & ".png"
SaveAs works properly:

Code: Alles auswählen

doc.Merge
doc.SaveAs path & name & ".png", "Compress", 9, "Interlace", False
Martin Huber
Entwickler
Entwickler
Beiträge: 4158
Registriert: Di 19 Nov 2002 15:49

Re: Neue Testversion 21.40b4

Beitrag von Martin Huber »

"SaveDialog" just shows a save dialog without saving (for example for choosing a path before saving several files).

In the 21.40b5 "Save", "SaveAs" and "Export" optionally show a save dialog.
Example:

doc.SaveAs path, "ShowDialog", TRUE, "Title", "Optional title of save dialog"

Martin
Antworten