- Posts: 2
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
dib render bitmap
10 years 2 months ago #9768
by marcohit
dib render bitmap was created by marcohit
Hi, it's possible to render a pdf over a colored background using DIB.drawbitmap.
I try to use new function MulAlpha(), but it seem not work.
Many thanks in advance
Marco
I try to use new function MulAlpha(), but it seem not work.
Many thanks in advance
Marco
10 years 2 months ago #9788
by Davide
Replied by Davide on topic dib render bitmap
Hi,
have you tried this code before rendering?
If you don't solve it with the above code, can you please send us the code you are using to render your pdf?
MulAlpha() is useful to put transparent images on the PDF as an overlay.
For more info check this: www.radaeepdf.com/support/knowledge-base...component&kbartid=24
have you tried this code before rendering?
Code:
//Fills the bitmap's pixels with the specified Color.
bitmap.eraseColor(somecolor);
If you don't solve it with the above code, can you please send us the code you are using to render your pdf?
MulAlpha() is useful to put transparent images on the PDF as an overlay.
For more info check this: www.radaeepdf.com/support/knowledge-base...component&kbartid=24
"MulAlpha() :
when display Bitmap object, adjust color value as: R = R * alpha / 255; G = G * alpha / 255; B = B * alpha / 255; for Bitmap all alpha is 0 or all alpha is 255, this method can be ignored to invoke."
- stefano.sartori@hit.it
- Offline
- New Member
-
Less
More
- Posts: 1
- Thank you received: 0
10 years 2 months ago #9852
by stefano.sartori@hit.it
Replied by stefano.sartori@hit.it on topic dib render bitmap
Hi Davide, I have already reply to you on the dedicated ticket. I duplicate here my answer.
I have tried the solution of erasecolor, but it doesn't work.
This is the piece of code that we use for render pdf:
Matrix matrix = new Matrix();
matrix.postScale(width / pageBounds.width(), height / pageBounds.height());
matrix.postTranslate(pageSliceBounds.left * width, pageSliceBounds.top * height);
matrix.postScale(1 / pageSliceBounds.width(), 1 / pageSliceBounds.height());
final float[] matrixSource = new float[9];
matrix.getValues(matrixSource);
DIB dib = new DIB();
dib.CreateOrResize(width, height);
float ty = (float) Math.floor(actualHeight * matrixSource[4] - matrixSource[5]);//+1;
com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(matrixSource[0], -matrixSource[4], -matrixSource[2]-0, ty);
RenderPrePare(dib);
Render(dib, mat);
mat.Destroy();
Bitmap bitmap= Bitmap.createBitmap( width, height, Config.ARGB_8888);
bitmap.eraseColor(0xFF0000FF); // try with any color
BMP bmp = new BMP();
bmp.Create(bitmap);
dib.DrawToBmp(bmp, 0, 0);
bmp.Free(bitmap);
dib.Free();
Many thanks.
I have tried the solution of erasecolor, but it doesn't work.
This is the piece of code that we use for render pdf:
Matrix matrix = new Matrix();
matrix.postScale(width / pageBounds.width(), height / pageBounds.height());
matrix.postTranslate(pageSliceBounds.left * width, pageSliceBounds.top * height);
matrix.postScale(1 / pageSliceBounds.width(), 1 / pageSliceBounds.height());
final float[] matrixSource = new float[9];
matrix.getValues(matrixSource);
DIB dib = new DIB();
dib.CreateOrResize(width, height);
float ty = (float) Math.floor(actualHeight * matrixSource[4] - matrixSource[5]);//+1;
com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(matrixSource[0], -matrixSource[4], -matrixSource[2]-0, ty);
RenderPrePare(dib);
Render(dib, mat);
mat.Destroy();
Bitmap bitmap= Bitmap.createBitmap( width, height, Config.ARGB_8888);
bitmap.eraseColor(0xFF0000FF); // try with any color
BMP bmp = new BMP();
bmp.Create(bitmap);
dib.DrawToBmp(bmp, 0, 0);
bmp.Free(bitmap);
dib.Free();
Many thanks.
10 years 2 months ago #9853
by radaee
Replied by radaee on topic dib render bitmap
hi that, RenderPrePare erase white to DIB.
so, u have to use Page.RenderToBMP() on Bitmap with background.
so, u have to use Page.RenderToBMP() on Bitmap with background.
Time to create page: 0.480 seconds