Serendipity Editors For Images & Icons

A place for you to show off what you have made with LiveCode

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9249
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Serendipity Editors Fot Images & Icons

Post by richmond62 » Fri Oct 08, 2021 7:15 pm

I hate to tell you this
Oddly enough I experienced no pain whatsoever, so do not apologise: between us we are having an odd type of bromance
where one of us has access to Windows and the other Macintosh, almost as bizarre as a conversation about sex where one
of us is gay and the other one is straight.

8)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9249
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Serendipity Editors Fot Images & Icons

Post by richmond62 » Fri Oct 08, 2021 7:50 pm

I am, almost, tempted to run down the road and get an acquaintance of mine
to install an OEM version of Windows 10 on the oldest, cheap, heap-of-junk
that can cope with it just so our 'bromance' can flourish, or, at the very
least communication re these issues becomes a whole lot easier.

The other alternative is this:

https://www.ebay.com/itm/264800727216?e ... %3A2334524

70 bucks!

which will run MacOS 10.7.5, LC 8.1.10, and let you do all your interface "shenanigans without
"having to climb into bed with Richmond" . . . less risk of infection (with my lunacy) . . .

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Sat Oct 09, 2021 6:59 pm

richmond62 wrote:
Fri Oct 08, 2021 7:15 pm
we are having an odd type of bromance
It's nice to have a little bromance in my life...especially when I would like MacOS users as well as Windows users to have a good experience with Serendipity Editors.

Here is the latest revision. I deleted all the logic around Mac Title 3 & Mac Title 4, and corrected an error I created in my "fix" to keep image New Image Frame from reacting to LiveCode paint tools.
Attachments
Serendipity Editors Rev 1.01.zip
(32.32 KiB) Downloaded 182 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Serendipity Editors Fot Images & Icons

Post by marksmithhfx » Wed Oct 13, 2021 5:45 pm

RCozens wrote:
Sun Oct 03, 2021 12:02 am
My gift to the LiveCode community...
..with special thanks to members of the Talking LiveCode Forum.

Enjoy!
Hi Rob, what kinds of image formats does Serendipity work with?

Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Wed Oct 13, 2021 6:13 pm

marksmithhfx wrote:
Wed Oct 13, 2021 5:45 pm
what kinds of image formats does Serendipity work with?
Morning Mark,

The Image Editor essentially works on images in LiveCode paint mode. LiveCode converts GIFs, PNGs, JPEGs to paint (PMB, etc.) images upon import and converts them back (or to another image format) on export. Also, composite images can be created from screen snapshots encompassing multiple smaller images in one or more image formats.

The Icon Editor presents a pixel grid of up to 32x32 pixels, and pixel-by-pixel changes in the grid are displayed in the actual output icon as a paint image which can be exported in the same four formats.

There is a bug in the LiveCode IDE (#233720) that causes screen snapshots exported to GIF format to render incorrect images on Win32, and the current version of the Editors does not support animated GIFs.

Cheers!
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Wed Oct 13, 2021 6:39 pm

A minor enhancement: To continuously increment height or width of a new image or icon in response to mouseStillDown, replace the scripts of the Height/Width Adjustor images in Image Editor's Image Dimension group and the Icon Editor's Resize Grid group with...

Image Editor Height Adjustor--

Code: Select all

global mouse3State

local clickOffset

on mouseDown  -- 8 Oct 21:RCC
   put mouse(3) into mouse3State
   put (item 2 of the mouseLoc)-(item 2 of the loc of me) into clickOffset
end mouseDown

on incrementField  --  8 Oct 21:RCC
   if clickOffset = 0 then exit incrementField
   if mouse3State is "down" then put 100 into theIncrement else put 1 into theIncrement
   put the text of field "Image Height" into currentHeight
   if clickOffset < 0 then add theIncrement to currentHeight else subtract theIncrement from currentHeight
   if currentHeight < 1 then exit incrementField
   set the text of field "Image Height" to currentHeight
end incrementField

on mouseStillDown buttonNumber  --  8 Oct 21:RCC
   incrementField
   put "up" into mouse3State  -- Increment by 1 after the first 100 if right button is down
end mouseStillDown

on mouseUp  -- 8 Oct 21:RCC
   incrementField
   put "up" into mouse3State
end mouseUp
Image Editor Width Adjustor--

Code: Select all

global mouse3State

local clickOffset

on mouseDown  -- 11 Oct 21:RCC
   put mouse(3) into mouse3State
   put (item 1 of the mouseLoc)-(item 1 of the loc of me) into clickOffset
end mouseDown

on incrementField  --  11 Oct 21:RCC
   if clickOffset = 0 then exit incrementField
   if mouse3State is "down" then put 100 into theIncrement else put 1 into theIncrement
   put the text of field "Image Width" into currentWidth
   if clickOffset > 0 then add theIncrement to currentWidth else subtract theIncrement from currentWidth
   if currentWidth < 1 then exit incrementField
   set the text of field "Image Width" to currentWidth
end incrementField

on mouseStillDown buttonNumber  --  11 Oct 21:RCC
   incrementField
   put "up" into mouse3State  -- Increment by 1 after the first 100 if right button is down
end mouseStillDown

on mouseUp  -- 11 Oct 21:RCC
   incrementField
   put "up" into mouse3State
end mouseUp
Icon Editor Height Adjustor--

Code: Select all

local clickOffset

on mouseDown  -- 11 Oct 21:RCC
   put (item 2 of the mouseLoc)-(item 2 of the loc of me) into clickOffset
end mouseDown

on incrementField  --  11 Oct 21:RCC
   constant gridRowSize = 32 -- Change this if you wish to build a larger grid 
   if clickOffset = 0 then exit incrementField
   lock screen
   put the loc of image "Icon Image" into savedLocation
   get the text of field "Icon Dimensions" 
   put word 3 of it into currentHeight
   if clickOffset < 0 then add 1 to currentHeight else subtract 1 from currentHeight
   if currentHeight < 1 or currentHeight > gridRowSize then exit incrementField
   put currentHeight into word 3 of it
   set the text of field "Icon Dimensions" to it
   set the height of image "Icon Image" to currentHeight
   set the loc of image "Icon Image" to savedLocation
   unlock screen
end incrementField

on mouseStillDown buttonNumber  --  11 Oct 21:RCC
   incrementField
end mouseStillDown

on mouseUp  -- 11 Oct 21:RCC
   incrementField
end mouseUp
Icon Editor Width Adjustor-

Code: Select all

local clickOffset

on mouseDown  -- 11 Oct 21:RCC
   put (item 1 of the mouseLoc)-(item 1 of the loc of me) into clickOffset
end mouseDown

on incrementField  --  11 Oct 21:RCC
   constant gridRowSize = 32 -- Change this if you build a larger grid 
   if clickOffset = 0 then exit incrementField
   lock screen
   put the loc of image "Icon Image" into savedLocation
   get the text of field "Icon Dimensions" 
   put word 1 of it into currentWidth
   if clickOffset > 0 then add 1 to currentWidth else subtract 1 from currentWidth
   if currentWidth < 1 or currentWidth > gridRowSize then exit incrementField
   put currentWidth into word 1 of it
   set the text of field "Icon Dimensions" to it
   set the height of image "Icon Image" to currentWidth
   set the loc of image "Icon Image" to savedLocation
   unlock screen
end incrementField

on mouseStillDown buttonNumber  --  11 Oct 21:RCC
   incrementField
end mouseStillDown

on mouseUp  -- 11 Oct 21:RCC
   incrementField
end mouseUp
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Thu Oct 21, 2021 6:47 pm

Serendipity Editors Rev 2.0 is attached.

* Pulldown menus have been replace with palettes
* Size & location of New Image Frame and size of new images & icons can be adjusted without invoking the Properties Inspector
* Image scanning & comparing handlers are rewritten to replace handler calls in the main repeat loops with straight-line code (reduces execution time to scan a 490,000-pixel image from 9864 ticks to 8029 ticks)
* I created my own busy cursor (as a learning experience)
* Images & icons are now correctly exported to all supported image types (except GIF on Windows)

Cheers1
Attachments
Serendipity Editors Rev 2.0.zip
(35.89 KiB) Downloaded 171 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Sun Oct 24, 2021 2:13 am

RCozens wrote:
Thu Oct 21, 2021 6:47 pm
* Images & icons are now correctly exported to all supported image types (except GIF on Windows)
Yes, they are, even if the exportImage handler says there is an error when you export a previously-imported image instead of a screen snapshot.

Make the following change in the script of card. Image Editor;

Code: Select all

   end switch
--   get the result
--   if it is not empty then
--      beep
--      answer "Image export error:" && it
--   end if
   if not newImageExport then 
For those of you who (like moi) find the new busy cursors provide insufficient feedback when scanning, comparing, or exporting large images, the revision I'm working on now displays a progress bar.

Cheers!
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Wed Oct 27, 2021 10:49 pm

Here's Rev 2.1 and a discussion of a performance issue.

I never intended for Serendipity Editors to be compiled. My concept was another developers' tool, not an app.

In testing today, when uncompiled it takes 1188 ticks to set the dgText representation of a 497,200-pixel image and 952 ticks to clear it
The compiled version set it in 523 ticks and cleared it in 53.

So I am looking into whether one can include LiveCode paint tools in a compiled app?

Without the paint tools the Image Editor can mask images and create screen snapshots of grouped images; but individual images cannot be created or modified.

Fortunately, the Icon Editor does not use the paint tools; so its functionality is not diminished.

The only functions where this problem is experienced are scanning and comparing images. That functionality was originally built as a tool for me to understand LiveCode's imageData format and debug the stack, as imageData is not readable in the Script Editor when debugging.

I expect the scan and compare functions will be the least used; so, at least for users who want to actually edit images with LiveCode's paint tool, I suggest you run Serendipity Editors as a stack rather than compile it.

Cheers!
Attachments
Serendipity Editors Rev 2.1.zip
(36.85 KiB) Downloaded 167 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Sat Nov 20, 2021 8:34 pm

The Image Editor automatically resizes the window when an imported image exceeds the current stack dimensions.

Rev 2.2 prevents the Editor from resizing beyond the size of the primary monitor.

If an oversize image is imported the Editor displays options to cancel the import or shrink the image.

The Image Dimensions Palette will not allow creation of a new image larger than the primary monitor's maximum working area.

At some point I may deal with the issue of multiple monitors; however I wanted to get this fix out before someone else was bitten by it.

Cheers!
Attachments
Serendipity Editors 2.2.zip
(37.36 KiB) Downloaded 166 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Wed Dec 01, 2021 7:23 pm

Morning All,

Rev 2.21 now checks all monitors when importing an oversize image. The user is prompted to move the stack to the largest monitor before shrinking the image if it is not already displayed there.

And it is finally possible to manipulate the size and position of the New Image Frame without invoking the Property Inspector.

Also, a bug that arose when exporting a screen snapshot from a rectangle that included areas outside existing images has been corrected.

Happy Holidays!
Attachments
Serendipity Editors 2.21.zip
(37.89 KiB) Downloaded 168 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Tue Feb 01, 2022 7:40 pm

Hi All,

This week I had a need to mask a specific color in an existing image; so I have added that capability in Serendipity Editors Rev 2.3.

To use this feature when exporting an image, right-click on the "Export" button of the Image Selector Palette. This will prompt you to click on the image color you want to be made transparent.

Enjoy!
Attachments
Serendipity Editors Rev 2.3.zip
(38.81 KiB) Downloaded 144 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors Fot Images & Icons

Post by RCozens » Tue Feb 01, 2022 10:06 pm

Oops!

I forgot to reinitialize the new user prompt before compressing Rev 2.3.

First time users should:

1. Open the stack
2. Type 'set the hilite of button "Opening Prompt Display" of group "Opening Prompt Group" to false' in the Message Box
3. Press Enter
4. Save the stack
5. Close the stack & remove it from memory
6. Reopen the stack

Cheers!
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Serendipity Editors For Images & Icons

Post by FourthWorld » Tue Feb 01, 2022 10:38 pm

I took the liberty of changing "Fot" in this thread's title to "For". If that was incorrect I can set it back. :) But it's a nice thread with many fine contributions, seemed fitting to tidy up its title to match the quality of the engagement here.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: Serendipity Editors For Images & Icons

Post by RCozens » Sat May 14, 2022 5:46 pm

Hi Richard,

Belated thanks for correcting my typo. As you may surmise, I have not been checking in on this thread since I uploaded Rev 2.3.

I will endeavor to check more often in case someone posts a question or problem.

Cheers!
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

Post Reply

Return to “Made With LiveCode”