Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] about renderer, tools and SWT Image

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@xxxxxxxxxxxxxxxxxx>:
> 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
>


Back to the top