cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to resize zoon-AF rectangle in SDK ?

ridhdhi
Contributor

How to resize zoon-AF Live View Rectangle Width and Height ?

IntPtr evfStream;
UInt64 streamLength;

EDSDKLib.EDSDK.EdsGetPointer(evfDataSet.stream, out evfStream);
EDSDKLib.EDSDK.EdsGetLength(evfDataSet.stream, out streamLength);

vRect = _model.VisibleRect;
SolidBrush black = new SolidBrush(Color.Black);

byte[] data = new byte[(int)streamLength];
Marshal.Copy(evfStream, data, 0, (int)streamLength);

Image img = (Image)imgconv.ConvertFrom(data);
Bitmap canvas = new Bitmap(img);

varas.ptval = canvas;

//this.temp = new Bitmap(img);
//canvas.Save(paths + "\\" + "SPR_" + i + ".jpeg", ImageFormat.Jpeg);
// canvas.Dispose();
temp = canvas;
int iWidth = canvas.Width;
int iHeight = canvas.Height;

Graphics g = Graphics.FromImage(canvas);

g.DrawImage(img, 0, 0);

//when aspect ratio is 1:1 or 4:3
if ((_model.Aspect == 1) || (_model.Aspect == 2))
{
float hvRatio = (float)vRect.width / vRect.height;
int rWidth = (int)(iWidth - iHeight * hvRatio) / 2;

Rectangle rectLeft = new Rectangle(0, 0, rWidth, iHeight);
Rectangle rectRight = new Rectangle((int)(rWidth + iHeight * hvRatio), 0, rWidth, iHeight);
g.FillRectangle(black, rectLeft);
g.FillRectangle(black, rectRight);

}

7 REPLIES 7

shadowsports
Elite

https://developercommunity.usa.canon.com/s/

~Rick
Bay Area - CA


~R5 C (1.0.2.1) ~RF Trinity, ~RF 100~400, +Canon Control Ring

~6D2 (v1.1.1) Retiring ~EF Trinity, others ~DxO PhotoLab Elite ~Windows10/11 Pro ~EVGA RTX 3080Ti FTW3 Ultra ~ImageClass MF644Cdw ~Pixel6 ~CarePaks Are Worth It

ridhdhi
Contributor

How to resize zoon-AF Live View Rectangle Width and Height ?Dynamically set rectangle height and width from user. So how can I do that ?

shadowsports
Elite

@ridhdhi,

See my post above.

shadowsports_0-1669129471034.png

~Rick
Bay Area - CA


~R5 C (1.0.2.1) ~RF Trinity, ~RF 100~400, +Canon Control Ring

~6D2 (v1.1.1) Retiring ~EF Trinity, others ~DxO PhotoLab Elite ~Windows10/11 Pro ~EVGA RTX 3080Ti FTW3 Ultra ~ImageClass MF644Cdw ~Pixel6 ~CarePaks Are Worth It

ridhdhi
Contributor

In the rectangle (zoomRect) coming in the SDK, the height and width of the rectangle has to be changed by entering the value from the user. The original length and height of the rectangle is 15. If the user enters 5, then the original length of the rectangle Should be done plus 5 and height Should be done plus 5. And the rectangle shown last in the picture box should be 20.

You've already been told that this is not a developer forum. You need to ask questions about the SDK elsewhere.

--
Ricky

EOS 5D IV, EF 50mm f/1.2L, EF 135mm f/2L, 600EX-RT (x6), ST-E3-RT
EOS C70, RF 24-70 f/2.8L IS, EF-EOS R 0.71x

Providing the community links again.

Canon Developers Community Europe:

Forum (canon-europe.com)

Canon Developers Community US

Canon Developer Community

~Rick
Bay Area - CA


~R5 C (1.0.2.1) ~RF Trinity, ~RF 100~400, +Canon Control Ring

~6D2 (v1.1.1) Retiring ~EF Trinity, others ~DxO PhotoLab Elite ~Windows10/11 Pro ~EVGA RTX 3080Ti FTW3 Ultra ~ImageClass MF644Cdw ~Pixel6 ~CarePaks Are Worth It

Speaking strictly for myself, you will not be receiving any further assistance from me. You have been provided with the link to the Canon SDK developer forum.

I suggest that you put more thought into how you phrase your questions. This question is basically a request for someone to write the code for you, which is not a good thing.

Good Luck.

--------------------------------------------------------
"The right mouse button is your friend."
Announcements
11/22/2022: New firmware available for EOS R3, EOS R7 and EOS R10
11/16/2022: We're thrilled to be ranked among the Best Employers for Veterans in 2022 by Forbes.
10/14/2022: Help ensure your autofocus is properly aligned with a Canon Precision Alignment
09/19/2022: New firmware version 1.0.4.1 is available for EOS C70
08/31/2022: New firmware version 1.1.1 is available for RF 70-200mm L IS USM
08/09/2022: New firmware version 1.2.0 is available for CR-N 300
08/09/2022: New firmware version 1.2.0 is available for CR-N 500
07/28/2022: New firmware version 1.2.1 is available for EOS-R3
07/21/2022: New firmware version 1.6.0 is available for EOS-R5
07/21/2022: New firmware version 1.6.0 is available for EOS-R6
07/21/2022: New firmware version 1.1.0 is available for EOS-R7
07/21/2022: New firmware version 1.1.0 is available for EOS-R10
07/14/2022: New firmware version 1.0.1 is available for CR-X300
07/01/2022: New firmware version 1.3.0 is available for PowerShot PICK
06/10/2022: Service Notice:UPDATE: Canon Inkjet Printer continuous reboot loop or powering down
06/07/2022: New firmware version 1.3.2 is available for PowerShot G7 X Mark III
06/07/2022: New firmware version 1.0.3 is available for EOS M50 Mark II
05/31/2022: Did someone SAY Badges?
05/26/2022: New firmware version 1.0.5.1 is available for EOS-C500 Mark II
05/26/2022: New firmware version 1.0.3.1 is available for EOS-C300 Mark III
05/10/2022: Keep your Canon gear in optimal condition with a Canon Maintenance Service
05/05/2022: We are excited to announce that we have refreshed the ranking scale within the community!
04/26/2022: New firmware version 1.0.1.1 is available for EOS R5 C
03/23/2022: New firmware version 1.0.3.1 is available for EOS-C70
02/09/2022: Share Your Photos is back!
02/07/2022: New firmware version 1.6.1 is available for EOS-1DX Mark III
01/19/2022: READY FOR ANYTHING EOS-R5 C
01/13/2022: Community Update. We will be retiring the legacy profile avatars on 01/20/2022. Click this link to read more.
01/05/2022: Welcome to CES 2022!