[EMAIL PROTECTED] wrote:
> On Mon, 21 Apr 2008 20:58:36 +0200, Andrei Simion <[EMAIL PROTECTED]> 
> wrote:
> 
>> Hi,
>>
>> I previously reported a memory leak in Gimp 2.2.
>>
>> I was told to install version 2.4 and the issue doesn't go away.
>>
>> The problem is that I discovered something even worst and it does take
>> place in both 2.2 and 2.4.
>>
>> If one runs a Gimp-Perl script for a number of times, enough to use the
>> whole physical memory, then the Gimp server crashes, it does not create
>> the swap. That's it, no swap file is created.
>>
>> I think there may be a configuration issue.
>>
>> If a test script is needed I can provide it.
>>
>> Thanks,
>> Andrei
> 
> That would certainly be worthwhile.
> 
> pls post.
> 
> /gg
> 

#!/usr/bin/perl

use Gimp qw(:auto);
use Gimp::Fu;
#use Gimp::Compat;

sub logov1 {
     my($text, $font, $fontsize, $fontcolor, $outlinesize, $outlinecolor,
         $shadowoffset, $shadowblur, $embossamount, $glowamount,
         $bevelamount, $texture, $alignment, $bgfile, $logowidth,
         $logoheight,$usebgdim,$textoffset,$vertoffset,$glowopacity,
         $textureopacity,$buttontexture,$buttoncolor,$buttonstyle,
         $backimage,$outfile) = @_;

     gimp_context_push();

     #print STDOUT "bgfile: <$bgfile>\n";
     if ($bgfile ne "none") {
         $img = gimp_file_load($bgfile,$bgfile);
     } else {
#print "creating background with $buttontexture,$buttonstyle\n";
         $backgroundcolor = "#FFFFFF";
    if ($backimage ne "") {
         $backgroundcolorimage = gimp_file_load($backimage,$backimage);

#       $backgroundcolor = 
gimp_image_pick_color($backgroundcolorimage,$drawable,1,1,1,0,0,1);
     } else {
         $backgroundcolor = "#FFFFFF";
     }

         gimp_context_set_background($backgroundcolor);
         gimp_context_get_background();

         $img = gimp_image_new($logowidth,$logoheight,RGB);
         $layer = 
gimp_layer_new($img,$logowidth,$logoheight,0,"Background",100,0);
         gimp_image_add_layer($img,$layer,0);
         gimp_layer_add_alpha($layer);
         gimp_selection_all($img);
         gimp_drawable_fill($layer,BACKGROUND_FILL);

         $buttonlayer = 
gimp_layer_new($img,$logowidth,$logoheight,0,"Button layer",100,0);
         gimp_image_add_layer($img,$buttonlayer,0);
         gimp_layer_add_alpha($buttonlayer);
         gimp_drawable_fill($buttonlayer,TRANSPARENT_FILL);
         gimp_selection_none($img);

         # start button style
         if ($buttonstyle =~ /round/i) {
        # select elipse and rectangle added together for rounded button
 
gimp_ellipse_select($img,$logowidth-$logoheight,0,$logoheight,$logoheight,0,1,0,0);
             gimp_rect_select($img,0,0,$logowidth - 
$logoheight/2,$logoheight,0,0,0);
         } else {
             gimp_selection_all($img);
         }

         # button texture
         if ($buttontexture ne "none") {
             open(LOG1, ">>/home/build/gimp/logs/gimp_steve_pm.log");
             print LOG1 "Button texture: <$buttontexture>\n";
             close(LOG1);

             $success = 0;
             ($numPatterns, @pattern_list) = gimp_patterns_get_list('');
             foreach $pattern (@pattern_list) {
                 #print STDOUT $pattern . "\n";
                 if ($pattern eq $buttontexture) {
                     $success = 1;
                     #print STDOUT "\n\nsuccess [$buttontexture]\n\n";
                     break;
                 }
             }
             if ($success) {
                 gimp_context_set_pattern($buttontexture);
 
#gimp_edit_bucket_fill($buttonlayer,PATTERN_FILL,0,100,0,0,0,0);
 
gimp_edit_bucket_fill($buttonlayer,PATTERN_BUCKET_FILL,0,100,0,0,0,0);
                 plug_in_colorify($img,$buttonlayer,$buttoncolor);
             }
         }

         if (0) {
             $success = 0;
             @pattern_list = gimp_patterns_get_list();
             foreach $pattern (@pattern_list) {
                 if ($pattern eq $buttontexture) {
                     $success = 1;
                     #print "\n\nsuccess $buttontexure\n\n";
                     break;
                 }
             }

             if ($success) {
                 $textureimg = gimp_image_new($logowidth,$logoheight,GRAY);

                 $texturelayer = 
gimp_layer_new($textureimg,$logowidth,$logoheight,GRAY-IMAGE,"Texture 
layer",$textureopacity,0);
                 $texturelayer2 = 
gimp_layer_new($img,$logowidth,$logoheight,RGB-IMAGE,"Texture 
layer",$textureopacity,0);

                 gimp_drawable_fill($texturelayer,PATTERN_FILL);
                 gimp_drawable_fill($texturelayer2,PATTERN_FILL);
                 gimp_layer_add_alpha($texturelayer);
                 gimp_layer_add_alpha($texturelayer2);


                 gimp_context_set_pattern($buttontexture);
 
gimp_edit_bucket_fill($texturelayer,2,0,$textureopacity,255,0,0,0);
                 gimp_image_add_layer($textureimg,$texturelayer,0);

                 gimp_image_convert_rgb($textureimg);

                 gimp_selection_all($textureimg);
                 gimp_edit_copy($texturelayer);

                 $texturelayer2 = gimp_edit_paste($texturelayer2,0);
                 gimp_selection_layer_alpha($buttonlayer);
                 gimp_selection_invert($img);
                 gimp_edit_cut($texturelayer2);
                 gimp_selection_none($img);

                 gimp_layer_set_opacity($texturelayer2,$textureopacity);

                 $buttonlayer = 
gimp_image_merge_down($img,$texturelayer2,2);
             }
         } # end if buttontexture
     # end button texture

         $background = gimp_image_merge_visible_layers($img,1);

     } # end else not exist bgfile

     if ($usebgdim) {
         $logoheight = gimp_image_height($img);
         $logowidth = gimp_image_width($img);
     }

     if (! gimp_drawable_is_rgb(gimp_image_active_drawable($img)) ) {
         gimp_image_convert_rgb($img);
     }

     gimp_context_set_foreground($fontcolor);

     # Create the text layer. Using -1 as the drawable creates a new layer.

     my $text_layer = 
gimp_layer_new($img,$logowidth,$logoheight,0,"text_layer",0,0);
     gimp_image_add_layer($img,$text_layer,0);
gimp_layer_add_alpha($text_layer);

     $img->gimp_selection_none;

     Gimp::Fu::save_image($img, $outfile);
     $img->gimp_image_delete;
     gimp_context_pop();

#return $img;

}

# register the script

register "logov1",
     "logo",
     "logo",
     "A",
     "B",
     "1999-06-09",
     "<Toolbox>/Xtns/Web/SS Logo",
     "",
     [
      [PF_STRING, "text",     "text", "sitesell rules"],
      [PF_FONT,   "font",     "font",   "Utopia Bold"],
      [PF_INT,    "fontsize", "Font Size", "70"],
      [PF_COLOR,  "fontcolor","Font Color", [255,200,0]],
      [PF_INT,    "outlinesize",   "Outline Size", "3"],
      [PF_COLOR,  "outlinecolor",  "Outline Color", [0,0,0]],
      [PF_INT,    "shadowoffset", "Drop Shadow Offset", "0"],
      [PF_INT,    "shadowblur",  "Drop Shadow Blur","0"],
      [PF_INT,    "embossamount", "Emboss Amount", "0"],
      [PF_INT,    "glowamount", "Glow Amount", "0"],
      [PF_INT,    "bevelamount", "Bevel Amount", "0"],
      [PF_STRING, "texture",  "Texture", "none"],
      [PF_STRING, "alignment","Alignment", "left"],
      [PF_STRING, "bgfile",   "Background file", "none"],
      [PF_INT,    "width",    "Width", "725"],
      [PF_INT,    "height",   "Height", "80"],
      [PF_INT,    "usebgdim", "Use BG Image Dimensions", "0"],
      [PF_INT,    "textoffset", "Offset for text to start", "0"],
      [PF_INT,    "vertoffset", "Vertical offset for text to start", "0"],
      [PF_INT,    "glowopacity", "Opacity of glow effect", "75"],
      [PF_INT,    "textureopacity", "Opacity of texture", "50"],
      [PF_STRING, "buttontexture", "button texture", "none"],
      [PF_COLOR,  "buttoncolor", "button color", [255,0,0]],
      [PF_STRING, "buttonstyle", "button style", "roundoutline"],
      [PF_STRING, "backimage","Background color file",""],
      [PF_STRING, "outfile",  "Output file name","/tmp/logov1.gif"]
     ],
     \&logov1;

# Handle over control to gimp
exit main();
#main();

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to