?
Solved

Reading variations in a .PCX file

Posted on 1998-07-30
20
Medium Priority
?
332 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:Tom Knowlton
[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
  • 11
  • 8
20 Comments
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1359159
Edited text of question
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1359160
Edited text of question
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 1359161
Adjusted points to 200
0
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!

 
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:Tom Knowlton
ID: 1359164
Andrey:

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

Author Comment

by:Tom 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:Tom 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
 
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:Tom 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 800 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:Tom 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

762 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