Convert a graphicspath to a compressed string

  • Thread starter Thread starter Crirus
  • Start date Start date
C

Crirus

I have a graphics path composed from multiple circles that may overlap...
That graphics path I need it converted to a string and that string I whould
like to be as small as possible

Any ideeas?
 
* "Crirus said:
I have a graphics path composed from multiple circles that may overlap...
That graphics path I need it converted to a string and that string I whould
like to be as small as possible

String? I don't understand what you want to do. A 'GraphisPath' can
have a custom shape, how would you convert that to a "string"?!
 
That's the ideea... I need to send it over TCP to a client... so I need to
decompose the GraphicsPath to a sort of string thatc an be reconstructed as
GraphicsPath on the other side
 
Hi,

The GraphicsPath.PathPoints returns an array of pointf. I guess you
convert that to a string. It wont be small.

Ken
 
Hi Crirus,
Have a look to the resx file

as a test.
Create a new project
Drop the imagelist on your form
Add an image to that imagelist
Open your solution explorer
Set the option show all files to true
Open the form1 root with the +
Open the resx file in your designer
Show it in XML view
You have a nice example how to transport your bitmaps.

Cor
 
Hi Crirus,

And for making such a file as that RESX is the XML dataset I think the most
easiest.


Cor
 
* "Crirus said:
That's the ideea... I need to send it over TCP to a client... so I need to
decompose the GraphicsPath to a sort of string thatc an be reconstructed as
GraphicsPath on the other side

Thanks -- now I understand what you want: You want a string
representation of the 'GraphicsPath'. Having a quick look at the
'GraphicsPath' class shows the properties 'PathData', 'PathPoints' and
'PathTypes'. Maybe looping though the collection and converting the
data to a string will be a good way to convert the 'PrapthicsPath' to a
string. You can use a 'StringBuilder' to create the text
representation.
 
Yes, I can use that, and pathTypes too, but I'm trying to find a better way,
or at least to compress the string resulted somehow
 
I noticed that pathPoints return points as floating.... ex: Y:=425,1854...
how much should I care about the numbes following the comma?
 
* "Cor said:
as a test.
Create a new project
Drop the imagelist on your form
Add an image to that imagelist
Open your solution explorer
Set the option show all files to true
Open the form1 root with the +
Open the resx file in your designer
Show it in XML view
You have a nice example how to transport your bitmaps.

Mhm... I think Crirus wants to transport a 'GraphicsPath'.
 
Herfried K. Wagner said:
Thanks -- now I understand what you want: You want a string
representation of the 'GraphicsPath'. Having a quick look at the
'GraphicsPath' class shows the properties 'PathData', 'PathPoints' and
'PathTypes'. Maybe looping though the collection and converting the
data to a string will be a good way to convert the 'PrapthicsPath' to a
string. You can use a 'StringBuilder' to create the text
representation.

Best way to do this would pound Microsoft and make this object serializable
**grin**...

Other way to do it would loop through the all properties, property arrays, et
cetera and store only those values which are not default values. This would keep
the resulting string value minimal. Then compress this using a string compresser
before sending the data.

Mythran

(probably already knew all this anyways)
 
Back
Top