Serendipity Editors Fot Images & Icons

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6240
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: 6240
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: 71
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 15 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation pays 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: 748
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 10.15.7, Xcode 12.4, LC 9.6.3, iOS 14.7.1
Targets: Mac, iOS

RCozens
Posts: 71
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 pays more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 71
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 pays more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 71
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 14 times
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

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

RCozens
Posts: 71
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 pays more attention to the man-made world...
and less attention to the world that made man.

RCozens
Posts: 71
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) Not downloaded yet
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

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

Post Reply

Return to “Made With LiveCode”