[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kjsembed
Subject:    [kjsembed] kdebindings/kjsembed/docs/examples/imunge
From:       Richard J. Moore <rich () kde ! org>
Date:       2004-05-21 0:24:45
Message-ID: 20040521002445.556DC93A7 () office ! kde ! org
[Download RAW message or body]

CVS commit by rich: 

- Improved the Imunge example code by splitting the image effect handling into
  a standalone file. In addition, I added support to the GUI for several
  additional effects and added a toolbar that makes it easy to invoke them.


  A            imunge_actions.js   1.1
  M +9 -48     imunge.js   1.3
  M +16 -1     imungeui.rc   1.2


--- kdebindings/kjsembed/docs/examples/imunge/imunge.js  #1.2:1.3
@@ -7,5 +7,4 @@
 
 mw = new KMainWindow();
-
 ac = mw.actionCollection();
 mb = mw.menuBar();
@@ -122,40 +121,4 @@
 
 //
-// Applies a water color effect filter to the image
-//
-mw.apply_watercolor = function()
-{
-    this.img.setPixmap( lbl.pixmap );
-
-    this.img = imgfx.contrast(this.img, 200);
-    this.img = imgfx.despeckle(this.img);
-    this.img = imgfx.despeckle(this.img);
-    this.img = imgfx.despeckle(this.img);
-    this.img = imgfx.sharpen(this.img);
-
-    this.update_view();
-}
-
-//
-// Applies a charcoal effect filter to the image
-//
-mw.apply_charcoal = function()
-{
-    this.img = imgfx.charcoal(this.img, 0.2);
-
-    this.update_view();
-}
-
-//
-// Applies a implode effect filter to the image
-//
-mw.apply_implode = function()
-{
-    this.img = imgfx.implode(this.img, 30, 'white');
-
-    this.update_view();
-}
-
-//
 // Setup the actions
 //
@@ -190,15 +153,12 @@
 
     // Effects
-    watercolor_action = new KAction( ac, 'watercolor_action' );
-    watercolor_action.text = 'Water Color';
-    watercolor_action.connect( watercolor_action, 'activated()', this, 'apply_watercolor' );
-    
-    charcoal_action = new KAction( ac, 'charcoal_action' );
-    charcoal_action.text = 'Charcoal';
-    charcoal_action.connect( charcoal_action, 'activated()', this, 'apply_charcoal' );
-
-    implode_action = new KAction( ac, 'implode_action' );
-    implode_action.text = 'Implode';
-    implode_action.connect( implode_action, 'activated()', this, 'apply_implode' );
+    this.create_watercolor( this, ac );
+    this.create_charcoal( this, ac );
+    this.create_implode( this, ac );
+    this.create_emboss( this, ac );
+    this.create_normalize( this, ac );
+    this.create_equalize( this, ac );
+    this.create_despeckle( this, ac );
+    this.create_togray( this, ac );
 
     // Tools
@@ -224,4 +184,5 @@
 // Activate XMLGUI and show the window
 //
+load( 'imunge_actions.js' );
 mw.setup_actions();
 

--- kdebindings/kjsembed/docs/examples/imunge/imungeui.rc  #1.1:1.2
@@ -6,4 +6,9 @@
     <Action name="charcoal_action" />
     <Action name="implode_action" />
+    <Action name="emboss_action" />
+    <Action name="normalize_action" />
+    <Action name="equalize_action" />
+    <Action name="despeckle_action" />
+    <Action name="togray_action" />
   </Menu>
   <Menu name="tools"><text>&amp;Tools</text>
@@ -11,13 +16,23 @@
   </Menu>
 </MenuBar>
+<!--
 <ToolBar name="view"><text>View Toolbar</text>
   <Action name="view_zoom_in"/>
   <Action name="view_zoom_out"/>
   <Action name="view_zoom"/>
-<!--
   <Separator/>
   <Action name="view_actual_size"/>
   <Action name="view_fit_to_page"/>
+</ToolBar>
 -->
+<ToolBar name="effects" position="left" iconText="icontextright"><text>Effects</text>
+    <Action name="watercolor_action" />
+    <Action name="charcoal_action" />
+    <Action name="implode_action" />
+    <Action name="emboss_action" />
+    <Action name="normalize_action" />
+    <Action name="equalize_action" />
+    <Action name="despeckle_action" />
+    <Action name="togray_action" />
 </ToolBar>
 </kpartgui>


_______________________________________________
kjsembed mailing list
kjsembed@kde.org
https://mail.kde.org/mailman/listinfo/kjsembed
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic