473,398 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Search single color rectangle in a bitmap and get position and dimensions

Hi,

first, I want to apologize for any bad english that might be following
and lead to none or bad understanding of my posting. It has been a long
time since I last posted in english ;-)

So far I haven't dealt much with graphics programmming except drawing a
line on a hwnd or similar simple tasks.

Now I actually have a problem that I couldn't solve by searching Google
and my usual research approaches.

Problem:

An existing bitmap (24-bit color) shows a "border", i.e. a TFT-Monitor
or window. The rectangle is in this bitmap, prepared with a perfectly
solid color at the place where I need to draw into. Since users can have
different screen resolutions and I don't want to hardcode the positions
for every image and might support user-defined (prepared) bitmaps in
future, I need to scan the bitmap for such an rectangle.

Goal:

I need to determine the position and dimensions of the solid colored
rectangle to be able to draw into it.

My thinkings:

Since there will only be one solid colored rectangle in such a bitmap,
my in-mind-builded logically solution is to scan the bitmap with a small
RECT pixelwise:

1. Use a loop and position RECT pixel-by-pixel from left to right
2. If bottom or left side of the RECT consist of one color completely,
I've found a beginning
3. Now I can position downwards until the upper side of the RECT also
has the solid color, etc.

Well, I'm nearly sure this way it might be incredibly slow, so I even
didn't try to code it...

Has anyone a better advice or piece of code, so I can solve this problem
as performant as possible?
Thank you,

Mathias Wuehrmann

Apr 7 '07 #1
0 1193

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matthias | last post by:
Hello, I have a Canvas-Widget and will use as a "array of pixel". At Positon x,y I print a rectangle with a special color. I give the rectangle no objectname. Then I will ask the...
15
by: Steven T. Hatton | last post by:
The following may strike many of you as just plain silly, but it represents the kind of delelima I find myself in when trying to make a design decision. This really is a toy project written for...
3
by: Vam | last post by:
Hi, My program makes an HTML report which needs to be easily printable. On this report is a table, and one of the columns in the table needs to express a color. I've done this by setting the...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
5
by: DazedAndConfused | last post by:
I have a rectangle around text that I want to fill in with color. I do not know the height of the rectangle until I actually go through and draw out the text. Is there a way of filling in the...
3
by: ShihChengYu | last post by:
Dear all: How to convert color image to bi-level image? I have confronted one problem when I build my OCR project. I used an software API function to enhance my project, but the API only...
1
by: Sugan | last post by:
Hi all, I'm creating a custom button control. I need to show a color image when the button control is enabled and a gray shade of the same image when the button control is disabled. How can i...
3
by: reidarT | last post by:
I try to draw a rectangle in a form on a buttons click event, The code is Dim bitmap As New Bitmap("lysblaa.jpg") Dim tBrush As New TextureBrush(bitmap) Dim texturedPen As New Pen(tBrush, 30)...
10
by: kimiraikkonen | last post by:
Hi, If previous post was missing, here's the complete one: I'm trying to draw a rectange on a picturebox image using mouse move event but the problem is that the rectangle selection / drawing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
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...
0
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...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.