Solved

Reading variations in a .PCX file

Posted on 1998-07-30
20
323 Views
Last Modified: 2010-04-04
I apologize for my numerous postings on this subject.

I've tried to illustrate my concept a little better by posting a representation of the file I am trying to work with.

What I need to do is, once I have the PCX file loaded in, I need to be able to extract a "frame" from the PCX file itself.  For example, if the file is 36 by 180, and I wanted to get the SECOND sequential 36 x 36 block I would need to go to coordinates 0,36 | 36,72....like this:

THIS IS ONE CONTINUOUS COLLECTION OF 36 x 36 pixel squares.  The dimensions of the entire image are 36 x 180 pixels for a total of 5 variations or "frames" going vertically.  If you we're to look at the .PCX file in MSPaint it would look like this:

SAMPLE.PCX

XXXXX
X         X
X         X   <-Variation 1
X         X
XXXXX
X         X
X         X   <-Variation 2
X         X
XXXXX
X         X
X         X   <-Variation 3
X         X
XXXXX
X         X
X         X   <-Variation 4
X         X
XXXXX
X         X
X         X   <-Variation 5
X         X
XXXXX

How would I extract Variation # 2?

I am VERY new at this, so I will require a FULLY FUNCTIONING procedure or function that I can just paste into my code and away I go.


The source code is available upon request.  Just send me mail at knowltonfamily@yahoo.com

A working demo of the Map Editor is available for download at:  www.enol.com/~knowlton
0
Comment
Question by:knowlton
  • 11
  • 8
20 Comments
 
LVL 5

Author Comment

by:knowlton
ID: 1359159
Edited text of question
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359160
Edited text of question
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359161
Adjusted points to 200
0
 
LVL 1

Expert Comment

by:andrey070798
ID: 1359162
Hi, Tom!
This is me.

What happened to the code I've sent to you?
Is it working or you didn't receive it?

If you didn't receive it I can send it again.
Also you can LOAD your .PCX file into TImageList (all you need to do -  set up Properties:  Height and Width to 36, then it will load it up correctly itself).

Thanks, Andrey.


0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359163
what could do is load the image into an invisible TPCXBitmap, or whatever you want and then use a TRect like so...if you know the size of the image...I mean the dimsensions of the image..you could use something similar to this...

procedure ExtractFrame(Row: Integer);
var Rect : TRect;
begin
   Row := 180 div 36;
   with Rect do
     begin
        Top := Row * 2;{Multiply the Row with the row #...if you want to extract frame #2 then use                                    Row * 2}
        Bottom := Row + 36;
        Left := 0;
        Right := 36;
        //Now here use Canvas.CopyRect() or BitBlt to copy Rect to the place you want on your         //visible canvas...
     end;
end;

I hope it helps a bit!

Regards,
Viktor Ivanov
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359164
Andrey:

The code did not work.  I need something....different.
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359165
Viktornet:

Thank you for your response.

I will NOT know how big the file is until runtime...that's the problem.

Also, if you provide a source code solution I need you to post a function that I can just drop into my program and away I go...

If you want to send my source code back to me with a new function that does what I want, that would be the preferred solution.

Thank you,

Tom
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359166
knowIton, what do you think about the piece of code I gave you above, do you think it can help you a bit? :)

Regards,
Viktor Ivanov
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359167
Edited text of question
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359168
Ok, I'll try to make a function/procedure but I need you to tell me where do you need the frame extracted image to be placed...???

Viktor Ivanov
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Expert Comment

by:viktornet
ID: 1359169
Do you wanted to be placed in the Image which is named ImageThumb...the small image on the top???

Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359170
Do you wanted to be placed in the Image which is named ImageThumb...the small image on the top???

Viktor Ivanov
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359171
Viktor:

Yes, you can put it into ImageThumb...that would be perfect.

Also, I suppose I should put the frames into some kind of TImageList.  For example, if the .PCX file had 5 frames, the TImageList would contain 5 images, each one would be 36 x 36 pixels.

I sure appreciate your help!

Tom

btw - What do you think of my code?  Is it pretty stupid or is it okay?
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359172
I think it's cool, but actually I'm kinda beginner myself... :)

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359173
Hey, KnowIton, I've made exactly what you need...I forgot your E-mail address, would you please leave a comment with the e-mail please...What I've done is that I've created a procedure to extract the frame you want from the image...it's so easy to use , just like this...

ExtractFrame( 0 , 0 , Invisibe_lImage_That_Contains_The_Whole_Image, ImageThumb );
 {That will extract the first frame of the Source Image and place it in the ThumbImage}

Just let me know your E-mail and I'll send you the procedure and a demo app..OK???

Regards,
Viktor Ivanov
That's all you need to write...I didn't try it on your project but I'm sure it will work...
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359174
Opps....Sorry, Your e-mail is on the top of this page....I'll send you the source code and please tell me if that;s exactly what you needed, so I can use it too in the future...OK???

Regards,
Viktor Ivanov
0
 
LVL 10

Accepted Solution

by:
viktornet earned 200 total points
ID: 1359175
OK, I've send you the code...Is that what you need???

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359176
Well, tell me what you think knowiton... Did you recieve my mail with the Source Code I sent you???

Regards,
Viktor Ivanov
0
 
LVL 5

Author Comment

by:knowlton
ID: 1359177
Viktor:

Yes, this code did work.  Now my problem is getting it to integrate with the Map Editor.

I am going to give you the points, but could you still help me integrate the code into the Map Editor itself?  I'm still having trouble there.

Thanks,

Tom
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1359178
Ok of course I'll help you. Just tell me an example of what are you trying to do now, and explain in details as you explained the question in the beginning. Then I'll try to help you! OK?? Ok talk to you later!

Regards,
Viktor Ivanov
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now