Mosaic Fun with OpenOffice Calc

imacat .
imacat .Software developer at OpenOffice PMC, Women in FOSS in Taiwan
Mosaic Fun with
   OpenOffice Calc



  imacat (Yang Shih-Ching)
<imacat@mail.imacat.idv.tw>
          2012/11/6
“Mosaic Fun with OpenOffice Calc” is created by imacat (Yang Shih-Ching),
and licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
imacat / Yang Shih-Ching
●   From Taiwan local OpenOffice community
●   A graduate student from the Computer
    Science Education Laboratory, National
    Taiwan Normal University
●   A member of Women in FOSS in Taiwan
●   Was…
    –   A Sun/Oracle freelance lecturer
    –   An OpenOffice RD for 1 year
    –   A web application developer for 8 years
This session is all about multimedia and fun.
        So please relax and enjoy!
After all, I’m not a show business professional.
                 I’m a developer.
Please forgive me if this is not cool enough. :p
Since this is all about multimedia,
          before we start,
lets get some multimedia first! ^_*’
Lets Gangnam Style!
Feeling spirited now? ^_^
I will start by telling a story…
Long time ago in the far, far land
   when I was still a child…
Long time ago in the far, far land
         when I was still a child…
Well, actually it was only in this August. :p
I saw on my RSS reader...
So I followed the story and
  watched the video…
It’s cool, isn’t it?
It’s cool, isn’t it?
Yes, it’s SO COOL!
I forwarded it onto our Google Plus,
      our Facebook fans page,
     our forums, local forum, etc.
I forwarded it onto our Google Plus,
      our Facebook fans page,
     our forums, local forum, etc.
          Then I put it away
      and return to my textbook.
Until I saw Rob talking about this
        video the next day…
So I watched it again, and also the
      “behind the scenes”…
Well, I think…
Well, I think…
Yeah, I can do it…
Well, I think…
Yeah, I can do it…
programmatically!
Creating mosaic art involves
calculating the average colors of image blocks.
Since neither OpenOffice BASIC nor UNO API
                has any method
    to obtain the colors of individual pixels,
           I have use Java to do this.
So here it is… ^_^
(demonstration)
It’s cool, isn’t it?
No.
No, that’s not cool.
It’s uglier than the original “Stop-Motion Excel”.
     It’s not the “eye candy” that I imagined.
Why?
     The original “Stop-Motion Excel”
     was painted manually, cell by cell.
MysteryGuitarMan painted it with a fixed
     palette, but not “average colors”.
It looks sharp. It feels like an animation.
Comparing Hand-Painted Colors
  with Mosaic Average Colors
So I need to find something more cool,
           something sharp,
    something with a high contrast.
That is not an easy task.
The idea of Calc Mosaic
     is not only to create mosaic arts,
but also to create stop-motion animations.
But it takes averagely 20 seconds
to create a spreadsheet of mosaic art
    with the Java UNO application.
      I cannot run the animation
by creating the mosaic art at real-time.
So I turn to another method,
to create each frame with a spreadsheet,
       and play them in sequence,
       as a stop-motion animation.
But then a spreadsheet document can only
 contain a maximum of 256 spreadsheets.
Since I only have 256 frames,
     this cannot be long.
I remembered there is the iPod Ad
The iPod Ad…
●   Has only 31 seconds, corresponding to 8
    FPS if we are having 256 frames.
The iPod Ad…
●   Has only 31 seconds, corresponding to 8
    FPS if we are having 256 frames.
●   Has sharp images, high contrasts.
The iPod Ad…
●   Has only 31 seconds, corresponding to 8
    FPS if we are having 256 frames.
●   Has sharp images, high contrasts.
●   Is very famous.
So here it is…
(demonstration)
At the same time, Villeroy responded to my
Calc Mosaic on the forum, using a different
                approach.
Villeroy’s Response
So here it is…
(demonstration)
As you can see,
 Villeroy places the color values in the cells.
 The OpenOffice BASIC macro can read and
update the cell background colors accordingly.
       OpenOffice BASIC is a lot faster
                than Java UNO.
This makes it possible to animate at real time.
Villeroy’s approach still has some
         disadvantages…
Disadvantages of
            Villeroy’s Approach
●   You still need to have the color values first.
Disadvantages of
             Villeroy’s Approach
●   You still need to have the color values first.
●   The frame rate is still low.
Disadvantages of
             Villeroy’s Approach
●   You still need to have the color values first.
●   The frame rate is still low.
●   Villeroy updates the colors with styles.
    –   A lot faster than painting the background
        color cell by cell.
    –   The number of colors to use is limited.
        That is why it is gray-scaled.
This is a different approach than me.
    But I still got greatly inspired.
The color values can be saved in the sheets,
   and painted with OpenOffice BASIC.
        This can make it a lot faster.
And I know there is the setDataArray()
     in the interface XCellRangeData.
I can populate all the color values at once
    instead of hundreds of UNO calls
    to set the CellBackColor property
                Of SheetCell.
The New Process Will Be…
1.Calculates the average colors of mosaic
  cells with the Java application.
The New Process Will Be…
1.Calculates the average colors of mosaic
  cells with the Java application.
2.Passes the color values from Java to
  OpenOffice BASIC.
The New Process Will Be…
1.Calculates the average colors of mosaic
  cells with the Java application.
2.Passes the color values from Java to
  OpenOffice BASIC.
3.Paints the background colors of the
  spreadsheet cells with the OpenOffice
  BASIC macro.
So the problem becomes:
        Writing an application
both in Java and OpenOffice BASIC.
So the problem becomes:
         Writing an application
 both in Java and OpenOffice BASIC.
               Or, simply,
Creating the OpenOffice BASIC macros
   through the UNO API with Java.
In the unpublished UNO API,
    there is a BasicLibraries property
            in OfficeDocument
     that application developers can
access, insert or delete the BASIC macros.
There’s also the XScriptProvider interface
        that I can use it to invoke
    the existing OpenOffice macros.
So I use them to “inject” the BASIC macros
into the newly-created spreadsheet document,
             and run these macros.
In fact, I don’t even need to use setDataArray()
to paste the color values into the spreadsheets.
   I can pass the color values as parameters
           to the invoked BASIC macros.
This is troublesome,
     but the result is amazing.
It is 8 times faster then before!
When I prepare for this presentation,
 I became more and more greedy.
I want something new,
        something hot,
something gets people excited!
Then I came across this…
Something hot…
Well, again, I think…
Well, again, I think…
 Yeah, I can do it!
The Gangnam Style song is 4:12 long.
            That is 252 seconds.
 With 10 FPS, it needs 2520 spreadsheets.
    That is 10 spreadsheet documents.
(Each has a maximum of 256 spreadsheets.)
I can then concatenate the 10 recorded videos,
              join them into one,
     and create an OpenOffice Calc Style.
So here is it. Enjoy!
Get Calc Mosaic!
http://sf.net/p/calcmosaic
Thank you.
Any questions?
1 of 76

Recommended

Multimedia Fun with OpenOffice Calc by
Multimedia Fun with OpenOffice CalcMultimedia Fun with OpenOffice Calc
Multimedia Fun with OpenOffice Calcimacat .
1K views97 slides
Martin Egelund Poulsen, kongehøj iii langhuse og stenfyldte forsænkninger fra... by
Martin Egelund Poulsen, kongehøj iii langhuse og stenfyldte forsænkninger fra...Martin Egelund Poulsen, kongehøj iii langhuse og stenfyldte forsænkninger fra...
Martin Egelund Poulsen, kongehøj iii langhuse og stenfyldte forsænkninger fra...Association of Danish Museums / Organisationen Danske Museer
436 views18 slides
1 csu mass_innoculation by
1 csu mass_innoculation1 csu mass_innoculation
1 csu mass_innoculationBrandon Williams
877 views68 slides
Work in progress 2 by
Work in progress 2Work in progress 2
Work in progress 2vangoh3
213 views6 slides

More Related Content

Viewers also liked

Wm moorhead practical steps in business continuity planning, shared strategies by
Wm moorhead   practical steps in business continuity planning, shared strategiesWm moorhead   practical steps in business continuity planning, shared strategies
Wm moorhead practical steps in business continuity planning, shared strategiesBrandon Williams
316 views19 slides
Programmeren in alice[1] by
Programmeren in alice[1]Programmeren in alice[1]
Programmeren in alice[1]Gilles Horemans
4.8K views10 slides

Viewers also liked(20)

Wm moorhead practical steps in business continuity planning, shared strategies by Brandon Williams
Wm moorhead   practical steps in business continuity planning, shared strategiesWm moorhead   practical steps in business continuity planning, shared strategies
Wm moorhead practical steps in business continuity planning, shared strategies
Brandon Williams316 views
Trea1 joseluis garcía_azabarte by joseluisguitar
Trea1 joseluis garcía_azabarteTrea1 joseluis garcía_azabarte
Trea1 joseluis garcía_azabarte
joseluisguitar115 views
Lead Management in SugarCRM Series: Viewing Leads by Atcore Systems
Lead Management in SugarCRM Series: Viewing LeadsLead Management in SugarCRM Series: Viewing Leads
Lead Management in SugarCRM Series: Viewing Leads
Atcore Systems 838 views
OpenOffice, Open Business by imacat .
OpenOffice, Open BusinessOpenOffice, Open Business
OpenOffice, Open Business
imacat .2.1K views

Similar to Mosaic Fun with OpenOffice Calc

Javascript Animation with Canvas - Gregory Starr 2015 by
Javascript Animation with Canvas - Gregory Starr 2015Javascript Animation with Canvas - Gregory Starr 2015
Javascript Animation with Canvas - Gregory Starr 2015Gregory Starr
1.1K views30 slides
Smalltalk in the pocket - Building applications for the iPhone by
Smalltalk in the pocket - Building applications for the iPhoneSmalltalk in the pocket - Building applications for the iPhone
Smalltalk in the pocket - Building applications for the iPhoneEsteban Lorenzano
965 views27 slides
Framing the canvas - DroidCon Paris 2014 by
Framing the canvas - DroidCon Paris 2014Framing the canvas - DroidCon Paris 2014
Framing the canvas - DroidCon Paris 2014Paris Android User Group
1.1K views39 slides
WRA 210 April 14th PowerPoint by
WRA 210 April 14th PowerPointWRA 210 April 14th PowerPoint
WRA 210 April 14th PowerPointMiami University
165 views41 slides
Frost by
FrostFrost
FrostShalin Hai-Jew
87 views65 slides
Transcript - Data Visualisation - Tools and Techniques by
Transcript - Data Visualisation - Tools and TechniquesTranscript - Data Visualisation - Tools and Techniques
Transcript - Data Visualisation - Tools and TechniquesARDC
743 views20 slides

Similar to Mosaic Fun with OpenOffice Calc(20)

Javascript Animation with Canvas - Gregory Starr 2015 by Gregory Starr
Javascript Animation with Canvas - Gregory Starr 2015Javascript Animation with Canvas - Gregory Starr 2015
Javascript Animation with Canvas - Gregory Starr 2015
Gregory Starr1.1K views
Smalltalk in the pocket - Building applications for the iPhone by Esteban Lorenzano
Smalltalk in the pocket - Building applications for the iPhoneSmalltalk in the pocket - Building applications for the iPhone
Smalltalk in the pocket - Building applications for the iPhone
Esteban Lorenzano965 views
Transcript - Data Visualisation - Tools and Techniques by ARDC
Transcript - Data Visualisation - Tools and TechniquesTranscript - Data Visualisation - Tools and Techniques
Transcript - Data Visualisation - Tools and Techniques
ARDC743 views
Adobe Illustrator - Creating the Poster by Timothy F McKenna
Adobe Illustrator - Creating the PosterAdobe Illustrator - Creating the Poster
Adobe Illustrator - Creating the Poster
Timothy F McKenna1.3K views
What does OOP stand for? by Colin Riley
What does OOP stand for?What does OOP stand for?
What does OOP stand for?
Colin Riley3.1K views
Coding - Pixel Art by isarevi
Coding - Pixel ArtCoding - Pixel Art
Coding - Pixel Art
isarevi150 views
16 OpenCV Functions to Start your Computer Vision journey.docx by ssuser90e017
16 OpenCV Functions to Start your Computer Vision journey.docx16 OpenCV Functions to Start your Computer Vision journey.docx
16 OpenCV Functions to Start your Computer Vision journey.docx
ssuser90e01792 views
Umbra Ignite 2015: Alex Evans – Learning from failure – prototypes, R&D, iter... by Umbra Software
Umbra Ignite 2015: Alex Evans – Learning from failure – prototypes, R&D, iter...Umbra Ignite 2015: Alex Evans – Learning from failure – prototypes, R&D, iter...
Umbra Ignite 2015: Alex Evans – Learning from failure – prototypes, R&D, iter...
Umbra Software775 views
3. fmp production experiments (finished) by sean cawood
3. fmp production experiments (finished)3. fmp production experiments (finished)
3. fmp production experiments (finished)
sean cawood28 views
Scilab for real dummies j.heikell - part 1 by Scilab
Scilab for real dummies j.heikell - part 1Scilab for real dummies j.heikell - part 1
Scilab for real dummies j.heikell - part 1
Scilab7.8K views

More from imacat .

A Room of WikiWomen's Own by
A Room of WikiWomen's OwnA Room of WikiWomen's Own
A Room of WikiWomen's Ownimacat .
390 views21 slides
Office寶可夢GO IV計算機 by
Office寶可夢GO IV計算機Office寶可夢GO IV計算機
Office寶可夢GO IV計算機imacat .
1.9K views113 slides
Crossing Office Applications by
Crossing Office ApplicationsCrossing Office Applications
Crossing Office Applicationsimacat .
918 views46 slides
OpenOffice Application with Python by
OpenOffice Application with PythonOpenOffice Application with Python
OpenOffice Application with Pythonimacat .
2.1K views60 slides
從doc、docx、odt到Google Docs by
從doc、docx、odt到Google Docs從doc、docx、odt到Google Docs
從doc、docx、odt到Google Docsimacat .
2.5K views46 slides
More Girls – Creating a Community of Diversity by
More Girls – Creating a Community of DiversityMore Girls – Creating a Community of Diversity
More Girls – Creating a Community of Diversityimacat .
2.6K views105 slides

More from imacat .(20)

A Room of WikiWomen's Own by imacat .
A Room of WikiWomen's OwnA Room of WikiWomen's Own
A Room of WikiWomen's Own
imacat .390 views
Office寶可夢GO IV計算機 by imacat .
Office寶可夢GO IV計算機Office寶可夢GO IV計算機
Office寶可夢GO IV計算機
imacat .1.9K views
Crossing Office Applications by imacat .
Crossing Office ApplicationsCrossing Office Applications
Crossing Office Applications
imacat .918 views
OpenOffice Application with Python by imacat .
OpenOffice Application with PythonOpenOffice Application with Python
OpenOffice Application with Python
imacat .2.1K views
從doc、docx、odt到Google Docs by imacat .
從doc、docx、odt到Google Docs從doc、docx、odt到Google Docs
從doc、docx、odt到Google Docs
imacat .2.5K views
More Girls – Creating a Community of Diversity by imacat .
More Girls – Creating a Community of DiversityMore Girls – Creating a Community of Diversity
More Girls – Creating a Community of Diversity
imacat .2.6K views
Welcome to Apache OpenOffice 4 by imacat .
Welcome to Apache OpenOffice 4Welcome to Apache OpenOffice 4
Welcome to Apache OpenOffice 4
imacat .1.4K views
Welcome to Apache OpenOffice 3.4 COSCUP 2012 by imacat .
Welcome to Apache OpenOffice 3.4 COSCUP 2012Welcome to Apache OpenOffice 3.4 COSCUP 2012
Welcome to Apache OpenOffice 3.4 COSCUP 2012
imacat .672 views
GNU Autoconf / Automake #4 by imacat .
GNU Autoconf / Automake #4GNU Autoconf / Automake #4
GNU Autoconf / Automake #4
imacat .743 views
GNU Autoconf / Automake #1 by imacat .
GNU Autoconf / Automake #1GNU Autoconf / Automake #1
GNU Autoconf / Automake #1
imacat .1.2K views
Solitaire with Greenfoot #3 by imacat .
Solitaire with Greenfoot #3Solitaire with Greenfoot #3
Solitaire with Greenfoot #3
imacat .348 views
Solitaire with Greenfoot #1 by imacat .
Solitaire with Greenfoot #1Solitaire with Greenfoot #1
Solitaire with Greenfoot #1
imacat .1.1K views
Solitaire with Greenfoot #4 by imacat .
Solitaire with Greenfoot #4Solitaire with Greenfoot #4
Solitaire with Greenfoot #4
imacat .675 views
Solitaire with Greenfoot #2 by imacat .
Solitaire with Greenfoot #2Solitaire with Greenfoot #2
Solitaire with Greenfoot #2
imacat .366 views
Solitaire with Greenfoot #2/4 by imacat .
Solitaire with Greenfoot #2/4Solitaire with Greenfoot #2/4
Solitaire with Greenfoot #2/4
imacat .375 views
Object-Oriented Programming Design with Greenfoot 02 by imacat .
Object-Oriented Programming Design with Greenfoot 02Object-Oriented Programming Design with Greenfoot 02
Object-Oriented Programming Design with Greenfoot 02
imacat .456 views
Object-Oriented Programming Design with Greenfoot 01 by imacat .
Object-Oriented Programming Design with Greenfoot 01Object-Oriented Programming Design with Greenfoot 01
Object-Oriented Programming Design with Greenfoot 01
imacat .722 views
Welcome to Apache OpenOffice 3.4 by imacat .
Welcome to Apache OpenOffice 3.4Welcome to Apache OpenOffice 3.4
Welcome to Apache OpenOffice 3.4
imacat .1K views
OpenOffice UNO Application on Android by imacat .
OpenOffice UNO Application on AndroidOpenOffice UNO Application on Android
OpenOffice UNO Application on Android
imacat .1.4K views
OpenOffice.org Magic Sandbox by imacat .
OpenOffice.org Magic SandboxOpenOffice.org Magic Sandbox
OpenOffice.org Magic Sandbox
imacat .398 views

Recently uploaded

Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...ShapeBlue
186 views15 slides
"Surviving highload with Node.js", Andrii Shumada by
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada Fwdays
56 views29 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
222 views7 slides
State of the Union - Rohit Yadav - Apache CloudStack by
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStackShapeBlue
297 views53 slides
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
263 views23 slides
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesShapeBlue
252 views15 slides

Recently uploaded(20)

Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... by ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue186 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays56 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue222 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue297 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue263 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue252 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue147 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue166 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu423 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue145 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue119 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue130 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue218 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue161 views
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T by ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue152 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc170 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue139 views

Mosaic Fun with OpenOffice Calc

  • 1. Mosaic Fun with OpenOffice Calc imacat (Yang Shih-Ching) <imacat@mail.imacat.idv.tw> 2012/11/6
  • 2. “Mosaic Fun with OpenOffice Calc” is created by imacat (Yang Shih-Ching), and licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
  • 3. imacat / Yang Shih-Ching ● From Taiwan local OpenOffice community ● A graduate student from the Computer Science Education Laboratory, National Taiwan Normal University ● A member of Women in FOSS in Taiwan ● Was… – A Sun/Oracle freelance lecturer – An OpenOffice RD for 1 year – A web application developer for 8 years
  • 4. This session is all about multimedia and fun. So please relax and enjoy!
  • 5. After all, I’m not a show business professional. I’m a developer. Please forgive me if this is not cool enough. :p
  • 6. Since this is all about multimedia, before we start, lets get some multimedia first! ^_*’
  • 9. I will start by telling a story…
  • 10. Long time ago in the far, far land when I was still a child…
  • 11. Long time ago in the far, far land when I was still a child… Well, actually it was only in this August. :p
  • 12. I saw on my RSS reader...
  • 13. So I followed the story and watched the video…
  • 15. It’s cool, isn’t it? Yes, it’s SO COOL!
  • 16. I forwarded it onto our Google Plus, our Facebook fans page, our forums, local forum, etc.
  • 17. I forwarded it onto our Google Plus, our Facebook fans page, our forums, local forum, etc. Then I put it away and return to my textbook.
  • 18. Until I saw Rob talking about this video the next day…
  • 19. So I watched it again, and also the “behind the scenes”…
  • 21. Well, I think… Yeah, I can do it…
  • 22. Well, I think… Yeah, I can do it… programmatically!
  • 23. Creating mosaic art involves calculating the average colors of image blocks. Since neither OpenOffice BASIC nor UNO API has any method to obtain the colors of individual pixels, I have use Java to do this.
  • 24. So here it is… ^_^
  • 27. No.
  • 28. No, that’s not cool. It’s uglier than the original “Stop-Motion Excel”. It’s not the “eye candy” that I imagined.
  • 29. Why? The original “Stop-Motion Excel” was painted manually, cell by cell. MysteryGuitarMan painted it with a fixed palette, but not “average colors”. It looks sharp. It feels like an animation.
  • 30. Comparing Hand-Painted Colors with Mosaic Average Colors
  • 31. So I need to find something more cool, something sharp, something with a high contrast.
  • 32. That is not an easy task.
  • 33. The idea of Calc Mosaic is not only to create mosaic arts, but also to create stop-motion animations.
  • 34. But it takes averagely 20 seconds to create a spreadsheet of mosaic art with the Java UNO application. I cannot run the animation by creating the mosaic art at real-time.
  • 35. So I turn to another method, to create each frame with a spreadsheet, and play them in sequence, as a stop-motion animation.
  • 36. But then a spreadsheet document can only contain a maximum of 256 spreadsheets.
  • 37. Since I only have 256 frames, this cannot be long.
  • 38. I remembered there is the iPod Ad
  • 39. The iPod Ad… ● Has only 31 seconds, corresponding to 8 FPS if we are having 256 frames.
  • 40. The iPod Ad… ● Has only 31 seconds, corresponding to 8 FPS if we are having 256 frames. ● Has sharp images, high contrasts.
  • 41. The iPod Ad… ● Has only 31 seconds, corresponding to 8 FPS if we are having 256 frames. ● Has sharp images, high contrasts. ● Is very famous.
  • 42. So here it is…
  • 44. At the same time, Villeroy responded to my Calc Mosaic on the forum, using a different approach.
  • 46. So here it is…
  • 48. As you can see, Villeroy places the color values in the cells. The OpenOffice BASIC macro can read and update the cell background colors accordingly. OpenOffice BASIC is a lot faster than Java UNO. This makes it possible to animate at real time.
  • 49. Villeroy’s approach still has some disadvantages…
  • 50. Disadvantages of Villeroy’s Approach ● You still need to have the color values first.
  • 51. Disadvantages of Villeroy’s Approach ● You still need to have the color values first. ● The frame rate is still low.
  • 52. Disadvantages of Villeroy’s Approach ● You still need to have the color values first. ● The frame rate is still low. ● Villeroy updates the colors with styles. – A lot faster than painting the background color cell by cell. – The number of colors to use is limited. That is why it is gray-scaled.
  • 53. This is a different approach than me. But I still got greatly inspired.
  • 54. The color values can be saved in the sheets, and painted with OpenOffice BASIC. This can make it a lot faster.
  • 55. And I know there is the setDataArray() in the interface XCellRangeData. I can populate all the color values at once instead of hundreds of UNO calls to set the CellBackColor property Of SheetCell.
  • 56. The New Process Will Be… 1.Calculates the average colors of mosaic cells with the Java application.
  • 57. The New Process Will Be… 1.Calculates the average colors of mosaic cells with the Java application. 2.Passes the color values from Java to OpenOffice BASIC.
  • 58. The New Process Will Be… 1.Calculates the average colors of mosaic cells with the Java application. 2.Passes the color values from Java to OpenOffice BASIC. 3.Paints the background colors of the spreadsheet cells with the OpenOffice BASIC macro.
  • 59. So the problem becomes: Writing an application both in Java and OpenOffice BASIC.
  • 60. So the problem becomes: Writing an application both in Java and OpenOffice BASIC. Or, simply, Creating the OpenOffice BASIC macros through the UNO API with Java.
  • 61. In the unpublished UNO API, there is a BasicLibraries property in OfficeDocument that application developers can access, insert or delete the BASIC macros.
  • 62. There’s also the XScriptProvider interface that I can use it to invoke the existing OpenOffice macros.
  • 63. So I use them to “inject” the BASIC macros into the newly-created spreadsheet document, and run these macros.
  • 64. In fact, I don’t even need to use setDataArray() to paste the color values into the spreadsheets. I can pass the color values as parameters to the invoked BASIC macros.
  • 65. This is troublesome, but the result is amazing. It is 8 times faster then before!
  • 66. When I prepare for this presentation, I became more and more greedy.
  • 67. I want something new, something hot, something gets people excited!
  • 68. Then I came across this…
  • 70. Well, again, I think…
  • 71. Well, again, I think… Yeah, I can do it!
  • 72. The Gangnam Style song is 4:12 long. That is 252 seconds. With 10 FPS, it needs 2520 spreadsheets. That is 10 spreadsheet documents. (Each has a maximum of 256 spreadsheets.)
  • 73. I can then concatenate the 10 recorded videos, join them into one, and create an OpenOffice Calc Style.
  • 74. So here is it. Enjoy!