|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
about renderer, tools and SWT ImageHi!
I think this question should probably direct to some eclipse mailing list, but there is implementation in udig so if you just could give a hint where to search.. =) I have currently implementing my own renderer, now i would like to use swt Image where first draw the image and then draw that to Graphics2D which IRender interface offer. Now what happend when i draw the swt Image to the awt Graphics, it has white background, and i cant find a way to prevent this, i tried also first to create swt Image in renderer with udig's AWTSWTImageutils: final Image image = AWTSWTImageUtils.convertToSWTImage(getContext().getImage()); but in that case it doesnt show anything, i tried also save that image to jpeg but it is totally black, the size is correct.. I think this is already done in udig because in tools we can add Draw command (AbstractDrawCommand) where we have ViewportGraphics which seems to be SWTViewportGraphics and it uses swt Image.. if i draw using this one then there is no white background.. any hints? The reason all this is that the SimpleFeatures and SimpleFeatureTypes are almost impossible to draw my domain objects so i have made my own class model, where every class contains it own way to draw itself, and i want to use this same draw implementation in edit tools and render. Thanks, Artsi _______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageHi Arto,
Arto Pastinen wrote: > Hi! > > I think this question should probably direct to some eclipse mailing > list, but there is implementation in udig so if you just could give a > hint where to search.. =) and if you find the answer there, please post is here... > > I have currently implementing my own renderer, now i would like to use > swt Image where first draw the image and then draw that to Graphics2D > which IRender interface offer. > Now what happend when i draw the swt Image to the awt Graphics, it has > white background, and i cant find a way to prevent this, i tried also > first to create swt Image in renderer with udig's AWTSWTImageutils: > final Image image = AWTSWTImageUtils.convertToSWTImage(getContext().getImage()); > but in that case it doesnt show anything, i tried also save that image > to jpeg but it is totally black, the size is correct.. I noticed something similar last week, when updating the code to trunk. In the old application (based on a trunk version of last year) the render creates transparent images. The current trunk generates images with white background. I'm using a modified version of ApplicationGIS.drawMap(). I tried with different image types, but couldn't restore the old behaviour yet. (ApplicationGIS.drawMap() uses an AWT image.) Any hints on this will be appreciated. Cheers, Ugo > > I think this is already done in udig because in tools we can add Draw > command (AbstractDrawCommand) where we have ViewportGraphics which > seems to be SWTViewportGraphics and it uses swt Image.. if i draw > using this one then there is no white background.. > > any hints? > > The reason all this is that the SimpleFeatures and SimpleFeatureTypes > are almost impossible to draw my domain objects so i have made my own > class model, where every class contains it own way to draw itself, and > i want to use this same draw implementation in edit tools and render. > > Thanks, Artsi > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel > > > User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageHi Ugo,
I wanted continue for now on and quickly rid of this, so i just defined the white color as transparent pixel, but i think correct solution would be clone the image bottom of my image and draw to that. BufferedImage ci = getContext().getImage(); DirectColorModel cm = (DirectColorModel) contextImage .getColorModel(); PaletteData p = new PaletteData(cm.getRedMask(), cm.getGreenMask(), cm.getBlueMask()); ImageData id = new ImageData(ci.getWidth(),ci.getHeight(),cm.getPixelSize(), p id.transparentPixel = 0xFFFFFF; for (int i = 0, len = id.data.length; i < len; i++) { id.data[i] = (byte) 0xFF; } Image i = new Image(display, id); - Artsi 2009/11/11 Ugo Taddei <ugo.taddei@...>: > Hi Arto, > > Arto Pastinen wrote: >> >> Hi! >> >> I think this question should probably direct to some eclipse mailing >> list, but there is implementation in udig so if you just could give a >> hint where to search.. =) > > and if you find the answer there, please post is here... > >> >> I have currently implementing my own renderer, now i would like to use >> swt Image where first draw the image and then draw that to Graphics2D >> which IRender interface offer. >> Now what happend when i draw the swt Image to the awt Graphics, it has >> white background, and i cant find a way to prevent this, i tried also >> first to create swt Image in renderer with udig's AWTSWTImageutils: >> final Image image = >> AWTSWTImageUtils.convertToSWTImage(getContext().getImage()); >> but in that case it doesnt show anything, i tried also save that image >> to jpeg but it is totally black, the size is correct.. > > I noticed something similar last week, when updating the code to trunk. In > the old application (based on a trunk version of last year) the render > creates transparent images. The current trunk generates images with white > background. I'm using a modified version of ApplicationGIS.drawMap(). I > tried with different image types, but couldn't restore the old behaviour > yet. (ApplicationGIS.drawMap() uses an AWT image.) > > Any hints on this will be appreciated. > > Cheers, > > Ugo > >> >> I think this is already done in udig because in tools we can add Draw >> command (AbstractDrawCommand) where we have ViewportGraphics which >> seems to be SWTViewportGraphics and it uses swt Image.. if i draw >> using this one then there is no white background.. >> >> any hints? >> >> The reason all this is that the SimpleFeatures and SimpleFeatureTypes >> are almost impossible to draw my domain objects so i have made my own >> class model, where every class contains it own way to draw itself, and >> i want to use this same draw implementation in edit tools and render. >> >> Thanks, Artsi >> _______________________________________________ >> User-friendly Desktop Internet GIS (uDig) >> http://udig.refractions.net >> http://lists.refractions.net/mailman/listinfo/udig-devel >> >> >> > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel > User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageHello Arto,
thanks for the reply. I think I found the problem (after a long struggle with jai jars... But that's another matter). There was an original jai_core.jar in my system. I *think* it was responsible for a different rendering. I'd find it better to have this patched jai have a name different than it's original (something like jai_core_gt_patch.jar). In a system with a multitude of jars, it's ever so easy so overlook one. Cheers, Ugo Arto Pastinen wrote: > Hi Ugo, > > I wanted continue for now on and quickly rid of this, so i just > defined the white color as > transparent pixel, but i think correct solution would be clone the > image bottom of my image > and draw to that. > > BufferedImage ci = getContext().getImage(); > DirectColorModel cm = (DirectColorModel) contextImage > .getColorModel(); > PaletteData p = new PaletteData(cm.getRedMask(), cm.getGreenMask(), > cm.getBlueMask()); > ImageData id = new ImageData(ci.getWidth(),ci.getHeight(),cm.getPixelSize(), p > id.transparentPixel = 0xFFFFFF; > for (int i = 0, len = id.data.length; i < len; i++) { > id.data[i] = (byte) 0xFF; > } > Image i = new Image(display, id); > > - Artsi > > > > 2009/11/11 Ugo Taddei <ugo.taddei@...>: >> Hi Arto, >> >> Arto Pastinen wrote: >>> Hi! >>> >>> I think this question should probably direct to some eclipse mailing >>> list, but there is implementation in udig so if you just could give a >>> hint where to search.. =) >> and if you find the answer there, please post is here... >> >>> I have currently implementing my own renderer, now i would like to use >>> swt Image where first draw the image and then draw that to Graphics2D >>> which IRender interface offer. >>> Now what happend when i draw the swt Image to the awt Graphics, it has >>> white background, and i cant find a way to prevent this, i tried also >>> first to create swt Image in renderer with udig's AWTSWTImageutils: >>> final Image image = >>> AWTSWTImageUtils.convertToSWTImage(getContext().getImage()); >>> but in that case it doesnt show anything, i tried also save that image >>> to jpeg but it is totally black, the size is correct.. >> I noticed something similar last week, when updating the code to trunk. In >> the old application (based on a trunk version of last year) the render >> creates transparent images. The current trunk generates images with white >> background. I'm using a modified version of ApplicationGIS.drawMap(). I >> tried with different image types, but couldn't restore the old behaviour >> yet. (ApplicationGIS.drawMap() uses an AWT image.) >> >> Any hints on this will be appreciated. >> >> Cheers, >> >> Ugo >> >>> I think this is already done in udig because in tools we can add Draw >>> command (AbstractDrawCommand) where we have ViewportGraphics which >>> seems to be SWTViewportGraphics and it uses swt Image.. if i draw >>> using this one then there is no white background.. >>> >>> any hints? >>> >>> The reason all this is that the SimpleFeatures and SimpleFeatureTypes >>> are almost impossible to draw my domain objects so i have made my own >>> class model, where every class contains it own way to draw itself, and >>> i want to use this same draw implementation in edit tools and render. >>> >>> Thanks, Artsi >>> _______________________________________________ >>> User-friendly Desktop Internet GIS (uDig) >>> http://udig.refractions.net >>> http://lists.refractions.net/mailman/listinfo/udig-devel >>> >>> >>> >> _______________________________________________ >> User-friendly Desktop Internet GIS (uDig) >> http://udig.refractions.net >> http://lists.refractions.net/mailman/listinfo/udig-devel >> > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel > > > User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageOn Friday 20 November 2009 13:16:01 Ugo Taddei wrote:
> I'd find it better to have this patched jai have a name different than > it's original (something like jai_core_gt_patch.jar). In a system with a > multitude of jars, it's ever so easy so overlook one. +1 we have had confusion with that also _______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageStefan Krüger ha scritto:
> On Friday 20 November 2009 13:16:01 Ugo Taddei wrote: >> I'd find it better to have this patched jai have a name different than >> it's original (something like jai_core_gt_patch.jar). In a system with a >> multitude of jars, it's ever so easy so overlook one. > +1 Patched JAI? Patched how and by whom? First time I hear about this. Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. _______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageAndrea Aime wrote: > Stefan Krüger ha scritto: >> On Friday 20 November 2009 13:16:01 Ugo Taddei wrote: >>> I'd find it better to have this patched jai have a name different >>> than it's original (something like jai_core_gt_patch.jar). In a >>> system with a multitude of jars, it's ever so easy so overlook one. >> +1 > > Patched JAI? Patched how and by whom? I might have to take it back. In fact, reading the jai api I do see the method there (JAI.createTileCache()). So it's either osgi getting on my way again (not the first time this week) or my not paying attention. (I'd try to reproduce the state eclipse it was in when I found this, but I have just spent hours trying to make it work. So I ain't touching it again.) > First time I hear about this. > > Cheers > Andrea > Sorry Andreas, might be I'm mistaking it with image-ext? Cheers, Ugo _______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageHello,
indeed I had two different version. Probably not a gt patch, anyway: The manifests: Manifest-Version: 1.0 Sealed: true Implementation-Version: 1.1.2_01 Specification-Title: Java Advanced Imaging Specification-Version: 1.1-mr Implementation-Title: javax.media.jai Extension-Name: javax.media.jai Created-By: 1.3.1_03 (Sun Microsystems Inc.) Implementation-Vendor: Sun Microsystems, Inc. Specification-Vendor: Sun Microsystems, Inc. and Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.2 Created-By: 1.4.2_12-b03 (Sun Microsystems Inc.) Specification-Title: Java Advanced Imaging Specification-Version: 1.1-mr Specification-Vendor: Sun Microsystems, Inc. Implementation-Title: javax.media.jai Implementation-Version: 1.1.3 Implementation-Vendor: Sun Microsystems, Inc. Extension-Name: javax.media.jai Sealed: true Ugo Ugo Taddei wrote: > > > Andrea Aime wrote: >> Stefan Krüger ha scritto: >>> On Friday 20 November 2009 13:16:01 Ugo Taddei wrote: >>>> I'd find it better to have this patched jai have a name different >>>> than it's original (something like jai_core_gt_patch.jar). In a >>>> system with a multitude of jars, it's ever so easy so overlook one. >>> +1 >> >> Patched JAI? Patched how and by whom? > > I might have to take it back. In fact, reading the jai api I do see the > method there (JAI.createTileCache()). So it's either osgi getting on my > way again (not the first time this week) or my not paying attention. > > (I'd try to reproduce the state eclipse it was in when I found this, but > I have just spent hours trying to make it work. So I ain't touching it > again.) > >> First time I hear about this. >> >> Cheers >> Andrea >> > > Sorry Andreas, might be I'm mistaking it with image-ext? > > Cheers, > > Ugo > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel > > > User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
|
|
Re: about renderer, tools and SWT ImageIn swt Image.setBackground javadoc it reads:
"There are certain uses of Images that do not support transparency ... In these cases, it may be desired to simulate transparency by using background color ... I found that there was used Canvas somewhere maby it was glasspane or something, where things worked like they should, not Image, but i cant remember it anymore, so at least in my case i must define some color as transparent in render.. maby i still go back to AWT instead SWT when i have more time.. =) - Artsi _______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel |
| Free embeddable forum powered by Nabble | Forum Help |