[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] shell region from image
|
There is no method like
r.addData( new ImageLoader("c:/test.jpg").getData() );
Instead, you need to do something like:
Region region = new Region(display);
ImageData data = image.getImageData();
ImageData mask = data.getTransparencyMask();
Rectangle pixel = new Rectangle(0, 0, 1, 1);
for (int y = 0; y < mask.height; y++) {
for (int x = 0; x < mask.width; x++) {
if (mask.getPixel(x, y) != 0) {
pixel.x = data.x + x;
pixel.y = data.y + y;
region.add(pixel);
}
}
}
Colin Parcell <cparcell@xxxxxxxxxxxxxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx
12/06/2005 10:15 AM
Please respond to
"Eclipse Platform SWT component developers list."
To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
[platform-swt-dev] shell region from image
Is there currently a way of creating a region from an image found on the
filesystem. I would like to create a shell with curved edges and would
rather use a pre-defined image than use a Rectangle and remove the edges
via code.
I'm looking for something like:
Region r = new Region();
r.addData( new ImageLoader("c:/test.jpg").getData() );
shell.setRegion( r );
Thanks,
Colin
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Attachment:
cparcell.vcf
Description: Binary data