?
Solved

Slicing an image into even squares ?

Posted on 2003-03-10
7
Medium Priority
?
166 Views
Last Modified: 2010-04-04
Is there a way to have an image devided into a grid (like 4X4) at runtime ?
I want to load an image from loadfile (the user finds the image).  Then the program needs to resize that image to be for eg: 300 x 300 pixels.  That image then needs to be cut up into a grid shape with 4 columns and 4 rows.
Each piece needs to have it's own identity so I can write code to work with them.  Hmmm and I barking up the wrong tree here ?  Is this possible ?

Thanks

Mark
0
Comment
Question by:Mark Brady
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 8101644
take a look at: BitBlt()
ziolko.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8101747
or if it must not be so perfomant,
then you can take a look
to the copyrect-method of tcanvas

a sample from the delphi-online help

The following code illustrates the differences between CopyRect and BrushCopy. The bitmap graphic ‘TARTAN.BMP’ is loaded into Bitmap and displayed on the Canvas of Form1. BrushCopy replaces the color black in the graphic with the brush of the canvas, while CopyRect leaves the colors intact.

var
  Bitmap: TBitmap;
  MyRect, MyOther: TRect;
begin

  MyRect := Rect(10,10,100,100);

  MyOther := Rect(10,111,100, 201);
  Bitmap := TBitmap.Create;
  Bitmap.LoadFromFile('c:\windows\tartan.bmp');
  Form1.Canvas.BrushCopy(MyRect, Bitmap, MyRect, clBlack);
  Form1.Canvas.CopyRect(MyOther,Bitmap.Canvas,MyRect);
  Bitmap.Free;
end;

meikl ;-)
0
 
LVL 9

Accepted Solution

by:
ITugay earned 150 total points
ID: 8101877
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Expert Comment

by:ILE
ID: 8107486
all u need is to use

procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);



wery easy for example


form1.canwans.stretchdraw(rect(10,20,10,20),graphic1));


where graphic1 is any tgraphic :))


0
 
LVL 3

Expert Comment

by:ILE
ID: 8107499
all u need is to use

procedure StretchDraw(const Rect: TRect; Graphic: TGraphic);



wery easy for example


form1.canwans.stretchdraw(rect(10,20,10,20),graphic1));


where graphic1 is any tgraphic :))


0
 
LVL 3

Expert Comment

by:ILE
ID: 8107545
UPPSSSS

i wrote wrong coordinats

rect comand will not work like i wrote here



yep and if u have a picture int the image1 component u mey write

put something like

form1.canwans.stretchdraw(rect(10,20,30,30),image1.picture.graphic));

see the picture :))



0
 
LVL 20

Author Comment

by:Mark Brady
ID: 8143987
We're still working on this one but it's along the right track.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question