Hello all:
I am using PIL to draw a rectangle filled with color blue.
Is there anyway I could set the fill pattern so that the drawn
rectangle could be filled with
gradient blue?
Thank you
-Daniel 1 7401
Daniel Mark wrote:
Hello all:
I am using PIL to draw a rectangle filled with color blue.
Is there anyway I could set the fill pattern so that the drawn
rectangle could be filled with
gradient blue?
Thank you
-Daniel
I don't think there is a built-in gradient function, but you could do
something like this:
>>import Image import ImageDraw im = Image.new("RGB" , (100, 100)) draw = ImageDraw.Draw( im) for l in xrange(100):
.... colour = (0, 0, 255 * l / 100)
.... draw.line((0, l, 100, l), fill=colour)
....
>>im.show()
You have to adjust for the size and colours you want of course, and change
the loop so that the gradient is in the right direction.
// Pontus
------------ And now a word from our sponsor ----------------------
For a quality mail server, try SurgeMail, easy to install,
fast, efficient and reliable. Run a million users on a standard
PC running NT or Unix without running out of power, use the best!
---- See http://netwinsite.com/sponsor/sponsor_surgemail.htm ---- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard |
last post by:
I have a requirement to put a GDI style circle or rectangle border around
the selected row of a datagrid/ It will overlap into the row above and below
the selected row. Doing this in a the OnPaint of a subclassed
DataGridTextBoxColum dos not seem like a practical way to do it.
I have subclassed a DataGrid and overridden the OnPaint as such:
|
by: Robert W. |
last post by:
In my Winforms app I'm trying to get an image's background to appear
transparent on a form that has a gradient background. So I added a
PictureBox and then attempted to add a custom paint command for the
PictureBox. But it's not working. Here's the code I've written:
public void InitializeLinearGradients()
{
this.Paint += new PaintEventHandler(PaintClient);
this.SizeChanged += new EventHandler(SizeClient);
pictureLogo.Paint += new...
|
by: Praveen |
last post by:
Hello,
I have a web page which will display the map of a
city/place. I have a toolbar which contains 'zoom in'
and 'zoom out' buttons. When the user clicks on zoom
in/zoom out button, he should be able to draw a rectangle
on any part of the map. The map will refresh automatically
with the zoom selections. Can any one help me on how to
draw the rectangle (without any predefined co-ords) and
capture the starting and ending points of the...
|
by: Colin McGuire |
last post by:
Hi there. I have written a small procedure to draw various shapes on
things. A bit of it is shown below.
Private Sub drawShape(ByVal shapeType As Integer, ByRef g As Graphics)
Select Case shapeType
Case 1 : g.DrawRectangle(New Pen(Color.Black), 0, 0, 50, 10)
Case 2 'draw a circle
Case 3 'draw a triangle
Case 4 'draw other shape
Case 5 'draw other shape
|
by: Mark Ingram |
last post by:
Hi, how can i draw a rounded rectange, with a border within a specified
area?
i.e. if i have a Rectangle with width and height of 100, how can i draw
a rectange with 2 pixel border inside of the original one? (the current
attempts all draw the border just outside of the original rectangle).
At the moment im using the following code, but it allows the rectangle
to grow - which i definately dont want!
| |
by: cmbardon |
last post by:
I'm trying to create a form with some rounded controls, and I'm having
some problems with the rounding not working correctly. I've tried a
couple of different methods for creating the graphics path, including
the one from the GDI+ FAQ. It's a pretty simple path, and
mathematically it looks just fine. When I apply it to a control
though, I have two problems. First, the corners on the right side of
the control are obviously not rounded...
|
by: Jeff Waskiewicz |
last post by:
Hello All,
I'm trying to solve a nagging problem. The goal is to draw a rectangle over
the top of all the other controls on a form. Specifically, over a ChartFX
control. The user would draw the rectangle using the right mouse button to
represent the area of the chart they want to zoom on. I haev been able to
draw the rectangle on a blank form but I cannot get it to draw on top of
other controls. I have pasted in the code i am using ....
|
by: Brandon Arnold |
last post by:
I have a panel that contains a label and a picturebox. When clicked, I
want to draw a rectangle over everything. I can draw the rect and set
the color, no big deal. The problem is because I have to pass the rect
of the panel, it draws on that, and under the other controls. How can
I force it to draw OVER everything else? Ideally this would also be
trackable since the whole thing(panel and children) will be dragable.
This is what i've got...
|
by: kummu4help |
last post by:
hi,
i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates.
i have the following code.
in the following code i am using SelectionArea class which extends a canvas on which i am performing drawing operation. i am using image variable in this class for double buffering to reduce flickering and to save the applet's previous...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |