Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Imported Image In Manipulate Resizing in 7

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102604] Imported Image In Manipulate Resizing in 7
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Sun, 16 Aug 2009 06:42:15 -0400 (EDT)

I am seeing some irregular treatment of imported images in a
Dynamic Module.  On version 7.0.0 the code below shows
different results for its two outputs, which are an inset grid and a
Manipulate window showing the same.  They should display the
same, and indeed they do in version 6.0.2.0.  (I haven=92t been able
to test it in Version 7.0.1 so far.)

The results are displayed as soon as the code is run.  The problem
seems to be that PlotRange is affected inside a Dynamic
Module, at least in version 7.0.0.

The code below tries three alternative types of inset square.  In
both versions 6 and 7, if the "plain graphics square" is used
everything works fine.  The problem occurs with imported
bitmap graphics.  Alternative versions of the square are included
which replicate an imported bitmap of 59 x 59 pixels.

Suggestions on how to fix the image in Dynamic Module
appreciated.


(* Plain graphics version *)
square = Graphics[{Red, Rectangle[{0, 0}, {59, 59}]},
   PlotRange -> {{0, 59}, {0, 59}}, ImageSize -> {59, 59}];

(* Representation of imported BMP (59 x 59 pixels), version 6 style *)
square = Graphics[
   Raster[Table[
     Table[{0, 255, 255}, {59}], {59}], {{0, 0}, {59, 59}}, {0, 255},
    ColorFunction -> RGBColor], ImageSize -> {59, 59},
   PlotRange -> {{0, 59}, {0, 59}}];

(* Representation of imported BMP (59 x 59 pixels), version 7 style *)
If[StringTake[$Version, 1] === "7",
  square = Image[Table[Table[{0, 255, 255}, {59}], {59}],
    ColorSpace -> "RGB", ImageSize -> {59, 59}]];

grid = Graphics[{Black, Rectangle[{0, 0}, {481, 481}],
    Inset[square, {30.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 450.5}, {Center, Center}, {59, 59}]},
   PlotRange -> {{0, 481}, {0, 481}}, ImageSize -> 481];

insetgrid =
 Graphics[{Green, Rectangle[{0, 0}, {680, 481}],
   Inset[grid, {0, 0}, {0, 0}, {481, 481}
    ]}, PlotRange -> {{0, 680}, {0, 481}}, ImageSize -> 680]

Manipulate[
 DynamicModule[{},
  Graphics[{Green, Rectangle[{0, 0}, {680, 481}], Inset[
     grid, {0, 0}, {0, 0}, {481, 481}
     ]}, PlotRange -> {{0, 680}, {0, 481}}, ImageSize -> 680]],
 SaveDefinitions -> False]




  • Prev by Date: Re: Intersection of line and a surface of revolution - a
  • Next by Date: Re: Generating a list numnber in string format
  • Previous by thread: Re: Imported Image In Manipulate Resizing in 7
  • Next by thread: Re: Imported Image In Manipulate Resizing in 7