Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Erasing something drawn with drawString
Erasing something drawn with drawString [message #447848] Sun, 19 December 2004 02:16 Go to next message
Eclipse UserFriend
Originally posted by: lindseygeorge.hotmail.com

I have a composite with a background image, and to show this image
properly, I use the drawString method for putting in text, instead of
labels. How can I erase one such text line, before updating it with a
new one?

Thanks,
Lindsey.
Re: Erasing something drawn with drawString [message #447865 is a reply to message #447848] Mon, 20 December 2004 14:32 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Use Control.redraw(in, int, int, int, boolean). This will damage the area
you want to change and then in the paint event for that area, you draw it
correctly. You will have to draw the image as well as the text. You can
draw a portion of an image using GC.drawImage(Image image, int srcX, int
srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int
destHeight).


"Lindsey George" <lindseygeorge@hotmail.com> wrote in message
news:cq2odn$dl$1@www.eclipse.org...
>I have a composite with a background image, and to show this image
>properly, I use the drawString method for putting in text, instead of
>labels. How can I erase one such text line, before updating it with a new
>one?
>
> Thanks,
> Lindsey.
Re: Erasing something drawn with drawString [message #447866 is a reply to message #447865] Mon, 20 December 2004 14:35 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Note also that org.eclipse.swt.custom.CLabel supports text over an image.
Use CLabel.setBackground(Image) to set an image in the background.

"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cq6nrj$7ap$1@www.eclipse.org...
> Use Control.redraw(in, int, int, int, boolean). This will damage the area
> you want to change and then in the paint event for that area, you draw it
> correctly. You will have to draw the image as well as the text. You can
> draw a portion of an image using GC.drawImage(Image image, int srcX, int
> srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth,
> int destHeight).
>
>
> "Lindsey George" <lindseygeorge@hotmail.com> wrote in message
> news:cq2odn$dl$1@www.eclipse.org...
>>I have a composite with a background image, and to show this image
>>properly, I use the drawString method for putting in text, instead of
>>labels. How can I erase one such text line, before updating it with a new
>>one?
>>
>> Thanks,
>> Lindsey.
>
>
Re: Erasing something drawn with drawString [message #447878 is a reply to message #447866] Mon, 20 December 2004 18:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lindseygeorge.hotmail.com

Thanks Veronika. However, does CLabel support transparency? My composite
has the background image, and I would prefer not to have break up the
image into multiple parts, and then assign one of these parts as a
background image to a CLabel.

Thanks,
Lindsey.

Veronika Irvine wrote:
> Note also that org.eclipse.swt.custom.CLabel supports text over an image.
> Use CLabel.setBackground(Image) to set an image in the background.
>
> "Veronika Irvine" <veronika_irvine@oti.com> wrote in message
> news:cq6nrj$7ap$1@www.eclipse.org...
>
>>Use Control.redraw(in, int, int, int, boolean). This will damage the area
>>you want to change and then in the paint event for that area, you draw it
>>correctly. You will have to draw the image as well as the text. You can
>>draw a portion of an image using GC.drawImage(Image image, int srcX, int
>>srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth,
>>int destHeight).
>>
>>
>>"Lindsey George" <lindseygeorge@hotmail.com> wrote in message
>>news:cq2odn$dl$1@www.eclipse.org...
>>
>>>I have a composite with a background image, and to show this image
>>>properly, I use the drawString method for putting in text, instead of
>>>labels. How can I erase one such text line, before updating it with a new
>>>one?
>>>
>>>Thanks,
>>>Lindsey.
>>
>>
>
>
Re: Erasing something drawn with drawString [message #447890 is a reply to message #447878] Tue, 21 December 2004 13:59 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
It doesn't. There is currently no support for transparency in SWT.


"Lindsey George" <lindseygeorge@hotmail.com> wrote in message
news:cq76fg$r33$1@www.eclipse.org...
> Thanks Veronika. However, does CLabel support transparency? My composite
> has the background image, and I would prefer not to have break up the
> image into multiple parts, and then assign one of these parts as a
> background image to a CLabel.
>
> Thanks,
> Lindsey.
>
> Veronika Irvine wrote:
>> Note also that org.eclipse.swt.custom.CLabel supports text over an image.
>> Use CLabel.setBackground(Image) to set an image in the background.
>>
>> "Veronika Irvine" <veronika_irvine@oti.com> wrote in message
>> news:cq6nrj$7ap$1@www.eclipse.org...
>>
>>>Use Control.redraw(in, int, int, int, boolean). This will damage the
>>>area you want to change and then in the paint event for that area, you
>>>draw it correctly. You will have to draw the image as well as the text.
>>>You can draw a portion of an image using GC.drawImage(Image image, int
>>>srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int
>>>destWidth, int destHeight).
>>>
>>>
>>>"Lindsey George" <lindseygeorge@hotmail.com> wrote in message
>>>news:cq2odn$dl$1@www.eclipse.org...
>>>
>>>>I have a composite with a background image, and to show this image
>>>>properly, I use the drawString method for putting in text, instead of
>>>>labels. How can I erase one such text line, before updating it with a
>>>>new one?
>>>>
>>>>Thanks,
>>>>Lindsey.
>>>
>>>
>>
Re: Erasing something drawn with drawString [message #447948 is a reply to message #447865] Wed, 22 December 2004 05:16 Go to previous message
Eclipse UserFriend
Originally posted by: lindseygeorge.hotmail.com

Thanks Veronika! That worked!

Veronika Irvine wrote:
> Use Control.redraw(in, int, int, int, boolean). This will damage the area
> you want to change and then in the paint event for that area, you draw it
> correctly. You will have to draw the image as well as the text. You can
> draw a portion of an image using GC.drawImage(Image image, int srcX, int
> srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int
> destHeight).
>
>
> "Lindsey George" <lindseygeorge@hotmail.com> wrote in message
> news:cq2odn$dl$1@www.eclipse.org...
>
>>I have a composite with a background image, and to show this image
>>properly, I use the drawString method for putting in text, instead of
>>labels. How can I erase one such text line, before updating it with a new
>>one?
>>
>>Thanks,
>>Lindsey.
>
>
>
Previous Topic:scroll draw2d on a swt canvas
Next Topic:Remove "input methods" item in popup menu
Goto Forum:
  


Current Time: Fri Apr 19 14:40:33 GMT 2024

Powered by FUDForum. Page generated in 0.02466 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top