en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en en en en en en en en en en en en fr en en en en de nl en en en en nl en cs en en en en en en en en en en en nl en en en en en en en en en en en en en en nl en en en en en en en de en en en en en en en nl en en en en en en en en en en en en en en en en en en nl en en en cs en en en en en en en en nl vi en en en en en en en en en en en en en nl en en en en en en en en en en en en en en en en en en en en nl fr en en en en en en en en en en en en nl en en en en en en en en en en en en en en en nl en en en en en en en en en en en en en nl en en en en nl en en en en en en en en en en en en en en nl en en en en en en en nl en en en en nl en es en en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
I'm either not understanding something, or not getting the results according to what I'm reading with the command GRAPHIC COLOR. I read:
Set the foreground color and optionally the background color for various statements.
So I set up my graphic control:
CONTROL ADD GRAPHIC, CB.HNDL, idGraphic + 1000, "", 10, 10, 80, 60, _
%WS_CHILD OR %WS_VISIBLE OR %SS_NOTIFY
GRAPHIC ATTACH CB.HNDL, idGraphic + 1000
Then apply the following attempts:
GRAPHIC COLOR %RED, RGB(Colors(95).rgbRed, Colors(95).rgbGreen, Colors(95).rgbBlue)
(Colors is an internal RGB array.) But in either case, the background is default dialog gray. With a red Ellipse drawn on it.
Furcadia, an interesting online MMORPG in which you can create and program your own content.
Join Date: Nov 2002
26 Mar 2009, 10:19 AM
For what item are you trying change the background? the dialog or the ellipse?
Is something like this more like what you want?
GRAPHIC ELLIPSE (5,5)-(75,55), %Red, %Blue
Or, have you tried GRAPHIC PAINT over the area?
Join Date: Nov 2004
26 Mar 2009, 11:44 AM
The ellipse is unimportant, it's there for testing, the questions are:
Should not the graphic control become "invisible" against whatever background the dialog is when the background color is set to -2
If not, then should not the graphic control's background be rendered the set RGB color from my Colors()
And no, have not tried paint yet.
Furcadia, an interesting online MMORPG in which you can create and program your own content.
Join Date: Jun 1999
26 Mar 2009, 12:14 PM
your code behaves as I'd expect it to.
What result did you expect?
The default background is dialog grey and you never change that. If you want other than the default dialog grey as a background then you need to set the background colour then use GRAHIC CLEAR to clear the background to your desired colour. Then you can draw your red elipse on it.
The ellipses are drawn in the current foreground colour, red, and leave the background unchanged at whatever was last drawn, in your case that's the default grey.
Join Date: Nov 2004
26 Mar 2009, 07:17 PM
Need to learn that PB's graphic controls are passive reactors, ...
CONTROL ADD GRAPHIC, CB.HNDL, idGraphic + 1000, "", 10, 10, 80, 60, _ %WS_CHILD OR %WS_VISIBLE OR %SS_NOTIFY GRAPHIC ATTACH CB.HNDL, idGraphic + 1000 GRAPHIC COLOR %RED, -2 GRAPHIC CLEAR GRAPHIC ELLIPSE (5,5)-(75,55)
Background remains gray, so what does the manual mean when it says:
"If the background parameter is -2, the background is not painted, allowing the content behind to become visible"
The background is NOT gray! Matter of fact, it happens to be Colors(95).
CONTROL ADD GRAPHIC, CB.HNDL, idGraphic + 1000, "", 10, 10, 80, 60, _ %WS_CHILD OR %WS_VISIBLE OR %SS_NOTIFY GRAPHIC ATTACH CB.HNDL, idGraphic + 1000 GRAPHIC COLOR %RED, RGB(Colors(95).rgbRed, Colors(95).rgbGreen, Colors(95).rgbBlue) GRAPHIC CLEAR GRAPHIC ELLIPSE (5,5)-(75,55)
Essentially, this works, but leaves me in need to use something else should I happen to switch modes into Alpha Transparency blending against a background image. Along with hit testing for when the user clicks on the image(s) which are supposed to be movable within that background image.
Furcadia, an interesting online MMORPG in which you can create and program your own content.
Join Date: Apr 2007
27 Mar 2009, 12:00 AM
Perhaps if we had compilable code that shows the issue we could be more specific in our assistance.
In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.
Join Date: Jan 1980
27 Mar 2009, 12:58 AM
GRAPHIC ELLIPSE draws only a foreground image on the background which currently exists. When the current background is grey, you end up with a red ellipse on a grey background. If you want a different background, you must create it before you draw the ellipse. That's what you did in the second example.
GRAPHIC COLOR sets the default colors, to be used in the future, as they are needed. Some GRAPHIC functions (like Ellipse) use only a foreground color. Some GRAPHIC functions (like Clear) use only a background color. Some GRAPHIC functions (like Print) use both.
GRAPHIC ELLIPSE does not erase the entire previous background when it executes. That would make graphic statements practically useless, because you could never draw 2 ellipses, or 3, or 427 of them. Each new ellipse would erase the previous ones.
Join Date: Nov 2004
27 Mar 2009, 07:43 AM
Originally posted by Bob Zale View Post
GRAPHIC ELLIPSE does not erase the entire previous background when it executes. That would make graphic statements practically useless, because you could never draw 2 ellipses, or 3, or 427 of them. Each new ellipse would erase the previous ones.
I would expect that behavior, that's how a DC drawing surface should behave.
"If the background parameter is -2, the background is not painted, allowing the content behind to become visible."
So in the attached source code, the left graphic control does:
GRAPHIC COLOR nColor, -2 GRAPHIC CLEAR GRAPHIC ELLIPSE (5, 5) - (95, 95)
While the right graphic control does full foreground / background setting. The left graphic control remains "default dialog background".
graphics.zip (2.8 KB, 23 views)
Furcadia, an interesting online MMORPG in which you can create and program your own content.
Join Date: Jan 1980
27 Mar 2009, 08:57 AM
I'm sorry, Colin, but at this point I have no idea of your current question. You attached a very nice little program, but it doesn't seem to have much relation to the messages posted.
Join Date: Feb 2001
27 Mar 2009, 09:38 AM
Are you expecting the ellipse to be drawn filled with the background& colour set by GRAPHIC COLOR foreground& [, background&] ?
Ellipses don't work that way ..
#Compile Exe #Dim All Function PBMain() As Long Local hDlg As Dword Dialog New Pixels, 0, "Colours", 300, 300, 200, 200, %WS_OverlappedWindow To hDlg Control Add Button, hDlg, 100, "Paint", 50, 10, 100, 20 Dialog Show Modal hDlg Call DlgProc End Function '------------------/ CallBack Function DlgProc() As Long If Cb.Msg = %WM_Command And Cb.Ctl = 100 And Cb.CtlMsg = %BN_Clicked Then CONTROL ADD GRAPHIC, CB.HNDL, 101, "", 10, 40, 180, 150, _ %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %SS_NOTIFY 'Attach it: GRAPHIC ATTACH CB.HNDL, 101 'Then apply the following attempts: Graphic Set Pos (25, 5) GRAPHIC COLOR %RED, -2 GRAPHIC ELLIPSE (25,25)-(150,55) GRAPHIC PRINT "Red transp" Graphic Set Pos (25, 60) GRAPHIC COLOR %RED, RGB(120, 120, 220) GRAPHIC ELLIPSE (25,75)-(150,110) GRAPHIC Print "Red Blue" 'NB: 'GRAPHIC ELLIPSE (x1!, y1!) - (x2!, y2!) [, [rgbColor&] [,[fillcolor&] [, [fillstyle&]]]] 'rgbColor& - Optional RGB color of the ellipse edge. ' If omitted (or -1), the edge color defaults to the current foreground color for ' the selected graphic window. 'fillcolor& - Optional RGB color of the ellipse interior. ' If fillcolor& is omitted (or -2), the interior of the ellipse is not filled, ' allowing the background to show through. GRAPHIC ELLIPSE (25,120)-(100,140), , %Yellow End If End Function '------------------/
Join Date: Nov 2004
27 Mar 2009, 11:45 AM
The ELLIPSE's are not the issue.
Originally posted by colin glenn View Post
RE: GRAPHIC COLOR STATEMENT
"If the background parameter is -2, the background is not painted, allowing the content behind to become visible."
I'm asking what is meant by this when you actually use this format:
GRAPHIC COLOR %RED, -2
And the background of the GRAPHIC CONTROL is STILL visible? Regardless of whether it's a pixel or a cyclic quadrilateral being drawn, the background of the control is still visible, that is, it's still being painted "default dialog color".
Furcadia, an interesting online MMORPG in which you can create and program your own content.
Join Date: Nov 2002
27 Mar 2009, 01:55 PM
In Dave's program above, make the following change:
Function PBMain() As Long Local hDlg As Dword Dialog New Pixels, 0, "Colours", 300, 300, 200, 200, %WS_OverlappedWindow To hDlg Control Add Button, hDlg, 100, "Paint", 50, 10, 100, 20 [B] Dialog Set Color hDlg, 0, -2&[/B] Dialog Show Modal hDlg Call DlgProc End Function
Drag the window around. Does this help explain the -2 param?
Last edited by John Montenigro; 27 Mar 2009, 01:57 PM.
Join Date: Nov 2004
27 Mar 2009, 03:26 PM
With the dialog set color, it does, it causes the dialog to assume a "transparent" state, or kin to when you use a hollow brush for a WinClass hbrBackground.
Why won't that work with a graphic control?
Furcadia, an interesting online MMORPG in which you can create and program your own content.
Join Date: Nov 2002
27 Mar 2009, 03:58 PM
Sorry I can't give you the proper explanation - I stumbled on this while experimenting but I don't understand the technical underpinnings. I'll defer to more knowledgable people.
Added: I've been playing a bit more, using the summary in Bob's message #7 (it would be great if the Help file contained that info in a summary or overview...).
I tried a GRAPHICS CLEAR %green just before the first ellipse in the callback of Dave's sample, and it changed the background of the drawing area, and not the rest of the dialog....
I think you may be expecting the color statement to affect graphic objects that get drawn afterward, but I think (guessing?) that it applies only to the target of the last ATTACH...
Last edited by John Montenigro; 27 Mar 2009, 04:14 PM. Reason: Added result of more experimenting...
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 03:43 AM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.