OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-09-2004, 07:43
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default PCX Object Model

I'm using CorelDraw 11 and I have looked through the object models for Corel 10 and the Export and ExportEx Object models only to find that there is no information regarding PCX exporting. Does anyone have a description of the model or a breakdown.

Thanks in advance
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #2  
Old 07-09-2004, 18:31
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: PCX Object Model

Sean,

I'm not sure what kind of object model access you are looking for. If I'm not mistaken, PCX export filter doesn't have any extra parameters (unline filters like JPEG or GIF which have filter-specific options). What export parameters you want to set through object model?
Reply With Quote
  #3  
Old 08-09-2004, 06:41
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

I am trying to take whatever is on the current page and export to a 1-bit Black and White image no more than 3000 pixels in either direction with a resoltuion of 600 dpi. If the image is smaller than 3000 pixels, then I want it to stay 100%, otherwise I want it to shrink down to 3000 px maximum. (objects being exported are not alway square, so the largest dimension needs to be 3000 px)
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #4  
Old 08-09-2004, 10:42
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Sean,

You don't need access to PCX filter for this. You can do all the calculations yourself. Just get the size of the objects on the current page and see how big the image will get, if above your limit, then adjust width/height accordingly.

Here is an example:

Code:
Sub ExportToPCX()
    Const MaxSize As Long = 3000
    Const ReqDPI As Long = 600
    
    Dim x As Double, y As Double
    Dim Width As Double, Height As Double
    Dim sr As ShapeRange
    
    Dim expflt As ExportFilter
    
    Set sr = ActivePage.SelectableShapes.All
    If sr.Count = 0 Then
        MsgBox "There are no shapes to export on the current page", vbCritical
        Exit Sub
    End If
    sr.GetBoundingBox x, y, Width, Height, True
    x = ActiveDocument.FromUnits(Width, cdrInch) * ReqDPI
    y = ActiveDocument.FromUnits(Height, cdrInch) * ReqDPI
    If x > MaxSize Or y > MaxSize Then
        If x > y Then
            y = y * MaxSize / x
            x = MaxSize
        Else
            x = x * MaxSize / y
            y = MaxSize
        End If
    End If
    
    Set expflt = ActiveDocument.ExportBitmap("C:\Graphic1.pcx", cdrPCX, cdrCurrentPage, _
                            cdrBlackAndWhiteImage, x, y, ReqDPI, ReqDPI, cdrNoAntiAliasing)
    expflt.Finish
End Sub
Reply With Quote
  #5  
Old 08-09-2004, 11:28
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Thanks Alex, as always, you wash away the dirt to make things clear again.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #6  
Old 08-09-2004, 11:39
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

However, I'm not sure if this is a CD 12 vs 11 difference, but I am getting "object not supported" on the line...
Quote:
Set sr = ActivePage.SelectableShapes.All
So I changed it to...
Code:
Set sr = ActivePage.Shapes.All
When I do that thought I get the non-support thingy for this...
Quote:
x = ActiveDocument.FromUnits(Width, cdrInch) * ReqDPI
I assume I will get it with the follwing line as well.

Is this because I'm using CD11?
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #7  
Old 08-09-2004, 15:04
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Yes, I used some of CorelDRAW 12 specific semantics.

But if you have Draw 11, most of the things still should apply. Here is a revisited version for v11:

Code:
Sub ExportToPCX11()
    Const MaxSize As Long = 3000
    Const ReqDPI As Long = 600
    
    Dim x As Double, y As Double
    Dim Width As Double, Height As Double
    Dim sr As ShapeRange
    
    Dim expflt As ExportFilter
    
    Set sr = ActivePage.Shapes.All
    If sr.Count = 0 Then
        MsgBox "There are no shapes to export on the current page", vbCritical
        Exit Sub
    End If
    ActiveDocument.Unit = cdrInch
    sr.GetBoundingBox x, y, Width, Height, True
    x = Width * ReqDPI
    y = Height * ReqDPI
    If x > MaxSize Or y > MaxSize Then
        If x > y Then
            y = y * MaxSize / x
            x = MaxSize
        Else
            x = x * MaxSize / y
            y = MaxSize
        End If
    End If
    
    Set expflt = ActiveDocument.ExportBitmap("C:\Graphic1.pcx", cdrPCX, cdrCurrentPage, _
                            cdrBlackAndWhiteImage, x, y, ReqDPI, ReqDPI, cdrNoAntiAliasing)
    expflt.Finish
End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CDR12: refresh Object Manager docker after CreateSelection zlatev CorelDRAW/Corel DESIGNER VBA 2 05-03-2005 09:00
Bounding lines around an object toy4mud CorelDRAW CS 2 04-11-2004 11:56
Sorting entries in the object manager dan CorelDRAW/Corel DESIGNER VBA 1 18-08-2004 22:16
Would you miss CorelScript object? Alex CorelDRAW/Corel DESIGNER VBA 32 04-02-2004 14:59
Accesing CorelDraw 10 VBA Object Model without running it dolmos CorelDRAW/Corel DESIGNER VBA 5 19-12-2003 07:52


All times are GMT -5. The time now is 09:53.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com